Sat, 27 Apr 2013 02:52:32 +0300
Fixed view going blank after resize
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
104 | 3 | * Copyright (C) 2013 Santeri Piippo |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "zz_historyDialog.h" |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "history.h" |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
21 | #include "colors.h" |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <qboxlayout.h> |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <qmessagebox.h> |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | EXTERN_ACTION (undo); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | EXTERN_ACTION (redo); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | HistoryDialog::HistoryDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
32 | historyList = new QListWidget; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
33 | undoButton = new QPushButton ("Undo"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
34 | redoButton = new QPushButton ("Redo"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
35 | clearButton = new QPushButton ("Clear"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
36 | buttons = new QDialogButtonBox (QDialogButtonBox::Close); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
38 | historyList->setAlternatingRowColors (true); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
39 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
40 | undoButton->setIcon (getIcon ("undo")); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
41 | redoButton->setIcon (getIcon ("redo")); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
43 | connect (undoButton, SIGNAL (clicked ()), this, SLOT (slot_undo ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
44 | connect (redoButton, SIGNAL (clicked ()), this, SLOT (slot_redo ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
45 | connect (clearButton, SIGNAL (clicked ()), this, SLOT (slot_clear ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
46 | connect (buttons, SIGNAL (rejected ()), this, SLOT (reject ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
47 | connect (historyList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selChanged ())); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | QVBoxLayout* qButtonLayout = new QVBoxLayout; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | qButtonLayout->setDirection (QBoxLayout::TopToBottom); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
51 | qButtonLayout->addWidget (undoButton); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
52 | qButtonLayout->addWidget (redoButton); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
53 | qButtonLayout->addWidget (clearButton); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | qButtonLayout->addStretch (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | QGridLayout* qLayout = new QGridLayout; |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
57 | qLayout->setColumnStretch (0, 1); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
58 | qLayout->addWidget (historyList, 0, 0, 2, 1); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | qLayout->addLayout (qButtonLayout, 0, 1); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
60 | qLayout->addWidget (buttons, 1, 1); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | setLayout (qLayout); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | setWindowIcon (getIcon ("history")); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | setWindowTitle (APPNAME_DISPLAY " - Edit history"); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | populateList (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | updateButtons (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
68 | updateSelection (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | void HistoryDialog::populateList () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
75 | historyList->clear (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
77 | QListWidgetItem* qItem = new QListWidgetItem; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
78 | qItem->setText ("[[ initial state ]]"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
79 | qItem->setIcon (getIcon ("empty")); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
80 | historyList->addItem (qItem); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
81 | |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | for (HistoryEntry* entry : History::entries) { |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | str zText; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
84 | QIcon qEntryIcon; |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | switch (entry->type ()) { |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
87 | case HISTORY_Add: |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | { |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
89 | AddHistory* addentry = static_cast<AddHistory*> (entry); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
90 | ulong ulCount = addentry->paObjs.size (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
91 | str zVerb = "Added"; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
92 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
93 | switch (addentry->eType) { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
94 | case AddHistory::Paste: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
95 | zVerb = "Pasted"; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
96 | qEntryIcon = getIcon ("paste"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
97 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
98 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
99 | default: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
100 | { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
101 | // Determine a common type for these objects. If all objects are of the same |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
102 | // type, we display its addition icon. Otherwise, we draw a subfile addition |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
103 | // one as a default. |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
104 | LDObjectType_e eCommonType = OBJ_Unidentified; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
105 | for (LDObject* obj : addentry->paObjs) { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
106 | if (eCommonType == OBJ_Unidentified or obj->getType() == eCommonType) |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
107 | eCommonType = obj->getType (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
108 | else { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
109 | eCommonType = OBJ_Unidentified; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
110 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
111 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
112 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
113 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
114 | // Set the icon based on the common type decided above. |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
115 | if (eCommonType == OBJ_Unidentified) |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
116 | qEntryIcon = getIcon ("add-subfile"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
117 | else |
116 | 118 | qEntryIcon = getIcon (format ("add-%s", g_saObjTypeIcons[eCommonType])); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
119 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
120 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
121 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
122 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
123 | zText.format ("%s %lu objects\n%s", zVerb.chars(), ulCount, |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
124 | LDObject::objectListContents (addentry->paObjs).chars()); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | break; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | case HISTORY_QuadSplit: |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | { |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | QuadSplitHistory* splitentry = static_cast<QuadSplitHistory*> (entry); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | ulong ulCount = splitentry->paQuads.size (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | zText.format ("Split %lu quad%s to triangles", ulCount, PLURAL (ulCount)); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
133 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
134 | qEntryIcon = getIcon ("quad-split"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
135 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
136 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
137 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
138 | case HISTORY_Del: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
139 | { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
140 | DelHistory* delentry = static_cast<DelHistory*> (entry); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
141 | ulong ulCount = delentry->cache.size (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
142 | str zVerb = "Deleted"; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
143 | qEntryIcon = getIcon ("delete"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
144 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
145 | switch (delentry->eType) { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
146 | case DelHistory::Cut: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
147 | qEntryIcon = getIcon ("cut"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
148 | zVerb = "Cut"; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
149 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
150 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
151 | default: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
152 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
153 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
154 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
155 | zText.format ("%s %lu objects:\n%s", zVerb.chars(), ulCount, |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
156 | LDObject::objectListContents (delentry->cache).chars ()); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | } |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
158 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
159 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
160 | case HISTORY_SetColor: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
161 | { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
162 | SetColorHistory* colentry = static_cast<SetColorHistory*> (entry); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
163 | ulong ulCount = colentry->ulaIndices.size (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
164 | zText.format ("Set color of %lu objects to %d (%s)", ulCount, |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
165 | colentry->dNewColor, getColor (colentry->dNewColor)->zName.chars()); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
166 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
167 | qEntryIcon = getIcon ("palette"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
168 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
169 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
170 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
171 | case HISTORY_ListMove: |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
172 | { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
173 | ListMoveHistory* moveentry = static_cast<ListMoveHistory*> (entry); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
174 | ulong ulCount = moveentry->ulaIndices.size (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
175 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
176 | zText.format ("Moved %lu objects %s", ulCount, |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
177 | moveentry->bUp ? "up" : "down"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
178 | qEntryIcon = getIcon (moveentry->bUp ? "arrow-up" : "arrow-down"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
179 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
180 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
181 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
182 | case HISTORY_Edit: |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
183 | { |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
184 | EditHistory* pEntry = static_cast<EditHistory*> (entry); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
185 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
186 | zText.format ("Edited %u objects\n%s", |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
187 | pEntry->paNewObjs.size(), |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
188 | LDObject::objectListContents (pEntry->paOldObjs).chars ()); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
189 | qEntryIcon = getIcon ("set-contents"); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
190 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
191 | break; |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
193 | case HISTORY_Inline: |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
194 | { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
195 | InlineHistory* subentry = static_cast<InlineHistory*> (entry); |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
196 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
197 | zText.format ("%s %lu subfiles:\n%lu resultants", |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
198 | (subentry->bDeep) ? "Deep-inlined" : "Inlined", |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
199 | (ulong) subentry->paRefs.size(), |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
200 | (ulong) subentry->ulaBitIndices.size()); |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
201 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
202 | qEntryIcon = getIcon (subentry->bDeep ? "inline-deep" : "inline"); |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
203 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
204 | break; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
205 | |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | default: |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | zText = "???"; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | break; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | QListWidgetItem* qItem = new QListWidgetItem; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | qItem->setText (zText); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
213 | qItem->setIcon (qEntryIcon); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
214 | historyList->addItem (qItem); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | void HistoryDialog::slot_undo () { |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | History::undo (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | updateButtons (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
224 | updateSelection (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | void HistoryDialog::slot_redo () { |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | History::redo (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | updateButtons (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
231 | updateSelection (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
232 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
233 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
234 | void HistoryDialog::updateSelection () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
235 | historyList->setCurrentItem (historyList->item (History::pos () + 1)); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | void HistoryDialog::slot_clear () { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
240 | if (!confirm ("Are you sure you want to clear the edit history?\nThis cannot be undone.")) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
241 | return; // Canceled |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | History::clear (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | populateList (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
245 | updateButtons (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
248 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | void HistoryDialog::updateButtons () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
250 | undoButton->setEnabled (ACTION (undo)->isEnabled ()); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
251 | redoButton->setEnabled (ACTION (redo)->isEnabled ()); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
252 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
253 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
254 | // ============================================================================= |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
255 | void HistoryDialog::slot_selChanged () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
256 | if (historyList->selectedItems ().size () != 1) |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
257 | return; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
258 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
259 | QListWidgetItem* qItem = historyList->selectedItems ()[0]; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
260 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
261 | // Find the index of the edit |
107
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
262 | long lIdx; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
263 | for (lIdx = 0; lIdx < historyList->count (); ++lIdx) |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
264 | if (historyList->item (lIdx) == qItem) |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
265 | break; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
266 | |
107
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
267 | // qHistoryList is 0-based, History is -1-based, thus decrement |
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
268 | // the index now |
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
269 | lIdx--; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
270 | |
107
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
271 | if (lIdx == History::pos ()) |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
272 | return; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
273 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
274 | // Seek to the selected edit by repeadetly undoing or redoing. |
107
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
275 | while (History::pos () != lIdx) { |
195aa036da7f
Picking improvements
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
276 | if (History::pos () > lIdx) |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
277 | History::undo (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
278 | else |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
279 | History::redo (); |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
280 | } |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
281 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
282 | updateButtons (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | } |