Dialog 3D path config: fix incorrect grid cells sizes when opening the dialog, and incorrect min size dialog.

This commit is contained in:
jean-pierre charras 2016-05-28 11:33:20 +02:00
parent 4441a4b4c7
commit f1c9f284fd
5 changed files with 69 additions and 60 deletions

View File

@ -30,14 +30,21 @@ DLG_3D_PATH_CONFIG::DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER
DLG_3D_PATH_CONFIG_BASE( aParent ), m_resolver( aResolver )
{
m_Aliases->EnableEditing( true );
// Gives a min width to each column, when the user drags a column
m_Aliases->SetColMinimalWidth( 0, 80 );
m_Aliases->SetColMinimalWidth( 1, 300 );
m_Aliases->SetColMinimalWidth( 2, 120 );
m_Aliases->SetColMinimalAcceptableWidth( 80 );
// Set column sizes to this min value
m_Aliases->SetColSize( 0, 80 );
m_Aliases->SetColSize( 1, 300 );
m_Aliases->SetColSize( 2, 120 );
if( m_resolver )
{
// prohibit these characters in teh alias names: []{}()%~<>"='`;:.,&?/\|$
// prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
@ -96,8 +103,8 @@ DLG_3D_PATH_CONFIG::DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER
m_Aliases->AutoSize();
}
Fit();
SetMinSize( GetSize() );
GetSizer()->SetSizeHints( this );
Centre();
return;
}
@ -158,7 +165,6 @@ void DLG_3D_PATH_CONFIG::OnAddAlias( wxCommandEvent& event )
}
event.Skip();
return;
}

View File

@ -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!
@ -11,24 +11,27 @@
DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
this->SetSizeHints( wxSize( 600,150 ), wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerGrid;
bSizerGrid = new wxBoxSizer( wxHORIZONTAL );
m_Aliases = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_Aliases->CreateGrid( 1, 3 );
m_Aliases->EnableEditing( true );
m_Aliases->EnableGridLines( true );
m_Aliases->EnableDragGridSize( false );
m_Aliases->SetMargins( 0, 0 );
// Columns
m_Aliases->SetColSize( 0, 80 );
m_Aliases->SetColSize( 1, 300 );
m_Aliases->SetColSize( 2, 120 );
m_Aliases->EnableDragColMove( false );
m_Aliases->EnableDragColSize( true );
m_Aliases->SetColLabelSize( 30 );
@ -36,55 +39,55 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i
m_Aliases->SetColLabelValue( 1, _("Path") );
m_Aliases->SetColLabelValue( 2, _("Description") );
m_Aliases->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_Aliases->AutoSizeRows();
m_Aliases->EnableDragRowSize( false );
m_Aliases->SetRowLabelSize( 80 );
m_Aliases->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_Aliases->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer3->Add( m_Aliases, 1, wxALL|wxEXPAND, 5 );
bSizer1->Add( bSizer3, 1, wxEXPAND, 5 );
bSizerGrid->Add( m_Aliases, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerGrid, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
m_btnAddAlias = new wxButton( this, wxID_ANY, _("Add Alias"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnAddAlias, 0, wxALL, 5 );
bSizerButtons->Add( m_btnAddAlias, 0, wxALL, 5 );
m_btnDelAlias = new wxButton( this, wxID_ANY, _("Remove Alias"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnDelAlias, 0, wxALL, 5 );
bSizerButtons->Add( m_btnDelAlias, 0, wxALL, 5 );
m_btnMoveUp = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnMoveUp, 0, wxALL, 5 );
bSizerButtons->Add( m_btnMoveUp, 0, wxALL, 5 );
m_btnMoveDown = new wxButton( this, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnMoveDown, 0, wxALL, 5 );
bSizerButtons->Add( m_btnMoveDown, 0, wxALL, 5 );
m_btnOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnOK, 0, wxALL, 5 );
bSizerButtons->Add( m_btnOK, 0, wxALL, 5 );
m_btnCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_btnCancel, 0, wxALL, 5 );
bSizer1->Add( bSizer2, 0, wxEXPAND, 5 );
this->SetSizer( bSizer1 );
bSizerButtons->Add( m_btnCancel, 0, wxALL, 5 );
bSizerMain->Add( bSizerButtons, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_btnAddAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAddAlias ), NULL, this );
m_btnDelAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnDelAlias ), NULL, this );
@ -99,5 +102,5 @@ DLG_3D_PATH_CONFIG_BASE::~DLG_3D_PATH_CONFIG_BASE()
m_btnDelAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnDelAlias ), NULL, this );
m_btnMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveUp ), NULL, this );
m_btnMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveDown ), NULL, this );
}

View File

@ -41,10 +41,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">600,150</property>
<property name="name">DLG_3D_PATH_CONFIG_BASE</property>
<property name="pos"></property>
<property name="size">555,144</property>
<property name="size">619,160</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">3D Search Path Configuration</property>
@ -90,7 +90,7 @@
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1</property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
@ -98,8 +98,8 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
<property name="minimum_size">-1,-1</property>
<property name="name">bSizerGrid</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
@ -133,7 +133,7 @@
<property name="col_label_values">&quot;Alias&quot; &quot;Path&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">3</property>
<property name="column_sizes"></property>
<property name="column_sizes">80,300,120</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -164,7 +164,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">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_Aliases</property>
<property name="pane_border">1</property>
@ -330,11 +330,11 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
<property name="name">bSizerButtons</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">

View File

@ -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!
@ -54,7 +54,7 @@ class DLG_3D_PATH_CONFIG_BASE : public DIALOG_SHIM
public:
DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Search Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 555,144 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Search Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 619,160 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DLG_3D_PATH_CONFIG_BASE();
};

View File

@ -64,7 +64,7 @@ DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
initDialog();
SetDefaultItem( (wxWindow*) m_sdbSizerOK );
SetDefaultItem( m_sdbSizerOK );
Layout();
GetSizer()->SetSizeHints( this );
Centre();