UI cleanup and a crashfix for duplicate back key events

This commit is contained in:
Henrik Rydgård committed 2013-10-28 16:04:53 +01:00
1 parent 0471a8c886
commit 787db5812d
10 files changed
+14 -71

No files matched your search

+1 -12
View File
@@ -193,7 +193,7 @@ void ControlMappingScreen::CreateViews() {
leftColumn->Add(new Choice(k->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping);
leftColumn->Add(new Choice(k->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping);
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f)));
leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &ControlMappingScreen::OnBack);
leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
/*
ChoiceStrip *mode = leftColumn->Add(new ChoiceStrip(ORIENT_VERTICAL));
mode->AddChoice("Replace");
@@ -223,17 +223,6 @@ void ControlMappingScreen::sendMessage(const char *message, const char *value) {
}
}
UI::EventReturn ControlMappingScreen::OnBack(UI::EventParams &e) {
// If we're in-game, return to the game via DR_CANCEL.
if(PSP_IsInited()) {
screenManager()->finishDialog(this, DR_CANCEL);
} else {
screenManager()->finishDialog(this, DR_OK);
}
return UI::EVENT_DONE;
}
UI::EventReturn ControlMappingScreen::OnClearMapping(UI::EventParams &params) {
KeyMap::g_controllerMap.clear();
RecreateViews();
-1
View File
@@ -29,7 +29,6 @@ public:
protected:
virtual void CreateViews();
virtual void sendMessage(const char *message, const char *value);
virtual UI::EventReturn OnBack(UI::EventParams &e);
private:
UI::EventReturn OnDefaultMapping(UI::EventParams &params);
+2 -13
View File
@@ -58,7 +58,7 @@ void GameSettingsScreen::CreateViews() {
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60;
iAlternateSpeedPercent_ = 3;
for (int i = 0; i < 8; i++) {
if (g_Config.iFpsLimit <= alternateSpeedTable[i]) {
@@ -394,18 +394,6 @@ void GameSettingsScreen::onFinish(DialogResult result) {
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;
}
/*
void GlobalSettingsScreen::CreateViews() {
using namespace UI;
@@ -524,6 +512,7 @@ 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 ItemHeader(""));
list->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}
-2
View File
@@ -52,11 +52,9 @@ private:
UI::EventReturn OnControlMapping(UI::EventParams &e);
UI::EventReturn OnTouchControlLayout(UI::EventParams &e);
UI::EventReturn OnDumpNextFrameToLog(UI::EventParams &e);
UI::EventReturn OnBack(UI::EventParams &e);
UI::EventReturn OnReloadCheats(UI::EventParams &e);
UI::EventReturn OnToggleTouchControls(UI::EventParams &e);
UI::EventReturn OnTiltAnalogSettings(UI::EventParams &e);
// Global settings handlers
UI::EventReturn OnLanguage(UI::EventParams &e);
+3 -2
View File
@@ -778,9 +778,10 @@ void GamePauseScreen::CreateViews() {
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
root_->Add(rightColumn);
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
rightColumn->Add(rightColumnItems);
rightColumnItems->SetSpacing(0.0f);
rightColumnItems->Add(new Choice(i->T("Continue")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
rightColumnItems->Add(new Choice(i->T("Game Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
if (g_Config.bEnableCheats) {
@@ -794,7 +795,7 @@ void GamePauseScreen::CreateViews() {
}
UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
screenManager()->push(new GameSettingsScreen(gamePath_));
screenManager()->push(new GameSettingsScreen(gamePath_));
return UI::EVENT_DONE;
}
+1 -1
View File
@@ -55,7 +55,7 @@ private:
class GamePauseScreen : public UIDialogScreen {
public:
GamePauseScreen(const std::string &filename) : UIDialogScreen(), gamePath_(filename), saveSlots_(NULL) {}
~GamePauseScreen();
virtual ~GamePauseScreen();
virtual void onFinish(DialogResult result);
+2 -18
View File
@@ -3,19 +3,16 @@
#include "Core/System.h"
#include "i18n/i18n.h"
TiltAnalogSettingsScreen::TiltAnalogSettingsScreen() : currentTiltX_(0), currentTiltY_(0) {};
void TiltAnalogSettingsScreen::CreateViews() {
using namespace UI;
I18NCategory *c = GetI18NCategory("Controls");
root_ = root_ = new ScrollView(ORIENT_VERTICAL);
root_ = new ScrollView(ORIENT_VERTICAL);
LinearLayout *settings = new LinearLayout(ORIENT_VERTICAL);
settings->SetSpacing(0);
settings->SetSpacing(0);
settings->Add(new ItemHeader(c->T("Invert Axes")));
settings->Add(new CheckBox(&g_Config.bInvertTiltX, c->T("Invert Tilt along X axis")));
settings->Add(new CheckBox(&g_Config.bInvertTiltY, c->T("Invert Tilt along Y axis")));
@@ -25,7 +22,6 @@ void TiltAnalogSettingsScreen::CreateViews() {
settings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivityX, 0, 100, c->T("Tilt Sensitivity along X axis"), screenManager()));
settings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivityY, 0, 100, c->T("Tilt Sensitivity along Y axis"), screenManager()));
settings->Add(new PopupSliderChoiceFloat(&g_Config.fDeadzoneRadius, 0.0, 1.0, c->T("Deadzone Radius"), screenManager()));
settings->Add(new ItemHeader(c->T("Calibration")));
InfoItem *calibrationInfo = new InfoItem("To calibrate, keep device on a flat surface and press calibrate.", "");
@@ -48,18 +44,6 @@ void TiltAnalogSettingsScreen::update(InputState &input) {
currentTiltY_ = input.acc.x;
};
UI::EventReturn TiltAnalogSettingsScreen::OnBack(UI::EventParams &e) {
if (PSP_IsInited()) {
screenManager()->finishDialog(this, DR_CANCEL);
} else {
screenManager()->finishDialog(this, DR_OK);
}
return UI::EVENT_DONE;
};
UI::EventReturn TiltAnalogSettingsScreen::OnCalibrate(UI::EventParams &e) {
g_Config.fTiltBaseX = currentTiltX_;
g_Config.fTiltBaseY = currentTiltY_;
+1 -3
View File
@@ -23,12 +23,10 @@
class TiltAnalogSettingsScreen : public UIDialogScreenWithBackground {
public:
TiltAnalogSettingsScreen();
TiltAnalogSettingsScreen() : currentTiltX_(0), currentTiltY_(0) {}
virtual void CreateViews();
virtual void update(InputState &input);
protected:
virtual UI::EventReturn OnBack(UI::EventParams &e);
private:
UI::EventReturn OnCalibrate(UI::EventParams &e);
float currentTiltX_, currentTiltY_;
+4 -18
View File
@@ -225,20 +225,6 @@ void TouchControlLayoutScreen::touch(const TouchInput &touch) {
}
};
UI::EventReturn TouchControlLayoutScreen::OnBack(UI::EventParams &e) {
// Hm, wtf?
if (PSP_IsInited()) {
screenManager()->finishDialog(this, DR_CANCEL);
} else {
screenManager()->finishDialog(this, DR_OK);
}
return UI::EVENT_DONE;
};
void TouchControlLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save();
}
@@ -291,7 +277,7 @@ void TouchControlLayoutScreen::CreateViews() {
Choice *back = new Choice(d->T("Back"), "", false, new AnchorLayoutParams(leftMargin, WRAP_CONTENT, 10, NONE, NONE, 10));
Choice *visibility = new Choice(c->T("Visibility"), "", false, new AnchorLayoutParams(leftMargin, WRAP_CONTENT, 10, NONE, NONE, 158));
reset->OnClick.Handle(this, &TouchControlLayoutScreen::OnReset);
back->OnClick.Handle(this, &TouchControlLayoutScreen::OnBack);
back->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
visibility->OnClick.Handle(this, &TouchControlLayoutScreen::OnVisibility);
root_->Add(visibility);
root_->Add(reset);
@@ -300,9 +286,9 @@ void TouchControlLayoutScreen::CreateViews() {
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftMargin, new AnchorLayoutParams(10, 0, 10, 0, false));
root_->Add(tabHolder);
//this is more for show than anything else. It's used to provide a boundary
//so that buttons like back can be placed within the boundary.
//serves no other purpose.
// this is more for show than anything else. It's used to provide a boundary
// so that buttons like back can be placed within the boundary.
// serves no other purpose.
AnchorLayout *controlsHolder = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
I18NCategory *ms = GetI18NCategory("MainSettings");
-1
View File
@@ -34,7 +34,6 @@ public:
virtual void onFinish(DialogResult reason);
protected:
virtual UI::EventReturn OnBack(UI::EventParams &e);
virtual UI::EventReturn OnReset(UI::EventParams &e);
virtual UI::EventReturn OnVisibility(UI::EventParams &e);