diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index f052661c7c..73f8804d8e 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -360,6 +360,7 @@ bool StickyChoice::Touch(const TouchInput &touch) { SetFocusedView(this); ClickInternal(); dragging_ = false; + down_ = true; return true; } dragging_ = false; diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index a2ee50b74a..6bb01c99ab 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -289,7 +289,7 @@ void CwCheatScreen::ImportAndReport(const Path &cheatFile) { auto cw = GetI18NCategory(I18NCat::CWCHEATS); // Show an error message? errorLevel_ = NoticeLevel::INFO; - errorMessage_ = cw->T("No cheats found for this game"); + errorMessage_ = cw->T("No new cheats found for this game"); errorDetails_.clear(); } else { auto cw = GetI18NCategory(I18NCat::CWCHEATS); diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index c28982ec35..cfadb621f9 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -580,17 +580,19 @@ DragDropButton *ControlLayoutView::getPickedControl(const int x, const int y) { } void TouchControlLayoutScreen::resized() { + UIBaseDialogScreen::resized(); RecreateViews(); } void TouchControlLayoutScreen::onFinish(DialogResult reason) { + UIBaseDialogScreen::onFinish(reason); g_Config.Save("TouchControlLayoutScreen::onFinish"); } void TouchControlLayoutScreen::OnReset(UI::EventParams &e) { INFO_LOG(Log::G3D, "Resetting touch control layout to default."); - const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); + const Bounds &bounds = GetLayoutBounds(*screenManager()->getUIContext()); const DeviceOrientation orientation = GetDeviceOrientation(); TouchControlConfig &touch = g_Config.GetTouchControlsConfig(orientation); touch.ResetLayout(); @@ -599,16 +601,10 @@ void TouchControlLayoutScreen::OnReset(UI::EventParams &e) { }; void TouchControlLayoutScreen::dialogFinished(const Screen *dialog, DialogResult result) { + UIBaseDialogScreen::dialogFinished(dialog, result); RecreateViews(); } -void TouchControlLayoutScreen::OnMode(UI::EventParams &e) { - int mode = mode_->GetSelection(); - if (layoutView_) { - layoutView_->mode_ = mode; - } -} - void TouchControlLayoutScreen::update() { UIBaseDialogScreen::update(); @@ -621,21 +617,13 @@ void TouchControlLayoutScreen::update() { if (!layoutView_->HasCreatedViews()) { layoutView_->CreateViews(); } - - Bounds bounds = layoutView_->GetBounds(); - // Convert virtual pixels to real pixels. - bounds.x /= g_display.dpi_scale_x; - bounds.y /= g_display.dpi_scale_y; - bounds.w /= g_display.dpi_scale_x; - bounds.h /= g_display.dpi_scale_y; - SetOverrideScreenFrame(&bounds); } void TouchControlLayoutScreen::CreateViews() { using namespace UI; // setup g_Config for button layout - const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); + const Bounds &bounds = GetLayoutBounds(*screenManager()->getUIContext()); const DeviceOrientation orientation = GetDeviceOrientation(); InitPadLayout(&g_Config.GetTouchControlsConfig(orientation), orientation, bounds.w, bounds.h); @@ -659,7 +647,12 @@ void TouchControlLayoutScreen::CreateViews() { mode_->AddChoice(di->T("Move"), ImageID("I_MOVE")); mode_->AddChoice(di->T("Resize"), ImageID("I_RESIZE")); mode_->SetSelection(0, false); - mode_->OnChoice.Handle(this, &TouchControlLayoutScreen::OnMode); + mode_->OnChoice.Add([this](UI::EventParams &e) { + int mode = mode_->GetSelection(); + if (layoutView_) { + layoutView_->mode_ = mode; + } + }); CheckBox *snap = new CheckBox(&g_Config.bTouchSnapToGrid, di->T("Snap")); PopupSliderChoice *gridSize = new PopupSliderChoice(&g_Config.iTouchSnapGridSize, 2, 256, 64, di->T("Grid"), screenManager(), ""); @@ -675,6 +668,7 @@ void TouchControlLayoutScreen::CreateViews() { leftColumn->Add(new Spacer(12.0f)); leftColumn->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK")))->OnClick.Handle(this, &UIScreen::OnBack); leftColumn->Add(new Spacer(0.0f)); + leftColumnScroll->SetShadows(false); LinearLayout* rightColumn = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f, Margins(0.0f, 12.0f, 12.0f, 12.0f)))); rightColumn->Add(new TextView(co->T(DeviceOrientationToString(orientation))))->SetTextSize(TextSize::Small); diff --git a/UI/TouchControlLayoutScreen.h b/UI/TouchControlLayoutScreen.h index 9f298f171c..5287387737 100644 --- a/UI/TouchControlLayoutScreen.h +++ b/UI/TouchControlLayoutScreen.h @@ -37,6 +37,7 @@ public: const char *tag() const override { return "TouchControlLayout"; } protected: + ViewLayoutMode LayoutMode() const override { return ViewLayoutMode::ApplyInsets; } void OnReset(UI::EventParams &e); void OnMode(UI::EventParams &e);