Fredric: Pause implicitly when entering the menu (and remove the

option)
This commit is contained in:
simon.kagstrom 2010-03-14 12:03:30 +00:00
parent 486b5bffc7
commit a470e21b63
3 changed files with 31 additions and 51 deletions

View File

@ -340,6 +340,10 @@ GuiView *Gui::popView()
/* Deactivate when no views are left */ /* Deactivate when no views are left */
this->is_active = false; this->is_active = false;
if (TheC64->IsPaused())
Gui::gui->status_bar->queueMessage("C64 emulation resumed");
TheC64->Resume();
return NULL; return NULL;
} }
@ -485,6 +489,12 @@ void Gui::activate()
this->np = &cur_prefs; this->np = &cur_prefs;
this->pushView(this->mv); this->pushView(this->mv);
TheC64->Pause();
if (TheC64->network)
Gui::gui->status_bar->queueMessage("Can't pause when in network mode");
else
Gui::gui->status_bar->queueMessage("C64 emulation paused");
} }
SDL_Surface *Gui::loadThemeImage(const char *dir, const char *what) SDL_Surface *Gui::loadThemeImage(const char *dir, const char *what)

View File

@ -60,34 +60,20 @@ public:
MainMenu(Font *font, HelpBox *help) : Menu(font) MainMenu(Font *font, HelpBox *help) : Menu(font)
{ {
this->help = help; this->help = help;
this->setText(main_menu_messages);
this->updatePauseState();
} }
virtual void selectCallback(int which) virtual void selectCallback(int which)
{ {
switch (which) switch (which)
{ {
case 0: case 0: /* Insert disc */
TheC64->IsPaused() ? TheC64->Resume() : TheC64->Pause();
if (TheC64->network)
{
Gui::gui->status_bar->queueMessage("Can't pause when in network mode");
break;
}
if (TheC64->IsPaused())
Gui::gui->status_bar->queueMessage("C64 emulation paused");
else
Gui::gui->status_bar->queueMessage("C64 emulation resumed");
this->updatePauseState();
break;
case 2: /* Insert disc */
Gui::gui->dv->setDirectory(Gui::gui->game_base_path); Gui::gui->dv->setDirectory(Gui::gui->game_base_path);
Gui::gui->pushView(Gui::gui->dv); Gui::gui->pushView(Gui::gui->dv);
Gui::gui->dv->runStartSequence(this->p_submenus[0].sel == 0); Gui::gui->dv->runStartSequence(this->p_submenus[0].sel == 0);
break; break;
case 4: /* Load/save states */ case 2: /* Load/save states */
if (this->p_submenus[1].sel == 1) if (this->p_submenus[1].sel == 1)
Gui::gui->sgv->saveSnapshot(); Gui::gui->sgv->saveSnapshot();
else else
@ -98,7 +84,7 @@ public:
Gui::gui->sgv->setLoadSnapshot(this->p_submenus[1].sel == 0); Gui::gui->sgv->setLoadSnapshot(this->p_submenus[1].sel == 0);
} }
break; break;
case 6: /* Keyboard */ case 4: /* Keyboard */
switch(this->p_submenus[2].sel) switch(this->p_submenus[2].sel)
{ {
case 0: case 0:
@ -113,16 +99,16 @@ public:
panic("Illegal selection\n"); panic("Illegal selection\n");
} }
break; break;
case 9: /* Game info */ case 7: /* Game info */
Gui::gui->pushView(Gui::gui->giv); Gui::gui->pushView(Gui::gui->giv);
break; break;
case 10: /* Networking */ case 8: /* Networking */
Gui::gui->pushView(Gui::gui->nv); Gui::gui->pushView(Gui::gui->nv);
break; break;
case 11: /* Options */ case 9: /* Options */
Gui::gui->pushView(Gui::gui->ov); Gui::gui->pushView(Gui::gui->ov);
break; break;
case 12: /* Exit */ case 11: /* Exit */
DialogueBox *exit_dialogue = new DialogueBox(exit_dialogue_messages); DialogueBox *exit_dialogue = new DialogueBox(exit_dialogue_messages);
exit_dialogue->registerListener(new ExitListener()); exit_dialogue->registerListener(new ExitListener());
Gui::gui->pushDialogueBox(exit_dialogue); Gui::gui->pushDialogueBox(exit_dialogue);
@ -141,14 +127,6 @@ public:
} }
private: private:
void updatePauseState()
{
if (TheC64->IsPaused())
main_menu_messages[0] = "Resume";
else
main_menu_messages[0] = "Pause";
this->setText(main_menu_messages);
}
HelpBox *help; HelpBox *help;
}; };

View File

@ -128,31 +128,22 @@ const char *frodo_help[11] = {
const char *main_menu_messages[14] = { const char *main_menu_messages[14] = {
/*00*/ NULL, /* Setup dynamically */ /*00*/ "File",
/*01*/ " ", /*01*/ "^|Start|Insert",
/*02*/ "File", /*02*/ "States",
/*03*/ "^|Start|Insert", /*03*/ "^|Load|Save|Delete",
/*04*/ "States", /*04*/ "Keyboard",
/*05*/ "^|Load|Save|Delete", /*05*/ "^|Type|Bind",
/*06*/ "Keyboard", /*06*/ " ",
/*07*/ "^|Type|Bind", /*07*/ "Game info",
/*08*/ " ", /*08*/ "Networking",
/*09*/ "Game info", /*09*/ "Options",
/*10*/ "Networking", /*10*/ " ",
/*11*/ "Options", /*11*/ "Quit",
/*12*/ "Quit",
NULL NULL
}; };
const char **main_menu_help[14] = { const char **main_menu_help[14] = {
(const char*[]){
"Pause or resume the C64",
"emulation. Not available",
"when running in networked",
"mode.",
NULL,
},
NULL,
(const char*[]){ (const char*[]){
"Insert a disc/tape or", "Insert a disc/tape or",
"start it", "start it",
@ -189,6 +180,7 @@ const char **main_menu_help[14] = {
"Configure Frodo", "Configure Frodo",
NULL, NULL,
}, },
NULL,
(const char*[]){ (const char*[]){
"Quit Frodo", "Quit Frodo",
NULL, NULL,