mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Add user-controlled scaling factor
Lets the user decide what 100% zoom is for their system based on a slider. This is inspired by Inkscape's custom scaling widget Fixes https://gitlab.com/kicad/code/kicad/-/issues/19256
This commit is contained in:
parent
843eea259d
commit
bfe805a221
@ -523,6 +523,7 @@ set( COMMON_WIDGET_SRCS
|
|||||||
widgets/wx_splitter_window.cpp
|
widgets/wx_splitter_window.cpp
|
||||||
widgets/wx_treebook.cpp
|
widgets/wx_treebook.cpp
|
||||||
widgets/webview_panel.cpp
|
widgets/webview_panel.cpp
|
||||||
|
widgets/zoom_correction_ctrl.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set( COMMON_DRAWING_SHEET_SRCS
|
set( COMMON_DRAWING_SHEET_SRCS
|
||||||
|
@ -105,6 +105,10 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent ) :
|
|||||||
m_canvasScaleAuto->Show( false );
|
m_canvasScaleAuto->Show( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_zoomCorrectionCtrl = new ZOOM_CORRECTION_CTRL( this,
|
||||||
|
Pgm().GetCommonSettings()->m_Appearance.zoom_correction_factor );
|
||||||
|
bLeftSizer->Add( m_zoomCorrectionCtrl, 1, wxEXPAND );
|
||||||
|
|
||||||
// Hide the option of icons in menus for platforms that do not support them
|
// Hide the option of icons in menus for platforms that do not support them
|
||||||
m_checkBoxIconsInMenus->Show( KIPLATFORM::UI::AllowIconsInMenus() );
|
m_checkBoxIconsInMenus->Show( KIPLATFORM::UI::AllowIconsInMenus() );
|
||||||
|
|
||||||
@ -198,6 +202,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
|
|||||||
|
|
||||||
commonSettings->m_Appearance.grid_striping = m_gridStriping->GetValue();
|
commonSettings->m_Appearance.grid_striping = m_gridStriping->GetValue();
|
||||||
|
|
||||||
|
commonSettings->m_Appearance.zoom_correction_factor = m_zoomCorrectionCtrl->GetValue();
|
||||||
|
|
||||||
double dimmingPercent = 80;
|
double dimmingPercent = 80;
|
||||||
m_highContrastCtrl->GetValue().ToDouble( &dimmingPercent );
|
m_highContrastCtrl->GetValue().ToDouble( &dimmingPercent );
|
||||||
commonSettings->m_Appearance.hicontrast_dimming_factor = dimmingPercent / 100.0f;
|
commonSettings->m_Appearance.hicontrast_dimming_factor = dimmingPercent / 100.0f;
|
||||||
@ -288,6 +294,8 @@ void PANEL_COMMON_SETTINGS::applySettingsToPanel( COMMON_SETTINGS& aSettings )
|
|||||||
|
|
||||||
m_gridStriping->SetValue( aSettings.m_Appearance.grid_striping );
|
m_gridStriping->SetValue( aSettings.m_Appearance.grid_striping );
|
||||||
|
|
||||||
|
m_zoomCorrectionCtrl->SetDisplayedValue( aSettings.m_Appearance.zoom_correction_factor );
|
||||||
|
|
||||||
double dimmingPercent = aSettings.m_Appearance.hicontrast_dimming_factor * 100.0f;
|
double dimmingPercent = aSettings.m_Appearance.hicontrast_dimming_factor * 100.0f;
|
||||||
m_highContrastCtrl->SetValue( wxString::Format( "%.0f", dimmingPercent ) );
|
m_highContrastCtrl->SetValue( wxString::Format( "%.0f", dimmingPercent ) );
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
@ -16,7 +16,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||||||
wxBoxSizer* bPanelSizer;
|
wxBoxSizer* bPanelSizer;
|
||||||
bPanelSizer = new wxBoxSizer( wxHORIZONTAL );
|
bPanelSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
wxBoxSizer* bLeftSizer;
|
|
||||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_staticText20 = new wxStaticText( this, wxID_ANY, _("Rendering Engine"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticText20 = new wxStaticText( this, wxID_ANY, _("Rendering Engine"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
@ -292,6 +291,16 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||||||
bLeftSizer->Add( bUserInterfaceSizer, 0, wxTOP|wxLEFT|wxEXPAND, 5 );
|
bLeftSizer->Add( bUserInterfaceSizer, 0, wxTOP|wxLEFT|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bLeftSizer->Add( 0, 0, 0, 0, 5 );
|
||||||
|
|
||||||
|
m_staticText251 = new wxStaticText( this, wxID_ANY, _("Scaling"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticText251->Wrap( -1 );
|
||||||
|
bLeftSizer->Add( m_staticText251, 0, wxLEFT|wxRIGHT|wxTOP, 15 );
|
||||||
|
|
||||||
|
m_staticline7 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
|
bLeftSizer->Add( m_staticline7, 0, wxEXPAND | wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
bPanelSizer->Add( bLeftSizer, 0, wxRIGHT, 35 );
|
bPanelSizer->Add( bLeftSizer, 0, wxRIGHT, 35 );
|
||||||
|
|
||||||
wxBoxSizer* rightSizer;
|
wxBoxSizer* rightSizer;
|
||||||
|
@ -68,12 +68,12 @@
|
|||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bLeftSizer</property>
|
<property name="name">bLeftSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">13</property>
|
<property name="border">13</property>
|
||||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
|
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="true">
|
<object class="wxStaticText" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -131,11 +131,11 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">2</property>
|
<property name="border">2</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticLine" expanded="true">
|
<object class="wxStaticLine" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -190,21 +190,21 @@
|
|||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag"></property>
|
<property name="flag"></property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="spacer" expanded="true">
|
<object class="spacer" expanded="false">
|
||||||
<property name="height">3</property>
|
<property name="height">3</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxFlexGridSizer" expanded="true">
|
<object class="wxFlexGridSizer" expanded="false">
|
||||||
<property name="cols">1</property>
|
<property name="cols">1</property>
|
||||||
<property name="flexible_direction">wxBOTH</property>
|
<property name="flexible_direction">wxBOTH</property>
|
||||||
<property name="growablecols"></property>
|
<property name="growablecols"></property>
|
||||||
@ -216,11 +216,11 @@
|
|||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="rows">0</property>
|
<property name="rows">0</property>
|
||||||
<property name="vgap">4</property>
|
<property name="vgap">4</property>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxLEFT</property>
|
<property name="flag">wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxRadioButton" expanded="true">
|
<object class="wxRadioButton" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -281,11 +281,11 @@
|
|||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxLEFT</property>
|
<property name="flag">wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxRadioButton" expanded="true">
|
<object class="wxRadioButton" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -348,21 +348,21 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag"></property>
|
<property name="flag"></property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="spacer" expanded="true">
|
<object class="spacer" expanded="false">
|
||||||
<property name="height">3</property>
|
<property name="height">3</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxLEFT</property>
|
<property name="flag">wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxGridBagSizer" expanded="true">
|
<object class="wxGridBagSizer" expanded="false">
|
||||||
<property name="empty_cell_size">-1,2</property>
|
<property name="empty_cell_size">-1,2</property>
|
||||||
<property name="flexible_direction">wxBOTH</property>
|
<property name="flexible_direction">wxBOTH</property>
|
||||||
<property name="growablecols">1</property>
|
<property name="growablecols">1</property>
|
||||||
@ -438,7 +438,7 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="gbsizeritem" expanded="true">
|
<object class="gbsizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="colspan">1</property>
|
<property name="colspan">1</property>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@ -508,32 +508,32 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="true">
|
<object class="wxBoxSizer" expanded="false">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bAntialiasingSizer</property>
|
<property name="name">bAntialiasingSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag"></property>
|
<property name="flag"></property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="spacer" expanded="true">
|
<object class="spacer" expanded="false">
|
||||||
<property name="height">15</property>
|
<property name="height">15</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">13</property>
|
<property name="border">13</property>
|
||||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="true">
|
<object class="wxStaticText" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -591,11 +591,11 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">2</property>
|
<property name="border">2</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticLine" expanded="true">
|
<object class="wxStaticLine" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -650,11 +650,11 @@
|
|||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="true">
|
<object class="wxBoxSizer" expanded="false">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bHelperAppsSizer</property>
|
<property name="name">bHelperAppsSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
@ -882,20 +882,20 @@
|
|||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxRIGHT|wxTOP</property>
|
<property name="flag">wxEXPAND|wxRIGHT|wxTOP</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="true">
|
<object class="wxBoxSizer" expanded="false">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bSizerFileManager</property>
|
<property name="name">bSizerFileManager</property>
|
||||||
<property name="orient">wxHORIZONTAL</property>
|
<property name="orient">wxHORIZONTAL</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="true">
|
<object class="wxStaticText" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -953,11 +953,11 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxTextCtrl" expanded="true">
|
<object class="wxTextCtrl" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -1020,17 +1020,17 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="spacer" expanded="true">
|
<object class="spacer" expanded="false">
|
||||||
<property name="height">12</property>
|
<property name="height">12</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">2</property>
|
<property name="border">2</property>
|
||||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
@ -1107,11 +1107,11 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT|wxEXPAND</property>
|
<property name="flag">wxBOTTOM|wxRIGHT|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="true">
|
<object class="wxBoxSizer" expanded="false">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bSizer7</property>
|
<property name="name">bSizer7</property>
|
||||||
<property name="orient">wxHORIZONTAL</property>
|
<property name="orient">wxHORIZONTAL</property>
|
||||||
@ -1326,21 +1326,21 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag"></property>
|
<property name="flag"></property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="spacer" expanded="true">
|
<object class="spacer" expanded="false">
|
||||||
<property name="height">15</property>
|
<property name="height">15</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">13</property>
|
<property name="border">13</property>
|
||||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="true">
|
<object class="wxStaticText" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -1398,11 +1398,11 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">2</property>
|
<property name="border">2</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticLine" expanded="true">
|
<object class="wxStaticLine" expanded="false">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
@ -1457,11 +1457,11 @@
|
|||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="true">
|
<object class="wxBoxSizer" expanded="false">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">bUserInterfaceSizer</property>
|
<property name="name">bUserInterfaceSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
@ -2465,11 +2465,11 @@
|
|||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="false">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxGridBagSizer" expanded="true">
|
<object class="wxGridBagSizer" expanded="false">
|
||||||
<property name="empty_cell_size">-1,-1</property>
|
<property name="empty_cell_size">-1,-1</property>
|
||||||
<property name="flexible_direction">wxVERTICAL</property>
|
<property name="flexible_direction">wxVERTICAL</property>
|
||||||
<property name="growablecols"></property>
|
<property name="growablecols"></property>
|
||||||
@ -2886,6 +2886,137 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="sizeritem" expanded="true">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag"></property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="spacer" expanded="true">
|
||||||
|
<property name="height">0</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="width">0</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="true">
|
||||||
|
<property name="border">15</property>
|
||||||
|
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticText" expanded="true">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer">0</property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position">0</property>
|
||||||
|
<property name="aui_row">0</property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></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="drag_accept_files">0</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="label">Scaling</property>
|
||||||
|
<property name="markup">0</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_staticText251</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="style"></property>
|
||||||
|
<property name="subclass">; ; forward_declare</property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<property name="wrap">-1</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="true">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND | wxALL</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticLine" expanded="true">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer">0</property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position">0</property>
|
||||||
|
<property name="aui_row">0</property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></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="drag_accept_files">0</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_staticline7</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="style">wxLI_HORIZONTAL</property>
|
||||||
|
<property name="subclass">; ; forward_declare</property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="true">
|
<object class="sizeritem" expanded="true">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
@ -44,6 +44,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
wxBoxSizer* bLeftSizer;
|
||||||
wxStaticText* m_staticText20;
|
wxStaticText* m_staticText20;
|
||||||
wxStaticLine* m_staticline3;
|
wxStaticLine* m_staticline3;
|
||||||
wxFlexGridSizer* m_renderingSizer;
|
wxFlexGridSizer* m_renderingSizer;
|
||||||
@ -85,6 +86,8 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
|
|||||||
wxStaticText* m_highContrastLabel;
|
wxStaticText* m_highContrastLabel;
|
||||||
wxTextCtrl* m_highContrastCtrl;
|
wxTextCtrl* m_highContrastCtrl;
|
||||||
wxStaticText* m_highContrastUnits;
|
wxStaticText* m_highContrastUnits;
|
||||||
|
wxStaticText* m_staticText251;
|
||||||
|
wxStaticLine* m_staticline7;
|
||||||
wxStaticText* m_staticText23;
|
wxStaticText* m_staticText23;
|
||||||
wxStaticLine* m_staticline6;
|
wxStaticLine* m_staticline6;
|
||||||
wxCheckBox* m_warpMouseOnMove;
|
wxCheckBox* m_warpMouseOnMove;
|
||||||
|
@ -106,6 +106,10 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
|||||||
m_params.emplace_back( new PARAM<bool>( "appearance.grid_striping",
|
m_params.emplace_back( new PARAM<bool>( "appearance.grid_striping",
|
||||||
&m_Appearance.grid_striping, false ) );
|
&m_Appearance.grid_striping, false ) );
|
||||||
|
|
||||||
|
m_Appearance.zoom_correction_factor = 1.0;
|
||||||
|
m_params.emplace_back( new PARAM<double>( "appearance.zoom_correction_factor",
|
||||||
|
&m_Appearance.zoom_correction_factor, 1.0, 0.1, 10.0 ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<bool>( "auto_backup.enabled", &m_Backup.enabled, true ) );
|
m_params.emplace_back( new PARAM<bool>( "auto_backup.enabled", &m_Backup.enabled, true ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<bool>( "auto_backup.backup_on_autosave",
|
m_params.emplace_back( new PARAM<bool>( "auto_backup.backup_on_autosave",
|
||||||
|
256
common/widgets/zoom_correction_ctrl.cpp
Normal file
256
common/widgets/zoom_correction_ctrl.cpp
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 3
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* Inspired by the Inkscape preferences widget, which is
|
||||||
|
* Authors:
|
||||||
|
* Marco Scholten
|
||||||
|
* Bruno Dilly <bruno.dilly@gmail.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004, 2006, 2007 Authors
|
||||||
|
*
|
||||||
|
* Released under GNU GPL v2+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <widgets/zoom_correction_ctrl.h>
|
||||||
|
#include <widgets/ui_common.h>
|
||||||
|
|
||||||
|
#include <wx/dcclient.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/spinctrl.h>
|
||||||
|
|
||||||
|
class ZOOM_CORRECTION_RULER : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ZOOM_CORRECTION_RULER( wxWindow* aParent ) :
|
||||||
|
wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxSize( 200, 40 ) )
|
||||||
|
{
|
||||||
|
Bind( wxEVT_PAINT, &ZOOM_CORRECTION_RULER::OnPaint, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnPaint( wxPaintEvent& )
|
||||||
|
{
|
||||||
|
wxPaintDC dc( this );
|
||||||
|
wxSize size = GetClientSize();
|
||||||
|
|
||||||
|
// Draw baseline
|
||||||
|
dc.DrawLine( 0, size.y - 1, size.x, size.y - 1 );
|
||||||
|
ZOOM_CORRECTION_CTRL* parent = static_cast<ZOOM_CORRECTION_CTRL*>( GetParent() );
|
||||||
|
|
||||||
|
if( !parent )
|
||||||
|
return;
|
||||||
|
|
||||||
|
double value = parent->GetValue();
|
||||||
|
ZOOM_CORRECTION_UNITS units = static_cast<ZOOM_CORRECTION_UNITS>( parent->GetUnitsSelection() );
|
||||||
|
|
||||||
|
double dpi = GetDPI().x;
|
||||||
|
double unitsPerInch = 25.4;
|
||||||
|
|
||||||
|
if( units == ZOOM_CORRECTION_UNITS::CM )
|
||||||
|
unitsPerInch = 2.54;
|
||||||
|
else if( units == ZOOM_CORRECTION_UNITS::INCH )
|
||||||
|
unitsPerInch = 1.0;
|
||||||
|
|
||||||
|
double pxPerUnit = dpi / unitsPerInch * value;
|
||||||
|
|
||||||
|
// Minimum spacing between number labels to prevent overlap (in pixels)
|
||||||
|
const int MIN_LABEL_SPACING = 30;
|
||||||
|
double lastLabelX = -MIN_LABEL_SPACING;
|
||||||
|
|
||||||
|
// Draw major and minor tick marks with numbering
|
||||||
|
if( units == ZOOM_CORRECTION_UNITS::INCH )
|
||||||
|
{
|
||||||
|
double pxPerMinorTick = pxPerUnit / 4.0; // 1/4 inch intervals
|
||||||
|
|
||||||
|
for( double x = 0; x <= size.x; x += pxPerMinorTick )
|
||||||
|
{
|
||||||
|
int tickCount = (int)round( x / pxPerMinorTick );
|
||||||
|
|
||||||
|
if( tickCount % 4 == 0 )
|
||||||
|
{
|
||||||
|
// Major tick (inch mark)
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 16 );
|
||||||
|
|
||||||
|
int inchNum = tickCount / 4;
|
||||||
|
|
||||||
|
if( inchNum > 0 && x < size.x - 10 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
|
||||||
|
{
|
||||||
|
wxString label = wxString::Format( wxT("%d"), inchNum );
|
||||||
|
wxSize textSize = dc.GetTextExtent( label );
|
||||||
|
dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
|
||||||
|
lastLabelX = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Minor tick (1/4 inch mark)
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 8 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( units == ZOOM_CORRECTION_UNITS::CM )
|
||||||
|
{
|
||||||
|
double pxPerMinorTick = pxPerUnit / 10.0; // 1mm intervals
|
||||||
|
|
||||||
|
for( double x = 0; x <= size.x; x += pxPerMinorTick )
|
||||||
|
{
|
||||||
|
int tickCount = (int)round( x / pxPerMinorTick );
|
||||||
|
|
||||||
|
if( tickCount % 10 == 0 )
|
||||||
|
{
|
||||||
|
// Major tick (cm mark)
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 16 );
|
||||||
|
|
||||||
|
int cmNum = tickCount / 10;
|
||||||
|
|
||||||
|
if( cmNum > 0 && x < size.x - 10 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
|
||||||
|
{
|
||||||
|
wxString label = wxString::Format( wxT("%d"), cmNum );
|
||||||
|
wxSize textSize = dc.GetTextExtent( label );
|
||||||
|
dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
|
||||||
|
lastLabelX = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Minor tick (mm mark)
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 8 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // MM
|
||||||
|
{
|
||||||
|
// For mm: Same as cm ruler but numbers count by 10 (so 10mm, 20mm, etc.)
|
||||||
|
double pxPerMinorTick = pxPerUnit;
|
||||||
|
|
||||||
|
for( double x = 0; x <= size.x; x += pxPerMinorTick )
|
||||||
|
{
|
||||||
|
int tickCount = (int)round( x / pxPerMinorTick );
|
||||||
|
|
||||||
|
if( tickCount % 10 == 0 )
|
||||||
|
{
|
||||||
|
// Major tick (10mm mark)
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 16 );
|
||||||
|
|
||||||
|
if( tickCount > 0 && x < size.x - 15 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
|
||||||
|
{
|
||||||
|
wxString label = wxString::Format( wxT("%d"), tickCount );
|
||||||
|
wxSize textSize = dc.GetTextExtent( label );
|
||||||
|
dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
|
||||||
|
lastLabelX = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dc.DrawLine( x, size.y - 1, x, size.y - 8 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ZOOM_CORRECTION_CTRL::ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue ) :
|
||||||
|
wxPanel( aParent, wxID_ANY ),
|
||||||
|
m_value( &aValue )
|
||||||
|
{
|
||||||
|
wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
// Top section: Slider and spinner
|
||||||
|
wxBoxSizer* controlsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
m_slider = new wxSlider( this, wxID_ANY, (int)( aValue * 100 ), 10, 1000, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSL_HORIZONTAL | wxSL_VALUE_LABEL );
|
||||||
|
controlsSizer->Add( m_slider, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, KIUI::GetStdMargin() );
|
||||||
|
|
||||||
|
m_spinner = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSP_ARROW_KEYS, 10, 1000, (int)( aValue * 100 ) );
|
||||||
|
controlsSizer->Add( m_spinner, 0, wxALIGN_CENTER_VERTICAL );
|
||||||
|
|
||||||
|
topSizer->Add( controlsSizer, 0, wxEXPAND | wxALL, KIUI::GetStdMargin() );
|
||||||
|
|
||||||
|
// Middle section: Ruler and units choice
|
||||||
|
wxBoxSizer* rulerSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_ruler = new ZOOM_CORRECTION_RULER( this );
|
||||||
|
rulerSizer->Add( m_ruler, 1, wxEXPAND | wxRIGHT, KIUI::GetStdMargin() );
|
||||||
|
|
||||||
|
wxArrayString choices;
|
||||||
|
choices.Add( wxT( "mm" ) );
|
||||||
|
choices.Add( wxT( "cm" ) );
|
||||||
|
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 );
|
||||||
|
|
||||||
|
topSizer->Add( rulerSizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, KIUI::GetStdMargin() );
|
||||||
|
|
||||||
|
SetSizer( topSizer );
|
||||||
|
|
||||||
|
m_slider->Bind( wxEVT_SLIDER, &ZOOM_CORRECTION_CTRL::sliderChanged, this );
|
||||||
|
m_spinner->Bind( wxEVT_SPINCTRL, &ZOOM_CORRECTION_CTRL::spinnerChanged, this );
|
||||||
|
m_unitsChoice->Bind( wxEVT_CHOICE, &ZOOM_CORRECTION_CTRL::unitsChanged, this );
|
||||||
|
|
||||||
|
// Ensure initial synchronization of all controls
|
||||||
|
m_ruler->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZOOM_CORRECTION_CTRL::SetDisplayedValue( double aValue )
|
||||||
|
{
|
||||||
|
m_slider->SetValue( (int)( aValue * 100 ) );
|
||||||
|
m_spinner->SetValue( (int)( aValue * 100 ) );
|
||||||
|
m_ruler->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
double ZOOM_CORRECTION_CTRL::GetValue() const
|
||||||
|
{
|
||||||
|
return m_slider->GetValue() / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZOOM_CORRECTION_CTRL::GetUnitsSelection() const
|
||||||
|
{
|
||||||
|
return m_unitsChoice->GetSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZOOM_CORRECTION_CTRL::TransferDataToWindow()
|
||||||
|
{
|
||||||
|
m_slider->SetValue( (int)( *m_value * 100 ) );
|
||||||
|
m_spinner->SetValue( (int)( *m_value * 100 ) );
|
||||||
|
m_ruler->Refresh();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZOOM_CORRECTION_CTRL::TransferDataFromWindow()
|
||||||
|
{
|
||||||
|
*m_value = GetValue();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZOOM_CORRECTION_CTRL::sliderChanged( wxCommandEvent& )
|
||||||
|
{
|
||||||
|
*m_value = GetValue();
|
||||||
|
m_spinner->SetValue( m_slider->GetValue() );
|
||||||
|
m_ruler->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZOOM_CORRECTION_CTRL::spinnerChanged( wxSpinEvent& )
|
||||||
|
{
|
||||||
|
*m_value = m_spinner->GetValue() / 100.0;
|
||||||
|
m_slider->SetValue( m_spinner->GetValue() );
|
||||||
|
m_ruler->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZOOM_CORRECTION_CTRL::unitsChanged( wxCommandEvent& )
|
||||||
|
{
|
||||||
|
m_ruler->Refresh();
|
||||||
|
}
|
@ -24,6 +24,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <dialogs/panel_common_settings_base.h>
|
#include <dialogs/panel_common_settings_base.h>
|
||||||
|
#include <widgets/zoom_correction_ctrl.h>
|
||||||
|
|
||||||
|
|
||||||
class COMMON_SETTINGS;
|
class COMMON_SETTINGS;
|
||||||
@ -60,4 +61,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void ShowFileManagerWidgets( bool aBool );
|
void ShowFileManagerWidgets( bool aBool );
|
||||||
void setPdfViewerPathState();
|
void setPdfViewerPathState();
|
||||||
|
|
||||||
|
ZOOM_CORRECTION_CTRL* m_zoomCorrectionCtrl;
|
||||||
};
|
};
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include <gal/gal_display_options.h>
|
#include <gal/gal_display_options.h>
|
||||||
#include <font/stroke_font.h>
|
#include <font/stroke_font.h>
|
||||||
#include <geometry/eda_angle.h>
|
#include <geometry/eda_angle.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
#include <settings/common_settings.h>
|
||||||
|
|
||||||
class SHAPE_LINE_CHAIN;
|
class SHAPE_LINE_CHAIN;
|
||||||
class SHAPE_POLY_SET;
|
class SHAPE_POLY_SET;
|
||||||
@ -1041,6 +1043,9 @@ protected:
|
|||||||
inline void computeWorldScale()
|
inline void computeWorldScale()
|
||||||
{
|
{
|
||||||
m_worldScale = m_screenDPI * m_worldUnitLength * m_zoomFactor;
|
m_worldScale = m_screenDPI * m_worldUnitLength * m_zoomFactor;
|
||||||
|
|
||||||
|
if( Pgm().GetCommonSettings() )
|
||||||
|
m_worldScale *= Pgm().GetCommonSettings()->m_Appearance.zoom_correction_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
int text_editor_zoom;
|
int text_editor_zoom;
|
||||||
int toolbar_icon_size;
|
int toolbar_icon_size;
|
||||||
bool grid_striping;
|
bool grid_striping;
|
||||||
|
double zoom_correction_factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AUTO_BACKUP
|
struct AUTO_BACKUP
|
||||||
|
70
include/widgets/zoom_correction_ctrl.h
Normal file
70
include/widgets/zoom_correction_ctrl.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 3
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* Inspired by the Inkscape preferences widget, which is
|
||||||
|
* Authors:
|
||||||
|
* Marco Scholten
|
||||||
|
* Bruno Dilly <bruno.dilly@gmail.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004, 2006, 2007 Authors
|
||||||
|
*
|
||||||
|
* Released under GNU GPL v2+
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ZOOM_CORRECTION_CTRL__H_
|
||||||
|
#define ZOOM_CORRECTION_CTRL__H_
|
||||||
|
|
||||||
|
#include <wx/choice.h>
|
||||||
|
#include <wx/panel.h>
|
||||||
|
#include <wx/slider.h>
|
||||||
|
#include <wx/spinctrl.h>
|
||||||
|
|
||||||
|
class ZOOM_CORRECTION_RULER;
|
||||||
|
|
||||||
|
enum class ZOOM_CORRECTION_UNITS : int
|
||||||
|
{
|
||||||
|
MM,
|
||||||
|
CM,
|
||||||
|
INCH
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Control to calibrate screen zoom to match real-world size.
|
||||||
|
*/
|
||||||
|
class ZOOM_CORRECTION_CTRL : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue );
|
||||||
|
|
||||||
|
void SetDisplayedValue( double aValue );
|
||||||
|
double GetValue() const;
|
||||||
|
int GetUnitsSelection() const;
|
||||||
|
bool TransferDataToWindow() override;
|
||||||
|
bool TransferDataFromWindow() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void sliderChanged( wxCommandEvent& aEvent );
|
||||||
|
void unitsChanged( wxCommandEvent& aEvent );
|
||||||
|
void spinnerChanged( wxSpinEvent& aEvent );
|
||||||
|
|
||||||
|
double* m_value;
|
||||||
|
ZOOM_CORRECTION_RULER* m_ruler;
|
||||||
|
wxSlider* m_slider;
|
||||||
|
wxSpinCtrl* m_spinner;
|
||||||
|
wxChoice* m_unitsChoice;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -9,7 +9,8 @@
|
|||||||
"show_scrollbars": false,
|
"show_scrollbars": false,
|
||||||
"text_editor_zoom": 0,
|
"text_editor_zoom": 0,
|
||||||
"toolbar_icon_size": 24,
|
"toolbar_icon_size": 24,
|
||||||
"use_icons_in_menus": false
|
"use_icons_in_menus": false,
|
||||||
|
"zoom_correction_factor": 1
|
||||||
},
|
},
|
||||||
"auto_backup": {
|
"auto_backup": {
|
||||||
"backup_on_autosave": false,
|
"backup_on_autosave": false,
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"show_scrollbars": false,
|
"show_scrollbars": false,
|
||||||
"text_editor_zoom": 0,
|
"text_editor_zoom": 0,
|
||||||
"toolbar_icon_size": 24,
|
"toolbar_icon_size": 24,
|
||||||
"use_icons_in_menus": false
|
"use_icons_in_menus": false,
|
||||||
|
"zoom_correction_factor": 1
|
||||||
},
|
},
|
||||||
"auto_backup": {
|
"auto_backup": {
|
||||||
"backup_on_autosave": false,
|
"backup_on_autosave": false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user