mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-04 23:35:31 +00:00
Fix job run-log sizing issues.
wxLIST_AUTOSIZE_USEHEADER doesn't work on some platforms, and using OnSize was having seizures on Mac.
This commit is contained in:
parent
1808fcec78
commit
92b4b7187e
@ -57,7 +57,9 @@ public:
|
||||
JOBSET_DESTINATION* aDestination ) :
|
||||
DIALOG_JOBSET_RUN_LOG_BASE( aParent ),
|
||||
m_jobsFile( aJobsFile ),
|
||||
m_destination( aDestination )
|
||||
m_destination( aDestination ),
|
||||
m_lastWidth( -1 ),
|
||||
m_marginsWidth( -1 )
|
||||
{
|
||||
m_staticTextOutputName->SetLabel( wxString::Format( _( "Destination: %s" ),
|
||||
aDestination->GetDescription() ) );
|
||||
@ -66,9 +68,9 @@ public:
|
||||
int jobNoColId = m_jobList->AppendColumn( _( "No." ) );
|
||||
int jobDescColId = m_jobList->AppendColumn( _( "Job Description" ) );
|
||||
int jobSourceColId = m_jobList->AppendColumn( _( "Source" ) );
|
||||
m_jobList->SetColumnWidth( jobBmpColId, GetTextExtent( wxT( "XXXX" ) ).GetWidth() );
|
||||
m_jobList->SetColumnWidth( jobBmpColId, 26 );
|
||||
m_jobList->SetColumnWidth( jobNoColId, GetTextExtent( wxT( "XXXX" ) ).GetWidth() );
|
||||
m_jobList->SetColumnWidth( jobSourceColId, GetTextExtent( wxT( "XXXXXXXX" ) ).GetWidth() );
|
||||
m_jobList->SetColumnWidth( jobSourceColId, GetTextExtent( wxT( "XXXXXX" ) ).GetWidth() );
|
||||
|
||||
wxImageList* imageList = new wxImageList( 16, 16, true, 3 );
|
||||
imageList->Add( KiBitmapBundle( BITMAPS::ercerr ).GetBitmap( wxSize( 16, 16 ) ) );
|
||||
@ -109,13 +111,25 @@ public:
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Close" ) } } );
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
int width = m_jobList->GetSize().x;
|
||||
width -= m_jobList->GetColumnWidth( jobBmpColId );
|
||||
width -= m_jobList->GetColumnWidth( jobNoColId );
|
||||
width -= m_jobList->GetColumnWidth( jobSourceColId );
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) override
|
||||
{
|
||||
if( GetSize().GetWidth() != m_lastWidth )
|
||||
{
|
||||
m_lastWidth = GetSize().GetWidth();
|
||||
|
||||
m_jobList->SetColumnWidth( jobDescColId, width );
|
||||
if( m_marginsWidth < 0 )
|
||||
m_marginsWidth = m_lastWidth - ( m_jobList->GetSize().GetWidth() * 2 );
|
||||
|
||||
int width = ( m_lastWidth / 2 );
|
||||
width -= m_marginsWidth;
|
||||
width -= m_jobList->GetColumnWidth( 0 );
|
||||
width -= m_jobList->GetColumnWidth( 1 );
|
||||
width -= m_jobList->GetColumnWidth( 3 );
|
||||
|
||||
m_jobList->SetColumnWidth( 2, width );
|
||||
}
|
||||
}
|
||||
|
||||
void OnJobListItemSelected( wxListEvent& event ) override
|
||||
@ -150,6 +164,9 @@ public:
|
||||
private:
|
||||
JOBSET* m_jobsFile;
|
||||
JOBSET_DESTINATION* m_destination;
|
||||
|
||||
int m_lastWidth;
|
||||
int m_marginsWidth;
|
||||
};
|
||||
|
||||
|
||||
|
@ -241,12 +241,12 @@ DIALOG_JOBSET_RUN_LOG_BASE::DIALOG_JOBSET_RUN_LOG_BASE( wxWindow* parent, wxWind
|
||||
bSizer16 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_jobList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
|
||||
bSizer16->Add( m_jobList, 3, wxALL|wxEXPAND, 5 );
|
||||
bSizer16->Add( m_jobList, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_textCtrlOutput = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_BESTWRAP|wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_textCtrlOutput->SetMinSize( wxSize( 420,-1 ) );
|
||||
|
||||
bSizer16->Add( m_textCtrlOutput, 4, wxALL|wxEXPAND, 5 );
|
||||
bSizer16->Add( m_textCtrlOutput, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizer16, 1, wxEXPAND, 5 );
|
||||
@ -266,16 +266,16 @@ DIALOG_JOBSET_RUN_LOG_BASE::DIALOG_JOBSET_RUN_LOG_BASE( wxWindow* parent, wxWind
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnUpdateUI ) );
|
||||
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnJobListItemSelected ), NULL, this );
|
||||
m_jobList->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::onJobListSize ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnButtonOk ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_JOBSET_RUN_LOG_BASE::~DIALOG_JOBSET_RUN_LOG_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnUpdateUI ) );
|
||||
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnJobListItemSelected ), NULL, this );
|
||||
m_jobList->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::onJobListSize ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnButtonOk ), NULL, this );
|
||||
|
||||
}
|
||||
|
@ -1361,6 +1361,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
@ -1440,7 +1441,7 @@
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">3</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxListCtrl" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
@ -1499,13 +1500,12 @@
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnListItemSelected">OnJobListItemSelected</event>
|
||||
<event name="OnSize">onJobListSize</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">4</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -123,8 +123,8 @@ class DIALOG_JOBSET_RUN_LOG_BASE : public DIALOG_SHIM
|
||||
wxButton* m_sdbSizerOK;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnJobListItemSelected( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void onJobListSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOk( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user