From e95943ac6b2b4eb6b1eba4e0a9fc045dfa62aecf Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 3 Jan 2009 12:21:40 +0000 Subject: [PATCH] label extra windows --- Fltk/GUI.cpp | 15 +++++++++++---- Fltk/graphicWindow.cpp | 6 ++++++ Fltk/graphicWindow.h | 4 ++++ Fltk/menuWindow.cpp | 2 +- utils/misc/variables.msvc | 5 +++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 4accfe3250..73796d912d 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -3,6 +3,7 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. +#include <sstream> #include <FL/Fl.H> #include <FL/Fl_Tooltip.H> #include <FL/Fl_Shared_Image.H> @@ -518,10 +519,16 @@ int GUI::testArrowShortcuts() void GUI::setGraphicTitle(const char *str) { - // FIXME should use copy_label, but it is broken for Fl_Windows in - // fltk 1.1.7 - for(unsigned int i = 0; i < graph.size(); i++) - graph[i]->win->label(str); + for(unsigned int i = 0; i < graph.size(); i++){ + if(!i){ + graph[i]->setTitle(str); + } + else{ + std::ostringstream sstream; + sstream << str << " [" << i << "]"; + graph[i]->setTitle(sstream.str()); + } + } } void GUI::updateViews() diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 60b1e3a651..e428906ce3 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -475,6 +475,12 @@ graphicWindow::~graphicWindow() Fl::delete_widget(win); } +void graphicWindow::setTitle(std::string str) +{ + _title = str; + win->label(_title.c_str()); +} + void graphicWindow::split(openglWindow *g, char how) { if(tile->find(g) == tile->children()) return; diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index 4ceace8f11..3747c98514 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -6,6 +6,7 @@ #ifndef _GRAPHIC_WINDOW_H_ #define _GRAPHIC_WINDOW_H_ +#include <string> #include <vector> #include <FL/Fl_Window.H> #include <FL/Fl_Button.H> @@ -14,6 +15,8 @@ #include "openglWindow.h" class graphicWindow{ + private: + std::string _title; public: Fl_Window *win; Fl_Tile *tile; @@ -24,6 +27,7 @@ class graphicWindow{ public: graphicWindow(bool main=true, int numTiles=1); ~graphicWindow(); + void setTitle(std::string str); void split(openglWindow *g, char how); void setAnimButtons(int mode); void checkAnimButtons(); diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index 61363e69c5..39330dc42d 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -155,7 +155,7 @@ static void file_window_cb(Fl_Widget *w, void *data) graphicWindow *g1 = GUI::instance()->graph.back(); graphicWindow *g2 = new graphicWindow(false, CTX.num_tiles); GUI::instance()->graph.push_back(g2); - g2->win->label(g1->win->label()); + GUI::instance()->setGraphicTitle(CTX.filename); g2->win->resize(g1->win->x() + 10, g1->win->y() + 10, g1->win->w(), g1->win->h()); g2->win->show(); diff --git a/utils/misc/variables.msvc b/utils/misc/variables.msvc index d29a83dd2e..cc870b6845 100644 --- a/utils/misc/variables.msvc +++ b/utils/misc/variables.msvc @@ -133,9 +133,10 @@ ifeq (${ENABLE_MED},1) endif ifeq (${ENABLE_GUI},1) - GMSH_DIRS+=Graphics Fltk contrib/NativeFileChooser + GMSH_DIRS+=Graphics Fltk contrib/NativeFileChooser contrib/TreeBrowser FLAGS+=/DHAVE_FLTK /I${FLTK_PREFIX} /I${FLTK_PREFIX}/FL/images - FLAGS+=/DHAVE_LIBZ /DHAVE_LIBPNG /DHAVE_LIBJPEG /DHAVE_NATIVE_FILE_CHOOSER + FLAGS+=/DHAVE_LIBZ /DHAVE_LIBPNG /DHAVE_LIBJPEG + FLAGS+=/DHAVE_NATIVE_FILE_CHOOSER /DHAVE_TREE_BROWSER GMSH_LIBS+=Fltk/Main.obj lib/*.lib ${FLTK_PREFIX}/lib/fltk*.lib GMSH_LIBS+=glu32.lib opengl32.lib advapi32.lib gdi32.lib user32.lib GMSH_LIBS+=shell32.lib ole32.lib comctl32.lib comdlg32.lib ws2_32.lib -- GitLab