From 405f8fba3a14a50bd0340be93eb39e1ede938112 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 18 Apr 1999 23:43:42 +0000 Subject: [PATCH] Changed exit callback in FLUID to moe standard "Save Changes?" with yes, no, and cancel. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@549 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/fluid.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 02b9b0185..c43f7fcca 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1,5 +1,5 @@ // -// "$Id: fluid.cxx,v 1.15 1999/03/09 06:59:05 bill Exp $" +// "$Id: fluid.cxx,v 1.15.2.1 1999/04/18 23:43:42 mike Exp $" // // FLUID main entry for the Fast Light Tool Kit (FLTK). // @@ -110,10 +110,6 @@ void leave_source_dir() { Fl_Window *main_window; -void exit_cb(Fl_Widget *,void *) { - if (!modflag || fl_ask("Exit without saving changes?")) exit(0); -} - void save_cb(Fl_Widget *, void *v) { const char *c = filename; if (v || !c || !*c) { @@ -127,6 +123,20 @@ void save_cb(Fl_Widget *, void *v) { modflag = 0; } +void exit_cb(Fl_Widget *,void *) { + if (modflag) + switch (fl_choice("Save changes before exiting?", "Cancel", "No", "Yes")) + { + case 0 : /* Cancel */ + return; + case 2 : /* Yes */ + save_cb(NULL, NULL); + if (modflag) return; // Didn't save! + } + + exit(0); +} + void open_cb(Fl_Widget *, void *v) { if (!v && modflag && !fl_ask("Discard changes?")) return; const char *c; @@ -418,5 +428,5 @@ int main(int argc,char **argv) { } // -// End of "$Id: fluid.cxx,v 1.15 1999/03/09 06:59:05 bill Exp $". +// End of "$Id: fluid.cxx,v 1.15.2.1 1999/04/18 23:43:42 mike Exp $". //