diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index 563dcc8413..b1f8a9a5fb 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -71,10 +71,10 @@ void CwCheatScreen::CreateViews() { LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(400, FILL_PARENT)); leftColumn->Add(new ItemHeader(k->T("Options"))); - leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &CwCheatScreen::OnBack); - //leftColumn->Add(new Choice(k->T("Add Cheat")))->OnClick.Handle(this, &CwCheatScreen::OnAddCheat); - leftColumn->Add(new Choice(k->T("Import Cheats")))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat); - leftColumn->Add(new Choice(k->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll); + leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); + //leftColumn->Add(new Choice(k->T("Add Cheat")))->OnClick.Handle(this, &CwCheatScreen::OnAddCheat); + leftColumn->Add(new Choice(k->T("Import Cheats")))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat); + leftColumn->Add(new Choice(k->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll); ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f)); rightScroll->SetScrollToTop(false); @@ -91,8 +91,7 @@ void CwCheatScreen::CreateViews() { } } -UI::EventReturn CwCheatScreen::OnBack(UI::EventParams ¶ms) { - screenManager()->finishDialog(this, DR_OK); +void CwCheatScreen::onFinish(DialogResult result) { os.open(activeCheatFile.c_str()); for (int j = 0; j < (int)cheatList.size(); j++) { os << cheatList[j]; @@ -105,7 +104,6 @@ UI::EventReturn CwCheatScreen::OnBack(UI::EventParams ¶ms) { if (MIPSComp::jit) { MIPSComp::jit->ClearCache(); } - return UI::EVENT_DONE; } UI::EventReturn CwCheatScreen::OnEnableAll(UI::EventParams ¶ms) { diff --git a/UI/CwCheatScreen.h b/UI/CwCheatScreen.h index 69829b950d..783bbf7549 100644 --- a/UI/CwCheatScreen.h +++ b/UI/CwCheatScreen.h @@ -41,6 +41,7 @@ public: UI::EventReturn OnImportCheat(UI::EventParams ¶ms); UI::EventReturn OnEnableAll(UI::EventParams ¶ms); + virtual void onFinish(DialogResult result); protected: virtual void CreateViews(); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index bf4366fc5f..eb77207076 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -132,9 +132,8 @@ EmuScreen::~EmuScreen() { } void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { - // TODO: improve the way with which we got commands from PauseMenu. - // DR_CANCEL means clicked on "continue", DR_OK means clicked on "back to menu", + // DR_CANCEL/DR_BACK means clicked on "continue", DR_OK means clicked on "back to menu", // DR_YES means a message sent to PauseMenu by NativeMessageReceived. if (result == DR_OK) { screenManager()->switchScreen(new MainScreen()); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a15e19caf0..2574f441ed 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -84,7 +84,7 @@ void GameSettingsScreen::CreateViews() { ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); - root_->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameSettingsScreen::OnBack); + root_->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &UIScreen::OnBack); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new AnchorLayoutParams(10, 0, 10, 0, false)); @@ -371,15 +371,7 @@ void GameSettingsScreen::sendMessage(const char *message, const char *value) { } } -UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) { - // If we're in-game, return to the game via DR_CANCEL. - if (PSP_IsInited()) { - screenManager()->finishDialog(this, DR_CANCEL); - host->UpdateScreen(); - } else { - screenManager()->finishDialog(this, DR_OK); - } - +void GameSettingsScreen::onFinish(DialogResult result) { if (g_Config.bEnableSound) { if (PSP_IsInited() && !IsAudioInitialised()) Audio_Init(); @@ -391,6 +383,16 @@ UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) { host->UpdateUI(); KeyMap::UpdateConfirmCancelKeys(); +} + +UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) { + // If we're in-game, return to the game via DR_CANCEL. + if (PSP_IsInited()) { + screenManager()->finishDialog(this, DR_CANCEL); + host->UpdateScreen(); + } else { + screenManager()->finishDialog(this, DR_OK); + } return UI::EVENT_DONE; } @@ -508,21 +510,16 @@ void DeveloperToolsScreen::CreateViews() { list->Add(new ItemHeader(de->T("Language"))); list->Add(new Choice(de->T("Load language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoadLanguageIni); list->Add(new Choice(de->T("Save language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSaveLanguageIni); - list->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack); + list->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); } -UI::EventReturn DeveloperToolsScreen::OnBack(UI::EventParams &e) { - screenManager()->finishDialog(this, DR_OK); - +void DeveloperToolsScreen::onFinish(DialogResult result) { g_Config.Save(); - - return UI::EVENT_DONE; } void GameSettingsScreen::CallbackRestoreDefaults(bool yes) { - if(yes) + if (yes) g_Config.RestoreDefaults(); - host->UpdateUI(); } diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 4adf49c050..e4981e297c 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -28,6 +28,7 @@ public: : gamePath_(gamePath), gameID_(gameID), iAlternateSpeedPercent_(3), enableReports_(false) {} virtual void update(InputState &input); + virtual void onFinish(DialogResult result); UI::Event OnLanguageChanged; UI::Event OnRecentChanged; @@ -91,6 +92,7 @@ private: class DeveloperToolsScreen : public UIDialogScreenWithBackground { public: DeveloperToolsScreen() {} + virtual void onFinish(DialogResult result); protected: virtual void CreateViews(); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index a69f93a119..7da60cbdad 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -704,14 +704,6 @@ void GamePauseScreen::update(InputState &input) { UIScreen::update(input); } -void GamePauseScreen::key(const KeyInput &key) { - if ((key.flags & KEY_DOWN) && UI::IsEscapeKeyCode(key.keyCode)) { - screenManager()->finishDialog(this, DR_CANCEL); - } else { - UIScreen::key(key); - } -} - void DrawBackground(float alpha); void GamePauseScreen::DrawBackground(UIContext &dc) { diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 6e28b3d175..96590a0e0d 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -56,7 +56,6 @@ class GamePauseScreen : public UIScreen { public: GamePauseScreen(const std::string &filename) : UIScreen(), gamePath_(filename), saveSlots_(NULL) {} ~GamePauseScreen(); - virtual void key(const KeyInput &key); protected: virtual void DrawBackground(UIContext &dc); @@ -81,4 +80,4 @@ private: UI::ChoiceStrip *saveSlots_; UI::Choice *saveStateButton_; UI::Choice *loadStateButton_; -}; \ No newline at end of file +}; diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 7707fc58a9..1a0d839986 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -225,9 +225,11 @@ void TouchControlLayoutScreen::touch(const TouchInput &touch) { } }; -UI::EventReturn TouchControlLayoutScreen::OnBack(UI::EventParams &e) { - g_Config.Save(); + +UI::EventReturn TouchControlLayoutScreen::OnBack(UI::EventParams &e) { + + // Hm, wtf? if (PSP_IsInited()) { screenManager()->finishDialog(this, DR_CANCEL); } else { @@ -237,6 +239,10 @@ UI::EventReturn TouchControlLayoutScreen::OnBack(UI::EventParams &e) { return UI::EVENT_DONE; }; +void TouchControlLayoutScreen::onFinish(DialogResult reason) { + g_Config.Save(); +} + UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { screenManager()->push(new TouchControlVisibilityScreen()); return UI::EVENT_DONE; diff --git a/UI/TouchControlLayoutScreen.h b/UI/TouchControlLayoutScreen.h index a35623635e..8db09235b7 100644 --- a/UI/TouchControlLayoutScreen.h +++ b/UI/TouchControlLayoutScreen.h @@ -24,13 +24,14 @@ class DragDropButton; -class TouchControlLayoutScreen : public UIDialogScreenWithBackground{ +class TouchControlLayoutScreen : public UIDialogScreenWithBackground { public: TouchControlLayoutScreen(); virtual void CreateViews(); virtual void touch(const TouchInput &touch); virtual void dialogFinished(const Screen *dialog, DialogResult result); + virtual void onFinish(DialogResult reason); protected: virtual UI::EventReturn OnBack(UI::EventParams &e); diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index f58e88c4c5..87f1ef098e 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -29,7 +29,7 @@ void TouchControlVisibilityScreen::CreateViews() { LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL); I18NCategory *di = GetI18NCategory("Dialog"); - topBar->Add(new Choice(di->T("Back")))->OnClick.Handle(this, &TouchControlVisibilityScreen::OnBack); + topBar->Add(new Choice(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); topBar->Add(new Choice(di->T("Toggle All")))->OnClick.Handle(this, &TouchControlVisibilityScreen::OnToggleAll); vert->Add(topBar); @@ -89,12 +89,8 @@ void TouchControlVisibilityScreen::CreateViews() { } } -UI::EventReturn TouchControlVisibilityScreen::OnBack(UI::EventParams &e) { - screenManager()->finishDialog(this, DR_OK); - +void TouchControlVisibilityScreen::onFinish(DialogResult result) { g_Config.Save(); - - return UI::EVENT_DONE; } UI::EventReturn TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) { diff --git a/UI/TouchControlVisibilityScreen.h b/UI/TouchControlVisibilityScreen.h index 005071dba5..cda68c0929 100644 --- a/UI/TouchControlVisibilityScreen.h +++ b/UI/TouchControlVisibilityScreen.h @@ -21,14 +21,14 @@ #include -class TouchControlVisibilityScreen : public UIScreenWithBackground { +class TouchControlVisibilityScreen : public UIDialogScreenWithBackground { public: TouchControlVisibilityScreen() { } virtual void CreateViews(); + virtual void onFinish(DialogResult result); protected: - virtual UI::EventReturn OnBack(UI::EventParams &e); virtual UI::EventReturn OnToggleAll(UI::EventParams &e); private: diff --git a/native b/native index 0c397c3e68..c53bf92350 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 0c397c3e68dfeac2be8adaf205f483bd6c828466 +Subproject commit c53bf9235088c922b4a99d546323d2af6fff2c27