Move call of SetSizeHints in a few dialogs form the dlg ctor to a wxInitDialogEvent event, because some widgets sizes are not fully initialized before this event is fired.
It is especially true in some Window Managers like KDE, but can be true in any WM, when initializations are made by TransferDataToWindow() method, called by the default wxInitDialogEvent handler.
This commit is contained in:
commit
4a20f376a3
|
@ -290,7 +290,6 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager ) :
|
|||
}
|
||||
|
||||
SetSizerAndFit( mainBox );
|
||||
Centre();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ void DIALOG_SHIM::FinishDialogSettings()
|
|||
// SetSizeHints fixes the minimal size of sizers in the dialog
|
||||
// (SetSizeHints calls Fit(), so no need to call it)
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
// the default position, when calling the first time the dlg
|
||||
Center();
|
||||
}
|
||||
|
|
|
@ -93,14 +93,18 @@ protected:
|
|||
|
||||
/**
|
||||
* In all dialogs, we must call the same functions to fix minimal
|
||||
* dlg size, the default position and some others to fix a few issues
|
||||
* dlg size, the default position and perhaps some others to fix a few issues
|
||||
* depending on Windows Managers
|
||||
* this helper function does these calls.
|
||||
*
|
||||
* FinishDialogSettings must be called from the constructor of derived classes,
|
||||
* FinishDialogSettings must be called from derived classes,
|
||||
* when all widgets are initialized, and therefore their size fixed.
|
||||
* If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow,
|
||||
* or better at end of a wxInitDialogEvent handler
|
||||
*
|
||||
* In any case, the best way is to call it in a wxInitDialogEvent handler
|
||||
* after calling TransfertDataToWindow(), which is the default
|
||||
* wxInitDialogEvent handler wxDialog
|
||||
*/
|
||||
void FinishDialogSettings();
|
||||
|
||||
|
|
|
@ -51,9 +51,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) :
|
|||
|
||||
InitValues();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
Centre();
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
|
|||
m_LastSelected3DShapeIndex = 0;
|
||||
m_OrientValue = 0;
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,16 @@ private:
|
|||
void ModuleOrientEvent( wxCommandEvent& event );
|
||||
void Cfg3DPath( wxCommandEvent& event );
|
||||
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
{
|
||||
// Call the default wxDialog handler of a wxInitDialogEvent
|
||||
TransferDataToWindow();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
bool TransferDataToWindow();
|
||||
bool TransferDataFromWindow();
|
||||
};
|
||||
|
|
|
@ -364,6 +364,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
|
|||
m_GeneralBoxSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnInitDlg ) );
|
||||
m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this );
|
||||
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this );
|
||||
m_OrientCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
|
||||
|
@ -380,6 +381,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
|
|||
DIALOG_MODULE_BOARD_EDITOR_BASE::~DIALOG_MODULE_BOARD_EDITOR_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnInitDlg ) );
|
||||
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this );
|
||||
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this );
|
||||
m_OrientCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnInitDialog">OnInitDlg</event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
|
|
|
@ -115,6 +115,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
|
|||
wxButton* m_sdbSizerStdButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -81,8 +81,7 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
|
|||
m_NoteBook->SetSelection( m_page );
|
||||
|
||||
m_sdbSizerStdButtonsOK->SetDefault();
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,16 @@ private:
|
|||
void OnCancelClick( wxCommandEvent& event );
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void Cfg3DPath( wxCommandEvent& event );
|
||||
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
{
|
||||
// Call the default wxDialog handler of a wxInitDialogEvent
|
||||
TransferDataToWindow();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
event.Skip();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
|
|||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnInitDlg ) );
|
||||
m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditReference ), NULL, this );
|
||||
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditValue ), NULL, this );
|
||||
m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
|
||||
|
@ -313,6 +314,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
|
|||
DIALOG_MODULE_MODULE_EDITOR_BASE::~DIALOG_MODULE_MODULE_EDITOR_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnInitDlg ) );
|
||||
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditReference ), NULL, this );
|
||||
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditValue ), NULL, this );
|
||||
m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnInitDialog">OnInitDlg</event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
|
|
|
@ -99,6 +99,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
|
|||
wxButton* m_sdbSizerStdButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -70,6 +70,17 @@ private:
|
|||
void OnPrintButtonClick( wxCommandEvent& event );
|
||||
|
||||
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
|
||||
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
{
|
||||
// Call the default wxDialog handler of a wxInitDialogEvent
|
||||
TransferDataToWindow();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void InitValues( );
|
||||
};
|
||||
|
||||
|
|
|
@ -93,6 +93,17 @@ private:
|
|||
void OnScaleSelectionClick( wxCommandEvent& event );
|
||||
|
||||
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
|
||||
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
{
|
||||
// Call the default wxDialog handler of a wxInitDialogEvent
|
||||
TransferDataToWindow();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void SetPrintParameters( );
|
||||
void SetPenWidth();
|
||||
void initValues( );
|
||||
|
@ -153,10 +164,6 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
|
|||
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
|
||||
m_buttonPreview->Hide();
|
||||
#endif
|
||||
|
||||
GetSizer()->Fit( this );
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Center();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 6 2016)
|
||||
// C++ code generated with wxFormBuilder (version May 21 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -59,7 +59,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
|
|||
sbLayersSizer->Add( m_Exclude_Edges_Pcb, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbLayersSizer, 1, wxEXPAND, 5 );
|
||||
bMainSizer->Add( sbLayersSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bmiddleLeftSizer;
|
||||
bmiddleLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -174,6 +174,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDlg ) );
|
||||
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
|
||||
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
|
||||
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
|
||||
|
@ -185,6 +186,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
|
|||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDlg ) );
|
||||
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
|
||||
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
|
||||
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnInitDialog">OnInitDlg</event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
|
@ -95,7 +95,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 6 2016)
|
||||
// C++ code generated with wxFormBuilder (version May 21 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -72,6 +72,7 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnScaleSelectionClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
Loading…
Reference in New Issue