| 2483 | |
| 2484 | |
| 2485 | void CsvApplication::delCols() { |
| 2486 | int row_top, row_bottom, col_top, col_bottom; |
| 2487 | int newCol; |
| 2488 | int winIndex = app.getTopWindow(); |
| 2489 | int choice; |
| 2490 | windows[winIndex].grid->get_selection(row_top, col_top, row_bottom, col_bottom); |
| 2491 | |
| 2492 | if( col_top < 0 || col_bottom < 0 || col_top >= windows[winIndex].table->getNumberCols() || col_bottom >= windows[winIndex].table->getNumberCols() ) { |
| 2493 | myFlChoice("Info", "No columns selected to delete!", {"OK"}); |
| 2494 | return; |
| 2495 | } |
| 2496 | |
| 2497 | windows[winIndex].grid->setDeletionHighlight(false, col_top, col_bottom); |
| 2498 | choice = myFlChoice("Confirmation", "Really delete "+std::to_string(col_bottom-col_top+1)+" column(s)?", {"Yes", "No"}); |
| 2499 | windows[winIndex].grid->removeDeletionHighlight(); |
| 2500 | if( choice != 0) { |
| 2501 | return; |
| 2502 | } |
| 2503 | |
| 2504 | // Close Search Window |
| 2505 | lastFound = {-1,-1}; |
| 2506 | searchWin->hide(); |
| 2507 | |
| 2508 | newCol = col_top > 0 ? col_top - 1 : 0; |
| 2509 | showImWorkingWindow("Deleting column(s) ..."); |
| 2510 | windows[winIndex].addUndoStateTable("Delete column(s)"); |
| 2511 | windows[winIndex].setChanged(true); |
| 2512 | windows[winIndex].setUsed(true); |
| 2513 | windows[winIndex].table->delCols(col_top, col_bottom); |
| 2514 | hideImWorkingWindow(); |
| 2515 | windows[winIndex].grid->updateSelection(row_top, newCol, row_bottom, newCol); |
| 2516 | windows[winIndex].grid->rows( windows[winIndex].table->getNumberRows() ); |
| 2517 | windows[winIndex].grid->cols( windows[winIndex].table->getNumberCols() ); |
| 2518 | windows[winIndex].grid->redraw(); |
| 2519 | Fl::check(); |
| 2520 | } |
| 2521 | |
| 2522 | |
| 2523 | void CsvApplication::delRows() { |
no test coverage detected