290
// D(printf("selRowStart:%d selColStart:%d selRowCount:%d selColCount:%d\n", selRowStart, selColStart, selRowCount, selColCount );)
291
D(printf("selRowStart:%d selColStart:%d selRowCount:%d selColCount:%d\n", selRowStart, selColStart, selRowCount, selColCount );)
293
294
void rightClickCellPopupMenu()
301
302
getSelectedArea();
303
// if nothing is selected, diable cut and copy.
304
// if nothing is selected, disable cut and copy.
304
305
if( !selRowCount && !selColCount )
306
307
menu.Enable( ID_CUT, false );
307
308
menu.Enable( ID_COPY, false );
311
bool have_cb_text = false;
312
if( wxTheClipboard->Open() )
314
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
317
wxTheClipboard->Close();
322
// if nothing on clipboard, disable paste.
323
menu.Enable( ID_PASTE, false );
310
326
// if there is no current cell cursor, disable paste.
311
if( m_cur_row == -1 || m_cur_col == -1 )
327
else if( m_cur_row == -1 || m_cur_col == -1 )
312
328
menu.Enable( ID_PASTE, false );
314
330
PopupMenu( &menu );
363
379
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
365
wxGridTableBase* tbl = m_cur_grid->GetTable();
366
381
wxTextDataObject data;
382
FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) m_cur_grid->GetTable();
368
384
wxTheClipboard->GetData( data );
370
wxStringTokenizer rows( data.GetText(), ROW_SEP, wxTOKEN_RET_EMPTY );
386
wxString cb_text = data.GetText();
387
size_t ndx = cb_text.find_first_of( wxT( "(fp_lib_table " ) );
372
// if clipboard rows would extend past end of current table size...
373
if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row )
389
if( ndx != std::string::npos )
375
int newRowsNeeded = rows.CountTokens() - ( tbl->GetNumberRows() - m_cur_row );
376
tbl->AppendRows( newRowsNeeded );
391
// paste the ROWs of s-expression (fp_lib_table), starting
392
// at column 0 regardless of current cursor column.
394
STRING_LINE_READER slr( TO_UTF8( cb_text ), wxT( "Clipboard" ) );
395
FP_LIB_TABLE_LEXER lexer( &slr );
396
FP_LIB_TABLE tmp_tbl;
401
tmp_tbl.Parse( &lexer );
403
catch( PARSE_ERROR& pe )
405
// @todo tell what line and offset
411
// if clipboard rows would extend past end of current table size...
412
if( int( tmp_tbl.rows.size() ) > tbl->GetNumberRows() - m_cur_row )
414
int newRowsNeeded = tmp_tbl.rows.size() - ( tbl->GetNumberRows() - m_cur_row );
415
tbl->AppendRows( newRowsNeeded );
418
for( int i = 0; i < (int) tmp_tbl.rows.size(); ++i )
420
tbl->rows[m_cur_row+i] = tmp_tbl.rows[i];
423
m_cur_grid->AutoSizeColumns();
379
for( int row = m_cur_row; rows.HasMoreTokens(); ++row )
381
wxString rowTxt = rows.GetNextToken();
383
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
385
for( int col = m_cur_col; cols.HasMoreTokens(); ++col )
387
wxString cellTxt = cols.GetNextToken();
388
tbl->SetValue( row, col, cellTxt );
427
wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY );
429
// if clipboard rows would extend past end of current table size...
430
if( int( rows.CountTokens() ) > tbl->GetNumberRows() - m_cur_row )
432
int newRowsNeeded = rows.CountTokens() - ( tbl->GetNumberRows() - m_cur_row );
433
tbl->AppendRows( newRowsNeeded );
436
for( int row = m_cur_row; rows.HasMoreTokens(); ++row )
438
wxString rowTxt = rows.GetNextToken();
440
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
442
for( int col = m_cur_col; cols.HasMoreTokens(); ++col )
444
wxString cellTxt = cols.GetNextToken();
445
tbl->SetValue( row, col, cellTxt );
740
798
m_project_grid->AutoSizeColumns( false );
742
800
wxArrayString choices;
743
802
choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) );
744
#if defined(BUILD_GITHUB_PLUGIN)
745
803
choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) );
747
804
choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) );
748
805
choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) );
749
806
choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) );