diff --git a/Common/Options.cpp b/Common/Options.cpp index 6140ea6f31c7fd5be208d872324cbbd1f3251d28..76670083c041bd5ace4baf183b1970cae08a8106 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -2947,7 +2947,7 @@ double opt_general_background_gradient(OPT_ARGS_NUM) { if(action & GMSH_SET){ CTX::instance()->bgGradient = (int)val; - if(CTX::instance()->bgGradient < 0 || CTX::instance()->bgGradient > 3) + if(CTX::instance()->bgGradient < 0 || CTX::instance()->bgGradient > 4) CTX::instance()->bgGradient = 0; } #if defined(HAVE_FLTK) diff --git a/Common/gmshPopplerWrapper.cpp b/Common/gmshPopplerWrapper.cpp index 862152ce06f91f8a4d549803b67742bd1b4dbed6..f9129329ca7479c77a388b35a8200b7d43b727d5 100644 --- a/Common/gmshPopplerWrapper.cpp +++ b/Common/gmshPopplerWrapper.cpp @@ -1,3 +1,8 @@ +// Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to <gmsh@geuz.org>. + #include "gmshPopplerWrapper.h" #if defined(HAVE_POPPLER) @@ -8,7 +13,7 @@ gmshPopplerWrapper *gmshPopplerWrapper::_instance = 0; poppler::document *gmshPopplerWrapper::_current_doc = 0; -#if defined(HAVE_OPENGL) +#if defined(HAVE_OPENGL) std::map<int,GLuint> gmshPopplerWrapper::_pages2textures; int gmshPopplerWrapper::_w = -1; int gmshPopplerWrapper::_h = -1; @@ -20,8 +25,8 @@ gmshPopplerWrapper *gmshPopplerWrapper::instance() { return _instance; } -int gmshPopplerWrapper::load_from_file (const std::string &file_name, - const std::string &owner_password, +int gmshPopplerWrapper::load_from_file (const std::string &file_name, + const std::string &owner_password, const std::string &user_password){ if (_current_doc) delete _current_doc; _current_doc = poppler::document::load_from_file (file_name,owner_password, @@ -32,8 +37,8 @@ int gmshPopplerWrapper::load_from_file (const std::string &file_name, return 1; } -#if defined(HAVE_OPENGL) -GLuint gmshPopplerWrapper::getTextureForPage(double xres, +#if defined(HAVE_OPENGL) +GLuint gmshPopplerWrapper::getTextureForPage(double xres, double yres) { int iPage = _current_page; std::map<int,GLuint>::iterator it = _pages2textures.find(iPage); @@ -41,7 +46,7 @@ GLuint gmshPopplerWrapper::getTextureForPage(double xres, if (!_current_doc)return 0; poppler::page *_current_page = _current_doc->create_page (iPage); poppler::page_renderer pr; - poppler::image im = pr.render_page (_current_page,xres,yres,-1,-1,-1); + poppler::image im = pr.render_page (_current_page,xres,yres,-1,-1,-1); _w = im.width(); _h = im.height(); // im.save("page.png","png"); @@ -51,7 +56,7 @@ GLuint gmshPopplerWrapper::getTextureForPage(double xres, _pages2textures[iPage] = texture; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, im.width(),im.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,im.const_data()); return texture; diff --git a/Common/gmshPopplerWrapper.h b/Common/gmshPopplerWrapper.h index 1dff680737e5408d211bf2ed0d1caf4f3edeec5a..4d14f68d64f36eeead75aefd4c5bce9d3206bc4a 100644 --- a/Common/gmshPopplerWrapper.h +++ b/Common/gmshPopplerWrapper.h @@ -1,3 +1,8 @@ +// Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to <gmsh@geuz.org>. + #ifndef _GMSHPOPPLERWRAPPER_PDF_H_ #define _GMSHPOPPLERWRAPPER_PDF_H_ @@ -9,7 +14,7 @@ #include <poppler/cpp/poppler-document.h> #include <poppler/cpp/poppler-page.h> #include <poppler/cpp/poppler-image.h> -#if defined(HAVE_OPENGL) +#if defined(HAVE_OPENGL) #include<OpenGL/gl.h> #endif @@ -25,15 +30,15 @@ private: public: static gmshPopplerWrapper *instance(); - static int load_from_file (const std::string &file_name, - const std::string &owner_password=std::string(), + static int load_from_file (const std::string &file_name, + const std::string &owner_password=std::string(), const std::string &user_password=std::string()); static int width() {return _w;} static int height() {return _h;} static void setCurrentPageUp () {_current_page++;} static void setCurrentPageDown () {if(_current_page > 0) _current_page--;} -#if defined(HAVE_OPENGL) - static GLuint getTextureForPage(double xres, +#if defined(HAVE_OPENGL) + static GLuint getTextureForPage(double xres, double yres) ; #endif }; diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index f31347fa576ef3936532df399b82185153893193..ffb970570cf5e6f0ced84eba608af06ce8fa091f 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -687,6 +687,7 @@ int FlGui::testArrowShortcuts() status_play_manual(0, CTX::instance()->post.animStep); return 1; } +#if defined(HAVE_POPPLER) else if(Fl::test_shortcut(FL_ALT + FL_Up)) { gmshPopplerWrapper::setCurrentPageDown(); drawContext::global()->draw(); @@ -697,8 +698,7 @@ int FlGui::testArrowShortcuts() drawContext::global()->draw(); return 1; } - - +#endif return 0; } diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index c36fdb9ec504128da05481cd1e54b36fc590adf3..b27dbb6915f78101283444b8df151d859ab064a8 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -2660,7 +2660,8 @@ class dummyBox : public Fl_Box { dummyBox(int x, int y, int w, int h, const char *l=0) : Fl_Box(x, y, w, h, l) {} }; -graphicWindow::graphicWindow(bool main, int numTiles) : _autoScrollMessages(true) +graphicWindow::graphicWindow(bool main, int numTiles, bool detachTree) + : _autoScrollMessages(true) { static bool first = true; if(first){ @@ -2695,7 +2696,7 @@ graphicWindow::graphicWindow(bool main, int numTiles) : _autoScrollMessages(true CTX::instance()->glSize[1] = glheight; } - int twidth = main ? 14 * sw : 0; + int twidth = (main && !detachTree) ? 14 * sw : 0; int glwidth = CTX::instance()->glSize[0] - twidth; int width = glwidth + twidth; // make sure width < screen width @@ -2890,7 +2891,11 @@ graphicWindow::graphicWindow(bool main, int numTiles) : _autoScrollMessages(true } if(main){ - onelab = new onelabGroup(0, mh, twidth, height - mh - sh); + if(!detachTree) + onelab = new onelabGroup(0, mh, twidth, height - mh - sh); + else{ + // create new win containing the onelab group + } } else{ onelab = 0; diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index d0bbcd2c42e969ada370b801455c4cd07630e777..8469648710a756f250aac6f0e7c4220d2fde86b8 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -41,7 +41,7 @@ class graphicWindow{ Fl_Progress *label; int minWidth, minHeight; public: - graphicWindow(bool main=true, int numTiles=1); + graphicWindow(bool main=true, int numTiles=1, bool detachTree=false); ~graphicWindow(); void setTitle(std::string str); void setAutoScroll(bool val){ _autoScrollMessages = val; } diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index cb9546ae3557905c595580ebca19f521a4e4cc66..2891c98ab5bd1c88c6d2c12ae8e3f69371007a0e 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -1743,6 +1743,7 @@ optionWindow::optionWindow(int deltaFontSize) {"Vertical", 0, 0, 0}, {"Horizontal", 0, 0, 0}, {"Radial", 0, 0, 0}, + {"Image", 0, 0, 0}, {0} }; diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 771499495028bd3753492b3b39d8a791b0c99591..19d60fbfd5f17e047d8bebe2a327df82dcebb120 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -339,7 +339,7 @@ void drawContext::drawBackgroundGradient() glVertex2i(viewport[0], viewport[1]); glEnd(); } - else if(CTX::instance()->bgGradient == 4){ // radial + else if(CTX::instance()->bgGradient == 3){ // radial double cx = 0.5 * (viewport[0] + viewport[2]); double cy = 0.5 * (viewport[1] + viewport[3]); double r = 0.5 * std::max(viewport[2] - viewport[0], @@ -357,19 +357,19 @@ void drawContext::drawBackgroundGradient() glEnd(); } #if defined(HAVE_POPPLER) - else if(CTX::instance()->bgGradient == 3){ // PDF @ background + else if(CTX::instance()->bgGradient == 4){ // PDF @ background GLuint texture=gmshPopplerWrapper::getTextureForPage(800,600); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D,texture); glBegin(GL_QUADS); glColor4ubv((GLubyte *) & CTX::instance()->color.bg); - + int dw =viewport[2] - viewport[0]; int dh =viewport[3] - viewport[1]; int dw_im = gmshPopplerWrapper::width(); int dh_im = gmshPopplerWrapper::height(); - + // consterve aspect ratio : dw / dh = dw_im / dh_im // dw = dh * dw_im / dh_im; dh = dw * dh_im / dw_im; diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index fb3bc0d54fac90781e408473676b039df4157cf6..cc99a7c6b2c477e87c62c7ac17eb2ce77a1dd542 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -390,8 +390,7 @@ void meshGEdge::operator() (GEdge *ge) // force odd number of points for if blossom is used for recombination if(ge->meshAttributes.Method != MESH_TRANSFINITE && CTX::instance()->mesh.algoRecombine == 1 && N % 2 == 0){ - - if(1 || CTX::instance()->mesh.recombineAll){ + if(/* 1 ||*/ CTX::instance()->mesh.recombineAll){ N++; } else{