diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp index 3589520cdd..ceb85e9b44 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp +++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp @@ -30,6 +30,17 @@ DLG_3D_PATH_CONFIG::DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver ) : DLG_3D_PATH_CONFIG_BASE( aParent ), m_resolver( aResolver ) +{ + initDialog(); + + GetSizer()->SetSizeHints( this ); + Centre(); + + return; +} + + +void DLG_3D_PATH_CONFIG::initDialog() { m_Aliases->EnableEditing( true ); @@ -113,11 +124,6 @@ DLG_3D_PATH_CONFIG::DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER m_Aliases->AutoSize(); } - - GetSizer()->SetSizeHints( this ); - Centre(); - - return; } @@ -320,6 +326,7 @@ void DLG_3D_PATH_CONFIG::updateEnvVars( void ) m_resolver->GetKicadPaths( epaths ); size_t nitems = epaths.size(); size_t nrows = m_EnvVars->GetNumberRows(); + bool resize = nrows != nitems; // true after adding/removing env vars if( nrows > nitems ) { @@ -350,15 +357,20 @@ void DLG_3D_PATH_CONFIG::updateEnvVars( void ) m_EnvVars->AutoSize(); + // Resizing the full dialog is sometimes needed for a clean display + // i.e. when adding/removing Kicad environment variables + if( resize ) + GetSizer()->SetSizeHints( this ); + return; } void DLG_3D_PATH_CONFIG::OnHelp( wxCommandEvent& event ) { - wxString msg = _( "Enter the name and path for each 3D alias variable. KiCad " + wxString msg = _( "Enter the name and path for each 3D alias variable.
KiCad " "environment variables and their values are shown for " - "reference only and cannot be edited. " ); + "reference only and cannot be edited." ); msg << "

"; msg << _( "Alias names may not contain any of the characters " ); msg << "{}[]()%~<>\"='`;:.,&?/\\|$"; diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.h b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.h index e4bfc0b03d..8a29f3ff1b 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.h +++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.h @@ -37,6 +37,8 @@ private: wxString m_curdir; wxTextValidator m_aliasValidator; + void initDialog(); + void OnAddAlias( wxCommandEvent& event ); void OnDelAlias( wxCommandEvent& event ); void OnAliasMoveUp( wxCommandEvent& event ); diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.cpp b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.cpp index 0a86beca19..b4b5f5e812 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.cpp +++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 2 2016) +// C++ code generated with wxFormBuilder (version May 21 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -48,7 +48,16 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i bSizer5->Add( m_EnvVars, 0, wxALL, 5 ); - bSizerMain->Add( bSizer5, 1, wxEXPAND, 5 ); + bSizer5->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_btnEnvCfg = new wxButton( this, wxID_ANY, _("Config Env"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer5->Add( m_btnEnvCfg, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerMain->Add( bSizer5, 0, wxEXPAND, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); wxBoxSizer* bSizerGrid; bSizerGrid = new wxBoxSizer( wxHORIZONTAL ); @@ -89,9 +98,6 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i bSizerMain->Add( bSizerGrid, 1, wxEXPAND, 5 ); - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - wxBoxSizer* bSizerButtons; bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); @@ -107,12 +113,12 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i m_btnMoveDown = new wxButton( this, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButtons->Add( m_btnMoveDown, 0, wxALL, 5 ); - m_btnEnvCfg = new wxButton( this, wxID_ANY, _("Config Env"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_btnEnvCfg, 0, wxALL, 5 ); - bSizerMain->Add( bSizerButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + m_sdbSizer2 = new wxStdDialogButtonSizer(); m_sdbSizer2OK = new wxButton( this, wxID_OK ); m_sdbSizer2->AddButton( m_sdbSizer2OK ); @@ -122,7 +128,7 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i m_sdbSizer2->AddButton( m_sdbSizer2Help ); m_sdbSizer2->Realize(); - bSizerMain->Add( m_sdbSizer2, 1, wxALIGN_CENTER, 5 ); + bSizerMain->Add( m_sdbSizer2, 0, wxALIGN_CENTER|wxALIGN_RIGHT|wxALL, 5 ); this->SetSizer( bSizerMain ); @@ -131,22 +137,22 @@ DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID i this->Centre( wxBOTH ); // Connect Events + m_btnEnvCfg->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this ); 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 ); m_btnMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveUp ), NULL, this ); m_btnMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveDown ), NULL, this ); - m_btnEnvCfg->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this ); m_sdbSizer2Help->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnHelp ), NULL, this ); } DLG_3D_PATH_CONFIG_BASE::~DLG_3D_PATH_CONFIG_BASE() { // Disconnect Events + m_btnEnvCfg->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this ); m_btnAddAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAddAlias ), NULL, this ); 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 ); - m_btnEnvCfg->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this ); m_sdbSizer2Help->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnHelp ), NULL, this ); } diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.fbp b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.fbp index 7f9800ea54..530fc7bee4 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.fbp +++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.fbp @@ -96,7 +96,7 @@ 5 wxEXPAND - 1 + 0 bSizer5 @@ -245,6 +245,185 @@ + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Config Env + + 0 + + + 0 + + 1 + m_btnEnvCfg + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnConfigEnvVar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -401,87 +580,6 @@ - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALIGN_CENTER_HORIZONTAL @@ -843,100 +941,93 @@ - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Config Env - - 0 - - - 0 - - 1 - m_btnEnvCfg - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnConfigEnvVar - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER - 1 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER|wxALIGN_RIGHT|wxALL + 0 0 1 diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.h b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.h index 71ded5ffed..e39e972ccd 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.h +++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 2 2016) +// C++ code generated with wxFormBuilder (version May 21 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -20,9 +20,9 @@ class DIALOG_SHIM; #include #include #include +#include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -37,24 +37,25 @@ class DLG_3D_PATH_CONFIG_BASE : public DIALOG_SHIM protected: wxGrid* m_EnvVars; + wxButton* m_btnEnvCfg; + wxStaticLine* m_staticline2; wxGrid* m_Aliases; - wxStaticLine* m_staticline1; wxButton* m_btnAddAlias; wxButton* m_btnDelAlias; wxButton* m_btnMoveUp; wxButton* m_btnMoveDown; - wxButton* m_btnEnvCfg; + wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer2; wxButton* m_sdbSizer2OK; wxButton* m_sdbSizer2Cancel; wxButton* m_sdbSizer2Help; // Virtual event handlers, overide them in your derived class + virtual void OnConfigEnvVar( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddAlias( wxCommandEvent& event ) { event.Skip(); } virtual void OnDelAlias( wxCommandEvent& event ) { event.Skip(); } virtual void OnAliasMoveUp( wxCommandEvent& event ) { event.Skip(); } virtual void OnAliasMoveDown( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConfigEnvVar( wxCommandEvent& event ) { event.Skip(); } virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 5cc34377aa..57102fbc7b 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -391,7 +391,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() _( "Add footprints" ), KiBitmap( module_xpm ) ); text = AddHotkeyName( _( "&Track" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ADD_NEW_TRACK ); + HK_ADD_NEW_TRACK, IS_ACCELERATOR ); AddMenuItem( placeMenu, ID_TRACK_BUTT, text, _( "Add tracks and vias" ), KiBitmap( add_tracks_xpm ) );