Force wxWidgets to set widths smaller than BestWidth().

This commit is contained in:
Jeff Young 2020-08-24 00:41:14 +01:00
parent d41f196d7f
commit fba6152709
4 changed files with 44 additions and 35 deletions

View File

@ -256,12 +256,12 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_appearancePanel, m_auimgr.AddPane( m_appearancePanel,
EDA_PANE().Name( "LayersManager" ).Right().Layer( 4 ) EDA_PANE().Name( "LayersManager" ).Right().Layer( 4 )
.Caption( _( "Appearance" ) ).PaneBorder( false ) .Caption( _( "Appearance" ) ).PaneBorder( false )
.MinSize( 160, -1 ).BestSize( m_appearancePanel->GetBestSize() ) ); .MinSize( 180, -1 ).BestSize( 180, -1 ) );
m_auimgr.AddPane( m_selectionFilterPanel, m_auimgr.AddPane( m_selectionFilterPanel,
EDA_PANE().Name( "SelectionFilter" ).Right().Layer( 4 ) EDA_PANE().Name( "SelectionFilter" ).Right().Layer( 4 )
.Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 ) .Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 )
.MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) ); .MinSize( 180, -1 ).BestSize( 180, -1 ) );
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
@ -272,23 +272,30 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// The selection filter doesn't need to grow in the vertical direction when docked // The selection filter doesn't need to grow in the vertical direction when docked
m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0; m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it.
m_auimgr.Update();
if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) ) if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
{ {
if( settings->m_AuiPanels.right_panel_width > 0 ) if( settings->m_AuiPanels.right_panel_width > 0 )
{ {
wxSize size = m_appearancePanel->GetBestSize(); wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
size.x = settings->m_AuiPanels.right_panel_width;
m_auimgr.GetPane( "LayersManager" ).BestSize( size ); // wxAUI hack: force width by setting MinSize() and then Fixed()
m_appearancePanel->SetSize( size ); // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
layersManager.MinSize( settings->m_AuiPanels.right_panel_width, -1 );
layersManager.Fixed();
m_auimgr.Update();
// now make it resizable again
layersManager.Resizable();
m_auimgr.Update();
} }
m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab ); m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
} }
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it.
m_auimgr.Update();
// We don't want the infobar displayed right away // We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide(); m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();

View File

@ -12,7 +12,7 @@
APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{ {
this->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); this->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
this->SetMinSize( wxSize( 200,360 ) ); this->SetMinSize( wxSize( 160,360 ) );
m_sizerOuter = new wxBoxSizer( wxVERTICAL ); m_sizerOuter = new wxBoxSizer( wxVERTICAL );
@ -31,7 +31,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_staticText13 = new wxStaticText( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Non-active layers:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText13 = new wxStaticText( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Non-active layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 ); m_staticText13->Wrap( -1 );
bSizer121->Add( m_staticText13, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer121->Add( m_staticText13, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* bSizer19; wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxHORIZONTAL ); bSizer19 = new wxBoxSizer( wxHORIZONTAL );
@ -40,17 +40,17 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_rbHighContrastNormal->SetValue( true ); m_rbHighContrastNormal->SetValue( true );
m_rbHighContrastNormal->SetToolTip( wxT("Non-active layers will be shown in full color") ); m_rbHighContrastNormal->SetToolTip( wxT("Non-active layers will be shown in full color") );
bSizer19->Add( m_rbHighContrastNormal, 1, wxRIGHT|wxLEFT, 5 ); bSizer19->Add( m_rbHighContrastNormal, 0, wxRIGHT|wxLEFT, 5 );
m_rbHighContrastDim = new wxRadioButton( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Dim"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbHighContrastDim = new wxRadioButton( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Dim"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbHighContrastDim->SetToolTip( wxT("Non-active layers will be dimmed") ); m_rbHighContrastDim->SetToolTip( wxT("Non-active layers will be dimmed") );
bSizer19->Add( m_rbHighContrastDim, 1, wxRIGHT|wxLEFT, 5 ); bSizer19->Add( m_rbHighContrastDim, 0, wxRIGHT|wxLEFT, 5 );
m_rbHighContrastOff = new wxRadioButton( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Hide"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbHighContrastOff = new wxRadioButton( m_paneLayerDisplay->GetPane(), wxID_ANY, wxT("Hide"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbHighContrastOff->SetToolTip( wxT("Non-active layers will be hidden") ); m_rbHighContrastOff->SetToolTip( wxT("Non-active layers will be hidden") );
bSizer19->Add( m_rbHighContrastOff, 1, wxRIGHT|wxLEFT, 5 ); bSizer19->Add( m_rbHighContrastOff, 0, wxRIGHT|wxLEFT, 5 );
bSizer121->Add( bSizer19, 0, wxEXPAND, 5 ); bSizer121->Add( bSizer19, 0, wxEXPAND, 5 );
@ -65,7 +65,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_paneLayerDisplay->GetPane()->SetSizer( bSizer121 ); m_paneLayerDisplay->GetPane()->SetSizer( bSizer121 );
m_paneLayerDisplay->GetPane()->Layout(); m_paneLayerDisplay->GetPane()->Layout();
bSizer121->Fit( m_paneLayerDisplay->GetPane() ); bSizer121->Fit( m_paneLayerDisplay->GetPane() );
m_panelLayersSizer->Add( m_paneLayerDisplay, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); m_panelLayersSizer->Add( m_paneLayerDisplay, 0, wxBOTTOM|wxTOP|wxEXPAND, 5 );
m_panelLayers->SetSizer( m_panelLayersSizer ); m_panelLayers->SetSizer( m_panelLayersSizer );
@ -130,6 +130,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_netsGrid->SetMargins( 0, 0 ); m_netsGrid->SetMargins( 0, 0 );
// Columns // Columns
m_netsGrid->AutoSizeColumns();
m_netsGrid->EnableDragColMove( false ); m_netsGrid->EnableDragColMove( false );
m_netsGrid->EnableDragColSize( false ); m_netsGrid->EnableDragColSize( false );
m_netsGrid->SetColLabelSize( 0 ); m_netsGrid->SetColLabelSize( 0 );
@ -206,18 +207,18 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_rbNetColorAll = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("All"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_rbNetColorAll = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("All"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbNetColorAll->SetToolTip( wxT("Net and netclass colors are shown on all copper items") ); m_rbNetColorAll->SetToolTip( wxT("Net and netclass colors are shown on all copper items") );
bSizer191->Add( m_rbNetColorAll, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer191->Add( m_rbNetColorAll, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_rbNetColorRatsnest = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbNetColorRatsnest = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetColorRatsnest->SetValue( true ); m_rbNetColorRatsnest->SetValue( true );
m_rbNetColorRatsnest->SetToolTip( wxT("Net and netclass colors are shown on the ratsnest only") ); m_rbNetColorRatsnest->SetToolTip( wxT("Net and netclass colors are shown on the ratsnest only") );
bSizer191->Add( m_rbNetColorRatsnest, 1, wxBOTTOM|wxLEFT, 5 ); bSizer191->Add( m_rbNetColorRatsnest, 0, wxBOTTOM|wxLEFT, 5 );
m_rbNetColorOff = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("None"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbNetColorOff = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("None"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetColorOff->SetToolTip( wxT("Net and netclass colors are not shown") ); m_rbNetColorOff->SetToolTip( wxT("Net and netclass colors are not shown") );
bSizer191->Add( m_rbNetColorOff, 1, wxBOTTOM|wxLEFT, 5 ); bSizer191->Add( m_rbNetColorOff, 0, wxBOTTOM|wxLEFT, 5 );
bSizerNetDisplay->Add( bSizer191, 0, wxEXPAND, 5 ); bSizerNetDisplay->Add( bSizer191, 0, wxEXPAND, 5 );
@ -268,11 +269,12 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bBottomMargin->Add( bPresets, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sizerOuter->Add( bBottomMargin, 0, wxEXPAND|wxBOTTOM, 2 ); m_sizerOuter->Add( bBottomMargin, 0, wxBOTTOM|wxEXPAND, 2 );
this->SetSizer( m_sizerOuter ); this->SetSizer( m_sizerOuter );
this->Layout(); this->Layout();
m_sizerOuter->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ) ); this->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ) );

View File

@ -40,10 +40,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size">200,360</property> <property name="minimum_size">160,360</property>
<property name="name">APPEARANCE_CONTROLS_BASE</property> <property name="name">APPEARANCE_CONTROLS_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">548,563</property> <property name="size">-1,-1</property>
<property name="subclass">; ; forward_declare</property> <property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
@ -240,7 +240,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property> <property name="flag">wxBOTTOM|wxTOP|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCollapsiblePane" expanded="1"> <object class="wxCollapsiblePane" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -309,7 +309,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="0"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -380,7 +380,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -444,7 +444,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -508,7 +508,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -1006,11 +1006,11 @@
<property name="name">bSizer192</property> <property name="name">bSizer192</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer17</property> <property name="name">bSizer17</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
@ -1228,7 +1228,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="autosize_cols">0</property> <property name="autosize_cols">1</property>
<property name="autosize_rows">0</property> <property name="autosize_rows">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
@ -1725,7 +1725,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -1789,7 +1789,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property> <property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -1853,7 +1853,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property> <property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="0"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -1926,7 +1926,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxEXPAND|wxBOTTOM</property> <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>

View File

@ -95,7 +95,7 @@ class APPEARANCE_CONTROLS_BASE : public wxPanel
public: public:
APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 548,563 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~APPEARANCE_CONTROLS_BASE(); ~APPEARANCE_CONTROLS_BASE();
void m_netsTabSplitterOnIdle( wxIdleEvent& ) void m_netsTabSplitterOnIdle( wxIdleEvent& )