| 2521 | |
| 2522 | |
| 2523 | void CsvApplication::delRows() { |
| 2524 | int row_top, row_bottom, col_top, col_bottom; |
| 2525 | int newRow; |
| 2526 | int winIndex = app.getTopWindow(); |
| 2527 | int choice; |
| 2528 | windows[winIndex].grid->get_selection(row_top, col_top, row_bottom, col_bottom); |
| 2529 | |
| 2530 | if( row_top < 0 || row_bottom < 0 || row_top >= windows[winIndex].table->getNumberRows() || row_bottom >= windows[winIndex].table->getNumberRows() ) { |
| 2531 | myFlChoice("Info", "No rows selected to delete!", {"OK"}); |
| 2532 | return; |
| 2533 | } |
| 2534 | |
| 2535 | windows[winIndex].grid->setDeletionHighlight(true, row_top, row_bottom); |
| 2536 | choice = myFlChoice("Confirmation", "Really delete "+std::to_string(row_bottom-row_top+1)+" row(s)?", {"Yes", "No"}); |
| 2537 | windows[winIndex].grid->removeDeletionHighlight(); |
| 2538 | if( choice != 0) { |
| 2539 | return; |
| 2540 | } |
| 2541 | |
| 2542 | // Close Search Window |
| 2543 | lastFound = {-1,-1}; |
| 2544 | searchWin->hide(); |
| 2545 | |
| 2546 | newRow = row_top > 0 ? row_top - 1 : 0; |
| 2547 | showImWorkingWindow("Deleting row(s) ..."); |
| 2548 | windows[winIndex].addUndoStateTable("Delete row(s)"); |
| 2549 | windows[winIndex].setChanged(true); |
| 2550 | windows[winIndex].setUsed(true); |
| 2551 | windows[winIndex].table->delRows(row_top, row_bottom); |
| 2552 | windows[winIndex].grid->updateSelection(newRow, col_top, newRow, col_bottom); |
| 2553 | hideImWorkingWindow(); |
| 2554 | windows[winIndex].grid->rows( windows[winIndex].table->getNumberRows() ); |
| 2555 | windows[winIndex].grid->cols( windows[winIndex].table->getNumberCols() ); |
| 2556 | windows[winIndex].grid->redraw(); |
| 2557 | Fl::check(); |
| 2558 | } |
| 2559 | |
| 2560 | |
| 2561 | void CsvApplication::splitCol() { |
no test coverage detected