Fix layout issues in Global Label dialog.

Fixes: lp:1782904
* https://bugs.launchpad.net/kicad/+bug/1782904
This commit is contained in:
Jeff Young 2018-07-22 16:01:24 +01:00
parent 65f4743a44
commit 7f64f41242
4 changed files with 497 additions and 346 deletions

View File

@ -108,33 +108,18 @@ const int maxSize = (int)( 250 * IU_PER_MM );
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DIALOG_LABEL_EDITOR_BASE( aParent ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeLabel, false, minSize, maxSize )
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false, minSize, maxSize )
{
m_Parent = aParent;
m_CurrentText = aTextItem;
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
SetTitle( _( "Global Label Properties" ) );
break;
case SCH_HIERARCHICAL_LABEL_T:
SetTitle( _( "Hierarchical Label Properties" ) );
break;
case SCH_LABEL_T:
SetTitle( _( "Label Properties" ) );
break;
case SCH_SHEET_PIN_T:
SetTitle( _( "Hierarchical Sheet Pin Properties" ) );
break;
default:
m_Label->SetLabel( _( "Text:" ) );
SetTitle( _( "Text Properties" ) );
break;
case SCH_GLOBAL_LABEL_T: SetTitle( _( "Global Label Properties" ) ); break;
case SCH_HIERARCHICAL_LABEL_T: SetTitle( _( "Hierarchical Label Properties" ) ); break;
case SCH_LABEL_T: SetTitle( _( "Label Properties" ) ); break;
case SCH_SHEET_PIN_T: SetTitle( _( "Hierarchical Sheet Pin Properties" ) ); break;
default: SetTitle( _( "Text Properties" ) ); break;
}
if( m_CurrentText->IsMultilineAllowed() )
@ -142,26 +127,26 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_activeTextCtrl = m_valueMultiLine;
m_activeTextEntry = m_valueMultiLine;
m_textControlSizer->AddGrowableRow( 0 );
m_labelSingleLine->Show( false ); m_valueSingleLine->Show( false );
m_labelCombo->Show( false ); m_valueCombo->Show( false );
m_valueSingleLine->Show( false );
m_valueCombo->Show( false );
m_textEntrySizer->AddGrowableRow( 0 );
}
else if( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T || m_CurrentText->Type() == SCH_LABEL_T )
{
m_activeTextCtrl = m_valueCombo;
m_activeTextEntry = m_valueCombo;
m_valueSingleLine->Show( false );
m_valueMultiLine->Show( false );
m_labelSingleLine->Show( false ); m_valueSingleLine->Show( false );
m_labelMultiLine->Show( false ); m_valueMultiLine->Show( false );
}
else
{
m_activeTextCtrl = m_valueSingleLine;
m_activeTextEntry = m_valueSingleLine;
m_valueCombo->Show( false );
m_valueMultiLine->Show( false );
m_labelCombo->Show( false ); m_valueCombo->Show( false );
m_labelMultiLine->Show( false ); m_valueMultiLine->Show( false );
}
SetInitialFocus( m_activeTextCtrl );
@ -179,6 +164,11 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
// so we have to listen to wxEVT_CHAR_HOOK events instead.
m_valueMultiLine->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_LABEL_EDITOR::OnCharHook ), nullptr, this );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
// various versions have different controls so we want to store sizes for each version.
m_hash_key = TO_UTF8( GetTitle() );
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -16,59 +16,63 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
m_textControlSizer->AddGrowableCol( 1 );
m_textControlSizer->SetFlexibleDirection( wxBOTH );
m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textEntrySizer = new wxFlexGridSizer( 4, 2, 3, 3 );
m_textEntrySizer->AddGrowableCol( 1 );
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_Label = new wxStaticText( this, wxID_ANY, _("Label:"), wxDefaultPosition, wxDefaultSize, 0 );
m_Label->Wrap( -1 );
m_Label->SetToolTip( _("Enter the text to be used within the schematic") );
m_labelSingleLine = new wxStaticText( this, wxID_ANY, _("Label:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelSingleLine->Wrap( -1 );
m_labelSingleLine->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_Label, 0, wxALIGN_TOP|wxRIGHT|wxTOP, 3 );
wxBoxSizer* bSizeText;
bSizeText = new wxBoxSizer( wxVERTICAL );
m_textEntrySizer->Add( m_labelSingleLine, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 );
m_valueSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RICH );
m_valueSingleLine->SetMinSize( wxSize( 360,-1 ) );
m_valueSingleLine->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelText ) );
bSizeText->Add( m_valueSingleLine, 0, wxBOTTOM|wxEXPAND|wxLEFT, 3 );
m_textEntrySizer->Add( m_valueSingleLine, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 3 );
m_labelMultiLine = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelMultiLine->Wrap( -1 );
m_textEntrySizer->Add( m_labelMultiLine, 0, wxRIGHT, 5 );
m_valueMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_valueMultiLine->SetMinSize( wxSize( 480,72 ) );
bSizeText->Add( m_valueMultiLine, 1, wxBOTTOM|wxEXPAND|wxLEFT, 3 );
m_textEntrySizer->Add( m_valueMultiLine, 1, wxEXPAND|wxBOTTOM|wxLEFT, 3 );
m_labelCombo = new wxStaticText( this, wxID_ANY, _("Label:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelCombo->Wrap( -1 );
m_textEntrySizer->Add( m_labelCombo, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_valueCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_valueCombo->SetMinSize( wxSize( 360,-1 ) );
m_valueCombo->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_comboText ) );
bSizeText->Add( m_valueCombo, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 );
m_textEntrySizer->Add( m_valueCombo, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
m_textControlSizer->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 3 );
m_textEntrySizer->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_textSizeCtrl = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxTOP, 3 );
bSizeCtrlSizer->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 3 );
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits->Wrap( -1 );
bSizeCtrlSizer->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 2 );
bSizeCtrlSizer->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL, 2 );
m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 );
m_textEntrySizer->Add( bSizeCtrlSizer, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 3 );
bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
@ -89,10 +93,10 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString );
m_TextShape = new wxRadioBox( this, wxID_ANY, _("Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 3 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP|wxEXPAND, 3 );
m_OptionsSizer->Add( m_TextShape, 1, wxEXPAND|wxTOP|wxLEFT, 3 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );

View File

@ -104,14 +104,14 @@
<property name="growablerows"></property>
<property name="hgap">3</property>
<property name="minimum_size"></property>
<property name="name">m_textControlSizer</property>
<property name="name">m_textEntrySizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">2</property>
<property name="rows">4</property>
<property name="vgap">3</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_TOP|wxRIGHT|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -149,7 +149,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_Label</property>
<property name="name">m_labelSingleLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -194,16 +194,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">-1,-1</property>
<property name="name">bSizeText</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -292,9 +283,92 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_labelMultiLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -385,7 +459,90 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Label:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_labelCombo</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxComboBox" expanded="1">
<property name="BottomDockable">1</property>
@ -421,7 +578,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">360,-1</property>
<property name="moveable">1</property>
<property name="name">m_valueCombo</property>
<property name="pane_border">1</property>
@ -476,11 +633,9 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -563,7 +718,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -572,7 +727,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -663,7 +818,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -749,7 +904,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
@ -939,7 +1094,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL|wxLEFT|wxTOP|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -43,10 +43,12 @@ class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM
wxID_SIZE
};
wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_Label;
wxFlexGridSizer* m_textEntrySizer;
wxStaticText* m_labelSingleLine;
wxTextCtrl* m_valueSingleLine;
wxStaticText* m_labelMultiLine;
wxTextCtrl* m_valueMultiLine;
wxStaticText* m_labelCombo;
wxComboBox* m_valueCombo;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;