From: <jer...@us...> - 2008-06-12 15:43:46
|
Revision: 6549 http://playerstage.svn.sourceforge.net/playerstage/?rev=6549&view=rev Author: jeremy_asher Date: 2008-06-12 15:43:55 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Won't ask to save when nothing is loaded Modified Paths: -------------- code/stage/trunk/libstage/worldgui.cc Modified: code/stage/trunk/libstage/worldgui.cc =================================================================== --- code/stage/trunk/libstage/worldgui.cc 2008-06-12 22:27:04 UTC (rev 6548) +++ code/stage/trunk/libstage/worldgui.cc 2008-06-12 22:43:55 UTC (rev 6549) @@ -259,9 +259,6 @@ void StgWorldGui::UnLoad() { - //canvas->UnLoad(); -// delete canvas; -// canvas = new StgCanvas( this,0,30,640,480 ); StgWorld::UnLoad(); // canvas->camera.setPose( 0, 0 ); } @@ -356,26 +353,35 @@ bool StgWorldGui::CloseWindowQuery() { int choice; - choice = fl_choice("Do you want to save?", - "&Cancel", // ->0: defaults to ESC - "&Yes", // ->1 - "&No" // ->2 - ); - - switch (choice) { - case 1: // Yes - bool saved = SaveAsDialog(); - if ( saved ) { - return 1; - } - else { - return 0; - } - case 2: // No - return 1; + + if ( wf ) { + // worldfile loaded, ask to save + choice = fl_choice("Do you want to save?", + "&Cancel", // ->0: defaults to ESC + "&Yes", // ->1 + "&No" // ->2 + ); + + switch (choice) { + case 1: // Yes + bool saved = SaveAsDialog(); + if ( saved ) { + return true; + } + else { + return false; + } + case 2: // No + return true; + } + + // Cancel + return false; } - - return 0; + else { + // nothing is loaded, just quit + return true; + } } void StgWorldGui::WindowCallback( Fl_Widget* wid, StgWorldGui* world ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |