Replace macHack as its requirement sadly never went away.

This commit is contained in:
Jeff Young 2022-09-24 23:22:05 +01:00
parent f6d0fb8eed
commit 659a6e5b04
4 changed files with 29 additions and 13 deletions

View File

@ -114,6 +114,9 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aSho
void PAGED_DIALOG::finishInitialization()
{
for( size_t i = 1; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
// For some reason adding page labels to the treeCtrl doesn't invalidate its bestSize
// cache so we have to do it by hand
m_treebook->GetTreeCtrl()->InvalidateBestSize();
@ -373,22 +376,33 @@ void PAGED_DIALOG::onCharHook( wxKeyEvent& aEvent )
void PAGED_DIALOG::onPageChanged( wxBookCtrlEvent& event )
{
int page = event.GetSelection();
size_t page = event.GetSelection();
// Use the first sub-page when a tree level node is selected.
if( m_treebook->GetCurrentPage()->GetChildren().IsEmpty() )
if( m_treebook->GetCurrentPage()->GetChildren().IsEmpty()
&& page + 1 < m_treebook->GetPageCount() )
{
unsigned next = page + 1;
if( next < m_treebook->GetPageCount() )
m_treebook->ChangeSelection( next );
m_treebook->ChangeSelection( ++page );
}
UpdateResetButton( page );
wxSizeEvent evt( wxDefaultSize );
#ifdef __WXMAC__
// Work around an OSX wxWidgets issue where the wxGrid children don't get placed correctly
// until the first resize event
if( page < m_macHack.size() && m_macHack[ page ] )
{
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
pageSize.x -= 5;
pageSize.y += 2;
m_treebook->GetPage( page )->SetSize( pageSize );
m_macHack[ page ] = false;
}
#else
wxSizeEvent evt( wxDefaultSize );
wxQueueEvent( m_treebook, evt.Clone() );
#endif
}

View File

@ -49,8 +49,8 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 3, 5, 5 );
fgSizer2->AddGrowableCol( 1 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer2->SetFlexibleDirection( wxHORIZONTAL );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
m_textSizeLabel = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Default text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
@ -146,7 +146,7 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
int m_choiceJunctionDotSizeNChoices = sizeof( m_choiceJunctionDotSizeChoices ) / sizeof( wxString );
m_choiceJunctionDotSize = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceJunctionDotSizeNChoices, m_choiceJunctionDotSizeChoices, 0 );
m_choiceJunctionDotSize->SetSelection( 3 );
bSizer61->Add( m_choiceJunctionDotSize, 1, wxEXPAND|wxRIGHT, 5 );
bSizer61->Add( m_choiceJunctionDotSize, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer2->Add( bSizer61, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );

View File

@ -234,13 +234,13 @@
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">5</property>
<property name="minimum_size"></property>
<property name="name">fgSizer2</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
@ -1294,7 +1294,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -70,6 +70,8 @@ private:
wxString m_title;
wxBoxSizer* m_buttonsSizer;
std::vector<bool> m_macHack;
};