More uniform spacing on scaling section of Preferences.

This commit is contained in:
Jeff Young
2026-02-01 20:55:20 +00:00
parent 56e933a68e
commit 4b9ff92391
4 changed files with 35 additions and 28 deletions
+15 -16
View File
@@ -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 );
@@ -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 );
@@ -2963,7 +2963,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">15</property>
<property name="border">13</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="true">
@@ -3025,8 +3025,8 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="border">2</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="true">
<property name="BottomDockable">1</property>
@@ -3084,8 +3084,8 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
+12 -4
View File
@@ -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 );