diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 784451cf80..cab2481320 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -294,11 +294,7 @@ bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace ) if( doReplace ) { - int ndx = it->second; - - rows[ndx] = aRow; - nickIndex.erase( aRow.nickName ); - nickIndex.insert( INDEX_VALUE( aRow.nickName, ndx ) ); + rows[it->second] = aRow; return true; } diff --git a/include/dlist.h b/include/dlist.h index 2acf80271c..b3f7284074 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -27,9 +27,6 @@ #define DLIST_H_ -#include // NULL definition. - - class EDA_ITEM; @@ -216,20 +213,20 @@ public: //-----< STL like functions >--------------------------------------- T* begin() const { return GetFirst(); } - T* end() const { return NULL; } + T* end() const { return 0; } T* PopFront() { if( GetFirst() ) return Remove( GetFirst() ); - return NULL; + return 0; } T* PopBack() { if( GetLast() ) return Remove( GetLast() ); - return NULL; + return 0; } /** diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 4d5c270c3e..97a512e6af 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -36,9 +36,8 @@ class OUTPUTFORMATTER; - - class MODULE; +class FP_LIB_TABLE_LEXER; /** * Class FP_LIB_TABLE @@ -279,7 +278,6 @@ public: */ std::vector GetLogicalLibs(); - //------------------------------------------------ int GetNumberRows () { return rows.size(); } @@ -318,13 +316,20 @@ public: switch( aCol ) { - case 1: return r.SetType( aValue ); - case 2: return r.SetFullURI( aValue ); - case 3: return r.SetOptions( aValue ); + case 1: r.SetType( aValue ); + case 2: r.SetFullURI( aValue ); + case 3: r.SetOptions( aValue ); } } } + bool IsEmptyCell( int aRow, int aCol ) + { + if( unsigned( aRow ) < rows.size() ) + return false; + return true; + } + //----------------------------------------------- diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 58d859d5fa..a398f68c2a 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -26,8 +26,8 @@ * @file wxPcbStruct.h */ -#ifndef WXPCB_STRUCT_H -#define WXPCB_STRUCT_H +#ifndef WXPCB_STRUCT_H_ +#define WXPCB_STRUCT_H_ #include @@ -1604,4 +1604,16 @@ public: }; -#endif /* WXPCB_STRUCT_H */ +class FP_LIB_TABLE; + +/** + * Function InvokePcbLibTableEditor + * shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables. + * + * @return int - bits 0 and 1 tell whether a change was made to the @a aGlobal + * and/or the @a aProject table, respectively. If set, table was modified. + */ +int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject ); + + +#endif // WXPCB_STRUCT_H_ diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index ffc56cdfde..02814ff9e7 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -50,6 +50,8 @@ set(PCBNEW_DIALOGS dialogs/dialog_export_3Dfiles_base.cpp dialogs/dialog_find_base.cpp dialogs/dialog_find.cpp + dialogs/dialog_fp_lib_table_base.cpp + dialogs/dialog_fp_lib_table.cpp dialogs/dialog_freeroute_exchange.cpp dialogs/dialog_freeroute_exchange_base.cpp dialogs/dialog_gendrill.cpp @@ -247,11 +249,11 @@ set(PCBNEW_SCRIPTING_PYTHON_HELPERS ) if (KICAD_SCRIPTING) - set(PCBNEW_SCRIPTING_SRCS - ${PCBNEW_SCRIPTING_DIALOGS} - pcbnew_wrap.cxx - ${PCBNEW_SCRIPTING_PYTHON_HELPERS} - ) + set(PCBNEW_SCRIPTING_SRCS + ${PCBNEW_SCRIPTING_DIALOGS} + pcbnew_wrap.cxx + ${PCBNEW_SCRIPTING_PYTHON_HELPERS} + ) endif(KICAD_SCRIPTING) ## @@ -260,34 +262,34 @@ endif(KICAD_SCRIPTING) if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) - set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) - if (DEBUG) - set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) - endif(DEBUG) - # collect CFLAGS , and pass them to swig later + set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) + if (DEBUG) + set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) + endif(DEBUG) + # collect CFLAGS , and pass them to swig later - get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) - foreach( d ${DirDefs} ) - SET(SWIG_FLAGS ${SWIG_FLAGS} -D${d} ) - endforeach() + get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) + foreach( d ${DirDefs} ) + SET(SWIG_FLAGS ${SWIG_FLAGS} -D${d} ) + endforeach() - # check if we have IO_MGR and KICAD_PLUGIN available - if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) - SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) - endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE) + # check if we have IO_MGR and KICAD_PLUGIN available + if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) + SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) + endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE) - if ( USE_PCBNEW_NANOMETRES ) - SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) - endif( USE_PCBNEW_NANOMETRES ) + if ( USE_PCBNEW_NANOMETRES ) + SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) + endif( USE_PCBNEW_NANOMETRES ) endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if (KICAD_SCRIPTING) - SET(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} ) + SET(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx DEPENDS scripting/pcbnew.i DEPENDS scripting/board.i DEPENDS scripting/board_item.i @@ -299,10 +301,10 @@ if (KICAD_SCRIPTING) DEPENDS ../scripting/wx.i DEPENDS ../scripting/kicadplugins.i - COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) + COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) endif(KICAD_SCRIPTING) @@ -430,7 +432,7 @@ install(TARGETS pcbnew COMPONENT binary) if(KICAD_SCRIPTING) - add_custom_target(FixSwigImportsScripting ALL + add_custom_target(FixSwigImportsScripting ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pcbnew COMMENT "Fixing swig_import_helper in Kicad scripting" @@ -442,7 +444,7 @@ if(KICAD_SCRIPTING) endif(KICAD_SCRIPTING) if (KICAD_SCRIPTING_MODULES) - add_custom_target(FixSwigImportsModuleScripting ALL + add_custom_target(FixSwigImportsModuleScripting ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew COMMENT "Fixing swig_import_helper in Kicad scripting modules" diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp new file mode 100644 index 0000000000..08978ea663 --- /dev/null +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -0,0 +1,56 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2012 Wayne Stambaugh + * Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + + +#include +#include + +/** + * Class DIALOG_FP_LIB_TABLE + * shows and edits the PCB library tables. Two tables are expected, one global + * and one project specific. + */ +class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE +{ + +public: + DIALOG_FP_LIB_TABLE( wxFrame* aParent ) : + DIALOG_FP_LIB_TABLE_BASE( aParent ) + { + } +}; + + + +int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject ) +{ + DIALOG_FP_LIB_TABLE dlg( aParent ); + + dlg.Show( true ); + + return 0; +} + diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp new file mode 100644 index 0000000000..dd5d8226d2 --- /dev/null +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp @@ -0,0 +1,213 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_fp_lib_table_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + m_splitter1 = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_3DBORDER ); + m_splitter1->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitter1OnIdle ), NULL, this ); + m_splitter1->SetMinimumPaneSize( 10 ); + + m_top = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxStaticBoxSizer* sbSizer3; + sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Global and Project Scope") ), wxVERTICAL ); + + m_auinotebook2 = new wxAuiNotebook( m_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE ); + m_panel4 = new wxPanel( m_auinotebook2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel4->SetToolTip( _("Module libraries which are visible for all projects") ); + + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxVERTICAL ); + + m_grid1 = new wxGrid( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid1->CreateGrid( 1, 4 ); + m_grid1->EnableEditing( true ); + m_grid1->EnableGridLines( true ); + m_grid1->EnableDragGridSize( false ); + m_grid1->SetMargins( 0, 0 ); + + // Columns + m_grid1->AutoSizeColumns(); + m_grid1->EnableDragColMove( false ); + m_grid1->EnableDragColSize( true ); + m_grid1->SetColLabelSize( 30 ); + m_grid1->SetColLabelValue( 0, _("Nickname") ); + m_grid1->SetColLabelValue( 1, _("Library Path") ); + m_grid1->SetColLabelValue( 2, _("Plugin") ); + m_grid1->SetColLabelValue( 3, _("Options") ); + m_grid1->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_grid1->AutoSizeRows(); + m_grid1->EnableDragRowSize( true ); + m_grid1->SetRowLabelSize( 80 ); + m_grid1->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid1->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bSizer4->Add( m_grid1, 1, wxALL|wxEXPAND, 5 ); + + + m_panel4->SetSizer( bSizer4 ); + m_panel4->Layout(); + bSizer4->Fit( m_panel4 ); + m_auinotebook2->AddPage( m_panel4, _("Global Libraries"), false, wxNullBitmap ); + m_panel5 = new wxPanel( m_auinotebook2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer5; + bSizer5 = new wxBoxSizer( wxVERTICAL ); + + m_grid11 = new wxGrid( m_panel5, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid11->CreateGrid( 1, 4 ); + m_grid11->EnableEditing( true ); + m_grid11->EnableGridLines( true ); + m_grid11->EnableDragGridSize( false ); + m_grid11->SetMargins( 0, 0 ); + + // Columns + m_grid11->AutoSizeColumns(); + m_grid11->EnableDragColMove( false ); + m_grid11->EnableDragColSize( true ); + m_grid11->SetColLabelSize( 30 ); + m_grid11->SetColLabelValue( 0, _("Nickname") ); + m_grid11->SetColLabelValue( 1, _("Library Path") ); + m_grid11->SetColLabelValue( 2, _("Plugin") ); + m_grid11->SetColLabelValue( 3, _("Options") ); + m_grid11->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_grid11->AutoSizeRows(); + m_grid11->EnableDragRowSize( true ); + m_grid11->SetRowLabelSize( 80 ); + m_grid11->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid11->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bSizer5->Add( m_grid11, 0, wxALL, 5 ); + + + m_panel5->SetSizer( bSizer5 ); + m_panel5->Layout(); + bSizer5->Fit( m_panel5 ); + m_auinotebook2->AddPage( m_panel5, _("Project Specific Libraries"), true, wxNullBitmap ); + + sbSizer3->Add( m_auinotebook2, 1, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizer51; + bSizer51 = new wxBoxSizer( wxHORIZONTAL ); + + m_button1 = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button1->SetToolTip( _("Add a pcb library row to this table") ); + + bSizer51->Add( m_button1, 0, wxALL, 5 ); + + m_button2 = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button2->SetToolTip( _("Remove a PCB library from this library table") ); + + bSizer51->Add( m_button2, 0, wxALL, 5 ); + + m_button3 = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button3->SetToolTip( _("Move the currently selected row up one position") ); + + bSizer51->Add( m_button3, 0, wxALL, 5 ); + + m_button4 = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button4->SetToolTip( _("Move the currently selected row down one position") ); + + bSizer51->Add( m_button4, 0, wxALL, 5 ); + + + sbSizer3->Add( bSizer51, 0, wxALIGN_CENTER, 5 ); + + + m_top->SetSizer( sbSizer3 ); + m_top->Layout(); + sbSizer3->Fit( m_top ); + m_bottom = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer8; + bSizer8 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_bottom, wxID_ANY, _("Path Substitutions") ), wxVERTICAL ); + + m_grid2 = new wxGrid( m_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid2->CreateGrid( 2, 2 ); + m_grid2->EnableEditing( true ); + m_grid2->EnableGridLines( true ); + m_grid2->EnableDragGridSize( false ); + m_grid2->SetMargins( 0, 0 ); + + // Columns + m_grid2->SetColSize( 0, 150 ); + m_grid2->SetColSize( 1, 500 ); + m_grid2->EnableDragColMove( false ); + m_grid2->EnableDragColSize( true ); + m_grid2->SetColLabelSize( 30 ); + m_grid2->SetColLabelValue( 0, _("Category") ); + m_grid2->SetColLabelValue( 1, _("Path Segment") ); + m_grid2->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_grid2->EnableDragRowSize( true ); + m_grid2->SetRowLabelSize( 40 ); + m_grid2->SetRowLabelValue( 0, _("%S") ); + m_grid2->SetRowLabelValue( 1, _("%P") ); + m_grid2->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid2->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer1->Add( m_grid2, 0, wxALL, 5 ); + + + bSizer8->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( m_bottom, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bSizer8->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); + + + m_bottom->SetSizer( bSizer8 ); + m_bottom->Layout(); + bSizer8->Fit( m_bottom ); + m_splitter1->SplitHorizontally( m_top, m_bottom, 254 ); + bSizer1->Add( m_splitter1, 2, wxEXPAND, 5 ); + + + this->SetSizer( bSizer1 ); + this->Layout(); + bSizer1->Fit( this ); + + this->Centre( wxBOTH ); +} + +DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() +{ +} diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp new file mode 100644 index 0000000000..5b9038d16a --- /dev/null +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp @@ -0,0 +1,1451 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_fp_lib_table_base + 1000 + none + 1 + MyProject1 + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_FP_LIB_TABLE_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + PCB Library Tables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer1 + wxVERTICAL + none + + 5 + wxEXPAND + 2 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 10 + + 0 + + 1 + m_splitter1 + 1 + + + protected + 1 + + Resizable + 0.0 + 254 + -1 + 1 + + wxSPLIT_HORIZONTAL + wxSP_3D|wxSP_3DBORDER + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_top + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + wxID_ANY + Global and Project Scope + + sbSizer3 + 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_auinotebook2 + 1 + + + protected + 1 + + Resizable + 1 + + wxAUI_NB_DEFAULT_STYLE + + -1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Global Libraries + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel4 + 1 + + + protected + 0 + + Resizable + 1 + + + 0 + Module libraries which are visible for all projects + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer4 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 1 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Nickname" "Library Path" "Plugin" "Options" + wxALIGN_CENTRE + 4 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_grid1 + 1 + + + protected + 1 + + Fixed + wxALIGN_CENTRE + 80 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Project Specific Libraries + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel5 + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer5 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 1 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Nickname" "Library Path" "Plugin" "Options" + wxALIGN_CENTRE + 4 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_grid11 + 1 + + + protected + 1 + + Fixed + wxALIGN_CENTRE + 80 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER + 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_button1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a pcb library row to this table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_button2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Remove a PCB library from this library table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_button3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row up one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_button4 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row down one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer8 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Path Substitutions + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Category" "Path Segment" + wxALIGN_CENTRE + 2 + 150,500 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_grid2 + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 40 + "%S" "%P" + wxALIGN_CENTRE + + 2 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.h b/pcbnew/dialogs/dialog_fp_lib_table_base.h new file mode 100644 index 0000000000..f65b923c2a --- /dev/null +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_FP_LIB_TABLE_BASE_H__ +#define __DIALOG_FP_LIB_TABLE_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FP_LIB_TABLE_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxSplitterWindow* m_splitter1; + wxPanel* m_top; + wxAuiNotebook* m_auinotebook2; + wxPanel* m_panel4; + wxGrid* m_grid1; + wxPanel* m_panel5; + wxGrid* m_grid11; + wxButton* m_button1; + wxButton* m_button2; + wxButton* m_button3; + wxButton* m_button4; + wxPanel* m_bottom; + wxGrid* m_grid2; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + 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( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FP_LIB_TABLE_BASE(); + + void m_splitter1OnIdle( wxIdleEvent& ) + { + m_splitter1->SetSashPosition( 254 ); + m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitter1OnIdle ), NULL, this ); + } + +}; + +#endif //__DIALOG_FP_LIB_TABLE_BASE_H__ diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 6b36d1a269..c0a4b9979b 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -428,6 +428,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() _( "Li&brary" ), _( "Setting libraries, directories and others..." ), KiBitmap( library_xpm ) ); + AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT, + _( "Li&brary Tables" ), _( "Setup footprint libraries" ), + KiBitmap( library_xpm ) ); + // Colors and Visibility are also handled by the layers manager toolbar AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, m_show_layer_manager_tools ? diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index f89084eae5..c4658a3b3f 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -109,6 +109,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) // menu Config EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, PCB_EDIT_FRAME::OnConfigurePcbOptions ) EVT_MENU( ID_CONFIG_REQ, PCB_EDIT_FRAME::Process_Config ) + EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 808a24056c..3051347cb6 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -58,8 +59,8 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { - int id = event.GetId(); - wxFileName fn; + int id = event.GetId(); + wxFileName fn; switch( id ) { @@ -81,6 +82,25 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) InstallConfigFrame(); break; + case ID_PCB_LIB_TABLE_EDIT: + { + FP_LIB_TABLE gbl; + FP_LIB_TABLE prj; + + int r = InvokePcbLibTableEditor( this, &gbl, &prj ); + + if( r & 1 ) + { + // save global table to disk and apply it + } + + if( r & 2 ) + { + // save project table to disk and apply it + } + } + break; + case ID_PCB_MASK_CLEARANCE: { DIALOG_PADS_MASK_CLEARANCE dlg( this ); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index c78a27462a..eae9ab32ea 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -250,6 +250,7 @@ enum pcbnew_ids ID_MENU_PCB_SHOW_3D_FRAME, ID_PCB_USER_GRID_SETUP, ID_PCB_GEN_BOM_FILE_FROM_BOARD, + ID_PCB_LIB_TABLE_EDIT, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, @@ -330,7 +331,7 @@ enum pcbnew_ids ID_MODVIEW_NEXT, ID_MODVIEW_SHOW_3D_VIEW, ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, - ID_FOOTPRINT_WIZARD_WINDOW, + ID_FOOTPRINT_WIZARD_WINDOW, ID_FOOTPRINT_WIZARD_PAGES, ID_FOOTPRINT_WIZARD_PARAMETERS, ID_FOOTPRINT_WIZARD_NEXT, @@ -343,7 +344,7 @@ enum pcbnew_ids ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW, ID_FOOTPRINT_WIZARD_SELECT_WIZARD, ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD, - + }; #endif /* __PCBNEW_IDS_H__ */