| 585 | } |
| 586 | |
| 587 | void Patch::insertRemove(bool insert, bool column, bool first) |
| 588 | { |
| 589 | undoSave(); |
| 590 | |
| 591 | try |
| 592 | { |
| 593 | if (insert) |
| 594 | { |
| 595 | // Decide whether we should insert rows or columns |
| 596 | if (column) { |
| 597 | // The insert point is 1 for "beginning" and width-2 for "end" |
| 598 | insertColumns(first ? 1 : _width-2); |
| 599 | } |
| 600 | else { |
| 601 | // The insert point is 1 for "beginning" and height-2 for "end" |
| 602 | insertRows(first ? 1 : _height-2); |
| 603 | } |
| 604 | } |
| 605 | else { |
| 606 | // Col/Row Removal |
| 607 | if (column) { |
| 608 | // Column removal, pass TRUE |
| 609 | removePoints(true, first ? 2 : _width - 3); |
| 610 | } |
| 611 | else { |
| 612 | // Row removal, pass FALSE |
| 613 | removePoints(false, first ? 2 : _height - 3); |
| 614 | } |
| 615 | } |
| 616 | } |
| 617 | catch (const GenericPatchException& g) { |
| 618 | rError() << "Error manipulating patch dimensions: " << g.what() << "\n"; |
| 619 | } |
| 620 | |
| 621 | controlPointsChanged(); |
| 622 | } |
| 623 | |
| 624 | void Patch::appendPoints(bool columns, bool beginning) { |
| 625 | bool rows = !columns; // Shortcut for readability |
no test coverage detected