gui_editactions.cpp

changeset 85
b1541b547c8c
parent 84
c9438ea54ed9
child 89
5e6c08e98dbf
equal deleted inserted replaced
84:c9438ea54ed9 85:b1541b547c8c
19 #include "gui.h" 19 #include "gui.h"
20 #include "common.h" 20 #include "common.h"
21 #include "zz_setContentsDialog.h" 21 #include "zz_setContentsDialog.h"
22 #include "file.h" 22 #include "file.h"
23 #include "zz_colorSelectDialog.h" 23 #include "zz_colorSelectDialog.h"
24 #include "history.h"
24 25
25 vector<LDObject*> g_Clipboard; 26 vector<LDObject*> g_Clipboard;
26 27
27 // ============================================================================= 28 // =============================================================================
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
78 79
79 // ============================================================================= 80 // =============================================================================
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
81 // ============================================================================= 82 // =============================================================================
82 ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) { 83 ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) {
83 g_ForgeWindow->deleteSelection (); 84 vector<LDObject*> sel = g_ForgeWindow->getSelectedObjects ();
85
86 if (sel.size() == 0)
87 return;
88
89 vector<ulong> ulaIndices;
90 vector<LDObject*> copies;
91
92 for (LDObject* obj : sel) {
93 copies.insert (copies.begin(), obj->clone ());
94 ulaIndices.insert (ulaIndices.begin(), obj->getIndex (g_CurrentFile));
95
96 g_CurrentFile->forgetObject (obj);
97 delete obj;
98 }
99
100 History::addEntry (new DeleteHistory (ulaIndices, copies));
101 g_ForgeWindow->refresh ();
84 } 102 }
85 103
86 // ============================================================================= 104 // =============================================================================
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
88 // ============================================================================= 106 // =============================================================================
290 } 308 }
291 309
292 ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", CTRL (Down)) { 310 ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", CTRL (Down)) {
293 doMoveSelection (false); 311 doMoveSelection (false);
294 } 312 }
313
314 ACTION (undo, "Undo", "undo", "Undo a step.", CTRL (Z)) {
315 History::undo ();
316 }
317
318 ACTION (redo, "Redo", "redo", "Redo a step.", CTRL_SHIFT (Z)) {
319 History::redo ();
320 }

mercurial