From d03e82602ee91cce93b6cbafcf991e47954c4f7d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 22 Nov 2018 17:11:49 +0100 Subject: [PATCH] PANEL_COMMON_SETTINGS: minor fixes, mainly cosmetic. --- common/dialogs/panel_common_settings.cpp | 9 +++++ common/dialogs/panel_common_settings.h | 1 + common/dialogs/panel_common_settings_base.cpp | 38 ++++++++++--------- common/dialogs/panel_common_settings_base.fbp | 22 +++++------ common/dialogs/panel_common_settings_base.h | 5 ++- pcbnew/dialogs/panel_pcbnew_settings_base.cpp | 4 +- pcbnew/dialogs/panel_pcbnew_settings_base.fbp | 4 +- 7 files changed, 48 insertions(+), 35 deletions(-) diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 8b2deeaa37..07695c103b 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -180,3 +180,12 @@ void PANEL_COMMON_SETTINGS::OnPDFViewerClick( wxCommandEvent& event ) m_otherPDFViewer->SetValue( true ); m_PDFViewerPath->SetValue( dlg.GetPath() ); } + + +void PANEL_COMMON_SETTINGS::onUpdateUIPdfPath( wxUpdateUIEvent& event ) +{ + bool enabled = m_otherPDFViewer->GetValue(); + m_PDFViewerPath->Enable( enabled ); + m_pdfViewerBtn->Enable( enabled ); +} + diff --git a/common/dialogs/panel_common_settings.h b/common/dialogs/panel_common_settings.h index a2b13ecaa4..40dbd37f95 100644 --- a/common/dialogs/panel_common_settings.h +++ b/common/dialogs/panel_common_settings.h @@ -43,6 +43,7 @@ protected: void OnScaleAuto( wxCommandEvent& aEvent ) override; void OnTextEditorClick( wxCommandEvent& event ) override; void OnPDFViewerClick( wxCommandEvent& event ) override; + void onUpdateUIPdfPath( wxUpdateUIEvent& event ) override; DIALOG_SHIM* m_dialog; diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 01c07492a0..acc08c4528 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -84,7 +84,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind gridHelperApps->Add( textEditorLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textEditorPath->Enable( false ); m_textEditorPath->SetMinSize( wxSize( 360,-1 ) ); gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); @@ -101,7 +100,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind gridHelperApps->Add( m_otherPDFViewer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_PDFViewerPath->Enable( false ); m_PDFViewerPath->SetMinSize( wxSize( 360,-1 ) ); gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); @@ -119,8 +117,8 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 ); - wxStaticBoxSizer* sbSizer5; - sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL ); + wxStaticBoxSizer* sbSizerIconsOpts; + sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL ); wxFlexGridSizer* fgSizer11; fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 ); @@ -128,39 +126,39 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind fgSizer11->SetFlexibleDirection( wxBOTH ); fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticText1 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - fgSizer11->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 4 ); + m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTexticonscale->Wrap( -1 ); + fgSizer11->Add( m_staticTexticonscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 4 ); wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxHORIZONTAL ); - m_scaleSlider = new STEPPED_SLIDER( sbSizer5->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); + m_scaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); m_scaleSlider->SetMinSize( wxSize( 240,-1 ) ); bSizer4->Add( m_scaleSlider, 1, wxBOTTOM|wxEXPAND, 4 ); - m_staticText2 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText2->Wrap( -1 ); - bSizer4->Add( m_staticText2, 0, wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 ); + m_staticTextPerCent = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPerCent->Wrap( -1 ); + bSizer4->Add( m_staticTextPerCent, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 ); fgSizer11->Add( bSizer4, 1, wxEXPAND, 5 ); - m_scaleAuto = new wxCheckBox( sbSizer5->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 ); + m_scaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer11->Add( m_scaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 25 ); fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 ); - sbSizer5->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); + sbSizerIconsOpts->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); - m_checkBoxIconsInMenus = new wxCheckBox( sbSizer5->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer5->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 ); + m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerIconsOpts->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 ); - bLeftSizer->Add( sbSizer5, 0, wxEXPAND|wxALL, 5 ); + bLeftSizer->Add( sbSizerIconsOpts, 0, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbSizer51; sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); @@ -168,7 +166,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_ZoomCenterOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_ZoomCenterOpt->SetToolTip( _("Center the cursor on screen when zooming.") ); - sbSizer51->Add( m_ZoomCenterOpt, 0, wxRIGHT|wxLEFT, 4 ); + sbSizer51->Add( m_ZoomCenterOpt, 0, wxTOP|wxRIGHT|wxLEFT, 4 ); m_MousewheelPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); m_MousewheelPANOpt->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") ); @@ -181,7 +179,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); - bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 ); bPanelSizer->Add( bLeftSizer, 0, 0, 5 ); @@ -193,7 +191,9 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind // Connect Events m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); + m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_pdfViewerBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this ); + m_pdfViewerBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_scaleSlider->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); @@ -210,7 +210,9 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE() { // Disconnect Events m_textEditorBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); + m_PDFViewerPath->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_pdfViewerBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this ); + m_pdfViewerBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index a07c0f6ae5..a42cf5d32f 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -955,7 +955,7 @@ Dock 0 Left - 0 + 1 1 @@ -1358,7 +1358,7 @@ Dock 0 Left - 0 + 1 1 @@ -1428,7 +1428,7 @@ - + onUpdateUIPdfPath @@ -1534,7 +1534,7 @@ - + onUpdateUIPdfPath @@ -1549,7 +1549,7 @@ wxID_ANY User Interface - sbSizer5 + sbSizerIconsOpts wxVERTICAL 1 none @@ -1572,7 +1572,7 @@ 0 4 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL 0 1 @@ -1611,7 +1611,7 @@ 0 1 - m_staticText1 + m_staticTexticonscale 1 @@ -1788,7 +1788,7 @@ 2 - wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -1827,7 +1827,7 @@ 0 1 - m_staticText2 + m_staticTextPerCent 1 @@ -2085,7 +2085,7 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 wxID_ANY @@ -2098,7 +2098,7 @@ 4 - wxRIGHT|wxLEFT + wxTOP|wxRIGHT|wxLEFT 0 1 diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index 718f875f4b..bb4cf912e3 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -60,9 +60,9 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel wxRadioButton* m_otherPDFViewer; wxTextCtrl* m_PDFViewerPath; wxBitmapButton* m_pdfViewerBtn; - wxStaticText* m_staticText1; + wxStaticText* m_staticTexticonscale; STEPPED_SLIDER* m_scaleSlider; - wxStaticText* m_staticText2; + wxStaticText* m_staticTextPerCent; wxCheckBox* m_scaleAuto; wxCheckBox* m_checkBoxIconsInMenus; wxCheckBox* m_ZoomCenterOpt; @@ -71,6 +71,7 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel // Virtual event handlers, overide them in your derived class virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); } + virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); } virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/panel_pcbnew_settings_base.cpp b/pcbnew/dialogs/panel_pcbnew_settings_base.cpp index 09545f43d9..4506dee89c 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings_base.cpp +++ b/pcbnew/dialogs/panel_pcbnew_settings_base.cpp @@ -41,7 +41,7 @@ PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWind m_Show_Page_Limits = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 ); m_Show_Page_Limits->SetValue(true); - bOptionsSizer->Add( m_Show_Page_Limits, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + bOptionsSizer->Add( m_Show_Page_Limits, 0, wxALL, 5 ); m_Segments_45_Only_Ctrl = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); m_Segments_45_Only_Ctrl->SetToolTip( _("Force line segment directions to H, V or 45 degrees when drawing on technical layers.") ); @@ -108,7 +108,7 @@ PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWind m_DrcOn->SetValue(true); m_DrcOn->SetToolTip( _("Enable DRC control. When DRC control is disabled, all connections are allowed.") ); - bLegacyOptionsSizer->Add( m_DrcOn, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLegacyOptionsSizer->Add( m_DrcOn, 0, wxEXPAND|wxALL, 5 ); m_TrackAutodel = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_TRACK_AUTODEL, _("Auto-delete old tracks"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackAutodel->SetValue(true); diff --git a/pcbnew/dialogs/panel_pcbnew_settings_base.fbp b/pcbnew/dialogs/panel_pcbnew_settings_base.fbp index c64aa210c3..e191a22014 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings_base.fbp +++ b/pcbnew/dialogs/panel_pcbnew_settings_base.fbp @@ -318,7 +318,7 @@ 5 - wxBOTTOM|wxLEFT|wxRIGHT + wxALL 0 1 @@ -1125,7 +1125,7 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 1