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
This commit is contained in:
parent
2a2e0821c9
commit
590020a945
@ -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();
|
||||
|
||||
@ -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 file_cb(const char *n) {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user