MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / copySelection

Method copySelection

src/csvapplication.cpp:1459–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457}
1458
1459void CsvApplication::copySelection() {
1460 table_index_t row_top, row_bottom, col_top, col_bottom;
1461 std::string copy = "";
1462 std::vector<std::string> vec;
1463 std::vector<std::vector<std::string>> block;
1464
1465 windows[topWindow].grid->get_selection(row_top, col_top, row_bottom, col_bottom);
1466 if( row_top == row_bottom && col_top == col_bottom ) {
1467 // copy a single cell
1468 copy = windows[topWindow].table->getCell(row_top, col_top);
1469 Fl::copy( copy.c_str(), strlen(copy.c_str()), 1 );
1470 } else {
1471 // copy multiple cells
1472 block = windows[topWindow].table->copyBlock(row_top, col_top, row_bottom, col_bottom);
1473
1474 for( table_index_t i = 0; i < (table_index_t) block.size(); ++i ) {
1475 vec = block.at(i);
1476 copy.append( windows[topWindow].table->encodeCsvLine( &vec, windows[topWindow].table->getDefinition() ) );
1477 }
1478 Fl::copy( copy.c_str(), strlen(copy.c_str()), 1 );
1479 }
1480}
1481
1482
1483void CsvApplication::paste(bool askUser, bool fillSelection) {

Callers 1

MyMenuCallbackMethod · 0.80

Calls 7

getCellMethod · 0.80
copyBlockMethod · 0.80
atMethod · 0.80
appendMethod · 0.80
encodeCsvLineMethod · 0.80
getDefinitionMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected