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
This commit is contained in:
Michael R Sweet 1999-04-18 23:43:42 +00:00
parent 816393d2d4
commit 405f8fba3a
1 changed files with 16 additions and 6 deletions

View File

@ -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). // FLUID main entry for the Fast Light Tool Kit (FLTK).
// //
@ -110,10 +110,6 @@ void leave_source_dir() {
Fl_Window *main_window; 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) { void save_cb(Fl_Widget *, void *v) {
const char *c = filename; const char *c = filename;
if (v || !c || !*c) { if (v || !c || !*c) {
@ -127,6 +123,20 @@ void save_cb(Fl_Widget *, void *v) {
modflag = 0; 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) { void open_cb(Fl_Widget *, void *v) {
if (!v && modflag && !fl_ask("Discard changes?")) return; if (!v && modflag && !fl_ask("Discard changes?")) return;
const char *c; 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 $".
// //