From ae541907ebc320484420474ac94ecf52e77d84a4 Mon Sep 17 00:00:00 2001 From: Karel Matas Date: Fri, 21 Jun 2013 18:22:15 +0200 Subject: [PATCH] Fl_File_Chooser changed to Fl_Native_File_Chooser --- src/gui.hxx | 18 ++++++++++++++---- src/gui_dialogs.cxx | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gui.hxx b/src/gui.hxx index bc6f2be..be6f760 100755 --- a/src/gui.hxx +++ b/src/gui.hxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -308,9 +308,19 @@ class GUI inline void highlight_components ( const string &comps ) { main_window_->compo_view_->set_highlight(comps); } - // TODO: Fl_Native_File_Chooser.H - char *open_file_dialog (){ - return fl_file_chooser("Open file...", "*", 0, 0); } + const char *open_file_dialog (){ + Fl_Native_File_Chooser fnfc; + fnfc.title("Pick a file"); + fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); + switch ( fnfc.show() ) { + case -1: + throw std::runtime_error( fnfc.errmsg() ); + break; + case 1: + return nullptr; + } + return fnfc.filename(); + } vector listview_filters (); diff --git a/src/gui_dialogs.cxx b/src/gui_dialogs.cxx index 6ddc624..2f70eb3 100755 --- a/src/gui_dialogs.cxx +++ b/src/gui_dialogs.cxx @@ -237,8 +237,9 @@ void ManageDBDialog::Item::set ( const string &title, const string &version, ManageDBDialog::ManageDBDialog ( int w, int h, const char *l ) : Fl_Double_Window(w,h,l) { - set_modal(); last_y_ = 5; + end(); + set_modal(); } void ManageDBDialog::add_item ( const string &name, const string &version, -- 2.11.4.GIT