summaryrefslogtreecommitdiff
path: root/test/editor.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-04-15 11:27:15 +0000
committerManolo Gouy <Manolo>2010-04-15 11:27:15 +0000
commit590020a9459a3d7444f269228775f37a0f758152 (patch)
treececfac7b2e01db60974528d31469939fcca4b262 /test/editor.cxx
parent2a2e0821c90f9eb6bd4c16f078acfd306ac47267 (diff)
Replaced fl_file_chooser() by Fl_Native_File_Chooser uses in test programs
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7509 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/editor.cxx')
-rw-r--r--test/editor.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/test/editor.cxx b/test/editor.cxx
index 3c650aab0..fc6f25c19 100644
--- a/test/editor.cxx
+++ b/test/editor.cxx
@@ -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 check_save(void) {
}
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 @@ void load_file(char *newfile, int ipos) {
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 new_cb(Fl_Widget*, void*) {
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 save_cb() {
}
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();