Better sizing for some conditional dialogs.
These dialogs don't have growable features but do have conditional features, so the size is better adjusted automatically by the code then by the user.
This commit is contained in:
parent
099ddb1517
commit
f372c8025b
|
@ -77,6 +77,7 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
|
|||
const wxString& name ) :
|
||||
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
|
||||
m_useCalculatedSize( false ),
|
||||
m_units( EDA_UNITS::MILLIMETRES ),
|
||||
m_firstPaintEvent( true ),
|
||||
m_initialFocusTarget( nullptr ),
|
||||
|
@ -211,11 +212,18 @@ bool DIALOG_SHIM::Show( bool show )
|
|||
|
||||
if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
|
||||
{
|
||||
SetSize( savedDialogRect.GetPosition().x,
|
||||
savedDialogRect.GetPosition().y,
|
||||
std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
|
||||
std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
|
||||
0 );
|
||||
if( m_useCalculatedSize )
|
||||
{
|
||||
SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
|
||||
wxDialog::GetSize().x, wxDialog::GetSize().y, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
|
||||
std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
|
||||
std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
|
||||
0 );
|
||||
}
|
||||
}
|
||||
|
||||
// Be sure that the dialog appears in a visible area
|
||||
|
|
|
@ -194,6 +194,10 @@ protected:
|
|||
EDA_UNITS m_units; // userUnits for display and parsing
|
||||
std::string m_hash_key; // alternate for class_map when classname re-used
|
||||
|
||||
// The following disables the storing of a user size. It is used primarily for dialogs
|
||||
// with conditional content which don't need user sizing.
|
||||
bool m_useCalculatedSize;
|
||||
|
||||
// On MacOS (at least) SetFocus() calls made in the constructor will fail because a
|
||||
// window that isn't yet visible will return false to AcceptsFocus(). So we must delay
|
||||
// the initial-focus SetFocus() call to the first paint event.
|
||||
|
@ -208,7 +212,6 @@ protected:
|
|||
EDA_BASE_FRAME* m_parentFrame;
|
||||
|
||||
std::vector<wxWindow*> m_tabOrder;
|
||||
|
||||
};
|
||||
|
||||
#endif // DIALOG_SHIM_
|
||||
|
|
|
@ -53,6 +53,8 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
m_tracks( false ),
|
||||
m_vias( false )
|
||||
{
|
||||
m_useCalculatedSize = true;
|
||||
|
||||
wxASSERT( !m_items.Empty() );
|
||||
|
||||
// Configure display origin transforms
|
||||
|
|
|
@ -41,7 +41,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
m_sbCommonSizer->Add( bSizerNetWidgets, 5, wxEXPAND|wxRIGHT, 10 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( m_sbCommonSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
m_sbCommonSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
m_sbCommonSizer->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_lockedCbox = new wxCheckBox( m_sbCommonSizer->GetStaticBox(), wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
|
||||
m_sbCommonSizer->Add( m_lockedCbox, 0, wxALL, 5 );
|
||||
|
@ -154,10 +154,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgTrackRightSizer->Add( m_TrackLayerCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgTrackRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_sbTrackSizer->Add( fgTrackRightSizer, 4, wxLEFT, 10 );
|
||||
m_sbTrackSizer->Add( fgTrackRightSizer, 4, wxLEFT|wxEXPAND, 10 );
|
||||
|
||||
|
||||
m_MainSizer->Add( m_sbTrackSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
@ -281,6 +278,9 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
|
||||
m_MainSizer->Add( m_sbViaSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
m_MainSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_StdButtons = new wxStdDialogButtonSizer();
|
||||
m_StdButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_StdButtons->AddButton( m_StdButtonsOK );
|
||||
|
|
|
@ -281,7 +281,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1648,7 +1648,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="flag">wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">4</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">3</property>
|
||||
|
@ -1788,16 +1788,6 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="0">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -3275,6 +3265,16 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
|
|
|
@ -107,6 +107,8 @@ PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD*
|
|||
PCB_LAYER_SELECTOR( aParent ),
|
||||
DIALOG_LAYER_SELECTION_BASE( aParent )
|
||||
{
|
||||
m_useCalculatedSize = true;
|
||||
|
||||
m_layerSelected = aDefaultLayer;
|
||||
m_notAllowedLayersMask = aNotAllowedLayersMask;
|
||||
m_brd = aBrd;
|
||||
|
|
Loading…
Reference in New Issue