From 3ec06fa3ccb62d24cce4aac67b12ae05a1f91ffc Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Thu, 3 Oct 2013 17:12:56 -0500 Subject: [PATCH] DIALOG_FP_LIB_TABLE does not use wxSplitterWindow, it would not obey. Paste popup menu in this dialog now allows pasting a (fp_lib_table) s-expression element holding (lib) elements. This provides an opportunity for GITHUB library publishers to put the table description into their README.md file as a (fp_lib_table) element where it can be quickly copied to clipboard and pasted into the fp lib table dialog. This is a paste operation, and overwrites from the initial cursor position. --- common/fp_lib_table.cpp | 19 +- include/fp_lib_table.h | 46 +- pcbnew/dialogs/dialog_fp_lib_table.cpp | 101 +- pcbnew/dialogs/dialog_fp_lib_table_base.cpp | 55 +- pcbnew/dialogs/dialog_fp_lib_table_base.fbp | 2218 +++++++++---------- pcbnew/dialogs/dialog_fp_lib_table_base.h | 13 +- 6 files changed, 1141 insertions(+), 1311 deletions(-) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 2fe60f2070..c5d9d8b34d 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -50,6 +50,22 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) : } +/* +void FP_LIB_TABLE::Paste( const FP_LIB_TABLE& aOther, int aDestNdx ) +{ + if( aDestNdx == -1 ) + aDestNdx = rows.size() - 1; + else if( unsigned( aDestNdx ) >= rows.size() ) + return; // bad caller. + else + { + + rows.assign( aOther.rows.begin(), aOther.rows.end() ); + } +} +*/ + + void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ) { /* @@ -142,9 +158,6 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR sawOpts = true; in->NeedSYMBOLorNUMBER(); row.SetOptions( in->FromUTF8() ); - - // create PROPERTIES* from options, set into the ROW - row.properties = ParseOptions( in->CurStr() ); break; case T_descr: diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index a0c79171b5..a667b4a35f 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -202,7 +202,13 @@ public: /** * Function SetOptions */ - void SetOptions( const wxString& aOptions ) { options = aOptions; } + void SetOptions( const wxString& aOptions ) + { + options = aOptions; + + // set PROPERTIES* from options + setProperties( ParseOptions( TO_UTF8( aOptions ) ) ); + } /** * Function GetDescr @@ -223,17 +229,6 @@ public: */ const PROPERTIES* GetProperties() const { return properties; } - /** - * Function SetProperties - * sets this ROW's PROPERTIES by taking ownership of @a aProperties. - * @param aProperties ownership is given over to this ROW. - */ - void SetProperties( const PROPERTIES* aProperties ) - { - delete properties; - properties = aProperties; - } - //---------------------------------------------------------- /** @@ -249,6 +244,17 @@ public: private: + /** + * Function setProperties + * sets this ROW's PROPERTIES by taking ownership of @a aProperties. + * @param aProperties ownership is given over to this ROW. + */ + void setProperties( const PROPERTIES* aProperties ) + { + delete properties; + properties = aProperties; + } + wxString nickName; wxString uri; LIB_T type; @@ -258,7 +264,6 @@ public: PROPERTIES* properties; }; - /** * Constructor FP_LIB_TABLE * builds a library table by pre-pending this table fragment in front of @@ -395,15 +400,8 @@ public: return row ? &row->options : 0; } #endif - //------------------------------------------------------- -#if 1 || defined(DEBUG) - /// implement the tests in here so we can honor the privilege levels of the - /// accessors, something difficult to do from int main(int, char**) - void Test(); -#endif - /** * Function InsertRow * adds aRow if it does not already exist or if doReplace is true. If doReplace @@ -443,6 +441,14 @@ public: */ bool IsEmpty() const; + /** + * Function Assign + * assigns new contents to ROWs of this table by copying ALL rows from aOther, + * and modifying the size of this table if necessary. + * @param aDestNdx is the starting index into this table. + void Assign( const FP_LIB_TABLE& aOther, int aDestNdx ); + */ + /** * Function MissingLegacyLibs * tests the list of \a aLibNames by URI to determine if any of them are missing from diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 7cccb00684..20a086cf23 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -287,7 +288,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE selColCount = 0; } - // D(printf("selRowStart:%d selColStart:%d selRowCount:%d selColCount:%d\n", selRowStart, selColStart, selRowCount, selColCount );) + D(printf("selRowStart:%d selColStart:%d selRowCount:%d selColCount:%d\n", selRowStart, selColStart, selRowCount, selColCount );) } void rightClickCellPopupMenu() @@ -300,15 +301,30 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE getSelectedArea(); - // if nothing is selected, diable cut and copy. + // if nothing is selected, disable cut and copy. if( !selRowCount && !selColCount ) { menu.Enable( ID_CUT, false ); menu.Enable( ID_COPY, false ); } + bool have_cb_text = false; + if( wxTheClipboard->Open() ) + { + if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) + have_cb_text = true; + + wxTheClipboard->Close(); + } + + if( !have_cb_text ) + { + // if nothing on clipboard, disable paste. + menu.Enable( ID_PASTE, false ); + } + // if there is no current cell cursor, disable paste. - if( m_cur_row == -1 || m_cur_col == -1 ) + else if( m_cur_row == -1 || m_cur_col == -1 ) menu.Enable( ID_PASTE, false ); PopupMenu( &menu ); @@ -362,30 +378,72 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE { if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) { - wxGridTableBase* tbl = m_cur_grid->GetTable(); wxTextDataObject data; + FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) m_cur_grid->GetTable(); wxTheClipboard->GetData( data ); - wxStringTokenizer rows( data.GetText(), ROW_SEP, wxTOKEN_RET_EMPTY ); + wxString cb_text = data.GetText(); + size_t ndx = cb_text.find_first_of( wxT( "(fp_lib_table " ) ); - // if clipboard rows would extend past end of current table size... - if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row ) + if( ndx != std::string::npos ) { - int newRowsNeeded = rows.CountTokens() - ( tbl->GetNumberRows() - m_cur_row ); - tbl->AppendRows( newRowsNeeded ); - } + // paste the ROWs of s-expression (fp_lib_table), starting + // at column 0 regardless of current cursor column. - for( int row = m_cur_row; rows.HasMoreTokens(); ++row ) - { - wxString rowTxt = rows.GetNextToken(); + STRING_LINE_READER slr( TO_UTF8( cb_text ), wxT( "Clipboard" ) ); + FP_LIB_TABLE_LEXER lexer( &slr ); + FP_LIB_TABLE tmp_tbl; + bool parsed = true; - wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY ); - - for( int col = m_cur_col; cols.HasMoreTokens(); ++col ) + try { - wxString cellTxt = cols.GetNextToken(); - tbl->SetValue( row, col, cellTxt ); + tmp_tbl.Parse( &lexer ); + } + catch( PARSE_ERROR& pe ) + { + // @todo tell what line and offset + parsed = false; + } + + if( parsed ) + { + // if clipboard rows would extend past end of current table size... + if( int( tmp_tbl.rows.size() ) > tbl->GetNumberRows() - m_cur_row ) + { + int newRowsNeeded = tmp_tbl.rows.size() - ( tbl->GetNumberRows() - m_cur_row ); + tbl->AppendRows( newRowsNeeded ); + } + + for( int i = 0; i < (int) tmp_tbl.rows.size(); ++i ) + { + tbl->rows[m_cur_row+i] = tmp_tbl.rows[i]; + } + } + m_cur_grid->AutoSizeColumns(); + } + else + { + wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY ); + + // if clipboard rows would extend past end of current table size... + if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row ) + { + int newRowsNeeded = rows.CountTokens() - ( tbl->GetNumberRows() - m_cur_row ); + tbl->AppendRows( newRowsNeeded ); + } + + for( int row = m_cur_row; rows.HasMoreTokens(); ++row ) + { + wxString rowTxt = rows.GetNextToken(); + + wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY ); + + for( int col = m_cur_col; cols.HasMoreTokens(); ++col ) + { + wxString cellTxt = cols.GetNextToken(); + tbl->SetValue( row, col, cellTxt ); + } } } } @@ -730,8 +788,8 @@ public: m_project( aProject ), m_global_model( *aGlobal ), m_project_model( *aProject ), - m_cur_row( -1 ), - m_cur_col( -1 ) + m_cur_row( 0 ), + m_cur_col( 0 ) { m_global_grid->SetTable( (wxGridTableBase*) &m_global_model ); m_project_grid->SetTable( (wxGridTableBase*) &m_project_model ); @@ -740,10 +798,9 @@ public: m_project_grid->AutoSizeColumns( false ); wxArrayString choices; + choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) ); -#if defined(BUILD_GITHUB_PLUGIN) choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) ); -#endif choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) ); choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) ); choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) ); diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp index bb78ba1333..20e21c020e 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp @@ -16,15 +16,10 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxVERTICAL ); - m_splitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH ); - m_splitter->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); - m_splitter->SetMinimumPaneSize( 10 ); - - m_top = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxStaticBoxSizer* m_top_sizer; - m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL ); + m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL ); - m_auinotebook = new wxAuiNotebook( m_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM ); + m_auinotebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM ); m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_global_panel->SetToolTip( _("Module libraries which are visible for all projects") ); @@ -56,6 +51,8 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID // Cell Defaults m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_global_grid->SetToolTip( _("This table is associated with all projects") ); + m_global_sizer->Add( m_global_grid, 1, wxALL|wxEXPAND, 5 ); @@ -94,6 +91,8 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID // Cell Defaults m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_project_grid->SetToolTip( _("Libraries list in this table is associated with the current project") ); + m_project_sizer->Add( m_project_grid, 1, wxALL|wxEXPAND, 5 ); @@ -102,32 +101,32 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID m_project_sizer->Fit( m_project_panel ); m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap ); - m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 ); + m_top_sizer->Add( m_auinotebook, 6, wxEXPAND | wxALL, 5 ); wxBoxSizer* bSizer51; bSizer51 = new wxBoxSizer( wxHORIZONTAL ); - m_append_button = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_append_button = new wxButton( this, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 ); m_append_button->SetToolTip( _("Add a PCB library row to this table") ); bSizer51->Add( m_append_button, 0, wxALL, 5 ); - m_delete_button = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_delete_button = new wxButton( this, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 ); m_delete_button->SetToolTip( _("Remove a PCB library from this library table") ); bSizer51->Add( m_delete_button, 0, wxALL, 5 ); - m_move_up_button = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_move_up_button = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); m_move_up_button->SetToolTip( _("Move the currently selected row up one position") ); bSizer51->Add( m_move_up_button, 0, wxALL, 5 ); - m_move_down_button = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); + m_move_down_button = new wxButton( this, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); m_move_down_button->SetToolTip( _("Move the currently selected row down one position") ); bSizer51->Add( m_move_down_button, 0, wxALL, 5 ); - m_edit_options = new wxButton( m_top, wxID_ANY, _("Options Editor"), wxDefaultPosition, wxDefaultSize, 0 ); + m_edit_options = new wxButton( this, wxID_ANY, _("Options Editor"), wxDefaultPosition, wxDefaultSize, 0 ); m_edit_options->SetToolTip( _("Zoom into the options table for current row") ); bSizer51->Add( m_edit_options, 0, wxALL, 5 ); @@ -136,17 +135,12 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 ); - m_top->SetSizer( m_top_sizer ); - m_top->Layout(); - m_top_sizer->Fit( m_top ); - m_bottom = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* m_bottom_sizer; - m_bottom_sizer = new wxBoxSizer( wxVERTICAL ); + bSizer1->Add( m_top_sizer, 1, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_bottom, wxID_ANY, _("Path Substitutions") ), wxVERTICAL ); + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path Substitutions") ), wxVERTICAL ); - m_path_subs_grid = new wxGrid( m_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_path_subs_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); // Grid m_path_subs_grid->CreateGrid( 1, 2 ); @@ -175,26 +169,27 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID // Cell Defaults m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_path_subs_grid->SetToolTip( _("This is a read-only table which shows pertinent environment variables.") ); + sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 ); - m_bottom_sizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); + bSizer1->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* m_bottom_sizer; + m_bottom_sizer = new wxBoxSizer( wxVERTICAL ); m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK ); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( m_bottom, wxID_CANCEL ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); - m_bottom->SetSizer( m_bottom_sizer ); - m_bottom->Layout(); - m_bottom_sizer->Fit( m_bottom ); - m_splitter->SplitHorizontally( m_top, m_bottom, 398 ); - bSizer1->Add( m_splitter, 2, wxEXPAND, 5 ); + bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 ); this->SetSizer( bSizer1 ); @@ -203,6 +198,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID this->Centre( wxBOTH ); // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FP_LIB_TABLE_BASE::onInitDialog ) ); m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); @@ -224,6 +220,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() { // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FP_LIB_TABLE_BASE::onInitDialog ) ); m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp index 1885fe1772..8f2ccf7494 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp @@ -42,8 +42,8 @@ DIALOG_FP_LIB_TABLE_BASE - 996,652 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + 700,700 + wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h PCB Library Tables @@ -65,7 +65,7 @@ - + onInitDialog @@ -94,93 +94,20 @@ 5 wxEXPAND - 2 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + 1 + wxID_ANY - - 0 - - 10 - - 0 + Library Tables by Scope - 1 - m_splitter - 1 - - - protected - 1 - - Resizable - 0.0 - 398 - -1 - 1 - - wxSPLIT_HORIZONTAL - wxSP_3DSASH - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + m_top_sizer + wxVERTICAL + none - - + + 5 + wxEXPAND | wxALL + 6 + 1 1 1 @@ -215,7 +142,7 @@ 0 1 - m_top + m_auinotebook 1 @@ -225,12 +152,23 @@ Resizable 1 + wxAUI_NB_BOTTOM + -1 0 + - wxTAB_TRAVERSAL + + + + + + + pageChangedHandler + + @@ -254,1109 +192,89 @@ - - wxID_ANY - Library Tables by Scope - - m_top_sizer - wxVERTICAL - none - - - 5 - wxEXPAND | wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_auinotebook - 1 - - - protected - 1 - - Resizable - 1 - - wxAUI_NB_BOTTOM - - -1 - 0 - - - - - - - - - - - pageChangedHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - Global Libraries - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_global_panel - 1 - - - protected - 0 - - Resizable - 1 - - - 0 - Module libraries which are visible for all projects - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_global_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - - wxALIGN_CENTRE - 5 - - - 1 - 0 - Dock - 1 - Left - 0 - 1 - 1 - 1 - 1 - 1 - - 0 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 0 - m_global_grid - 1 - - - protected - 1 - - Fixed - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - onGridCellLeftClick - onGridCellLeftDClick - onGridCellRightClick - - - - - - - - - - - - - - - - - onGridCmdSelectCell - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Project Specific Libraries - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_project_panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - Module libraries which are visible for curent project only - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_project_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - - wxALIGN_CENTRE - 5 - - - 1 - 0 - Dock - 1 - Left - 0 - 1 - 1 - 1 - 1 - 1 - - 0 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 0 - m_project_grid - 1 - - - protected - 1 - - Fixed - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - onGridCellLeftClick - onGridCellLeftDClick - onGridCellRightClick - - - - - - - - - - - - - - - - - onGridCmdSelectCell - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxALIGN_CENTER|wxBOTTOM - 0 + + + Global Libraries + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_global_panel + 1 + + + protected + 0 + + Resizable + 1 + + + 0 + Module libraries which are visible for all projects + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + - bSizer51 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Append Row - - 0 - - - 0 - - 1 - m_append_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Add a PCB library row to this table - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - appendRowHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Delete Row - - 0 - - - 0 - - 1 - m_delete_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Remove a PCB library from this library table - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - deleteRowHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move Up - - 0 - - - 0 - - 1 - m_move_up_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Move the currently selected row up one position - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - moveUpHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move Down - - 0 - - - 0 - - 1 - m_move_down_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Move the currently selected row down one position - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - moveDownHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Options Editor - - 0 - - - 0 - - 1 - m_edit_options - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Zoom into the options table for current row - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - optionsEditor - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bottom - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_bottom_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Path Substitutions - - sbSizer1 + m_global_sizer wxVERTICAL none - 5 wxALL|wxEXPAND @@ -1385,24 +303,24 @@ 1 wxALIGN_CENTRE 30 - "Environment Variable" "Path Segment" + wxALIGN_CENTRE - 2 - 150,500 + 5 + 1 0 Dock - 0 + 1 Left 0 1 - 0 + 1 1 - 0 + 1 1 - 1 + 0 1 @@ -1420,15 +338,15 @@ 0 - 1 - m_path_subs_grid + 0 + m_global_grid 1 protected 1 - Resizable + Fixed wxALIGN_CENTRE 40 @@ -1439,7 +357,7 @@ 0 - + This table is associated with all projects @@ -1447,9 +365,9 @@ - - - + onGridCellLeftClick + onGridCellLeftDClick + onGridCellRightClick @@ -1466,7 +384,7 @@ - + onGridCmdSelectCell @@ -1502,35 +420,883 @@ - - 5 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 + + + + Project Specific Libraries + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_project_panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + Module libraries which are visible for curent project only + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + - m_sdbSizer1 - protected - - onCancelButtonClick - - - - onOKButtonClick - - + m_project_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + + wxALIGN_CENTRE + 5 + + + 1 + 0 + Dock + 1 + Left + 0 + 1 + 1 + 1 + 1 + 1 + + 0 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 0 + m_project_grid + 1 + + + protected + 1 + + Fixed + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + Libraries list in this table is associated with the current project + + + + + + + + onGridCellLeftClick + onGridCellLeftDClick + onGridCellRightClick + + + + + + + + + + + + + + + + + onGridCmdSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALIGN_CENTER|wxBOTTOM + 0 + + + bSizer51 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Append Row + + 0 + + + 0 + + 1 + m_append_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a PCB library row to this table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + appendRowHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Delete Row + + 0 + + + 0 + + 1 + m_delete_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Remove a PCB library from this library table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + deleteRowHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Move Up + + 0 + + + 0 + + 1 + m_move_up_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row up one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + moveUpHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Move Down + + 0 + + + 0 + + 1 + m_move_down_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row down one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + moveDownHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Options Editor + + 0 + + + 0 + + 1 + m_edit_options + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Zoom into the options table for current row + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + optionsEditor + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Path Substitutions + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Environment Variable" "Path Segment" + wxALIGN_CENTRE + 2 + 150,500 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 0 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_path_subs_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + This is a read-only table which shows pertinent environment variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + m_bottom_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + onCancelButtonClick + + + + onOKButtonClick + + + + diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.h b/pcbnew/dialogs/dialog_fp_lib_table_base.h index 7cef046001..1f6114348b 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.h +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.h @@ -28,7 +28,6 @@ class DIALOG_SHIM; #include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -42,8 +41,6 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM private: protected: - wxSplitterWindow* m_splitter; - wxPanel* m_top; wxAuiNotebook* m_auinotebook; wxPanel* m_global_panel; wxGrid* m_global_grid; @@ -54,13 +51,13 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM wxButton* m_move_up_button; wxButton* m_move_down_button; wxButton* m_edit_options; - wxPanel* m_bottom; wxGrid* m_path_subs_grid; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class + virtual void onInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } virtual void onGridCellLeftClick( wxGridEvent& event ) { event.Skip(); } virtual void onGridCellLeftDClick( wxGridEvent& event ) { event.Skip(); } @@ -77,14 +74,8 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM public: - DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 996,652 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,700 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_FP_LIB_TABLE_BASE(); - - void m_splitterOnIdle( wxIdleEvent& ) - { - m_splitter->SetSashPosition( 398 ); - m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); - } };