|
|
@@ -268,6 +268,17 @@ bool UIElementCopy()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+void ResetDuplicateID(UIElement@ element)
|
|
|
+{
|
|
|
+ // If it is a duplicate copy then the element ID need to be regenerated by resetting it now to empty
|
|
|
+ if (GetListIndex(element) != NO_ITEM)
|
|
|
+ element.vars[UI_ELEMENT_ID_VAR] = Variant();
|
|
|
+
|
|
|
+ // Perform the action recursively for child elements
|
|
|
+ for (uint i = 0; i < element.numChildren; ++i)
|
|
|
+ ResetDuplicateID(element.children[i]);
|
|
|
+}
|
|
|
+
|
|
|
bool UIElementPaste()
|
|
|
{
|
|
|
ui.cursor.shape = CS_BUSY;
|
|
|
@@ -284,11 +295,7 @@ bool UIElementPaste()
|
|
|
if (editUIElement.LoadXML(rootElem))
|
|
|
{
|
|
|
UIElement@ element = editUIElement.children[editUIElement.numChildren - 1];
|
|
|
-
|
|
|
- // If it is a duplicate copy then the element ID need to be regenerated by resetting it now to empty
|
|
|
- if (GetListIndex(element) != NO_ITEM)
|
|
|
- element.vars[UI_ELEMENT_ID_VAR] = Variant();
|
|
|
-
|
|
|
+ ResetDuplicateID(element);
|
|
|
UpdateHierarchyItem(element);
|
|
|
|
|
|
// Create an undo action
|
|
|
@@ -299,9 +306,9 @@ bool UIElementPaste()
|
|
|
}
|
|
|
|
|
|
SaveEditActionGroup(group);
|
|
|
-
|
|
|
+
|
|
|
suppressUIElementChanges = false;
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|