diff --git a/Fltk/Makefile b/Fltk/Makefile index ba48145345672acd6161289de19bd865a821e44f..e4d3f6eb1c5de18c6fe03fd8b1a887a328681b16 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -294,7 +294,7 @@ fileDialogs${OBJEXT}: fileDialogs.cpp ../Common/GmshConfig.h \ ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \ ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Common/Context.h ../Geo/CGNSOptions.h \ - ../Mesh/meshPartitionOptions.h fileChooser.h + ../Mesh/meshPartitionOptions.h extraDialogs${OBJEXT}: extraDialogs.cpp GUI.h paletteWindow.h \ ../Common/GmshDefines.h ../Common/OpenFile.h ../Common/CreateFile.h \ ../Common/Options.h ../Post/ColorTable.h Draw.h ../Geo/GModel.h \ diff --git a/Fltk/fileChooser.h b/Fltk/fileChooser.h deleted file mode 100644 index 0209c18cf9ee95524986a4e12e90dd4f6bcf7ba3..0000000000000000000000000000000000000000 --- a/Fltk/fileChooser.h +++ /dev/null @@ -1,48 +0,0 @@ -// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#ifndef _FILE_PICKER_H_ -#define _FILE_PICKER_H_ - -#include <FL/Fl_File_Chooser.H> -#include <FL/Fl_Window.H> -#include <FL/Fl_File_Input.H> - -// The FLTK team doesn't want to add a position() method to the file -// chooser, so we have to derive our own. To make things worse, the -// original file chooser doesn't expose its window to the world, so -// we need to use a cheap hack to get to it. Even worse is the hack -// used to get the focus on the file input widget. Sigh... - -class fileChooser : public Fl_File_Chooser { - private: - Fl_Window *_win; - Fl_File_Input *_in; - public: - fileChooser(const char *d, const char *p, int t, const char *title) - : Fl_File_Chooser(d, p, t, title) - { - _win = dynamic_cast<Fl_Window*>(newButton->parent()->parent()); - _in = dynamic_cast<Fl_File_Input *>(previewButton->parent()->parent()->resizable()); - } - void show() - { - if(_win){ - _win->show(); - rescan(); // necessary since fltk 1.1.7 - if(_in) - _in->take_focus(); - else - _win->take_focus(); - } - else - Fl_File_Chooser::show(); - } - void position(int x, int y){ if(_win) _win->position(x,y); } - int x(){ if(_win) return _win->x(); else return 100; } - int y(){ if(_win) return _win->y(); else return 100; } -}; - -#endif diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 5d4aaeff6784ea4663d6ff215223f11368d87cb8..9d0cdc22ca6345307404abd903d0f5b5b0e53115 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -34,7 +34,39 @@ #include <FL/Fl_Native_File_Chooser.H> static Fl_Native_File_Chooser *fc = 0; #else -#include "fileChooser.h" +#include <FL/Fl_File_Chooser.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_File_Input.H> +class fileChooser : public Fl_File_Chooser { + // we derive our own so we can set its position (The original file + // chooser doesn't expose its window to the world, so we need to use + // a cheap hack to get to it. Even worse is the hack used to get the + // focus on the file input widget.) + private: + Fl_Window *_win; + Fl_File_Input *_in; + public: + fileChooser(const char *d, const char *p, int t, const char *title) + : Fl_File_Chooser(d, p, t, title) + { + _win = dynamic_cast<Fl_Window*>(newButton->parent()->parent()); + _in = dynamic_cast<Fl_File_Input *>(previewButton->parent()->parent()->resizable()); + } + void show() + { + if(_win){ + _win->show(); + rescan(); // necessary since fltk 1.1.7 + if(_in) _in->take_focus(); + else _win->take_focus(); + } + else + Fl_File_Chooser::show(); + } + void position(int x, int y){ if(_win) _win->position(x,y); } + int x(){ if(_win) return _win->x(); else return 100; } + int y(){ if(_win) return _win->y(); else return 100; } +}; static fileChooser *fc = 0; #endif