]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/xrced.py
Putting draft of wxImplDC and the wxDC using it
[wxWidgets.git] / wxPython / wx / tools / XRCed / xrced.py
index 63cc39c6f234bc0743780ae237eb3d70d75778fa..26d6bc6f302b176bf9ff758288a718a259d2809a 100644 (file)
@@ -686,12 +686,18 @@ class Frame(wx.Frame):
         index = tree.ItemIndex(selected)
         if index == 0: return # No previous sibling found
 
+        # Remove highlight, update testWin
+        if g.testWin and g.testWin.highLight:
+            g.testWin.highLight.Remove()
+            tree.needUpdate = True
+
         # Undo info
         self.lastOp = 'MOVEUP'
         status = 'Moved before previous sibling'
 
         # Prepare undo data
         panel.Apply()
+        tree.UnselectAll()
 
         parent = tree.GetItemParent(selected)
         elem = tree.RemoveLeaf(selected)
@@ -716,12 +722,18 @@ class Frame(wx.Frame):
         next = tree.GetNextSibling(selected)
         if not next: return
 
+        # Remove highlight, update testWin
+        if g.testWin and g.testWin.highLight:
+            g.testWin.highLight.Remove()
+            tree.needUpdate = True
+
         # Undo info
         self.lastOp = 'MOVEDOWN'
         status = 'Moved after next sibling'
 
         # Prepare undo data
         panel.Apply()
+        tree.UnselectAll()
 
         parent = tree.GetItemParent(selected)
         elem = tree.RemoveLeaf(selected)
@@ -750,6 +762,11 @@ class Frame(wx.Frame):
         # Check compatibility
         if not self.ItemsAreCompatible(tree.GetPyData(pparent).treeObject(), tree.GetPyData(selected).treeObject()): return
 
+        # Remove highlight, update testWin
+        if g.testWin and g.testWin.highLight:
+            g.testWin.highLight.Remove()
+            tree.needUpdate = True
+
         # Undo info
         self.lastOp = 'MOVELEFT'
         status = 'Made next sibling of parent'
@@ -789,6 +806,7 @@ class Frame(wx.Frame):
 
         selected = tree.InsertNode(pparent, tree.GetPyData(pparent).treeObject(), elem, nextItem)
         newIndex = tree.ItemIndex(selected)
+        tree.oldItem = None
         tree.SelectItem(selected)
 
         undoMan.RegisterUndo(UndoMove(oldParent, oldIndex, pparent, newIndex))
@@ -811,6 +829,11 @@ class Frame(wx.Frame):
         # Check compatibility
         if not self.ItemsAreCompatible(parent, tree.GetPyData(selected).treeObject()): return
 
+        # Remove highlight, update testWin
+        if g.testWin and g.testWin.highLight:
+            g.testWin.highLight.Remove()
+            tree.needUpdate = True
+
         # Undo info
         self.lastOp = 'MOVERIGHT'
         status = 'Made last child of previous sibling'
@@ -847,10 +870,11 @@ class Frame(wx.Frame):
         selected = tree.InsertNode(newParent, tree.GetPyData(newParent).treeObject(), elem, wx.TreeItemId())
 
         newIndex = tree.ItemIndex(selected)
+        tree.oldItem = None
         tree.SelectItem(selected)
 
         undoMan.RegisterUndo(UndoMove(oldParent, oldIndex, newParent, newIndex))
-        
+
         self.modified = True
         self.SetStatusText(status)
 
@@ -1077,6 +1101,10 @@ Homepage: http://xrced.sourceforge.net\
                 print msg
 
     def OnCreate(self, evt):
+        # Ignore fake events generated while dragging
+        if g.tools.drag: 
+            g.tools.drag = False
+            return
         selected = tree.selection
         if tree.ctrl: appendChild = False
         else: appendChild = not tree.NeedInsert(selected)
@@ -1334,7 +1362,7 @@ Homepage: http://xrced.sourceforge.net\
                     tree.HighLight(tree.pendingHighLight)
                 except:
                     # Remove highlight if any problem
-                    if g.testWin.highLight:
+                    if g.testWin and g.testWin.highLight:
                         g.testWin.highLight.Remove()
                     tree.pendingHighLight = None
                     raise