From b90a261d5ce139f24f2783815ddf14c92a652e2b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 19 Aug 2018 17:10:14 +0100 Subject: [PATCH] More safety fixes for uncommitted grid changes. --- common/dialogs/dialog_configure_paths.cpp | 40 +- .../dialogs/dialog_configure_paths_base.cpp | 20 +- .../dialogs/dialog_configure_paths_base.fbp | 2170 ++++++++--------- common/dialogs/dialog_configure_paths_base.h | 10 +- common/widgets/wx_grid.cpp | 20 +- common/widgets/wx_grid.h | 10 +- .../dialogs/dialog_fields_editor_global.cpp | 11 +- .../dialog_fields_editor_global_base.cpp | 6 +- .../dialog_fields_editor_global_base.fbp | 2078 ++++++++-------- .../dialog_fields_editor_global_base.h | 8 +- .../dialogs/dialog_lib_edit_pin_table.cpp | 15 +- .../panel_eeschema_template_fieldnames.cpp | 15 +- eeschema/dialogs/panel_sym_lib_table.cpp | 17 +- eeschema/dialogs/panel_sym_lib_table.h | 2 +- eeschema/dialogs/panel_sym_lib_table_base.cpp | 8 +- eeschema/dialogs/panel_sym_lib_table_base.fbp | 6 +- eeschema/dialogs/panel_sym_lib_table_base.h | 8 +- .../dialog_edit_footprint_for_fp_editor.cpp | 38 +- ...alog_edit_footprint_for_fp_editor_base.cpp | 2 +- ...alog_edit_footprint_for_fp_editor_base.fbp | 2 +- ...dialog_edit_footprint_for_fp_editor_base.h | 2 +- pcbnew/dialogs/dialog_fp_plugin_options.cpp | 14 +- .../dialogs/dialog_fp_plugin_options_base.cpp | 4 +- .../dialogs/dialog_fp_plugin_options_base.fbp | 2 +- .../dialogs/dialog_fp_plugin_options_base.h | 4 +- .../dialog_pad_basicshapes_properties.cpp | 14 +- pcbnew/dialogs/dialog_pad_properties_base.cpp | 5 +- pcbnew/dialogs/dialog_pad_properties_base.fbp | 1385 +---------- pcbnew/dialogs/dialog_pad_properties_base.h | 5 +- pcbnew/dialogs/dialog_swap_layers.cpp | 4 +- pcbnew/dialogs/panel_fp_lib_table.cpp | 20 +- pcbnew/dialogs/panel_fp_lib_table.h | 3 +- pcbnew/dialogs/panel_fp_lib_table_base.cpp | 8 +- pcbnew/dialogs/panel_fp_lib_table_base.fbp | 6 +- pcbnew/dialogs/panel_fp_lib_table_base.h | 8 +- pcbnew/dialogs/panel_modedit_defaults.cpp | 4 +- pcbnew/dialogs/panel_setup_netclasses.cpp | 24 +- .../dialogs/panel_setup_text_and_graphics.cpp | 7 +- .../dialogs/panel_setup_tracks_and_vias.cpp | 12 +- 39 files changed, 2298 insertions(+), 3719 deletions(-) diff --git a/common/dialogs/dialog_configure_paths.cpp b/common/dialogs/dialog_configure_paths.cpp index b72a47053c..63fdb65239 100644 --- a/common/dialogs/dialog_configure_paths.cpp +++ b/common/dialogs/dialog_configure_paths.cpp @@ -29,6 +29,7 @@ #include #include #include +#include enum ENV_VAR_GRID_COLUMNS @@ -184,12 +185,11 @@ void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxSt bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow() { - if( !wxDialog::TransferDataFromWindow() ) + if( !m_EnvVars->CommitPendingChanges() || !m_SearchPaths->CommitPendingChanges() ) return false; - // Commit any pending in-place edits and close the editor - m_EnvVars->DisableCellEditControl(); - m_SearchPaths->DisableCellEditControl(); + if( !wxDialog::TransferDataFromWindow() ) + return false; // Environment variables @@ -320,6 +320,9 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellChanging( wxGridEvent& event ) void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event ) { + if( !m_EnvVars->CommitPendingChanges() ) + return; + AppendEnvVar( wxEmptyString, wxEmptyString, false ); m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL ); @@ -332,6 +335,9 @@ void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event ) void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event ) { + if( !m_SearchPaths->CommitPendingChanges() ) + return; + AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString); m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL ); @@ -344,6 +350,9 @@ void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event ) void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event ) { + if( !m_EnvVars->CommitPendingChanges() ) + return; + int curRow = m_EnvVars->GetGridCursorRow(); if( !m_EnvVars->HasFocus() || curRow < 0 ) @@ -360,14 +369,16 @@ void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event ) m_EnvVars->DeleteRows( curRow, 1 ); - curRow = std::max( 0, curRow - 1 ); - m_EnvVars->MakeCellVisible( curRow, m_EnvVars->GetGridCursorCol() ); - m_EnvVars->SetGridCursor( curRow, m_EnvVars->GetGridCursorCol() ); + m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() ); + m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() ); } void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event ) { + if( !m_SearchPaths->CommitPendingChanges() ) + return; + int curRow = m_SearchPaths->GetGridCursorRow(); if( !m_SearchPaths->HasFocus() || curRow < 0 ) @@ -378,19 +389,19 @@ void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event ) m_SearchPaths->DeleteRows( curRow, 1 ); - curRow = std::max( 0, curRow - 1 ); - m_SearchPaths->MakeCellVisible( curRow, m_SearchPaths->GetGridCursorCol() ); - m_SearchPaths->SetGridCursor( curRow, m_SearchPaths->GetGridCursorCol() ); + m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() ); + m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() ); } void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event ) { + if( !m_SearchPaths->CommitPendingChanges() ) + return; + int curRow = m_SearchPaths->GetGridCursorRow(); int prevRow = curRow - 1; - m_SearchPaths->DisableCellEditControl(); - if( curRow > 0 ) { for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i ) @@ -407,11 +418,12 @@ void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event ) void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event ) { + if( !m_SearchPaths->CommitPendingChanges() ) + return; + int curRow = m_SearchPaths->GetGridCursorRow(); int nextRow = curRow + 1; - m_SearchPaths->DisableCellEditControl(); - if( curRow < m_SearchPaths->GetNumberRows() - 1 ) { for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i ) diff --git a/common/dialogs/dialog_configure_paths_base.cpp b/common/dialogs/dialog_configure_paths_base.cpp index f8d88a477c..ce98381be8 100644 --- a/common/dialogs/dialog_configure_paths_base.cpp +++ b/common/dialogs/dialog_configure_paths_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "dialog_configure_paths_base.h" /////////////////////////////////////////////////////////////////////////// @@ -19,7 +21,7 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi wxStaticBoxSizer* sbEnvVars; sbEnvVars = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Environment Variables") ), wxVERTICAL ); - m_EnvVars = new wxGrid( sbEnvVars->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_EnvVars = new WX_GRID( sbEnvVars->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_EnvVars->CreateGrid( 1, 2 ); @@ -54,7 +56,7 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi wxBoxSizer* bSizerEnvVarBtns; bSizerEnvVarBtns = new wxBoxSizer( wxHORIZONTAL ); - m_btnAddEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnAddEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnAddEnvVar->SetMinSize( wxSize( 30,29 ) ); bSizerEnvVarBtns->Add( m_btnAddEnvVar, 0, wxRIGHT, 5 ); @@ -62,7 +64,7 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi bSizerEnvVarBtns->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_btnDeleteEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnDeleteEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnDeleteEnvVar->SetMinSize( wxSize( 30,29 ) ); bSizerEnvVarBtns->Add( m_btnDeleteEnvVar, 0, wxRIGHT|wxLEFT, 5 ); @@ -75,7 +77,7 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi m_sb3DSearchPaths = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("3D Search Paths") ), wxVERTICAL ); - m_SearchPaths = new wxGrid( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_SearchPaths = new WX_GRID( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_SearchPaths->CreateGrid( 1, 3 ); @@ -113,17 +115,17 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi wxBoxSizer* bSizerSearchPathBtns; bSizerSearchPathBtns = new wxBoxSizer( wxHORIZONTAL ); - m_btnAddSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnAddSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnAddSearchPath->SetMinSize( wxSize( 30,29 ) ); bSizerSearchPathBtns->Add( m_btnAddSearchPath, 0, wxRIGHT, 5 ); - m_btnMoveUp = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnMoveUp = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnMoveUp->SetMinSize( wxSize( 30,29 ) ); bSizerSearchPathBtns->Add( m_btnMoveUp, 0, wxRIGHT, 5 ); - m_btnMoveDown = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnMoveDown = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnMoveDown->SetMinSize( wxSize( 30,29 ) ); bSizerSearchPathBtns->Add( m_btnMoveDown, 0, wxRIGHT, 5 ); @@ -131,7 +133,7 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi bSizerSearchPathBtns->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_btnDeleteSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnDeleteSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_btnDeleteSearchPath->SetMinSize( wxSize( 30,29 ) ); bSizerSearchPathBtns->Add( m_btnDeleteSearchPath, 0, wxRIGHT|wxLEFT, 5 ); diff --git a/common/dialogs/dialog_configure_paths_base.fbp b/common/dialogs/dialog_configure_paths_base.fbp index a389d7997b..44ba68899f 100644 --- a/common/dialogs/dialog_configure_paths_base.fbp +++ b/common/dialogs/dialog_configure_paths_base.fbp @@ -1,1129 +1,1041 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_configure_paths_base - 1000 - none - - 1 - DIALOG_CONFIGURE_PATHS_BASE - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - -1,-1 - DIALOG_CONFIGURE_PATHS_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Configure Paths - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 1 - - wxID_ANY - Environment Variables - - sbEnvVars - wxVERTICAL - 1 - none - - - 5 - wxEXPAND|wxBOTTOM - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Name" "Path" - wxALIGN_CENTRE - 2 - 150,454 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - 604,150 - 1 - m_EnvVars - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - - - - - - - OnGridCellChange - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnGridSize - OnUpdateUI - - - - 5 - wxEXPAND - 0 - - - bSizerEnvVarBtns - wxHORIZONTAL - none - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Environment Variable - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnAddEnvVar - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnAddEnvVar - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - protected - 0 - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Delete Environment Variable - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnDeleteEnvVar - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnRemoveEnvVar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 1 - - wxID_ANY - 3D Search Paths - - m_sb3DSearchPaths - wxVERTICAL - 1 - protected - - - 5 - wxEXPAND|wxBOTTOM - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 1 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Alias" "Path" "Description" - wxALIGN_CENTRE - 3 - 150,300,154 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 0 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - 604,150 - 1 - m_SearchPaths - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - - - - - - - OnGridCellChange - - - OnGridCellRightClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnUpdateUI - - - - 5 - wxEXPAND - 0 - - - bSizerSearchPathBtns - wxHORIZONTAL - none - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Path - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnAddSearchPath - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnAddSearchPath - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Up - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnMoveUp - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnSearchPathMoveUp - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Down - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnMoveDown - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnSearchPathMoveDown - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - protected - 0 - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Delete Path - - 0 - - 0 - - - 0 - 30,29 - 1 - m_btnDeleteSearchPath - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnDeleteSearchPath - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 1 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - - - - OnHelp - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_configure_paths_base + 1000 + none + 1 + DIALOG_CONFIGURE_PATHS_BASE + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + -1,-1 + DIALOG_CONFIGURE_PATHS_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Configure Paths + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Environment Variables + + sbEnvVars + wxVERTICAL + 1 + none + + + 5 + wxEXPAND|wxBOTTOM + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Name" "Path" + wxALIGN_CENTRE + 2 + 150,454 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + 604,150 + 1 + m_EnvVars + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + OnGridCellChange + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnGridSize + OnUpdateUI + + + + 5 + wxEXPAND + 0 + + + bSizerEnvVarBtns + wxHORIZONTAL + none + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Environment Variable + + 0 + + + 0 + 30,29 + 1 + m_btnAddEnvVar + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddEnvVar + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Environment Variable + + 0 + + + 0 + 30,29 + 1 + m_btnDeleteEnvVar + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveEnvVar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + wxID_ANY + 3D Search Paths + + m_sb3DSearchPaths + wxVERTICAL + 1 + protected + + + 5 + wxEXPAND|wxBOTTOM + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 1 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Alias" "Path" "Description" + wxALIGN_CENTRE + 3 + 150,300,154 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + 604,150 + 1 + m_SearchPaths + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 1 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + OnGridCellChange + + + OnGridCellRightClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateUI + + + + 5 + wxEXPAND + 0 + + + bSizerSearchPathBtns + wxHORIZONTAL + none + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Path + + 0 + + + 0 + 30,29 + 1 + m_btnAddSearchPath + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddSearchPath + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Up + + 0 + + + 0 + 30,29 + 1 + m_btnMoveUp + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSearchPathMoveUp + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Down + + 0 + + + 0 + 30,29 + 1 + m_btnMoveDown + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSearchPathMoveDown + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Path + + 0 + + + 0 + 30,29 + 1 + m_btnDeleteSearchPath + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteSearchPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + OnHelp + + + + + + + + + + diff --git a/common/dialogs/dialog_configure_paths_base.h b/common/dialogs/dialog_configure_paths_base.h index 8edc086194..1d9a4eb7a6 100644 --- a/common/dialogs/dialog_configure_paths_base.h +++ b/common/dialogs/dialog_configure_paths_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class WX_GRID; + #include "dialog_shim.h" #include #include @@ -18,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -38,11 +40,11 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM private: protected: - wxGrid* m_EnvVars; + WX_GRID* m_EnvVars; wxBitmapButton* m_btnAddEnvVar; wxBitmapButton* m_btnDeleteEnvVar; wxStaticBoxSizer* m_sb3DSearchPaths; - wxGrid* m_SearchPaths; + WX_GRID* m_SearchPaths; wxBitmapButton* m_btnAddSearchPath; wxBitmapButton* m_btnMoveUp; wxBitmapButton* m_btnMoveDown; diff --git a/common/widgets/wx_grid.cpp b/common/widgets/wx_grid.cpp index 5868cbb6be..e9f309d15a 100644 --- a/common/widgets/wx_grid.cpp +++ b/common/widgets/wx_grid.cpp @@ -29,7 +29,21 @@ #define MIN_GRIDCELL_MARGIN 3 -void WX_GRID::SetTable( wxGridTableBase* aTable ) +WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) : + wxGrid( parent, id, pos, size, style, name ), + m_weOwnTable( false ) +{} + + +WX_GRID::~WX_GRID() +{ + if( m_weOwnTable ) + DestroyTable( GetTable() ); +} + + +void WX_GRID::SetTable( wxGridTableBase* aTable, bool aTakeOwnership ) { // wxGrid::SetTable() messes up the column widths from wxFormBuilder so we have to save // and restore them. @@ -49,6 +63,8 @@ void WX_GRID::SetTable( wxGridTableBase* aTable ) } delete[] formBuilderColWidths; + + m_weOwnTable = aTakeOwnership; } @@ -56,7 +72,7 @@ void WX_GRID::DestroyTable( wxGridTableBase* aTable ) { // wxGrid's destructor will crash trying to look up the cell attr if the edit control // is left open. Normally it's closed in Validate(), but not if the user hit Cancel. - DisableCellEditControl(); + CommitPendingChanges( true /* quiet mode */ ); wxGrid::SetTable( nullptr ); delete aTable; diff --git a/common/widgets/wx_grid.h b/common/widgets/wx_grid.h index 11703e77a1..c5d84ab098 100644 --- a/common/widgets/wx_grid.h +++ b/common/widgets/wx_grid.h @@ -33,9 +33,9 @@ public: // Constructor has to be wxFormBuilder-compatible WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr ) : - wxGrid( parent, id, pos, size, style, name ) - {} + long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr ); + + ~WX_GRID() override; /** * Get a tokenized string containing the shown column indexes. @@ -52,7 +52,7 @@ public: * Hide wxGrid's SetTable() method with one which doesn't mess up the grid column * widths when setting the table. */ - void SetTable( wxGridTableBase* table ); + void SetTable( wxGridTableBase* table, bool aTakeOwnership = false ); /** * Work-around for a bug in wxGrid which crashes when deleting the table if the @@ -69,6 +69,8 @@ public: protected: void DrawColLabel( wxDC& dc, int col ) override; + + bool m_weOwnTable; }; #endif //KICAD_WX_GRID_H diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index e99c7f9716..2cb33700f3 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -423,7 +424,7 @@ public: { // Commit any pending in-place edits before the row gets moved out from under // the editor. - GetView()->DisableCellEditControl(); + dynamic_cast( GetView() )->CommitPendingChanges( true ); wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, m_rows.size() ); GetView()->ProcessTableMessage( msg ); @@ -722,8 +723,8 @@ DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL() bool DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataFromWindow() { - // Commit any pending in-place edits and close the editor - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; if( !wxDialog::TransferDataFromWindow() ) return false; @@ -974,8 +975,8 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnCancel( wxCommandEvent& event ) void DIALOG_FIELDS_EDITOR_GLOBAL::OnClose( wxCloseEvent& event ) { - // Commit any pending in-place edits and close the editor - m_grid->DisableCellEditControl(); + // This is a cancel, so commit quietly as we're going to throw the results away anyway. + m_grid->CommitPendingChanges( true ); if( m_dataModel->IsEdited() ) { diff --git a/eeschema/dialogs/dialog_fields_editor_global_base.cpp b/eeschema/dialogs/dialog_fields_editor_global_base.cpp index b28dd8bcc3..8263c041c5 100644 --- a/eeschema/dialogs/dialog_fields_editor_global_base.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "dialog_fields_editor_global_base.h" /////////////////////////////////////////////////////////////////////////// @@ -59,7 +61,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE( wxWindow* pa wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - m_grid = new wxGrid( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_grid = new WX_GRID( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_grid->CreateGrid( 5, 5 ); diff --git a/eeschema/dialogs/dialog_fields_editor_global_base.fbp b/eeschema/dialogs/dialog_fields_editor_global_base.fbp index be47657324..fad245ecf5 100644 --- a/eeschema/dialogs/dialog_fields_editor_global_base.fbp +++ b/eeschema/dialogs/dialog_fields_editor_global_base.fbp @@ -1,1087 +1,991 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_fields_editor_global_base - 1000 - none - - 1 - dialog_fields_editor_global_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - -1,-1 - DIALOG_FIELDS_EDITOR_GLOBAL_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Symbol Fields - - - - - - - - - - - - - - - - - - - - - OnClose - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1,-1 - bMainSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 200 - - 0 - -1,-1 - 1 - m_splitter1 - 1 - - - protected - 1 - - Resizable - 0.0 - -1 - -1 - 1 - - wxSPLIT_VERTICAL - wxSP_LIVE_UPDATE - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_leftPanel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bLeftSizer - wxVERTICAL - none - - 2 - wxALL|wxBOTTOM|wxEXPAND|wxTOP - 0 - - - bGroupSizer - wxHORIZONTAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - OPT_GROUP_COMPONENTS - Group symbols - - 0 - - - 0 - - 1 - m_groupComponentsBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Group components together based on common properties - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - OnGroupComponentsToggled - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Refresh Grouping - - 0 - - 0 - - - 0 - 30,30 - 1 - m_bRefresh - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnRegroupComponents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - - - 1 - 1 - - - 0 - wxID_ANY - - -1,220 - m_fieldsCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnColumnItemToggled - - - - - - - - - - - - - - - - - - - - - - OnSizeFieldList - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Field... - - 0 - - 0 - - - 0 - - 1 - m_addFieldButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnAddField - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_panel4 - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bRightSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 20 - - wxALIGN_CENTRE - 5 - - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 0 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - 400,240 - 1 - m_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 5 - 1 - - ; forward_declare - 0 - - - - - - - - - - - - - - - OnTableValueChanged - OnTableCellClick - OnTableCellClick - OnTableItemContextMenu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bButtonsSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Apply, Save Schematic && Continue - - 0 - - 0 - - - 0 - - 1 - m_button1 - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnSaveAndContinue - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected - - OnCancel - - - - - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_fields_editor_global_base + 1000 + none + 1 + dialog_fields_editor_global_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + -1,-1 + DIALOG_FIELDS_EDITOR_GLOBAL_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Symbol Fields + + + + + + + + + + + + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1,-1 + bMainSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 200 + + 0 + -1,-1 + 1 + m_splitter1 + 1 + + + protected + 1 + + Resizable + 0.0 + -1 + -1 + 1 + + wxSPLIT_VERTICAL + wxSP_LIVE_UPDATE + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_leftPanel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bLeftSizer + wxVERTICAL + none + + 2 + wxALL|wxBOTTOM|wxEXPAND|wxTOP + 0 + + + bGroupSizer + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + OPT_GROUP_COMPONENTS + Group symbols + + 0 + + + 0 + + 1 + m_groupComponentsBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Group components together based on common properties + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnGroupComponentsToggled + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Refresh Grouping + + 0 + + + 0 + 30,30 + 1 + m_bRefresh + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRegroupComponents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + 1 + + + 0 + wxID_ANY + + -1,220 + m_fieldsCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + OnColumnItemToggled + + + + + + + + + + + + + + + + + + + + + + OnSizeFieldList + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Add Field... + + 0 + + + 0 + + 1 + m_addFieldButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddField + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel4 + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bRightSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 20 + + wxALIGN_CENTRE + 5 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + 400,240 + 1 + m_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 5 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + OnTableValueChanged + OnTableCellClick + OnTableCellClick + OnTableItemContextMenu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bButtonsSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Apply, Save Schematic && Continue + + 0 + + + 0 + + 1 + m_button1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSaveAndContinue + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancel + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_fields_editor_global_base.h b/eeschema/dialogs/dialog_fields_editor_global_base.h index 02515b7100..c2162a60a9 100644 --- a/eeschema/dialogs/dialog_fields_editor_global_base.h +++ b/eeschema/dialogs/dialog_fields_editor_global_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class WX_GRID; + #include "dialog_shim.h" #include #include @@ -18,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -49,7 +51,7 @@ class DIALOG_FIELDS_EDITOR_GLOBAL_BASE : public DIALOG_SHIM wxDataViewListCtrl* m_fieldsCtrl; wxButton* m_addFieldButton; wxPanel* m_panel4; - wxGrid* m_grid; + WX_GRID* m_grid; wxButton* m_button1; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 3cd4112def..49977cf2fc 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -246,7 +246,7 @@ public: { // Commit any pending in-place edits before the row gets moved out from under // the editor. - GetView()->DisableCellEditControl(); + dynamic_cast( GetView() )->CommitPendingChanges( true ); wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, m_rows.size() ); GetView()->ProcessTableMessage( msg ); @@ -448,8 +448,8 @@ bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow() bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow() { - // Commit any pending in-place edits and close the editor - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; // Delete the part's pins while( LIB_PIN* pin = m_part->GetNextPin( nullptr ) ) @@ -488,6 +488,9 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnColSort( wxGridEvent& aEvent ) void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + m_pins.push_back( new LIB_PIN( nullptr ) ); m_dataModel->AppendRow( m_pins[ m_pins.size() - 1 ] ); @@ -504,6 +507,9 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event ) void DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int curRow = m_grid->GetGridCursorRow(); if( curRow < 0 ) @@ -530,6 +536,9 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnCellEdited( wxGridEvent& event ) void DIALOG_LIB_EDIT_PIN_TABLE::OnRebuildRows( wxCommandEvent& ) { + if( !m_grid->CommitPendingChanges() ) + return; + m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() ); adjustGridColumns( m_grid->GetRect().GetWidth() ); diff --git a/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp b/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp index fa2e0ade6f..f27a775d8e 100644 --- a/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp +++ b/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp @@ -62,6 +62,9 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToWindow() void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnAddButtonClick( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int row = m_grid->GetNumberRows(); TransferDataFromGrid(); @@ -78,6 +81,9 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnAddButtonClick( wxCommandEvent& event void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int curRow = m_grid->GetGridCursorRow(); if( curRow >= 0 ) @@ -86,9 +92,8 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& ev m_grid->DeleteRows( curRow ); } - curRow = std::max( 0, curRow - 1 ); - m_grid->MakeCellVisible( curRow, m_grid->GetGridCursorCol() ); - m_grid->SetGridCursor( curRow, m_grid->GetGridCursorCol() ); + m_grid->MakeCellVisible( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); + m_grid->SetGridCursor( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); } @@ -128,8 +133,8 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToGrid() bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromGrid() { - // Commit any pending edits - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; for( int row = 0; row < m_grid->GetNumberRows(); ++row ) { diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index dbb0967b32..967eebb083 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -417,6 +418,9 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) void PANEL_SYM_LIB_TABLE::appendRowHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + if( m_cur_grid->AppendRows( 1 ) ) { int row = m_cur_grid->GetNumberRows() - 1; @@ -435,6 +439,9 @@ void PANEL_SYM_LIB_TABLE::appendRowHandler( wxCommandEvent& event ) void PANEL_SYM_LIB_TABLE::deleteRowHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + int curRow = m_cur_grid->GetGridCursorRow(); int curCol = m_cur_grid->GetGridCursorCol(); @@ -485,6 +492,9 @@ void PANEL_SYM_LIB_TABLE::deleteRowHandler( wxCommandEvent& event ) void PANEL_SYM_LIB_TABLE::moveUpHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + SYMBOL_LIB_TABLE_GRID* tbl = cur_model(); int curRow = m_cur_grid->GetGridCursorRow(); @@ -512,6 +522,9 @@ void PANEL_SYM_LIB_TABLE::moveUpHandler( wxCommandEvent& event ) void PANEL_SYM_LIB_TABLE::moveDownHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + SYMBOL_LIB_TABLE_GRID* tbl = cur_model(); int curRow = m_cur_grid->GetGridCursorRow(); @@ -539,8 +552,8 @@ void PANEL_SYM_LIB_TABLE::moveDownHandler( wxCommandEvent& event ) bool PANEL_SYM_LIB_TABLE::TransferDataFromWindow() { - // Commit any pending in-place edits and close the editor - m_cur_grid->DisableCellEditControl(); + if( !m_cur_grid->CommitPendingChanges() ) + return false; if( !verifyTables() ) return false; diff --git a/eeschema/dialogs/panel_sym_lib_table.h b/eeschema/dialogs/panel_sym_lib_table.h index 9fbc98cc7f..0a235812cc 100644 --- a/eeschema/dialogs/panel_sym_lib_table.h +++ b/eeschema/dialogs/panel_sym_lib_table.h @@ -77,7 +77,7 @@ private: DIALOG_EDIT_LIBRARY_TABLES* m_parent; - wxGrid* m_cur_grid; ///< changed based on tab choice + WX_GRID* m_cur_grid; ///< changed based on tab choice static size_t m_pageNdx; ///< Remember the last notebook page selected during a session wxString m_lastBrowseDir; ///< last browsed directory }; diff --git a/eeschema/dialogs/panel_sym_lib_table_base.cpp b/eeschema/dialogs/panel_sym_lib_table_base.cpp index 2562326f19..a833024593 100644 --- a/eeschema/dialogs/panel_sym_lib_table_base.cpp +++ b/eeschema/dialogs/panel_sym_lib_table_base.cpp @@ -5,6 +5,8 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "panel_sym_lib_table_base.h" /////////////////////////////////////////////////////////////////////////// @@ -40,7 +42,7 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID m_global_sizer->Add( fgSizer1, 0, wxEXPAND, 2 ); - m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_global_grid = new WX_GRID( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_global_grid->CreateGrid( 1, 5 ); @@ -93,7 +95,7 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID m_project_sizer->Add( fgSizer2, 0, wxEXPAND, 5 ); - m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_project_grid = new WX_GRID( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_project_grid->CreateGrid( 1, 5 ); @@ -158,7 +160,7 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path Substitutions:") ), wxVERTICAL ); - m_path_subs_grid = new wxGrid( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_path_subs_grid = new WX_GRID( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_path_subs_grid->CreateGrid( 1, 2 ); diff --git a/eeschema/dialogs/panel_sym_lib_table_base.fbp b/eeschema/dialogs/panel_sym_lib_table_base.fbp index a280031118..54d52db6ae 100644 --- a/eeschema/dialogs/panel_sym_lib_table_base.fbp +++ b/eeschema/dialogs/panel_sym_lib_table_base.fbp @@ -533,7 +533,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 @@ -946,7 +946,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 @@ -1595,7 +1595,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 This is a read-only table which shows pertinent environment variables. diff --git a/eeschema/dialogs/panel_sym_lib_table_base.h b/eeschema/dialogs/panel_sym_lib_table_base.h index c2f0bb280c..a63ed46060 100644 --- a/eeschema/dialogs/panel_sym_lib_table_base.h +++ b/eeschema/dialogs/panel_sym_lib_table_base.h @@ -11,6 +11,8 @@ #include #include #include +class WX_GRID; + #include #include #include @@ -43,17 +45,17 @@ class PANEL_SYM_LIB_TABLE_BASE : public wxPanel wxPanel* m_global_panel; wxStaticText* m_staticText3; wxStaticText* m_GblTableFilename; - wxGrid* m_global_grid; + WX_GRID* m_global_grid; wxPanel* m_project_panel; wxStaticText* m_staticText4; wxStaticText* m_PrjTableFilename; - wxGrid* m_project_grid; + WX_GRID* m_project_grid; wxBitmapButton* m_append_button; wxBitmapButton* m_browse_button; wxBitmapButton* m_move_up_button; wxBitmapButton* m_move_down_button; wxBitmapButton* m_delete_button; - wxGrid* m_path_subs_grid; + WX_GRID* m_path_subs_grid; // Virtual event handlers, overide them in your derived class virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp index 5dfd2c2936..97928ac33c 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp @@ -357,6 +357,9 @@ void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent ) void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel( wxCommandEvent& ) { + if( !m_modelsGrid->CommitPendingChanges() ) + return; + int idx = m_modelsGrid->GetGridCursorRow(); if( idx >= 0 ) @@ -364,7 +367,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel( wxCommandEvent& ) m_shapes3D_list.erase( m_shapes3D_list.begin() + idx ); m_modelsGrid->DeleteRows( idx ); - select3DModel( idx ); // will clamp idx within bounds + select3DModel( idx-1 ); // will clamp idx within bounds m_PreviewPane->UpdateDummyModule(); } } @@ -372,6 +375,9 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel( wxCommandEvent& ) void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& ) { + if( !m_modelsGrid->CommitPendingChanges() ) + return; + PROJECT& prj = Prj(); MODULE_3D_SETTINGS model; @@ -432,6 +438,9 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& ) void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow( wxCommandEvent& ) { + if( !m_modelsGrid->CommitPendingChanges() ) + return; + MODULE_3D_SETTINGS model; model.m_Preview = true; @@ -452,8 +461,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow( wxCommandEvent& ) bool DIALOG_FOOTPRINT_FP_EDITOR::Validate() { - // Commit any pending in-place edits and close the editor - m_itemsGrid->DisableCellEditControl(); + if( !m_itemsGrid->CommitPendingChanges() ) + return false; if( !DIALOG_SHIM::Validate() ) return false; @@ -600,6 +609,9 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow() void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField( wxCommandEvent& event ) { + if( !m_itemsGrid->CommitPendingChanges() ) + return; + const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings(); TEXTE_MODULE textMod( m_footprint ); @@ -630,29 +642,29 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField( wxCommandEvent& event ) void DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField( wxCommandEvent& event ) { - int rowCount = m_itemsGrid->GetNumberRows(); - int curRow = m_itemsGrid->GetGridCursorRow(); - - if( curRow < 0 || curRow >= (int) m_texts->size() ) + if( !m_itemsGrid->CommitPendingChanges() ) return; - if( curRow < 2 ) + int curRow = m_itemsGrid->GetGridCursorRow(); + + if( curRow < 0 ) + return; + else if( curRow < 2 ) { DisplayError( nullptr, _( "Reference and value are mandatory." ) ); return; } - auto start = m_texts->begin() + curRow; - m_texts->erase( start, start + 1 ); + m_texts->erase( m_texts->begin() + curRow ); // notify the grid wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 ); m_itemsGrid->ProcessTableMessage( msg ); - if( curRow == rowCount - 1 ) + if( m_itemsGrid->GetNumberRows() > 0 ) { - m_itemsGrid->MakeCellVisible( curRow-1, m_itemsGrid->GetGridCursorCol() ); - m_itemsGrid->SetGridCursor( curRow-1, m_itemsGrid->GetGridCursorCol() ); + m_itemsGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() ); + m_itemsGrid->SetGridCursor( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() ); } } diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp index d03a60b6d9..6627af0284 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp @@ -313,7 +313,7 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_Panel3D, wxID_ANY, wxEmptyString ), wxVERTICAL ); - m_modelsGrid = new wxGrid( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER ); + m_modelsGrid = new WX_GRID( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER ); // Grid m_modelsGrid->CreateGrid( 3, 2 ); diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp index e267751d15..b47b1ece47 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp @@ -3627,7 +3627,7 @@ 3 1 - ; forward_declare + WX_GRID; widgets/wx_grid.h; forward_declare 0 diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h index f83a6c1b25..aeab93a8e0 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h @@ -89,7 +89,7 @@ class DIALOG_FOOTPRINT_FP_EDITOR_BASE : public DIALOG_SHIM wxChoice* m_ZoneConnectionChoice; wxPanel* m_Panel3D; wxBoxSizer* bSizerMain3D; - wxGrid* m_modelsGrid; + WX_GRID* m_modelsGrid; wxBitmapButton* m_button3DShapeAdd; wxBitmapButton* m_button3DShapeBrowse; wxBitmapButton* m_button3DShapeRemove; diff --git a/pcbnew/dialogs/dialog_fp_plugin_options.cpp b/pcbnew/dialogs/dialog_fp_plugin_options.cpp index 41f6601efe..028a87c4d5 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options.cpp +++ b/pcbnew/dialogs/dialog_fp_plugin_options.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -129,8 +130,8 @@ public: bool TransferDataFromWindow() override { - // Write any active editors into the grid - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; if( !DIALOG_SHIM::TransferDataFromWindow() ) return false; @@ -223,16 +224,25 @@ private: void onAppendOption( wxCommandEvent& ) override { + if( !m_grid->CommitPendingChanges() ) + return; + appendOption(); } void onAppendRow( wxCommandEvent& ) override { + if( !m_grid->CommitPendingChanges() ) + return; + appendRow(); } void onDeleteRow( wxCommandEvent& ) override { + if( !m_grid->CommitPendingChanges() ) + return; + if( !m_grid->HasFocus() ) { m_grid->SetFocus(); diff --git a/pcbnew/dialogs/dialog_fp_plugin_options_base.cpp b/pcbnew/dialogs/dialog_fp_plugin_options_base.cpp index cea1d86f49..e0fe0c99b6 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options_base.cpp +++ b/pcbnew/dialogs/dialog_fp_plugin_options_base.cpp @@ -5,6 +5,8 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "dialog_fp_plugin_options_base.h" /////////////////////////////////////////////////////////////////////////// @@ -23,7 +25,7 @@ DIALOG_FP_PLUGIN_OPTIONS_BASE::DIALOG_FP_PLUGIN_OPTIONS_BASE( wxWindow* parent, m_grid_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Plugin Options") ), wxVERTICAL ); m_grid_sizer->SetMinSize( wxSize( 400,300 ) ); - m_grid = new wxGrid( m_grid_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxVSCROLL ); + m_grid = new WX_GRID( m_grid_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxVSCROLL ); // Grid m_grid->CreateGrid( 1, 2 ); diff --git a/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp b/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp index 2889de154f..14d8b84ac0 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp +++ b/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp @@ -195,7 +195,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 diff --git a/pcbnew/dialogs/dialog_fp_plugin_options_base.h b/pcbnew/dialogs/dialog_fp_plugin_options_base.h index 58a8c7b5eb..eef74a8f18 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options_base.h +++ b/pcbnew/dialogs/dialog_fp_plugin_options_base.h @@ -11,6 +11,8 @@ #include #include #include +class WX_GRID; + #include "dialog_shim.h" #include #include @@ -40,7 +42,7 @@ class DIALOG_FP_PLUGIN_OPTIONS_BASE : public DIALOG_SHIM private: protected: - wxGrid* m_grid; + WX_GRID* m_grid; wxBitmapButton* m_append_button; wxBitmapButton* m_delete_button; wxListBox* m_listbox; diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index d29150ff0d..1bf2d52439 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -37,7 +37,7 @@ #include #include #include - +#include #include #include @@ -264,8 +264,8 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::Validate() // test for a valid polygon (a not self intersectiong polygon) bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners ) { - // Commit any pending edits - m_gridCornersList->DisableCellEditControl(); + if( !m_gridCornersList->CommitPendingChanges() ) + return false; if( m_currshape.m_Poly.size() < 3 ) { @@ -324,8 +324,8 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners ) void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event ) { - // Commit any pending edits - m_gridCornersList->DisableCellEditControl(); + if( !m_gridCornersList->CommitPendingChanges() ) + return; // Insert a new corner after the currently selected: wxArrayInt selections = m_gridCornersList->GetSelectedRows(); @@ -361,8 +361,8 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event ) void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonDelete( wxCommandEvent& event ) { - // Commit any pending edits - m_gridCornersList->DisableCellEditControl(); + if( !m_gridCornersList->CommitPendingChanges() ) + return; wxArrayInt selections = m_gridCornersList->GetSelectedRows(); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index df5be9768d..90942a3d22 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -1,11 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "widgets/text_ctrl_eval.h" +#include "widgets/wx_grid.h" #include "dialog_pad_properties_base.h" @@ -1079,7 +1080,7 @@ DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE::DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE( wxWi wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - m_gridCornersList = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE ); + m_gridCornersList = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE ); // Grid m_gridCornersList->CreateGrid( 1, 2 ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index 0bed69208e..311a3acd0e 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,7 +14,6 @@ dialog_pad_properties_base 1000 none - 1 dialog_pad_properties_base @@ -55,20 +54,13 @@ - + - - - - - - - @@ -83,23 +75,17 @@ - - - - - - @@ -173,14 +159,7 @@ - - - - - - - @@ -260,14 +239,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -353,7 +325,6 @@ 0 wxID_ANY Pad number: - 0 0 @@ -379,14 +350,7 @@ -1 - - - - - - - @@ -473,14 +437,7 @@ - - - - - - - @@ -552,7 +509,6 @@ 0 wxID_ANY Net name: - 0 0 @@ -578,14 +534,7 @@ -1 - - - - - - - @@ -670,14 +619,7 @@ - - - - - - - @@ -745,7 +687,6 @@ 0 wxID_ANY Pad type: - 0 0 @@ -771,14 +712,7 @@ -1 - - - - - - - @@ -865,14 +799,7 @@ - - - - - - - PadTypeSelected @@ -941,7 +868,6 @@ 0 wxID_ANY Shape: - 0 0 @@ -967,14 +893,7 @@ -1 - - - - - - - @@ -1061,14 +980,7 @@ - - - - - - - OnPadShapeSelection @@ -1137,7 +1049,6 @@ 0 wxID_ANY Position X: - 0 0 @@ -1163,14 +1074,7 @@ -1 - - - - - - - @@ -1257,14 +1161,7 @@ - - - - - - - @@ -1326,7 +1223,6 @@ 0 wxID_ANY Inch - 0 0 @@ -1352,14 +1248,7 @@ -1 - - - - - - - @@ -1417,7 +1306,6 @@ 0 wxID_ANY Position Y: - 0 0 @@ -1443,14 +1331,7 @@ -1 - - - - - - - @@ -1537,14 +1418,7 @@ - - - - - - - @@ -1606,7 +1480,6 @@ 0 wxID_ANY Inch - 0 0 @@ -1632,14 +1505,7 @@ -1 - - - - - - - @@ -1697,7 +1563,6 @@ 0 wxID_ANY Size X: - 0 0 @@ -1723,14 +1588,7 @@ -1 - - - - - - - @@ -1817,14 +1675,7 @@ - - - - - - - @@ -1886,7 +1737,6 @@ 0 wxID_ANY Inch - 0 0 @@ -1912,14 +1762,7 @@ -1 - - - - - - - @@ -1977,7 +1820,6 @@ 0 wxID_ANY Size Y: - 0 0 @@ -2003,14 +1845,7 @@ -1 - - - - - - - @@ -2097,14 +1932,7 @@ - - - - - - - @@ -2166,7 +1994,6 @@ 0 wxID_ANY Inch - 0 0 @@ -2192,14 +2019,7 @@ -1 - - - - - - - @@ -2257,7 +2077,6 @@ 0 wxID_ANY Orientation: - 0 0 @@ -2283,14 +2102,7 @@ -1 - - - - - - - @@ -2378,14 +2190,7 @@ - - - - - - - PadOrientEvent @@ -2448,7 +2253,6 @@ 0 wxID_ANY deg - 0 0 @@ -2474,14 +2278,7 @@ -1 - - - - - - - @@ -2539,7 +2336,6 @@ 0 wxID_ANY Shape offset X: - 0 0 @@ -2565,14 +2361,7 @@ -1 - - - - - - - @@ -2659,14 +2448,7 @@ - - - - - - - @@ -2728,7 +2510,6 @@ 0 wxID_ANY Inch - 0 0 @@ -2754,14 +2535,7 @@ -1 - - - - - - - @@ -2819,7 +2593,6 @@ 0 wxID_ANY Shape offset Y: - 0 0 @@ -2845,14 +2618,7 @@ -1 - - - - - - - @@ -2939,14 +2705,7 @@ - - - - - - - @@ -3008,7 +2767,6 @@ 0 wxID_ANY Inch - 0 0 @@ -3034,14 +2792,7 @@ -1 - - - - - - - @@ -3099,7 +2850,6 @@ 0 wxID_ANY Pad to die length: - 0 0 @@ -3125,14 +2875,7 @@ -1 - - - - - - - @@ -3219,14 +2962,7 @@ - - - - - - - @@ -3288,7 +3024,6 @@ 0 wxID_ANY Inch - 0 0 @@ -3314,14 +3049,7 @@ -1 - - - - - - - @@ -3379,7 +3107,6 @@ 0 wxID_ANY Trapezoid delta: - 0 0 @@ -3405,14 +3132,7 @@ -1 - - - - - - - @@ -3499,14 +3219,7 @@ - - - - - - - @@ -3568,7 +3281,6 @@ 0 wxID_ANY Inch - 0 0 @@ -3594,14 +3306,7 @@ -1 - - - - - - - @@ -3659,7 +3364,6 @@ 0 wxID_ANY Trapezoid axis: - 0 0 @@ -3685,14 +3389,7 @@ -1 - - - - - - - @@ -3779,14 +3476,7 @@ - - - - - - - OnSetLayers @@ -3855,7 +3545,6 @@ 0 wxID_ANY Corner size: - 0 0 @@ -3881,14 +3570,7 @@ -1 - - - - - - - @@ -3975,14 +3657,7 @@ - - - - - - - @@ -4044,7 +3719,6 @@ 0 wxID_ANY % - 0 0 @@ -4070,14 +3744,7 @@ -1 - - - - - - - @@ -4135,7 +3802,6 @@ 0 wxID_ANY Corner radius: - 0 0 @@ -4161,14 +3827,7 @@ -1 - - - - - - - @@ -4226,7 +3885,6 @@ 0 wxID_ANY dummy - 0 0 @@ -4252,14 +3910,7 @@ -1 - - - - - - - @@ -4317,7 +3968,6 @@ 0 wxID_ANY unit - 0 0 @@ -4343,14 +3993,7 @@ -1 - - - - - - - @@ -4437,7 +4080,6 @@ 0 wxID_ANY Hole shape: - 0 0 @@ -4463,14 +4105,7 @@ -1 - - - - - - - @@ -4557,14 +4192,7 @@ - - - - - - - OnDrillShapeSelected @@ -4623,7 +4251,6 @@ 0 wxID_ANY - 0 0 @@ -4649,14 +4276,7 @@ -1 - - - - - - - @@ -4714,7 +4334,6 @@ 0 wxID_ANY Hole size X: - 0 0 @@ -4740,14 +4359,7 @@ -1 - - - - - - - @@ -4834,14 +4446,7 @@ - - - - - - - @@ -4903,7 +4508,6 @@ 0 wxID_ANY Inch - 0 0 @@ -4929,14 +4533,7 @@ -1 - - - - - - - @@ -4994,7 +4591,6 @@ 0 wxID_ANY Hole size Y: - 0 0 @@ -5020,14 +4616,7 @@ -1 - - - - - - - @@ -5114,14 +4703,7 @@ - - - - - - - @@ -5183,7 +4765,6 @@ 0 wxID_ANY Inch - 0 0 @@ -5209,14 +4790,7 @@ -1 - - - - - - - @@ -5321,14 +4895,7 @@ - - - - - - - @@ -5386,7 +4953,6 @@ 0 wxID_ANY Parent footprint on board is flipped. Layers will be reversed. - 0 0 @@ -5412,14 +4978,7 @@ 150 - - - - - - - @@ -5488,7 +5047,6 @@ 0 wxID_ANY Copper: - 0 0 @@ -5514,14 +5072,7 @@ -1 - - - - - - - @@ -5608,14 +5159,7 @@ - - - - - - - OnSetLayers @@ -5676,7 +5220,6 @@ 0 wxID_ANY Technical layers: - 0 0 @@ -5702,14 +5245,7 @@ -1 - - - - - - - @@ -5796,14 +5332,7 @@ - - - - - - - OnSetLayers @@ -5891,14 +5420,7 @@ - - - - - - - OnSetLayers @@ -5986,14 +5508,7 @@ - - - - - - - OnSetLayers @@ -6081,14 +5596,7 @@ - - - - - - - OnSetLayers @@ -6176,14 +5684,7 @@ - - - - - - - OnSetLayers @@ -6271,14 +5772,7 @@ - - - - - - - OnSetLayers @@ -6366,14 +5860,7 @@ - - - - - - - OnSetLayers @@ -6461,14 +5948,7 @@ - - - - - - - OnSetLayers @@ -6556,14 +6036,7 @@ - - - - - - - OnSetLayers @@ -6651,14 +6124,7 @@ - - - - - - - OnSetLayers @@ -6746,14 +6212,7 @@ - - - - - - - OnSetLayers @@ -6841,14 +6300,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -6931,7 +6383,6 @@ 0 wxID_ANY Set values to 0 to use parent footprint or netclass values. - 0 0 @@ -6957,14 +6408,7 @@ -1 - - - - - - - @@ -7022,7 +6466,6 @@ 0 wxID_ANY Positive clearance means area bigger than the pad (usual for mask clearance). - 0 0 @@ -7048,14 +6491,7 @@ -1 - - - - - - - @@ -7113,7 +6549,6 @@ 0 wxID_ANY Negative clearance means area smaller than the pad (usual for paste clearance). - 0 0 @@ -7139,14 +6574,7 @@ -1 - - - - - - - @@ -7220,7 +6648,6 @@ 0 wxID_ANY Pad clearance: - 0 0 @@ -7246,14 +6673,7 @@ -1 - - - - - - - @@ -7340,14 +6760,7 @@ - - - - - - - @@ -7409,7 +6822,6 @@ 0 wxID_ANY Inch - 0 0 @@ -7435,14 +6847,7 @@ -1 - - - - - - - @@ -7500,7 +6905,6 @@ 0 wxID_ANY Solder mask clearance: - 0 0 @@ -7526,14 +6930,7 @@ -1 - - - - - - - @@ -7620,14 +7017,7 @@ - - - - - - - @@ -7689,7 +7079,6 @@ 0 wxID_ANY Inch - 0 0 @@ -7715,14 +7104,7 @@ -1 - - - - - - - @@ -7780,7 +7162,6 @@ 0 wxID_ANY Solder paste clearance: - 0 0 @@ -7806,14 +7187,7 @@ -1 - - - - - - - @@ -7900,14 +7274,7 @@ - - - - - - - @@ -7969,7 +7336,6 @@ 0 wxID_ANY Inch - 0 0 @@ -7995,14 +7361,7 @@ -1 - - - - - - - @@ -8060,7 +7419,6 @@ 0 wxID_ANY Solder paste ratio clearance: - 0 0 @@ -8086,14 +7444,7 @@ -1 - - - - - - - @@ -8180,14 +7531,7 @@ - - - - - - - @@ -8249,7 +7593,6 @@ 0 wxID_ANY % - 0 0 @@ -8275,14 +7618,7 @@ -1 - - - - - - - @@ -8364,14 +7700,7 @@ - - - - - - - @@ -8450,14 +7779,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -8518,7 +7840,6 @@ 0 wxID_ANY Note: solder mask and paste values are used only for pads on copper layers. - 0 0 @@ -8544,14 +7865,7 @@ -1 - - - - - - - @@ -8633,14 +7947,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -8724,14 +8031,7 @@ - - - - - - - @@ -8789,7 +8089,6 @@ 0 wxID_ANY Note: solder mask and paste values are used only for pads on copper layers. - 0 0 @@ -8815,14 +8114,7 @@ -1 - - - - - - - @@ -8916,7 +8208,6 @@ 0 wxID_ANY Pad connection: - 0 0 @@ -8942,14 +8233,7 @@ -1 - - - - - - - @@ -9036,14 +8320,7 @@ - - - - - - - @@ -9112,7 +8389,6 @@ 0 wxID_ANY Thermal relief spoke width: - 0 0 @@ -9138,14 +8414,7 @@ -1 - - - - - - - @@ -9232,14 +8501,7 @@ - - - - - - - @@ -9301,7 +8563,6 @@ 0 wxID_ANY Inch - 0 0 @@ -9327,14 +8588,7 @@ -1 - - - - - - - @@ -9392,7 +8646,6 @@ 0 wxID_ANY Thermal relief gap: - 0 0 @@ -9418,14 +8671,7 @@ -1 - - - - - - - @@ -9512,14 +8758,7 @@ - - - - - - - @@ -9581,7 +8820,6 @@ 0 wxID_ANY Inch - 0 0 @@ -9607,14 +8845,7 @@ -1 - - - - - - - @@ -9705,7 +8936,6 @@ 0 wxID_ANY Pad connection: - 0 0 @@ -9731,14 +8961,7 @@ -1 - - - - - - - @@ -9825,14 +9048,7 @@ - - - - - - - @@ -9891,7 +9107,6 @@ 0 wxID_ANY Custom pad shape in zone: - 0 0 @@ -9917,14 +9132,7 @@ -1 - - - - - - - @@ -10011,14 +9219,7 @@ - - - - - - - @@ -10108,14 +9309,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -10176,7 +9370,6 @@ 0 wxID_ANY Primitives list - 0 0 @@ -10202,14 +9395,7 @@ -1 - - - - - - - @@ -10267,7 +9453,6 @@ 0 wxID_ANY Coordinates are relative to anchor pad, orientation 0 - 0 0 @@ -10293,14 +9478,7 @@ -1 - - - - - - - @@ -10385,14 +9563,7 @@ - - - - - - - @@ -10470,31 +9641,25 @@ - 1 0 1 1 - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY Delete Primitive - - 0 0 @@ -10509,8 +9674,6 @@ protected 1 - - Resizable 1 @@ -10525,15 +9688,8 @@ - - - - - - onDeletePrimitive - @@ -10573,31 +9729,25 @@ - 1 0 1 1 - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY Edit Primitive - - 0 0 @@ -10612,8 +9762,6 @@ protected 1 - - Resizable 1 @@ -10628,15 +9776,8 @@ - - - - - - onEditPrimitive - @@ -10676,31 +9817,25 @@ - 1 0 1 1 - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY Add Primitive - - 0 0 @@ -10715,8 +9850,6 @@ protected 1 - - Resizable 1 @@ -10731,15 +9864,8 @@ - - - - - - onAddPrimitive - @@ -10779,31 +9905,25 @@ - 1 0 1 1 - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY Duplicate Primitive - - 0 0 @@ -10818,8 +9938,6 @@ protected 1 - - Resizable 1 @@ -10834,15 +9952,8 @@ - - - - - - onDuplicatePrimitive - @@ -10882,31 +9993,25 @@ - 1 0 1 1 - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY Transform Primitive - - 0 0 @@ -10921,8 +10026,6 @@ protected 1 - - Resizable 1 @@ -10937,15 +10040,8 @@ - - - - - - onGeometryTransform - @@ -11031,7 +10127,6 @@ 0 wxID_ANY Footprint name - 0 0 @@ -11057,14 +10152,7 @@ -1 - - - - - - - @@ -11122,7 +10210,6 @@ 0 wxID_ANY side and rotation - 0 0 @@ -11148,14 +10235,7 @@ -1 - - - - - - - @@ -11245,14 +10325,7 @@ wxFULL_REPAINT_ON_RESIZE|wxBORDER_SIMPLE - - - - - - - @@ -11337,14 +10410,7 @@ - - - - - - - @@ -11431,14 +10497,7 @@ - - - - - - - onChangePadMode @@ -11530,14 +10589,7 @@ - - - - - - - @@ -11622,20 +10674,13 @@ - + - - - - - - - @@ -11650,23 +10695,17 @@ - - - - - - @@ -11723,7 +10762,6 @@ 0 wxID_ANY Start point - 0 0 @@ -11749,14 +10787,7 @@ -1 - - - - - - - @@ -11814,7 +10845,6 @@ 0 wxID_ANY X: - 0 0 @@ -11840,14 +10870,7 @@ -1 - - - - - - - @@ -11934,14 +10957,7 @@ - - - - - - - @@ -12003,7 +11019,6 @@ 0 wxID_ANY unit - 0 0 @@ -12029,14 +11044,7 @@ -1 - - - - - - - @@ -12094,7 +11102,6 @@ 0 wxID_ANY Y: - 0 0 @@ -12120,14 +11127,7 @@ -1 - - - - - - - @@ -12214,14 +11214,7 @@ - - - - - - - @@ -12283,7 +11276,6 @@ 0 wxID_ANY unit - 0 0 @@ -12309,14 +11301,7 @@ -1 - - - - - - - @@ -12374,7 +11359,6 @@ 0 wxID_ANY End point - 0 0 @@ -12400,14 +11384,7 @@ -1 - - - - - - - @@ -12465,7 +11442,6 @@ 0 wxID_ANY X: - 0 0 @@ -12491,14 +11467,7 @@ -1 - - - - - - - @@ -12585,14 +11554,7 @@ - - - - - - - @@ -12654,7 +11616,6 @@ 0 wxID_ANY unit - 0 0 @@ -12680,14 +11641,7 @@ -1 - - - - - - - @@ -12745,7 +11699,6 @@ 0 wxID_ANY Y: - 0 0 @@ -12771,14 +11724,7 @@ -1 - - - - - - - @@ -12865,14 +11811,7 @@ - - - - - - - @@ -12934,7 +11873,6 @@ 0 wxID_ANY unit - 0 0 @@ -12960,14 +11898,7 @@ -1 - - - - - - - @@ -13025,7 +11956,6 @@ 0 wxID_ANY Radius: - 0 0 @@ -13051,14 +11981,7 @@ -1 - - - - - - - @@ -13155,14 +12078,7 @@ - - - - - - - @@ -13224,7 +12140,6 @@ 0 wxID_ANY unit - 0 0 @@ -13250,14 +12165,7 @@ -1 - - - - - - - @@ -13345,7 +12253,6 @@ 0 wxID_ANY Thickness: - 0 0 @@ -13371,14 +12278,7 @@ -1 - - - - - - - @@ -13475,14 +12375,7 @@ - - - - - - - @@ -13544,7 +12437,6 @@ 0 wxID_ANY unit - 0 0 @@ -13570,14 +12462,7 @@ -1 - - - - - - - @@ -13647,7 +12532,6 @@ 0 wxID_ANY Set thickness to 0 for a filled circle. - 0 0 @@ -13673,14 +12557,7 @@ -1 - - - - - - - @@ -13761,14 +12638,7 @@ - - - - - - - @@ -13849,20 +12719,13 @@ - + - - - - - - - @@ -13877,23 +12740,17 @@ - - - - - - @@ -13950,7 +12807,6 @@ 0 wxID_ANY Move vector - 0 0 @@ -13976,14 +12832,7 @@ -1 - - - - - - - @@ -14041,7 +12890,6 @@ 0 wxID_ANY X: - 0 0 @@ -14067,14 +12915,7 @@ -1 - - - - - - - @@ -14161,14 +13002,7 @@ - - - - - - - @@ -14230,7 +13064,6 @@ 0 wxID_ANY unit - 0 0 @@ -14256,14 +13089,7 @@ -1 - - - - - - - @@ -14321,7 +13147,6 @@ 0 wxID_ANY Y: - 0 0 @@ -14347,14 +13172,7 @@ -1 - - - - - - - @@ -14441,14 +13259,7 @@ - - - - - - - @@ -14510,7 +13321,6 @@ 0 wxID_ANY unit - 0 0 @@ -14536,14 +13346,7 @@ -1 - - - - - - - @@ -14601,7 +13404,6 @@ 0 wxID_ANY Rotation: - 0 0 @@ -14627,14 +13429,7 @@ -1 - - - - - - - @@ -14731,14 +13526,7 @@ - - - - - - - @@ -14800,7 +13588,6 @@ 0 wxID_ANY deg - 0 0 @@ -14826,14 +13613,7 @@ -1 - - - - - - - @@ -14921,7 +13701,6 @@ 0 wxID_ANY Scaling factor: - 0 0 @@ -14947,14 +13726,7 @@ -1 - - - - - - - @@ -15051,14 +13823,7 @@ - - - - - - - @@ -15160,7 +13925,6 @@ 0 wxID_ANY Duplicate: - 0 0 @@ -15186,14 +13950,7 @@ -1 - - - - - - - @@ -15288,14 +14045,7 @@ - - - - - - - @@ -15391,14 +14141,7 @@ - - - - - - - @@ -15479,20 +14222,13 @@ - + - - - - - - - @@ -15507,23 +14243,17 @@ - - - - - - @@ -15629,20 +14359,13 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 wxBORDER_SIMPLE - - - - - - - @@ -15730,7 +14453,6 @@ 1 1 - 0 0 @@ -15744,10 +14466,9 @@ 0 0 + wxID_ANY Add Corner - - 0 0 @@ -15762,9 +14483,8 @@ protected 1 - - Resizable + 1 @@ -15778,15 +14498,8 @@ - - - - - - OnButtonAdd - @@ -15843,7 +14556,6 @@ 1 1 - 0 0 @@ -15857,10 +14569,9 @@ 0 0 + wxID_ANY Delete Corner - - 0 0 @@ -15875,9 +14586,8 @@ protected 1 - - Resizable + 1 @@ -15891,15 +14601,8 @@ - - - - - - OnButtonDelete - @@ -15975,7 +14678,6 @@ 0 wxID_ANY Outline thickness: - 0 0 @@ -16001,14 +14703,7 @@ -1 - - - - - - - @@ -16095,14 +14790,7 @@ - - - - - - - @@ -16164,7 +14852,6 @@ 0 wxID_ANY unit - 0 0 @@ -16190,14 +14877,7 @@ -1 - - - - - - - @@ -16290,14 +14970,7 @@ wxTAB_TRAVERSAL - - - - - - - @@ -16387,14 +15060,7 @@ - - - - - - - @@ -16452,7 +15118,6 @@ 0 wxID_ANY MyLabel - 0 0 @@ -16478,14 +15143,7 @@ -1 - - - - - - - @@ -16582,14 +15240,7 @@ - - - - - - - @@ -16675,7 +15326,6 @@ 0 wxID_ANY Coordinates are relative to anchor pad, rotated 0.0 deg. - 0 0 @@ -16701,14 +15351,7 @@ -1 - - - - - - - @@ -16766,7 +15409,6 @@ 0 wxID_ANY Set thickness to 0 for a filled polygon. - 0 0 @@ -16792,14 +15434,7 @@ -1 - - - - - - - diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index 1653ed0989..7b8ffefe91 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,6 +12,7 @@ #include #include class TEXT_CTRL_EVAL; +class WX_GRID; #include "dialog_shim.h" #include @@ -298,7 +299,7 @@ class DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE : public DIALOG_SHIM private: protected: - wxGrid* m_gridCornersList; + WX_GRID* m_gridCornersList; wxBitmapButton* m_addButton; wxBitmapButton* m_deleteButton; wxStaticText* m_thicknessLabel; diff --git a/pcbnew/dialogs/dialog_swap_layers.cpp b/pcbnew/dialogs/dialog_swap_layers.cpp index 90adb324e6..70305e678b 100644 --- a/pcbnew/dialogs/dialog_swap_layers.cpp +++ b/pcbnew/dialogs/dialog_swap_layers.cpp @@ -144,8 +144,8 @@ bool DIALOG_SWAP_LAYERS::TransferDataToWindow() bool DIALOG_SWAP_LAYERS::TransferDataFromWindow() { - // Commit any pending changes - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() ); wxGridTableBase* table = m_grid->GetTable(); diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index 97749d4a13..a25d07c3ea 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -461,6 +462,9 @@ void PANEL_FP_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event ) void PANEL_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + if( m_cur_grid->AppendRows( 1 ) ) { int last_row = m_cur_grid->GetNumberRows() - 1; @@ -476,6 +480,9 @@ void PANEL_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event ) void PANEL_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + int curRow = m_cur_grid->GetGridCursorRow(); int curCol = m_cur_grid->GetGridCursorCol(); @@ -525,6 +532,9 @@ void PANEL_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event ) void PANEL_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + FP_LIB_TABLE_GRID* tbl = cur_model(); int curRow = m_cur_grid->GetGridCursorRow(); @@ -552,6 +562,9 @@ void PANEL_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event ) void PANEL_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + FP_LIB_TABLE_GRID* tbl = cur_model(); int curRow = m_cur_grid->GetGridCursorRow(); @@ -579,6 +592,9 @@ void PANEL_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event ) void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) { + if( !m_cur_grid->CommitPendingChanges() ) + return; + if( m_lastBrowseDir.IsEmpty() ) m_lastBrowseDir = m_projectBasePath; @@ -669,8 +685,8 @@ void PANEL_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event ) bool PANEL_FP_LIB_TABLE::TransferDataFromWindow() { - // stuff any pending cell editor text into the table. - m_cur_grid->DisableCellEditControl(); + if( !m_cur_grid->CommitPendingChanges() ) + return false; if( verifyTables() ) { diff --git a/pcbnew/dialogs/panel_fp_lib_table.h b/pcbnew/dialogs/panel_fp_lib_table.h index 6e6fd46281..4a25d3aa7f 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.h +++ b/pcbnew/dialogs/panel_fp_lib_table.h @@ -22,6 +22,7 @@ #include #include +#include class FP_LIB_TABLE; class FP_LIB_TABLE_GRID; @@ -86,7 +87,7 @@ private: DIALOG_EDIT_LIBRARY_TABLES* m_parent; - wxGrid* m_cur_grid; // changed based on tab choice + WX_GRID* m_cur_grid; // changed based on tab choice static size_t m_pageNdx; // Remember last notebook page selected during a session static wxString m_lastBrowseDir; // Remember last directory browsed during a session }; diff --git a/pcbnew/dialogs/panel_fp_lib_table_base.cpp b/pcbnew/dialogs/panel_fp_lib_table_base.cpp index 787b71a2b3..ae9181cb17 100644 --- a/pcbnew/dialogs/panel_fp_lib_table_base.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table_base.cpp @@ -5,6 +5,8 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "panel_fp_lib_table_base.h" /////////////////////////////////////////////////////////////////////////// @@ -40,7 +42,7 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i m_global_sizer->Add( fgSizer1, 0, wxEXPAND, 5 ); - m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_global_grid = new WX_GRID( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_global_grid->CreateGrid( 1, 5 ); @@ -92,7 +94,7 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i m_project_sizer->Add( fgSizer2, 0, wxEXPAND, 5 ); - m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_project_grid = new WX_GRID( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_project_grid->CreateGrid( 1, 5 ); @@ -157,7 +159,7 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path Substitutions:") ), wxVERTICAL ); - m_path_subs_grid = new wxGrid( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_path_subs_grid = new WX_GRID( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_path_subs_grid->CreateGrid( 1, 2 ); diff --git a/pcbnew/dialogs/panel_fp_lib_table_base.fbp b/pcbnew/dialogs/panel_fp_lib_table_base.fbp index 91546dc48a..ab7e46d59d 100644 --- a/pcbnew/dialogs/panel_fp_lib_table_base.fbp +++ b/pcbnew/dialogs/panel_fp_lib_table_base.fbp @@ -533,7 +533,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 @@ -946,7 +946,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 @@ -1595,7 +1595,7 @@ 1 1 - + WX_GRID; widgets/wx_grid.h; forward_declare 0 This is a read-only table which shows pertinent environment variables. diff --git a/pcbnew/dialogs/panel_fp_lib_table_base.h b/pcbnew/dialogs/panel_fp_lib_table_base.h index a5a8422c2d..d25b82a171 100644 --- a/pcbnew/dialogs/panel_fp_lib_table_base.h +++ b/pcbnew/dialogs/panel_fp_lib_table_base.h @@ -11,6 +11,8 @@ #include #include #include +class WX_GRID; + #include #include #include @@ -43,17 +45,17 @@ class PANEL_FP_LIB_TABLE_BASE : public wxPanel wxPanel* m_global_panel; wxStaticText* m_staticText3; wxStaticText* m_GblTableFilename; - wxGrid* m_global_grid; + WX_GRID* m_global_grid; wxPanel* m_project_panel; wxStaticText* m_staticText4; wxStaticText* m_PrjTableFilename; - wxGrid* m_project_grid; + WX_GRID* m_project_grid; wxBitmapButton* m_append_button; wxBitmapButton* m_browse_button; wxBitmapButton* m_move_up_button; wxBitmapButton* m_move_down_button; wxBitmapButton* m_delete_button; - wxGrid* m_path_subs_grid; + WX_GRID* m_path_subs_grid; // Virtual event handlers, overide them in your derived class virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/panel_modedit_defaults.cpp b/pcbnew/dialogs/panel_modedit_defaults.cpp index 53d36cad6e..37a58d6023 100644 --- a/pcbnew/dialogs/panel_modedit_defaults.cpp +++ b/pcbnew/dialogs/panel_modedit_defaults.cpp @@ -137,8 +137,8 @@ int PANEL_MODEDIT_DEFAULTS::getGridValue( int aRow, int aCol ) bool PANEL_MODEDIT_DEFAULTS::validateData() { - // Commit any pending in-place edits and close editors from grid - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; // Test text parameters. for( int row : { ROW_SILK, ROW_COPPER, ROW_OTHERS } ) diff --git a/pcbnew/dialogs/panel_setup_netclasses.cpp b/pcbnew/dialogs/panel_setup_netclasses.cpp index d6f72f24b9..75720f33e2 100644 --- a/pcbnew/dialogs/panel_setup_netclasses.cpp +++ b/pcbnew/dialogs/panel_setup_netclasses.cpp @@ -300,6 +300,9 @@ void PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging( wxGridEvent& event ) void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event ) { + if( !m_netclassGrid->CommitPendingChanges() ) + return; + int row = m_netclassGrid->GetNumberRows(); m_netclassGrid->AppendRows(); @@ -319,7 +322,8 @@ void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event ) void PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick( wxCommandEvent& event ) { - m_netclassGrid->DisableCellEditControl(); + if( !m_netclassGrid->CommitPendingChanges() ) + return; int curRow = m_netclassGrid->GetGridCursorRow(); @@ -345,9 +349,8 @@ void PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick( wxCommandEvent& event ) m_netclassGrid->DeleteRows( curRow, 1 ); - curRow = std::max( 0, curRow - 1 ); - m_netclassGrid->MakeCellVisible( curRow, m_netclassGrid->GetGridCursorCol() ); - m_netclassGrid->SetGridCursor( curRow, m_netclassGrid->GetGridCursorCol() ); + m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() ); + m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() ); m_netclassesDirty = true; } @@ -398,8 +401,8 @@ void PANEL_SETUP_NETCLASSES::OnSizeMembershipGrid( wxSizeEvent& event ) void PANEL_SETUP_NETCLASSES::doApplyFilters( bool aShowAll ) { - // Commit any pending in-place edits in the membership grid - m_membershipGrid->DisableCellEditControl(); + if( !m_membershipGrid->CommitPendingChanges() ) + return; wxString netClassFilter = m_netClassFilter->GetStringSelection(); wxString netFilter = m_netNameFilter->GetValue().MakeLower(); @@ -432,8 +435,8 @@ void PANEL_SETUP_NETCLASSES::doApplyFilters( bool aShowAll ) void PANEL_SETUP_NETCLASSES::doAssignments( bool aAssignAll ) { - // Commit any pending in-place edits in the membership grid - m_membershipGrid->DisableCellEditControl(); + if( !m_membershipGrid->CommitPendingChanges() ) + return; wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows(); @@ -468,9 +471,8 @@ int PANEL_SETUP_NETCLASSES::getNetclassValue( int aRow, int aCol ) bool PANEL_SETUP_NETCLASSES::validateData() { - // Commit any pending in-place edits and close editors from grid controls - m_netclassGrid->DisableCellEditControl(); - m_membershipGrid->DisableCellEditControl(); + if( !m_netclassGrid->CommitPendingChanges() || !m_membershipGrid->CommitPendingChanges() ) + return false; wxString msg; int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue(); diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp index e89ff80ae3..63e34b0937 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp @@ -136,8 +136,8 @@ int PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue( int aRow, int aCol ) bool PANEL_SETUP_TEXT_AND_GRAPHICS::validateData() { - // Commit any pending in-place edits and close editors from grid - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; // Test text parameters. for( int row : { ROW_SILK, ROW_COPPER, ROW_OTHERS } ) @@ -185,6 +185,9 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow() void PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom( BOARD* aBoard ) { + if( !m_grid->CommitPendingChanges() ) + return; + BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings; m_BrdSettings = &aBoard->GetDesignSettings(); diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp index 3897fed91c..47e856b1c1 100644 --- a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp @@ -168,10 +168,10 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() { - // Commit any pending in-place edits and close editors from grid controls - m_trackWidthsGrid->DisableCellEditControl(); - m_viaSizesGrid->DisableCellEditControl(); - m_diffPairsGrid->DisableCellEditControl(); + if( !m_trackWidthsGrid->CommitPendingChanges() + || !m_viaSizesGrid->CommitPendingChanges() + || !m_diffPairsGrid->CommitPendingChanges() ) + return false; wxString msg; int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue(); @@ -243,6 +243,10 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() void PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom( BOARD* aBoard ) { + m_trackWidthsGrid->CommitPendingChanges( true ); + m_viaSizesGrid->CommitPendingChanges( true ); + m_diffPairsGrid->CommitPendingChanges( true ); + // Note: do not change the board, as we need to get the current nets from it for // netclass memberships. All the netclass definitions and dimension lists are in // the BOARD_DESIGN_SETTINGS.