Revision: 6679
http://playerstage.svn.sourceforge.net/playerstage/?rev=6679&view=rev
Author: jeremy_asher
Date: 2008-06-24 11:37:10 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
StgWorldGui callback refactoring, fixed Options opening
Modified Paths:
--------------
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/worldgui.cc
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-06-24 16:09:36 UTC (rev 6678)
+++ code/stage/trunk/libstage/stage.hh 2008-06-24 18:37:10 UTC (rev 6679)
@@ -2034,22 +2034,8 @@
{ interval_real = usec; }
- // static callback functions
+
protected:
- static void LoadCallback( Fl_Widget* wid, StgWorldGui* world );
- static void SaveCallback( Fl_Widget* wid, StgWorldGui* world );
- static void SaveAsCallback( Fl_Widget* wid, StgWorldGui* world );
- static void QuitCallback( Fl_Widget* wid, StgWorldGui* world );
- static void About_cb( Fl_Widget* wid, StgWorldGui* world );
- static void HelpAboutCallback( Fl_Widget* wid );
- static void view_toggle_cb( Fl_Menu_Bar* menubar, StgCanvas* canvas );
- static void WindowCallback( Fl_Widget* wid, StgWorldGui* world );
- static void openOptionsCb( Fl_Widget* w, void* p );
- static void optionsDlgCb( Fl_Widget* w, void* p );
-
- bool SaveAsDialog();
- bool CloseWindowQuery();
-
virtual void PushColor( stg_color_t col )
{ canvas->PushColor( col ); }
@@ -2063,6 +2049,23 @@
void DrawFloor();
StgCanvas* GetCanvas( void ) { return canvas; }
+
+
+ // static callback functions
+ static void windowCb( Fl_Widget* w, void* p );
+
+ static void fileLoadCb( Fl_Widget* w, void* p );
+ static void fileSaveCb( Fl_Widget* w, void* p );
+ static void fileSaveAsCb( Fl_Widget* w, void* p );
+ static void fileExitCb( Fl_Widget* w, void* p );
+ static void viewToggleCb( Fl_Widget* w, void* p );
+ static void viewOptionsCb( Fl_Widget* w, void* p );
+ static void optionsDlgCb( Fl_Widget* w, void* p );
+ static void helpAboutCb( Fl_Widget* w, void* p );
+
+ // GUI functions
+ bool saveAsDialog();
+ bool closeWindowQuery();
};
Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc 2008-06-24 16:09:36 UTC (rev
6678)
+++ code/stage/trunk/libstage/worldgui.cc 2008-06-24 18:37:10 UTC (rev
6679)
@@ -134,7 +134,7 @@
StgWorldGui::StgWorldGui(int W,int H,const char* L) : Fl_Window(0,0,W,H,L)
{
//size_range( 100,100 ); // set minimum window size
-
+ oDlg = NULL;
graphics = true;
paused = false;
@@ -150,53 +150,48 @@
canvas = new StgCanvas( this,0,30,W,H-30 );
resizable(canvas);
end();
-
- oDlg = NULL;
mbar->add( "&File", 0, 0, 0, FL_SUBMENU );
- mbar->add( "File/&Load World...", FL_CTRL + 'l', (Fl_Callback
*)LoadCallback, this, FL_MENU_DIVIDER );
- mbar->add( "File/&Save World", FL_CTRL + 's', (Fl_Callback
*)SaveCallback, this );
- mbar->add( "File/Save World &As...", FL_CTRL + FL_SHIFT + 's',
(Fl_Callback *)SaveAsCallback, this, FL_MENU_DIVIDER );
- mbar->add( "File/E&xit", FL_CTRL+'q', (Fl_Callback *)QuitCallback, this
);
+ mbar->add( "File/&Load World...", FL_CTRL + 'l',
StgWorldGui::fileLoadCb, this, FL_MENU_DIVIDER );
+ mbar->add( "File/&Save World", FL_CTRL + 's', StgWorldGui::fileSaveCb,
this );
+ mbar->add( "File/Save World &As...", FL_CTRL + FL_SHIFT + 's',
StgWorldGui::fileSaveAsCb, this, FL_MENU_DIVIDER );
+ mbar->add( "File/E&xit", FL_CTRL+'q', StgWorldGui::fileExitCb, this );
mbar->add( "&View", 0, 0, 0, FL_SUBMENU );
- mbar->add( MITEM_VIEW_DATA, 'd', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_DATA, 'd', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_DATA ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_BLOCKS, 'b', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_BLOCKS, 'b', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_BLOCKS ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_GRID, 'g', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_GRID, 'g', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_GRID ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_OCCUPANCY, FL_ALT+'o',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
+ mbar->add( MITEM_VIEW_OCCUPANCY, FL_ALT+'o', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_OCCUPANCY
? FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_QUADTREE, FL_ALT+'t',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
+ mbar->add( MITEM_VIEW_QUADTREE, FL_ALT+'t', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_QUADTREE
? FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_FOLLOW, 'f', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_FOLLOW, 'f', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_FOLLOW ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_CLOCK, 'c', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_CLOCK, 'c', StgWorldGui::viewToggleCb, canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_CLOCK ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_PERSPECTIVE, 'r', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_PERSPECTIVE, 'r', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->use_perspective_camera ));
-
- mbar->add( MITEM_VIEW_TRAILS, 't', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_TRAILS, 't', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_TRAILS ?
FL_MENU_VALUE : 0 ));
-
- mbar->add( MITEM_VIEW_STATUS, 's', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ mbar->add( MITEM_VIEW_STATUS, 's', StgWorldGui::viewToggleCb,
canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_STATUS
? FL_MENU_VALUE : 0 ));
-
- mbar->add( MITEM_VIEW_FOOTPRINTS, FL_CTRL+'f',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
+ mbar->add( MITEM_VIEW_FOOTPRINTS, FL_CTRL+'f',
StgWorldGui::viewToggleCb, canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_FOOTPRINT
? FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_ARROWS, FL_CTRL+'a',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
+ mbar->add( MITEM_VIEW_ARROWS, FL_CTRL+'a',
StgWorldGui::viewToggleCb, canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_ARROWS ?
FL_MENU_VALUE : 0 ));
- mbar->add( MITEM_VIEW_BLOCKSRISING, FL_CTRL+'t',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
+ mbar->add( MITEM_VIEW_BLOCKSRISING, FL_CTRL+'t',
StgWorldGui::viewToggleCb, canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_TRAILRISE
? FL_MENU_VALUE : 0 ));
- mbar->add( "View/&Options", FL_CTRL + 'o', (Fl_Callback
*)openOptionsCb, canvas );
+ mbar->add( "View/&Options", FL_CTRL + 'o', StgWorldGui::viewOptionsCb,
this );
mbar->add( "&Help", 0, 0, 0, FL_SUBMENU );
- mbar->add( "Help/&About Stage...", 0, (Fl_Callback *)About_cb, this );
+ mbar->add( "Help/&About Stage...", 0, StgWorldGui::helpAboutCb, this );
//mbar->add( "Help/HTML Documentation", FL_CTRL + 'g', (Fl_Callback
*)dummy_cb );
- callback( (Fl_Callback*)WindowCallback, this );
+ callback( StgWorldGui::windowCb, this );
show();
}
@@ -351,14 +346,116 @@
// canvas->camera.setPose( 0, 0 );
}
-void StgWorldGui::LoadCallback( Fl_Widget* wid, StgWorldGui* world )
+bool StgWorldGui::Save( const char* filename )
{
+ PRINT_DEBUG1( "%s.Save()", token );
+
+ StgWorld::Save( filename );
+
+ // use the window section for the rest
+ int window_section = wf->LookupEntity( "window" );
+
+ if( window_section > 0 ) // section defined
+ {
+ wf->WriteTupleFloat( window_section, "size", 0, w() );
+ wf->WriteTupleFloat( window_section, "size", 1, h() );
+
+ wf->WriteFloat( window_section, "scale",
canvas->camera.getScale() );
+
+ wf->WriteTupleFloat( window_section, "center", 0,
canvas->camera.getX() );
+ wf->WriteTupleFloat( window_section, "center", 1,
canvas->camera.getY() );
+
+ wf->WriteTupleFloat( window_section, "rotate", 0,
canvas->camera.getPitch() );
+ wf->WriteTupleFloat( window_section, "rotate", 1,
canvas->camera.getYaw() );
+
+ uint32_t flags = canvas->GetShowFlags();
+ wf->WriteInt( window_section, "show_blocks", flags &
STG_SHOW_BLOCKS );
+ wf->WriteInt( window_section, "show_grid", flags &
STG_SHOW_GRID );
+ wf->WriteInt( window_section, "show_follow", flags &
STG_SHOW_FOLLOW );
+ wf->WriteInt( window_section, "show_data", flags &
STG_SHOW_DATA );
+ wf->WriteInt( window_section, "show_occupancy", flags &
STG_SHOW_OCCUPANCY );
+ wf->WriteInt( window_section, "show_tree", flags &
STG_SHOW_QUADTREE );
+ wf->WriteInt( window_section, "show_clock", flags &
STG_SHOW_CLOCK );
+
+ // TODO - per model visualizations save
+ }
+
+ // TODO - error checking
+ return true;
+}
+
+bool StgWorldGui::Update()
+{
+ if( real_time_of_last_update == 0 )
+ real_time_of_last_update = RealTimeNow();
+
+ bool val = paused ? true : StgWorld::Update();
+
+ stg_usec_t interval;
+ stg_usec_t timenow;
+
+ do { // we loop over updating the GUI, sleeping if there's any spare
+ // time
+ Fl::check();
+
+ timenow = RealTimeNow();
+ interval = timenow - real_time_of_last_update; // guaranteed to be >= 0
+
+ double sleeptime = (double)interval_real - (double)interval;
+
+ if( sleeptime > 0 )
+ usleep( (stg_usec_t)MIN(sleeptime,100000) ); // check the GUI at
10Hz min
+
+ } while( interval < interval_real );
+
+
+ interval_log[updates%INTERVAL_LOG_LEN] = timenow - real_time_of_last_update;
+
+ real_time_of_last_update = timenow;
+
+ return val;
+}
+
+void StgWorldGui::DrawTree( bool drawall )
+{
+ g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Draw_cb, NULL
);
+}
+
+void StgWorldGui::DrawFloor()
+{
+ PushColor( 1,1,1,1 );
+ g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Floor_cb, NULL
);
+ PopColor();
+}
+
+
+void StgWorldGui::windowCb( Fl_Widget* w, void* p )
+{
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
+ switch ( Fl::event() ) {
+ case FL_SHORTCUT:
+ if ( Fl::event_key() == FL_Escape )
+ return;
+ case FL_CLOSE: // clicked close button
+ bool done = worldGui->closeWindowQuery();
+ if ( !done )
+ return;
+ }
+
+ exit(0);
+}
+
+void StgWorldGui::fileLoadCb( Fl_Widget* w, void* p )
+{
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
const char* filename;
const char* worldsPath;
//bool success;
const char* pattern = "World Files (*.world)";
- worldsPath = world->fileMan->worldsRoot().c_str();
+ worldsPath = worldGui->fileMan->worldsRoot().c_str();
Fl_File_Chooser fc( worldsPath, pattern, Fl_File_Chooser::CREATE, "Load
World File..." );
fc.ok_label( "Load" );
@@ -369,17 +466,17 @@
filename = fc.value();
if (filename != NULL) { // chose something
- if ( world->fileMan->readable( filename ) ) {
+ if ( worldGui->fileMan->readable( filename ) ) {
// file is readable, clear and load
// if (initialized) {
- world->Stop();
- world->UnLoad();
+ worldGui->Stop();
+ worldGui->UnLoad();
// }
// todo: make sure loading is successful
- world->Load( filename );
- world->Start(); // if (stopped)
+ worldGui->Load( filename );
+ worldGui->Start(); // if (stopped)
}
else {
fl_alert( "Unable to read selected world file." );
@@ -389,104 +486,41 @@
}
}
-void StgWorldGui::SaveCallback( Fl_Widget* wid, StgWorldGui* world )
+void StgWorldGui::fileSaveCb( Fl_Widget* w, void* p )
{
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
// save to current file
- bool success = world->Save( NULL );
+ bool success = worldGui->Save( NULL );
if ( !success ) {
fl_alert( "Error saving world file." );
}
}
-void StgWorldGui::SaveAsCallback( Fl_Widget* wid, StgWorldGui* world )
+void StgWorldGui::fileSaveAsCb( Fl_Widget* w, void* p )
{
- world->SaveAsDialog();
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
+ worldGui->saveAsDialog();
}
-bool StgWorldGui::SaveAsDialog()
-{
- const char* newFilename;
- bool success = false;
- const char* pattern = "World Files (*.world)";
- Fl_File_Chooser fc( wf->filename, pattern, Fl_File_Chooser::CREATE,
"Save File As..." );
- fc.ok_label( "Save" );
- fc.show();
- while (fc.shown())
- Fl::wait();
+void StgWorldGui::fileExitCb( Fl_Widget* w, void* p )
+{
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
- newFilename = fc.value();
-
- if (newFilename != NULL) {
- // todo: make sure file ends in .world
- success = Save( newFilename );
- if ( !success ) {
- fl_alert( "Error saving world file." );
- }
- }
-
- return success;
-}
-
-void StgWorldGui::QuitCallback( Fl_Widget* wid, StgWorldGui* world )
-{
- bool done = world->CloseWindowQuery();
+ bool done = worldGui->closeWindowQuery();
if (done) {
exit(0);
}
}
-bool StgWorldGui::CloseWindowQuery()
+void StgWorldGui::viewToggleCb( Fl_Widget* w, void* p )
{
- int choice;
-
- 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
- if ( SaveAsDialog() ) {
- return true;
- }
- else {
- return false;
- }
- case 2: // No
- return true;
- }
-
- // Cancel
- return false;
- }
- else {
- // nothing is loaded, just quit
- return true;
- }
-}
+ Fl_Menu_Bar* menubar = static_cast<Fl_Menu_Bar*>( w );
+ StgCanvas* canvas = static_cast<StgCanvas*>( p );
-void StgWorldGui::WindowCallback( Fl_Widget* wid, StgWorldGui* world )
-{
- switch ( Fl::event() ) {
- case FL_SHORTCUT:
- if ( Fl::event_key() == FL_Escape )
- return;
- case FL_CLOSE: // clicked close button
- bool done = world->CloseWindowQuery();
- if ( !done )
- return;
- }
-
- exit(0);
-}
-
-void StgWorldGui::view_toggle_cb( Fl_Menu_Bar* menubar, StgCanvas* canvas )
-{
char picked[128];
menubar->item_pathname(picked, sizeof(picked)-1);
@@ -511,7 +545,7 @@
//printf( "value: %d\n", item->value() );
}
-void StgWorldGui::openOptionsCb( Fl_Widget* w, void* p ) {
+void StgWorldGui::viewOptionsCb( Fl_Widget* w, void* p ) {
StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
std::vector<Option> options;
@@ -538,6 +572,7 @@
void StgWorldGui::optionsDlgCb( Fl_Widget* w, void* p ) {
OptionsDlg* oDlg = static_cast<OptionsDlg*>( w );
StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
switch ( Fl::event() ) {
case FL_SHORTCUT:
if ( Fl::event_key() != FL_Escape )
@@ -557,7 +592,15 @@
}
}
-void AboutCloseCb( Fl_Widget* w, void* p ) {
+
+void aboutOKBtnCb( Fl_Widget* w, void* p ) {
+ Fl_Return_Button* btn;
+ btn = static_cast<Fl_Return_Button*>( w );
+
+ btn->window()->do_callback();
+}
+
+void aboutCloseCb( Fl_Widget* w, void* p ) {
Fl_Window* win;
win = static_cast<Fl_Window*>( w );
Fl_Text_Display* textDisplay;
@@ -569,8 +612,10 @@
Fl::delete_widget( win );
}
-void StgWorldGui::About_cb( Fl_Widget*, StgWorldGui* world )
+void StgWorldGui::helpAboutCb( Fl_Widget* w, void* p )
{
+ StgWorldGui* worldGui = static_cast<StgWorldGui*>( p );
+
fl_register_images();
const int Width = 400;
@@ -588,7 +633,7 @@
std::string fullpath;
- fullpath = world->fileMan->fullPath( "stagelogo.png" );
+ fullpath = worldGui->fileMan->fullPath( "stagelogo.png" );
Fl_PNG_Image* png = new Fl_PNG_Image( fullpath.c_str() ); // load image
into ram
box->image( png ); // attach image to box
@@ -597,7 +642,7 @@
Width-2*Spc,
Height-pngH-ButtonH-4*Spc );
textDisplay->box( FL_NO_BOX );
textDisplay->color( win->color() );
- win->callback( AboutCloseCb, textDisplay );
+ win->callback( aboutCloseCb, textDisplay );
const char* AboutText =
"\n"
@@ -614,94 +659,67 @@
button = new Fl_Return_Button( (Width - ButtonW)/2, Height-Spc-ButtonH,
ButtonW, ButtonH,
"&OK" );
- button->callback( (Fl_Callback*)HelpAboutCallback );
+ button->callback( aboutOKBtnCb );
win->show();
}
-void StgWorldGui::HelpAboutCallback( Fl_Widget* wid ) {
- wid->window()->hide();
-}
-bool StgWorldGui::Save( const char* filename )
+bool StgWorldGui::saveAsDialog()
{
- PRINT_DEBUG1( "%s.Save()", token );
+ const char* newFilename;
+ bool success = false;
+ const char* pattern = "World Files (*.world)";
- StgWorld::Save( filename );
-
- // use the window section for the rest
- int window_section = wf->LookupEntity( "window" );
+ Fl_File_Chooser fc( wf->filename, pattern, Fl_File_Chooser::CREATE,
"Save File As..." );
+ fc.ok_label( "Save" );
- if( window_section > 0 ) // section defined
- {
- wf->WriteTupleFloat( window_section, "size", 0, w() );
- wf->WriteTupleFloat( window_section, "size", 1, h() );
-
- wf->WriteFloat( window_section, "scale",
canvas->camera.getScale() );
-
- wf->WriteTupleFloat( window_section, "center", 0,
canvas->camera.getX() );
- wf->WriteTupleFloat( window_section, "center", 1,
canvas->camera.getY() );
-
- wf->WriteTupleFloat( window_section, "rotate", 0,
canvas->camera.getPitch() );
- wf->WriteTupleFloat( window_section, "rotate", 1,
canvas->camera.getYaw() );
-
- uint32_t flags = canvas->GetShowFlags();
- wf->WriteInt( window_section, "show_blocks", flags &
STG_SHOW_BLOCKS );
- wf->WriteInt( window_section, "show_grid", flags &
STG_SHOW_GRID );
- wf->WriteInt( window_section, "show_follow", flags &
STG_SHOW_FOLLOW );
- wf->WriteInt( window_section, "show_data", flags &
STG_SHOW_DATA );
- wf->WriteInt( window_section, "show_occupancy", flags &
STG_SHOW_OCCUPANCY );
- wf->WriteInt( window_section, "show_tree", flags &
STG_SHOW_QUADTREE );
- wf->WriteInt( window_section, "show_clock", flags &
STG_SHOW_CLOCK );
+ fc.show();
+ while (fc.shown())
+ Fl::wait();
- // TODO - per model visualizations save
- }
+ newFilename = fc.value();
- // TODO - error checking
- return true;
-}
+ if (newFilename != NULL) {
+ // todo: make sure file ends in .world
+ success = Save( newFilename );
+ if ( !success ) {
+ fl_alert( "Error saving world file." );
+ }
+ }
-
-bool StgWorldGui::Update()
-{
- if( real_time_of_last_update == 0 )
- real_time_of_last_update = RealTimeNow();
-
- bool val = paused ? true : StgWorld::Update();
-
- stg_usec_t interval;
- stg_usec_t timenow;
-
- do { // we loop over updating the GUI, sleeping if there's any spare
- // time
- Fl::check();
-
- timenow = RealTimeNow();
- interval = timenow - real_time_of_last_update; // guaranteed to be >= 0
-
- double sleeptime = (double)interval_real - (double)interval;
-
- if( sleeptime > 0 )
- usleep( (stg_usec_t)MIN(sleeptime,100000) ); // check the GUI at
10Hz min
-
- } while( interval < interval_real );
-
-
- interval_log[updates%INTERVAL_LOG_LEN] = timenow - real_time_of_last_update;
-
- real_time_of_last_update = timenow;
-
- return val;
+ return success;
}
-void StgWorldGui::DrawTree( bool drawall )
-{
- g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Draw_cb, NULL
);
-}
-
-void StgWorldGui::DrawFloor()
+bool StgWorldGui::closeWindowQuery()
{
- PushColor( 1,1,1,1 );
- g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Floor_cb, NULL
);
- PopColor();
+ int choice;
+
+ 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
+ if ( saveAsDialog() ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ case 2: // No
+ return true;
+ }
+
+ // Cancel
+ return false;
+ }
+ else {
+ // nothing is loaded, just quit
+ return true;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit