Commit fb43f4ad authored by Dick Hollenbeck's avatar Dick Hollenbeck

fp_lib_table dialog work

parent 80693fa7
......@@ -178,6 +178,52 @@ std::vector<wxString> FP_LIB_TABLE::GetLogicalLibs()
}
FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickName ) const
{
// this function must be *super* fast, so therefore should not instantiate
// anything which would require using the heap.
const FP_LIB_TABLE* cur = this;
do
{
INDEX_CITER it = cur->nickIndex.find( aNickName );
if( it != cur->nickIndex.end() )
{
return (FP_LIB_TABLE::ROW*) &cur->rows[it->second]; // found
}
// not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 );
return 0; // not found
}
bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace )
{
// this does not need to be super fast.
INDEX_CITER it = nickIndex.find( aRow.nickName );
if( it == nickIndex.end() )
{
rows.push_back( aRow );
nickIndex.insert( INDEX_VALUE( aRow.nickName, rows.size() - 1 ) );
return true;
}
if( doReplace )
{
rows[it->second] = aRow;
return true;
}
return false;
}
#if 0 // will need PLUGIN_RELEASER.
MODULE* FP_LIB_TABLE::LookupFootprint( const FP_LIB_ID& aFootprintId )
throw( IO_ERROR )
......@@ -256,47 +302,3 @@ void FP_LIB_TABLE::loadLib( ROW* aRow ) throw( IO_ERROR )
}
#endif
FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickName ) const
{
// this function must be *super* fast, so therefore should not instantiate
// anything which would require using the heap.
const FP_LIB_TABLE* cur = this;
do
{
INDEX_CITER it = cur->nickIndex.find( aNickName );
if( it != cur->nickIndex.end() )
{
return (FP_LIB_TABLE::ROW*) &cur->rows[it->second]; // found
}
// not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 );
return 0; // not found
}
bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace )
{
// this does not need to be super fast.
INDEX_CITER it = nickIndex.find( aRow.nickName );
if( it == nickIndex.end() )
{
rows.push_back( aRow );
nickIndex.insert( INDEX_VALUE( aRow.nickName, rows.size() - 1 ) );
return true;
}
if( doReplace )
{
rows[it->second] = aRow;
return true;
}
return false;
}
......@@ -82,6 +82,8 @@ class FP_LIB_TABLE_LEXER;
*/
class FP_LIB_TABLE : public wxGridTableBase
{
friend class DIALOG_FP_LIB_TABLE;
public:
/**
......@@ -92,6 +94,7 @@ public:
class ROW
{
friend class FP_LIB_TABLE;
friend class DIALOG_FP_LIB_TABLE;
public:
......@@ -148,8 +151,6 @@ public:
void Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR );
protected:
ROW( FP_LIB_TABLE* aOwner ) :
owner( aOwner )
// lib( 0 )
......@@ -316,9 +317,9 @@ public:
switch( aCol )
{
case 1: r.SetType( aValue );
case 2: r.SetFullURI( aValue );
case 3: r.SetOptions( aValue );
case 1: r.SetType( aValue ); break;
case 2: r.SetFullURI( aValue ); break;
case 3: r.SetOptions( aValue ); break;
}
}
}
......@@ -330,6 +331,51 @@ public:
return true;
}
bool InsertRows( size_t aPos = 0, size_t aNumRows = 1 )
{
if( aPos < rows.size() )
{
rows.insert( rows.begin() + aPos, aNumRows, ROW( this ) );
return true;
}
return false;
}
bool AppendRows( size_t aNumRows = 1 )
{
while( aNumRows-- )
rows.push_back( ROW( this ) );
return true;
}
bool DeleteRows( size_t aPos, size_t aNumRows )
{
if( aPos + aNumRows <= rows.size() )
{
ROWS_ITER start = rows.begin() + aPos;
rows.erase( start, start + aNumRows );
return true;
}
return false;
}
void Clear()
{
rows.clear();
}
wxString GetColLabelValue( int aCol )
{
switch( aCol )
{
case 0: return _( "Nickname" );
case 1: return _( "Plugin" );
case 2: return _( "Library Path" );
case 3: return _( "Options" );
default: return wxEmptyString;
}
}
//-----</wxGridTableBase overloads>------------------------------------------
......
......@@ -24,7 +24,7 @@
*/
#include <fctsys.h>
#include <dialog_fp_lib_table_base.h>
#include <fp_lib_table.h>
......@@ -35,11 +35,113 @@
*/
class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
{
//-----<event handlers>----------------------------------
void pageChangedHandler( wxAuiNotebookEvent& event )
{
int pageNdx = m_auinotebook->GetSelection();
m_cur_grid = pageNdx ? m_global_grid : m_project_grid;
}
void appendRowHandler( wxMouseEvent& event )
{
D(printf("%s\n", __func__);)
}
void deleteRowHandler( wxMouseEvent& event )
{
D(printf("%s\n", __func__);)
}
void moveUpHandler( wxMouseEvent& event )
{
D(printf("%s\n", __func__);)
}
void moveDownHandler( wxMouseEvent& event )
{
D(printf("%s\n", __func__);)
}
void onCancelButtonClick( wxCommandEvent& event )
{
m_global->rows = m_orig_global;
m_project->rows = m_orig_project;
// @todo reindex, or add member function for wholesale row replacement
EndModal( wxID_CANCEL );
}
void onOKButtonClick( wxCommandEvent& event )
{
EndModal( wxID_OK );
}
//-----</event handlers>---------------------------------
// caller's tables are modified only on OK button.
FP_LIB_TABLE* m_global;
FP_LIB_TABLE* m_project;
// local copies are saved and restored if Cancel button.
FP_LIB_TABLE::ROWS m_orig_global;
FP_LIB_TABLE::ROWS m_orig_project;
wxGrid* m_cur_grid; ///< changed based on tab choice
public:
DIALOG_FP_LIB_TABLE( wxFrame* aParent ) :
DIALOG_FP_LIB_TABLE_BASE( aParent )
DIALOG_FP_LIB_TABLE( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject ) :
DIALOG_FP_LIB_TABLE_BASE( aParent ),
m_global( aGlobal ),
m_project( aProject ),
m_orig_global( aGlobal->rows ),
m_orig_project( aProject->rows )
{
/*
GetSizer()->SetSizeHints( this );
Centre();
SetAutoLayout( true );
Layout();
*/
#if 1 && defined(DEBUG)
// put some dummy data into table(s)
FP_LIB_TABLE::ROW row( m_global );
row.SetNickName( wxT( "passives" ) );
row.SetType( wxT( "kicad" ) );
row.SetFullURI( wxT( "%G/passives" ) );
row.SetOptions( wxT( "speed=fast,purpose=testing" ) );
m_global->InsertRow( row );
row.SetNickName( wxT( "micros" ) );
row.SetType( wxT( "legacy" ) );
row.SetFullURI( wxT( "%P/micros" ) );
row.SetOptions( wxT( "speed=fast,purpose=testing" ) );
m_global->InsertRow( row );
row.owner = m_project;
row.SetFullURI( wxT( "%P/chips" ) );
m_project->InsertRow( row );
#endif
m_global_grid->SetTable( m_global );
m_project_grid->SetTable( m_project );
//m_global_grid->AutoSize();
m_global_grid->AutoSizeColumns( false );
//m_project_grid->AutoSize();
m_project_grid->AutoSizeColumns( false );
//m_path_subs_grid->AutoSize();
m_path_subs_grid->AutoSizeColumns( false );
}
};
......@@ -47,9 +149,17 @@ public:
int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject )
{
DIALOG_FP_LIB_TABLE dlg( aParent );
DIALOG_FP_LIB_TABLE dlg( aParent, aGlobal, aProject );
dlg.Show( true );
int ret = dlg.ShowModal();
switch( ret )
{
case wxID_OK:
break;
case wxID_CANCEL:
break;
}
return 0;
}
......
......@@ -16,173 +16,164 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
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_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_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Global and Project Scope") ), wxVERTICAL );
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_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") );
m_auinotebook = new wxAuiNotebook( m_top, 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") );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_global_box_sizer;
m_global_box_sizer = new wxBoxSizer( wxVERTICAL );
m_grid1 = new wxGrid( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_global_grid = new wxGrid( m_global_panel, 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 );
m_global_grid->CreateGrid( 1, 4 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( true );
m_global_grid->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 );
m_global_grid->AutoSizeColumns();
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelSize( 30 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid1->AutoSizeRows();
m_grid1->EnableDragRowSize( true );
m_grid1->SetRowLabelSize( 80 );
m_grid1->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_global_grid->EnableDragRowSize( true );
m_global_grid->SetRowLabelSize( 40 );
m_global_grid->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_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_global_box_sizer->Add( m_global_grid, 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_global_panel->SetSizer( m_global_box_sizer );
m_global_panel->Layout();
m_global_box_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL );
m_grid11 = new wxGrid( m_panel5, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_project_grid = new wxGrid( m_project_panel, 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 );
m_project_grid->CreateGrid( 1, 4 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( true );
m_project_grid->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 );
m_project_grid->AutoSizeColumns();
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelSize( 30 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid11->AutoSizeRows();
m_grid11->EnableDragRowSize( true );
m_grid11->SetRowLabelSize( 80 );
m_grid11->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_project_grid->EnableDragRowSize( true );
m_project_grid->SetRowLabelSize( 40 );
m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid11->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer5->Add( m_grid11, 0, wxALL, 5 );
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_project_sizer->Add( m_project_grid, 0, wxALL, 5 );
m_panel5->SetSizer( bSizer5 );
m_panel5->Layout();
bSizer5->Fit( m_panel5 );
m_auinotebook2->AddPage( m_panel5, _("Project Specific Libraries"), true, wxNullBitmap );
m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap );
sbSizer3->Add( m_auinotebook2, 1, wxEXPAND | wxALL, 5 );
m_top_sizer->Add( m_auinotebook, 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") );
m_append_button = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 );
m_append_button->SetToolTip( _("Add a pcb library row to this table") );
bSizer51->Add( m_button1, 0, wxALL, 5 );
bSizer51->Add( m_append_button, 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") );
m_delete_button = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 );
m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
bSizer51->Add( m_button2, 0, wxALL, 5 );
bSizer51->Add( m_delete_button, 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") );
m_move_up_button = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_up_button->SetToolTip( _("Move the currently selected row up one position") );
bSizer51->Add( m_button3, 0, wxALL, 5 );
bSizer51->Add( m_move_up_button, 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") );
m_move_down_button = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_down_button->SetToolTip( _("Move the currently selected row down one position") );
bSizer51->Add( m_button4, 0, wxALL, 5 );
bSizer51->Add( m_move_down_button, 0, wxALL, 5 );
sbSizer3->Add( bSizer51, 0, wxALIGN_CENTER, 5 );
m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 );
m_top->SetSizer( sbSizer3 );
m_top->SetSizer( m_top_sizer );
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 );
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 );
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 );
m_path_subs_grid = 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 );
m_path_subs_grid->CreateGrid( 2, 2 );
m_path_subs_grid->EnableEditing( true );
m_path_subs_grid->EnableGridLines( true );
m_path_subs_grid->EnableDragGridSize( false );
m_path_subs_grid->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 );
m_path_subs_grid->SetColSize( 0, 150 );
m_path_subs_grid->SetColSize( 1, 500 );
m_path_subs_grid->AutoSizeColumns();
m_path_subs_grid->EnableDragColMove( false );
m_path_subs_grid->EnableDragColSize( true );
m_path_subs_grid->SetColLabelSize( 30 );
m_path_subs_grid->SetColLabelValue( 0, _("Category") );
m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") );
m_path_subs_grid->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 );
m_path_subs_grid->EnableDragRowSize( true );
m_path_subs_grid->SetRowLabelSize( 40 );
m_path_subs_grid->SetRowLabelValue( 0, _("%S") );
m_path_subs_grid->SetRowLabelValue( 1, _("%P") );
m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid2->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizer1->Add( m_grid2, 0, wxALL, 5 );
m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 );
bSizer8->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
m_bottom_sizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK );
......@@ -191,23 +182,40 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizer8->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
m_bottom->SetSizer( bSizer8 );
m_bottom->SetSizer( m_bottom_sizer );
m_bottom->Layout();
bSizer8->Fit( m_bottom );
m_splitter1->SplitHorizontally( m_top, m_bottom, 254 );
bSizer1->Add( m_splitter1, 2, wxEXPAND, 5 );
m_bottom_sizer->Fit( m_bottom );
m_splitter->SplitHorizontally( m_top, m_bottom, 343 );
bSizer1->Add( m_splitter, 2, wxEXPAND, 5 );
this->SetSizer( bSizer1 );
this->Layout();
bSizer1->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
{
// Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}
......@@ -42,7 +42,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_FP_LIB_TABLE_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">864,652</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">PCB Library Tables</property>
......@@ -131,7 +131,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_splitter1</property>
<property name="name">m_splitter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -140,12 +140,12 @@
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="sashgravity">0.0</property>
<property name="sashpos">254</property>
<property name="sashpos">343</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_HORIZONTAL</property>
<property name="style">wxSP_3D|wxSP_3DBORDER</property>
<property name="style">wxSP_3DSASH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
......@@ -254,19 +254,19 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Global and Project Scope</property>
<property name="label">Library Tables by Scope</property>
<property name="minimum_size"></property>
<property name="name">sbSizer3</property>
<property name="name">m_top_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxAuiNotebook" expanded="0">
<object class="wxAuiNotebook" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -301,7 +301,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_auinotebook2</property>
<property name="name">m_auinotebook</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -311,7 +311,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxAUI_NB_DEFAULT_STYLE</property>
<property name="style">wxAUI_NB_BOTTOM</property>
<property name="subclass"></property>
<property name="tab_ctrl_height">-1</property>
<property name="toolbar_pane">0</property>
......@@ -325,7 +325,7 @@
<event name="OnAuiNotebookButton"></event>
<event name="OnAuiNotebookDragMotion"></event>
<event name="OnAuiNotebookEndDrag"></event>
<event name="OnAuiNotebookPageChanged"></event>
<event name="OnAuiNotebookPageChanged">pageChangedHandler</event>
<event name="OnAuiNotebookPageChanging"></event>
<event name="OnAuiNotebookPageClose"></event>
<event name="OnChar"></event>
......@@ -351,11 +351,11 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="auinotebookpage" expanded="0">
<object class="auinotebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Global Libraries</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -390,7 +390,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel4</property>
<property name="name">m_global_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -429,9 +429,9 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="name">m_global_box_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
......@@ -448,7 +448,7 @@
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_rows">1</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -462,7 +462,7 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">30</property>
<property name="col_label_values">&quot;Nickname&quot; &quot;Library Path&quot; &quot;Plugin&quot; &quot;Options&quot;</property>
<property name="col_label_values"></property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">4</property>
<property name="column_sizes"></property>
......@@ -470,16 +470,16 @@
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_grid_size">1</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="floatable">0</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
......@@ -497,8 +497,8 @@
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_grid1</property>
<property name="moveable">0</property>
<property name="name">m_global_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -507,7 +507,7 @@
<property name="pos"></property>
<property name="resize">Fixed</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="row_label_size">80</property>
<property name="row_label_size">40</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_sizes"></property>
......@@ -580,11 +580,11 @@
</object>
</object>
</object>
<object class="auinotebookpage" expanded="0">
<object class="auinotebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Project Specific Libraries</property>
<property name="select">1</property>
<object class="wxPanel" expanded="0">
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -619,7 +619,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel5</property>
<property name="name">m_project_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -658,9 +658,9 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="name">m_project_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
......@@ -677,7 +677,7 @@
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_rows">1</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -691,7 +691,7 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">30</property>
<property name="col_label_values">&quot;Nickname&quot; &quot;Library Path&quot; &quot;Plugin&quot; &quot;Options&quot;</property>
<property name="col_label_values"></property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">4</property>
<property name="column_sizes"></property>
......@@ -699,16 +699,16 @@
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_grid_size">1</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="floatable">0</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
......@@ -726,8 +726,8 @@
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_grid11</property>
<property name="moveable">0</property>
<property name="name">m_project_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -736,7 +736,7 @@
<property name="pos"></property>
<property name="resize">Fixed</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="row_label_size">80</property>
<property name="row_label_size">40</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_sizes"></property>
......@@ -812,8 +812,8 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER</property>
<property name="border">8</property>
<property name="flag">wxALIGN_CENTER|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
......@@ -861,7 +861,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button1</property>
<property name="name">m_append_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -891,7 +891,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftDown">appendRowHandler</event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
......@@ -949,7 +949,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button2</property>
<property name="name">m_delete_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -979,7 +979,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftDown">deleteRowHandler</event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
......@@ -1037,7 +1037,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3</property>
<property name="name">m_move_up_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1067,7 +1067,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftDown">moveUpHandler</event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
......@@ -1125,7 +1125,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button4</property>
<property name="name">m_move_down_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1155,7 +1155,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftDown">moveDownHandler</event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
......@@ -1252,16 +1252,16 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer8</property>
<property name="name">m_bottom_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Path Substitutions</property>
<property name="minimum_size"></property>
......@@ -1271,8 +1271,8 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
......@@ -1282,7 +1282,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_cols">1</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
......@@ -1333,7 +1333,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_grid2</property>
<property name="name">m_path_subs_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1431,11 +1431,11 @@
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnCancelButtonClick">onCancelButtonClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnOKButtonClick">onOKButtonClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
......
......@@ -42,32 +42,42 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
private:
protected:
wxSplitterWindow* m_splitter1;
wxSplitterWindow* m_splitter;
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;
wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel;
wxGrid* m_global_grid;
wxPanel* m_project_panel;
wxGrid* m_project_grid;
wxButton* m_append_button;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
wxPanel* m_bottom;
wxGrid* m_grid2;
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 pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void deleteRowHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void moveDownHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void onCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 864,652 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FP_LIB_TABLE_BASE();
void m_splitter1OnIdle( wxIdleEvent& )
void m_splitterOnIdle( wxIdleEvent& )
{
m_splitter1->SetSashPosition( 254 );
m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitter1OnIdle ), NULL, this );
m_splitter->SetSashPosition( 343 );
m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this );
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment