Better UX for handling vertical scroll mapping
Show an error instead of preventing an invalid state
This commit is contained in:
parent
946073845c
commit
8dcf5404fc
|
@ -18,14 +18,15 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <dialog_shim.h>
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/panel_mouse_settings.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <wx/defs.h>
|
||||
|
||||
|
||||
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent ) :
|
||||
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
|
||||
PANEL_MOUSE_SETTINGS_BASE( aParent ),
|
||||
m_dialog( aDialog ),
|
||||
m_currentScrollMod( {} )
|
||||
|
@ -46,6 +47,9 @@ PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aPar
|
|||
m_lblCtrl->SetLabel( _( "Cmd" ) );
|
||||
#endif
|
||||
|
||||
m_scrollWarning->SetBitmap( KiBitmap( small_warning_xpm ) );
|
||||
m_scrollWarning->Hide();
|
||||
|
||||
m_checkAutoZoomSpeed->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED,
|
||||
[&]( wxCommandEvent& aEvt )
|
||||
{
|
||||
|
@ -76,7 +80,11 @@ bool PANEL_MOUSE_SETTINGS::TransferDataFromWindow()
|
|||
m_currentScrollMod = getScrollModSet();
|
||||
|
||||
if( !isScrollModSetValid( m_currentScrollMod ) )
|
||||
{
|
||||
m_dialog->SetError( _( "Only one action can be assigned to each vertical scroll setting" ),
|
||||
this, nullptr );
|
||||
return false;
|
||||
}
|
||||
|
||||
switch( m_choiceLeftButtonDrag->GetSelection() )
|
||||
{
|
||||
|
@ -183,10 +191,9 @@ void PANEL_MOUSE_SETTINGS::OnScrollRadioButton( wxCommandEvent& event )
|
|||
|
||||
SCROLL_MOD_SET newSet = getScrollModSet();
|
||||
|
||||
if( isScrollModSetValid( newSet ) )
|
||||
m_scrollWarning->Show( !isScrollModSetValid( newSet ) );
|
||||
|
||||
m_currentScrollMod = newSet;
|
||||
else
|
||||
updateScrollModButtons();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -144,9 +144,20 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
wxStaticBoxSizer* sbSizer3;
|
||||
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scroll Gestures") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText21 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Vertical touchpad or scroll wheel movement:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText21->Wrap( -1 );
|
||||
sbSizer3->Add( m_staticText21, 0, wxRIGHT|wxLEFT, 5 );
|
||||
bSizer4->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_scrollWarning = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_scrollWarning->SetToolTip( _("Only one action can be assigned to each column") );
|
||||
|
||||
bSizer4->Add( m_scrollWarning, 0, wxALL, 5 );
|
||||
|
||||
|
||||
sbSizer3->Add( bSizer4, 1, wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 5, 5, 0 );
|
||||
|
|
|
@ -1094,7 +1094,16 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer4</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1153,6 +1162,66 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_scrollWarning</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Only one action can be assigned to each column</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">24</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <wx/gbsizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
|
@ -53,6 +57,7 @@ class PANEL_MOUSE_SETTINGS_BASE : public RESETTABLE_PANEL
|
|||
wxStaticText* m_staticText31;
|
||||
wxChoice* m_choiceRightButtonDrag;
|
||||
wxStaticText* m_staticText21;
|
||||
wxStaticBitmap* m_scrollWarning;
|
||||
wxStaticText* m_staticText19;
|
||||
wxStaticText* m_staticText17;
|
||||
wxStaticText* m_lblCtrl;
|
||||
|
|
|
@ -233,10 +233,12 @@ bool PAGED_DIALOG::TransferDataToWindow()
|
|||
|
||||
bool PAGED_DIALOG::TransferDataFromWindow()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
// Call TransferDataFromWindow() only once:
|
||||
// this is enough on wxWidgets 3.1
|
||||
if( !DIALOG_SHIM::TransferDataFromWindow() )
|
||||
return false;
|
||||
ret = false;
|
||||
|
||||
// On wxWidgets 3.0, TransferDataFromWindow() is not called recursively
|
||||
// so we have to call it for each page
|
||||
|
@ -246,11 +248,17 @@ bool PAGED_DIALOG::TransferDataFromWindow()
|
|||
wxWindow* page = m_treebook->GetPage( i );
|
||||
|
||||
if( !page->TransferDataFromWindow() )
|
||||
return false;
|
||||
{
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
if( !ret && !m_errorMessage.IsEmpty() )
|
||||
m_infoBar->ShowMessage( m_errorMessage, wxICON_WARNING );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
class COMMON_SETTINGS;
|
||||
class DIALOG_SHIM;
|
||||
class PAGED_DIALOG;
|
||||
|
||||
|
||||
struct SCROLL_MOD_SET
|
||||
|
@ -39,7 +39,7 @@ struct SCROLL_MOD_SET
|
|||
class PANEL_MOUSE_SETTINGS : public PANEL_MOUSE_SETTINGS_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_MOUSE_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent );
|
||||
PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent );
|
||||
|
||||
~PANEL_MOUSE_SETTINGS();
|
||||
|
||||
|
@ -52,7 +52,7 @@ protected:
|
|||
|
||||
void OnScrollRadioButton( wxCommandEvent& event ) override;
|
||||
|
||||
DIALOG_SHIM* m_dialog;
|
||||
PAGED_DIALOG* m_dialog;
|
||||
|
||||
private:
|
||||
void applySettingsToPanel( const COMMON_SETTINGS& aSettings );
|
||||
|
|
Loading…
Reference in New Issue