Author: manolo
Date: 2010-04-15 04:27:15 -0700 (Thu, 15 Apr 2010)
New Revision: 7509
Log:
Replaced fl_file_chooser() by Fl_Native_File_Chooser uses in test programs
Modified:
branches/branch-1.3/test/editor.cxx
branches/branch-1.3/test/pixmap_browser.cxx
Modified: branches/branch-1.3/test/editor.cxx
===================================================================
--- branches/branch-1.3/test/editor.cxx 2010-04-15 09:18:51 UTC (rev 7508)
+++ branches/branch-1.3/test/editor.cxx 2010-04-15 11:27:15 UTC (rev 7509)
@@ -45,7 +45,7 @@
#include <FL/Fl_Group.H>
#include <FL/Fl_Double_Window.H>
#include <FL/fl_ask.H>
-#include <FL/Fl_File_Chooser.H>
+#include <FL/Fl_Native_File_Chooser.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Button.H>
@@ -484,7 +484,7 @@
}
int loading = 0;
-void load_file(char *newfile, int ipos) {
+void load_file(const char *newfile, int ipos) {
loading = 1;
int insert = (ipos != -1);
changed = insert;
@@ -500,7 +500,7 @@
textbuf->call_modify_callbacks();
}
-void save_file(char *newfile) {
+void save_file(const char *newfile) {
if (textbuf->savefile(newfile))
fl_alert("Error writing to file \'%s\':\n%s.", newfile, strerror(errno));
else
@@ -590,15 +590,21 @@
void open_cb(Fl_Widget*, void*) {
if (!check_save()) return;
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Open file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
+ if ( fnfc.show() ) return;
+ load_file(fnfc.filename(), -1);
- char *newfile = fl_file_chooser("Open File?", "*", filename);
- if (newfile != NULL) load_file(newfile, -1);
}
-void insert_cb(Fl_Widget*, void *v) {
- char *newfile = fl_file_chooser("Insert File?", "*", filename);
+void insert_cb(Fl_Widget*, void *v) {
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Insert file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
+ if ( fnfc.show() ) return;
EditorWindow *w = (EditorWindow *)v;
- if (newfile != NULL) load_file(newfile, w->editor->insert_position());
+ load_file(fnfc.filename(), w->editor->insert_position());
}
void paste_cb(Fl_Widget*, void* v) {
@@ -718,10 +724,11 @@
}
void saveas_cb() {
- char *newfile;
-
- newfile = fl_file_chooser("Save File As?", "*", filename);
- if (newfile != NULL) save_file(newfile);
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Save File As?");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);
+ if ( fnfc.show() ) return;
+ save_file(fnfc.filename());
}
Fl_Window* new_view();
Modified: branches/branch-1.3/test/pixmap_browser.cxx
===================================================================
--- branches/branch-1.3/test/pixmap_browser.cxx 2010-04-15 09:18:51 UTC (rev
7508)
+++ branches/branch-1.3/test/pixmap_browser.cxx 2010-04-15 11:27:15 UTC (rev
7509)
@@ -32,7 +32,7 @@
#include <FL/Fl_Shared_Image.H>
#include <string.h>
#include <errno.h>
-#include <FL/Fl_File_Chooser.H>
+#include <FL/Fl_Native_File_Chooser.H>
#include <FL/fl_message.H>
Fl_Box *b;
@@ -87,9 +87,12 @@
}
void button_cb(Fl_Widget *,void *) {
- fl_file_chooser_callback(file_cb);
- fl_file_chooser("Image file?","*.{bm,bmp,gif,jpg,pbm,pgm,png,ppm,xbm,xpm}",
name);
- fl_file_chooser_callback(0);
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Pick an image file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
+ fnfc.filter("Image files\t*.{bm,bmp,gif,jpg,pbm,pgm,png,ppm,xbm,xpm}");
+ if ( fnfc.show() ) return;
+ file_cb(fnfc.filename());
}
int dvisual = 0;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit