Commit e45ed220 authored by Dick Hollenbeck's avatar Dick Hollenbeck

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.
parent 8234966a
...@@ -50,6 +50,22 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) : ...@@ -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 ) 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 ...@@ -142,9 +158,6 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
sawOpts = true; sawOpts = true;
in->NeedSYMBOLorNUMBER(); in->NeedSYMBOLorNUMBER();
row.SetOptions( in->FromUTF8() ); row.SetOptions( in->FromUTF8() );
// create PROPERTIES* from options, set into the ROW
row.properties = ParseOptions( in->CurStr() );
break; break;
case T_descr: case T_descr:
......
...@@ -202,7 +202,13 @@ public: ...@@ -202,7 +202,13 @@ public:
/** /**
* Function SetOptions * 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 * Function GetDescr
...@@ -223,17 +229,6 @@ public: ...@@ -223,17 +229,6 @@ public:
*/ */
const PROPERTIES* GetProperties() const { return properties; } 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;
}
//-----</accessors>----------------------------------------------------- //-----</accessors>-----------------------------------------------------
/** /**
...@@ -249,6 +244,17 @@ public: ...@@ -249,6 +244,17 @@ public:
private: 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 nickName;
wxString uri; wxString uri;
LIB_T type; LIB_T type;
...@@ -258,7 +264,6 @@ public: ...@@ -258,7 +264,6 @@ public:
PROPERTIES* properties; PROPERTIES* properties;
}; };
/** /**
* Constructor FP_LIB_TABLE * Constructor FP_LIB_TABLE
* builds a library table by pre-pending this table fragment in front of * builds a library table by pre-pending this table fragment in front of
...@@ -395,15 +400,8 @@ public: ...@@ -395,15 +400,8 @@ public:
return row ? &row->options : 0; return row ? &row->options : 0;
} }
#endif #endif
//----</read accessors>--------------------------------------------------- //----</read accessors>---------------------------------------------------
#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 * Function InsertRow
* adds aRow if it does not already exist or if doReplace is true. If doReplace * adds aRow if it does not already exist or if doReplace is true. If doReplace
...@@ -443,6 +441,14 @@ public: ...@@ -443,6 +441,14 @@ public:
*/ */
bool IsEmpty() const; 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 * Function MissingLegacyLibs
* tests the list of \a aLibNames by URI to determine if any of them are missing from * tests the list of \a aLibNames by URI to determine if any of them are missing from
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <dialog_fp_lib_table_base.h> #include <dialog_fp_lib_table_base.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <fp_lib_table_lexer.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
...@@ -287,7 +288,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -287,7 +288,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
selColCount = 0; 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() void rightClickCellPopupMenu()
...@@ -300,15 +301,30 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -300,15 +301,30 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
getSelectedArea(); getSelectedArea();
// if nothing is selected, diable cut and copy. // if nothing is selected, disable cut and copy.
if( !selRowCount && !selColCount ) if( !selRowCount && !selColCount )
{ {
menu.Enable( ID_CUT, false ); menu.Enable( ID_CUT, false );
menu.Enable( ID_COPY, 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 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 ); menu.Enable( ID_PASTE, false );
PopupMenu( &menu ); PopupMenu( &menu );
...@@ -362,12 +378,53 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -362,12 +378,53 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
{ {
if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
{ {
wxGridTableBase* tbl = m_cur_grid->GetTable();
wxTextDataObject data; wxTextDataObject data;
FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) m_cur_grid->GetTable();
wxTheClipboard->GetData( data ); 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( ndx != std::string::npos )
{
// paste the ROWs of s-expression (fp_lib_table), starting
// at column 0 regardless of current cursor column.
STRING_LINE_READER slr( TO_UTF8( cb_text ), wxT( "Clipboard" ) );
FP_LIB_TABLE_LEXER lexer( &slr );
FP_LIB_TABLE tmp_tbl;
bool parsed = true;
try
{
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 clipboard rows would extend past end of current table size...
if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row ) if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row )
...@@ -389,6 +446,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -389,6 +446,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
} }
} }
} }
}
wxTheClipboard->Close(); wxTheClipboard->Close();
m_cur_grid->ForceRefresh(); m_cur_grid->ForceRefresh();
...@@ -730,8 +788,8 @@ public: ...@@ -730,8 +788,8 @@ public:
m_project( aProject ), m_project( aProject ),
m_global_model( *aGlobal ), m_global_model( *aGlobal ),
m_project_model( *aProject ), m_project_model( *aProject ),
m_cur_row( -1 ), m_cur_row( 0 ),
m_cur_col( -1 ) m_cur_col( 0 )
{ {
m_global_grid->SetTable( (wxGridTableBase*) &m_global_model ); m_global_grid->SetTable( (wxGridTableBase*) &m_global_model );
m_project_grid->SetTable( (wxGridTableBase*) &m_project_model ); m_project_grid->SetTable( (wxGridTableBase*) &m_project_model );
...@@ -740,10 +798,9 @@ public: ...@@ -740,10 +798,9 @@ public:
m_project_grid->AutoSizeColumns( false ); m_project_grid->AutoSizeColumns( false );
wxArrayString choices; wxArrayString choices;
choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) ); choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) );
#if defined(BUILD_GITHUB_PLUGIN)
choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) ); choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) );
#endif
choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) ); choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) );
choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) ); choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) );
choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) ); choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) );
......
...@@ -16,15 +16,10 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID ...@@ -16,15 +16,10 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizer1; wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL ); 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; 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 = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_global_panel->SetToolTip( _("Module libraries which are visible for all projects") ); 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 ...@@ -56,6 +51,8 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Cell Defaults // Cell Defaults
m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); 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 ); 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 ...@@ -94,6 +91,8 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Cell Defaults // Cell Defaults
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); 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 ); 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 ...@@ -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_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap ); 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; wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL ); 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") ); m_append_button->SetToolTip( _("Add a PCB library row to this table") );
bSizer51->Add( m_append_button, 0, wxALL, 5 ); 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") ); m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
bSizer51->Add( m_delete_button, 0, wxALL, 5 ); 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") ); m_move_up_button->SetToolTip( _("Move the currently selected row up one position") );
bSizer51->Add( m_move_up_button, 0, wxALL, 5 ); 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") ); m_move_down_button->SetToolTip( _("Move the currently selected row down one position") );
bSizer51->Add( m_move_down_button, 0, wxALL, 5 ); 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") ); m_edit_options->SetToolTip( _("Zoom into the options table for current row") );
bSizer51->Add( m_edit_options, 0, wxALL, 5 ); 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 ...@@ -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_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 );
m_top->SetSizer( m_top_sizer ); bSizer1->Add( m_top_sizer, 1, wxEXPAND, 5 );
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 );
wxStaticBoxSizer* sbSizer1; 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 // Grid
m_path_subs_grid->CreateGrid( 1, 2 ); m_path_subs_grid->CreateGrid( 1, 2 );
...@@ -175,26 +169,27 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID ...@@ -175,26 +169,27 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Cell Defaults // Cell Defaults
m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); 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 ); 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_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK ); m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK ); 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->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
m_bottom->SetSizer( m_bottom_sizer ); bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 );
m_bottom->Layout();
m_bottom_sizer->Fit( m_bottom );
m_splitter->SplitHorizontally( m_top, m_bottom, 398 );
bSizer1->Add( m_splitter, 2, wxEXPAND, 5 );
this->SetSizer( bSizer1 ); this->SetSizer( bSizer1 );
...@@ -203,6 +198,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID ...@@ -203,6 +198,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // 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_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_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 ); 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 ...@@ -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() DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
{ {
// Disconnect Events // 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_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_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 ); m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this );
......
This diff is collapsed.
...@@ -28,7 +28,6 @@ class DIALOG_SHIM; ...@@ -28,7 +28,6 @@ class DIALOG_SHIM;
#include <wx/aui/auibook.h> #include <wx/aui/auibook.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/splitter.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -42,8 +41,6 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM ...@@ -42,8 +41,6 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
private: private:
protected: protected:
wxSplitterWindow* m_splitter;
wxPanel* m_top;
wxAuiNotebook* m_auinotebook; wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel; wxPanel* m_global_panel;
wxGrid* m_global_grid; wxGrid* m_global_grid;
...@@ -54,13 +51,13 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM ...@@ -54,13 +51,13 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
wxButton* m_move_up_button; wxButton* m_move_up_button;
wxButton* m_move_down_button; wxButton* m_move_down_button;
wxButton* m_edit_options; wxButton* m_edit_options;
wxPanel* m_bottom;
wxGrid* m_path_subs_grid; wxGrid* m_path_subs_grid;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // 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 pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); }
virtual void onGridCellLeftClick( wxGridEvent& event ) { event.Skip(); } virtual void onGridCellLeftClick( wxGridEvent& event ) { event.Skip(); }
virtual void onGridCellLeftDClick( wxGridEvent& event ) { event.Skip(); } virtual void onGridCellLeftDClick( wxGridEvent& event ) { event.Skip(); }
...@@ -77,15 +74,9 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM ...@@ -77,15 +74,9 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
public: 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(); ~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 );
}
}; };
#endif //__DIALOG_FP_LIB_TABLE_BASE_H__ #endif //__DIALOG_FP_LIB_TABLE_BASE_H__
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