diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 03ed644c79..90bc5560a1 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -83,21 +83,19 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent ) : m_canvasScaleCtrl->SetIncrement( dpi_scaling_increment ); m_canvasScaleCtrl->SetValue( DPI_SCALING::GetDefaultScaleFactor() ); - m_canvasScaleCtrl->SetToolTip( - _( "Set the scale for the canvas." - "\n\n" - "On high-DPI displays on some platforms, KiCad cannot determine the " - "scaling factor. In this case you may need to set this to a value to " - "match your system's DPI scaling. 2.0 is a common value. " - "\n\n" - "If this does not match the system DPI scaling, the canvas will " - "not match the window size and cursor position." ) ); + m_canvasScaleCtrl->SetToolTip( _( "Set the scale for the canvas." + "\n\n" + "On high-DPI displays on some platforms, KiCad cannot determine the " + "scaling factor. In this case you may need to set this to a value to " + "match your system's DPI scaling. 2.0 is a common value. " + "\n\n" + "If this does not match the system DPI scaling, the canvas will " + "not match the window size and cursor position." ) ); - m_canvasScaleAuto->SetToolTip( - _( "Use an automatic value for the canvas scale." - "\n\n" - "On some platforms, the automatic value is incorrect and should be " - "set manually." ) ); + m_canvasScaleAuto->SetToolTip( _( "Use an automatic value for the canvas scale." + "\n\n" + "On some platforms, the automatic value is incorrect and should be " + "set manually." ) ); } else { @@ -107,8 +105,9 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent ) : m_canvasScaleAuto->Show( false ); } - m_zoomCorrectionCtrl = new ZOOM_CORRECTION_CTRL( - this, Pgm().GetCommonSettings()->m_Appearance.zoom_correction_factor, ADVANCED_CFG::GetCfg().m_ScreenDPI ); + m_zoomCorrectionCtrl = new ZOOM_CORRECTION_CTRL( this, + Pgm().GetCommonSettings()->m_Appearance.zoom_correction_factor, + ADVANCED_CFG::GetCfg().m_ScreenDPI ); m_scalingSizer->Add( m_zoomCorrectionCtrl, 1, wxEXPAND ); diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 0786293799..3bc2c6bd2a 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -303,15 +303,15 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_staticText251 = new wxStaticText( this, wxID_ANY, _("Scaling"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText251->Wrap( -1 ); - rightSizer->Add( m_staticText251, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 15 ); + rightSizer->Add( m_staticText251, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 13 ); m_staticline7 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - rightSizer->Add( m_staticline7, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + rightSizer->Add( m_staticline7, 0, wxEXPAND|wxTOP, 2 ); m_scalingSizer = new wxBoxSizer( wxVERTICAL ); - rightSizer->Add( m_scalingSizer, 1, wxEXPAND|wxTOP|wxLEFT, 5 ); + rightSizer->Add( m_scalingSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); rightSizer->Add( 0, 15, 0, wxEXPAND, 5 ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index 7e9d9b07af..d1b9b357ea 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -2963,7 +2963,7 @@ wxVERTICAL none - 15 + 13 wxLEFT|wxRIGHT|wxTOP|wxEXPAND 0 @@ -3025,8 +3025,8 @@ - 5 - wxEXPAND|wxTOP|wxBOTTOM + 2 + wxEXPAND|wxTOP 0 1 @@ -3084,8 +3084,8 @@ - 5 - wxEXPAND|wxTOP|wxLEFT + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 diff --git a/common/widgets/zoom_correction_ctrl.cpp b/common/widgets/zoom_correction_ctrl.cpp index 782399b0f2..814d75e653 100644 --- a/common/widgets/zoom_correction_ctrl.cpp +++ b/common/widgets/zoom_correction_ctrl.cpp @@ -125,6 +125,7 @@ private: } }; + ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, double aBaseValue ) : wxPanel( aParent, wxID_ANY ), m_baseValue( aBaseValue ), @@ -135,7 +136,7 @@ ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, d // Top section: Label, spinner, auto button wxBoxSizer* controlsSizer = new wxBoxSizer( wxHORIZONTAL ); - m_label = new wxStaticText( this, wxID_ANY, _( "Display PPI: " ), wxDefaultPosition, wxDefaultSize ); + m_label = new wxStaticText( this, wxID_ANY, _( "Display PPI: " ) ); controlsSizer->Add( m_label, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, KIUI::GetStdMargin() ); m_spinner = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, @@ -143,7 +144,7 @@ ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, d controlsSizer->Add( m_spinner, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, KIUI::GetStdMargin() ); m_autoButton = new wxButton( this, wxID_ANY, _( "Detect" ) ); - controlsSizer->Add( m_autoButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, KIUI::GetStdMargin() ); + controlsSizer->Add( m_autoButton, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, KIUI::GetStdMargin() ); topSizer->Add( controlsSizer, 0, wxEXPAND, KIUI::GetStdMargin() ); @@ -151,7 +152,7 @@ ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, d wxBoxSizer* rulerSizer = new wxBoxSizer( wxHORIZONTAL ); m_ruler = new ZOOM_CORRECTION_RULER( this ); - rulerSizer->Add( m_ruler, 1, wxEXPAND | wxRIGHT, KIUI::GetStdMargin() ); + rulerSizer->Add( m_ruler, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, KIUI::GetStdMargin() ); wxArrayString choices; choices.Add( wxT( "mm" ) ); @@ -159,7 +160,7 @@ ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, d choices.Add( wxT( "in" ) ); m_unitsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices ); m_unitsChoice->SetSelection( 0 ); // Default to MM - rulerSizer->Add( m_unitsChoice, 0, wxALIGN_CENTER_VERTICAL ); + rulerSizer->Add( m_unitsChoice, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP, KIUI::GetStdMargin() ); topSizer->Add( rulerSizer, 0, wxEXPAND | wxTOP, KIUI::GetStdMargin() ); @@ -173,17 +174,20 @@ ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue, d m_ruler->Refresh(); } + void ZOOM_CORRECTION_CTRL::SetDisplayedValue( double aValue ) { m_spinner->SetValue( (int)( aValue * m_baseValue ) ); m_ruler->Refresh(); } + double ZOOM_CORRECTION_CTRL::GetValue() const { return (double) m_spinner->GetValue() / m_baseValue; } + int ZOOM_CORRECTION_CTRL::GetUnitsSelection() const { return m_unitsChoice->GetSelection(); @@ -197,23 +201,27 @@ bool ZOOM_CORRECTION_CTRL::TransferDataToWindow() return true; } + bool ZOOM_CORRECTION_CTRL::TransferDataFromWindow() { *m_value = GetValue(); return true; } + void ZOOM_CORRECTION_CTRL::spinnerChanged( wxSpinEvent& ) { *m_value = m_spinner->GetValue() / m_baseValue; m_ruler->Refresh(); } + void ZOOM_CORRECTION_CTRL::unitsChanged( wxCommandEvent& ) { m_ruler->Refresh(); } + void ZOOM_CORRECTION_CTRL::autoPressed( wxCommandEvent& aEvent ) { wxDisplay dpy( this );