34 if (!m_RedoList.empty())
36 this->ClearList(&m_RedoList);
37 InvokeEvent(RedoEmptyEvent());
40 m_UndoList.push_back(undoStackItem);
42 InvokeEvent(UndoNotEmptyEvent());
51 if (m_UndoList.empty())
54 int oeid = m_UndoList.back()->GetObjectEventId();
55 std::string currentDescription;
56 int currentDescriptionCount(0);
57 bool niceDescriptionFound(
false);
58 std::string lastDescription;
61 for (
auto iter = m_UndoList.rbegin(); iter != m_UndoList.rend(); ++iter)
63 if (oeid != (*iter)->GetObjectEventId())
66 if (currentDescription.empty())
67 currentDescription =
"Some unnamed action";
71 currentDescription =
"";
72 currentDescriptionCount = 0;
73 niceDescriptionFound =
false;
74 oeid = (*iter)->GetObjectEventId();
77 if (!(*iter)->GetDescription().empty())
79 if (!dynamic_cast<OperationEvent *>(*iter))
82 currentDescription = (*iter)->GetDescription();
83 niceDescriptionFound =
true;
85 else if (!niceDescriptionFound)
87 if (currentDescriptionCount)
89 if (lastDescription != (*iter)->GetDescription())
92 currentDescription +=
" AND ";
93 currentDescription += (*iter)->GetDescription();
98 currentDescription += (*iter)->GetDescription();
101 lastDescription = (*iter)->GetDescription();
102 ++currentDescriptionCount;
108 if (currentDescription.empty())
109 currentDescription =
"Some unnamed action";
119 if (m_RedoList.empty())
122 int oeid = m_RedoList.back()->GetObjectEventId();
123 std::string currentDescription;
124 int currentDescriptionCount(0);
125 bool niceDescriptionFound(
false);
126 std::string lastDescription;
129 for (
auto iter = m_RedoList.rbegin(); iter != m_RedoList.rend(); ++iter)
131 if (oeid != (*iter)->GetObjectEventId())
134 if (currentDescription.empty())
135 currentDescription =
"Some unnamed action";
139 currentDescription =
"";
140 currentDescriptionCount = 0;
141 niceDescriptionFound =
false;
142 oeid = (*iter)->GetObjectEventId();
145 if (!(*iter)->GetDescription().empty())
147 if (!dynamic_cast<OperationEvent *>(*iter))
150 currentDescription = (*iter)->GetDescription();
151 niceDescriptionFound =
true;
153 else if (!niceDescriptionFound)
155 if (currentDescriptionCount)
157 if (lastDescription != (*iter)->GetDescription())
160 currentDescription +=
" AND ";
161 currentDescription += (*iter)->GetDescription();
166 currentDescription += (*iter)->GetDescription();
169 lastDescription = (*iter)->GetDescription();
170 ++currentDescriptionCount;
176 if (currentDescription.empty())
177 currentDescription =
"Some unnamed action";
virtual bool SetOperationEvent(UndoStackItem *undoStackItem) override
a list of pairs (int,string), representing a stack with ObjectEventIDs and descriptions ...
virtual ~VerboseLimitedLinearUndo()
std::pair< int, std::string > StackDescriptionItem
Represents an entry of the undo or redo stack.
VerboseLimitedLinearUndo()
virtual StackDescription GetRedoDescriptions()
std::vector< StackDescriptionItem > StackDescription
virtual StackDescription GetUndoDescriptions()