From 2b269858498bc251917e89889655bdfbd72c309d Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 18 Jan 2012 16:35:22 +0000 Subject: [PATCH] never show the message console on startup: this reverts to the old behaviour when we had a separate message window --- Fltk/FlGui.cpp | 27 +++++++++++++-------------- Fltk/graphicWindow.cpp | 22 ++++++++++------------ Fltk/graphicWindow.h | 1 + 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index cd12e7da24..3ceb781197 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -84,7 +84,7 @@ class drawContextFltk : public drawContextGlobal{ FlGui::instance()->check(); } int getFontIndex(const char *fontname) - { + { if(fontname){ for(int i = 0; i < NUM_FONTS; i++) if(!strcmp(menu_font_names[i].label(), fontname)) @@ -225,7 +225,7 @@ FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false) // load default system icons (for file browser) Fl_File_Icon::load_system_icons(); - + // add callback to respond to Mac Finder #if defined(__APPLE__) fl_open_callback(OpenProjectMacFinder); @@ -345,11 +345,11 @@ int FlGui::run() // merging any files (e.g. if we build the geometry with python and // create the gui from the python script) SetBoundingBox(); - + // draw the scene drawContext::global()->draw(); - return Fl::run(); + return Fl::run(); } int FlGui::testGlobalShortcuts(int event) @@ -468,7 +468,7 @@ int FlGui::testGlobalShortcuts(int event) status = 1; } } - else if(Fl::test_shortcut(FL_SHIFT + 'a')) { + else if(Fl::test_shortcut(FL_SHIFT + 'a')) { window_cb(0, (void*)"front"); status = 1; } @@ -548,7 +548,7 @@ int FlGui::testGlobalShortcuts(int event) (0, GMSH_SET | GMSH_GUI, !opt_mesh_reverse_all_normals(0, GMSH_GET, 0)); status = 2; } - else if(Fl::test_shortcut(FL_ALT + 'x') || + else if(Fl::test_shortcut(FL_ALT + 'x') || Fl::test_shortcut(FL_ALT + FL_SHIFT + 'x')) { status_xyz1p_cb(0, (void *)"x"); status = 1; @@ -678,7 +678,7 @@ int FlGui::testGlobalShortcuts(int event) else if(testArrowShortcuts()) { status = 1; } - + if(status == 2){ drawContext::global()->draw(); return 1; @@ -795,7 +795,7 @@ void FlGui::setStatus(const char *msg, int num) gl->screenMessage[0] = std::string(msg); if(i) gl->screenMessage[0].resize(i - 1); - if(i < n) + if(i < n) gl->screenMessage[1] = std::string(&msg[i]); else gl->screenMessage[1].clear(); @@ -810,9 +810,8 @@ void FlGui::storeCurrentWindowsInfo() CTX::instance()->glPosition[0] = graph[0]->win->x(); CTX::instance()->glPosition[1] = graph[0]->win->y(); CTX::instance()->glSize[0] = graph[0]->win->w(); - CTX::instance()->glSize[1] = (graph[0]->win->h() - graph[0]->bottom->h() - - graph[0]->browser->h()); - CTX::instance()->msgSize = graph[0]->browser->h(); + CTX::instance()->glSize[1] = (graph[0]->win->h() - graph[0]->bottom->h()); + CTX::instance()->msgSize = graph[0]->getMessageHeight(); CTX::instance()->optPosition[0] = options->win->x(); CTX::instance()->optPosition[1] = options->win->y(); CTX::instance()->pluginPosition[0] = plugins->win->x(); @@ -842,8 +841,8 @@ void FlGui::storeCurrentWindowsInfo() } void FlGui::callForSolverPlugin(int dim) -{ - GMSH_SolverPlugin *sp = PluginManager::instance()->findSolverPlugin(); +{ + GMSH_SolverPlugin *sp = PluginManager::instance()->findSolverPlugin(); if(sp) sp->popupPropertiesForPhysicalEntity(dim); } @@ -903,7 +902,7 @@ void window_cb(Fl_Widget *w, void *data) // the order is important! for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->win->show(); - if(FlGui::instance()->options->win->shown()) + if(FlGui::instance()->options->win->shown()) FlGui::instance()->options->win->show(); if(FlGui::instance()->plugins->win->shown()) FlGui::instance()->plugins->win->show(); diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index d2e8b0ed49..028ee19409 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -522,25 +522,17 @@ graphicWindow::graphicWindow(bool main, int numTiles) : _autoScrollMessages(true int sh = 2 * FL_NORMAL_SIZE - 4; // status bar height int sw = FL_NORMAL_SIZE + 3; // status button width int width = CTX::instance()->glSize[0]; - int mheight = CTX::instance()->msgSize; - int glheight = CTX::instance()->glSize[1]; + int mheight = 10; // dummy (nonzero) + int glheight = CTX::instance()->glSize[1] - mheight; int height = glheight + mheight + sh; // make sure height < screen height if(height > Fl::h()){ height = Fl::h(); - mheight = 50; glheight = height - mheight - sh; - CTX::instance()->msgSize = mheight; CTX::instance()->glSize[1] = glheight; } - // no tile should be zero during tile creation - if(CTX::instance()->msgSize <= 0){ - mheight = 10; - glheight = CTX::instance()->glSize[1] - 10; - } - // the graphic window should be a "normal" window (neither modal nor // non-modal) if(main){ @@ -820,9 +812,9 @@ void graphicWindow::resizeMessages(int dh) void graphicWindow::showMessages() { if(!win->shown()) return; - if(browser->h() < 10){ + if(browser->h() < 5){ int height = _savedMessageHeight; - if(height < 1) height = 50; + if(height < 5) height = 50; int maxh = win->h() - bottom->h(); if(height > maxh) height = maxh / 2; resizeMessages(height - browser->h()); @@ -837,6 +829,12 @@ void graphicWindow::hideMessages() resizeMessages(-browser->h()); } +int graphicWindow::getMessageHeight() +{ + if(!browser->h()) return _savedMessageHeight; + return browser->h(); +} + void graphicWindow::addMessage(const char *msg) { browser->add(msg, 0); diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index 07e76b8448..0482c4f6cb 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -36,6 +36,7 @@ class graphicWindow{ void setTitle(std::string str); void setAutoScroll(bool val){ _autoScrollMessages = val; } bool getAutoScroll(){ return _autoScrollMessages; } + int getMessageHeight(); void split(openglWindow *g, char how); void setAnimButtons(int mode); void checkAnimButtons(); -- GitLab