commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8380 - in trunk/gnue-designer/src: forms forms/PagePainter/skins


From: jcater
Subject: [gnue] r8380 - in trunk/gnue-designer/src: forms forms/PagePainter/skins ui/wx/uihelpers/doccanvas
Date: Wed, 5 Apr 2006 17:48:40 -0500 (CDT)

Author: jcater
Date: 2006-04-05 17:48:40 -0500 (Wed, 05 Apr 2006)
New Revision: 8380

Modified:
   trunk/gnue-designer/src/forms/Document.py
   trunk/gnue-designer/src/forms/PagePainter/skins/default.py
   trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
Log:
fixed a selection offset bug when an object (entry) with siblings (label) is 
selected and moved

Modified: trunk/gnue-designer/src/forms/Document.py
===================================================================
--- trunk/gnue-designer/src/forms/Document.py   2006-04-05 22:04:07 UTC (rev 
8379)
+++ trunk/gnue-designer/src/forms/Document.py   2006-04-05 22:48:40 UTC (rev 
8380)
@@ -315,10 +315,13 @@
     # =========================================================================
     # Public methods specific to a Forms document
     # =========================================================================
-    def find_glabels_for(self, name): 
-        labels = self.rootObject.findChildrenOfType('GFLabel')
+    def find_gflabel_for(self, name): 
+        labels = self.rootObject.findChildrenOfType('GFLabel', 
+                         allowAllChildren=True)
+                         
         results = []
         append = results.append
+        
         for label in labels: 
            if hasattr(label,'for') and label['for'] == name: 
                append(label)

Modified: trunk/gnue-designer/src/forms/PagePainter/skins/default.py
===================================================================
--- trunk/gnue-designer/src/forms/PagePainter/skins/default.py  2006-04-05 
22:04:07 UTC (rev 8379)
+++ trunk/gnue-designer/src/forms/PagePainter/skins/default.py  2006-04-05 
22:48:40 UTC (rev 8380)
@@ -232,22 +232,26 @@
         x, y, width, height = self.draw_area.Get()
         target_dc.DrawRectangle(x, y, width, height - 1)
 
-    def get_movable_children(self): 
+    def get_movable_siblings(self): 
         """
         return a list of widgets that "move" with you when selected. 
         This is NOT children of container widgets. Those are returned
         from get_movable_children(). 
         """
-        gobject = self.gobject
-        myname = gobject.name
-        page = gobject.findParentOfType('GFPage')
-        labels = gobject.findChildrenOfType('GFLabel')
-        for label in labels:
-            label_for = self.canvas.document.find_gflabel_for(nyname)
-            if label_for: 
+        labels = self.canvas.document.find_gflabel_for(self.gobject.name)
+        results = []
+        append = results.append
+        
+        # Get the DocumentWidget for each matched GFLabel
+        for label in labels: 
+            try: 
+                append(self.canvas.gobject_map[label])
+            except KeyError: 
                 pass
-        return labels
+                
+        return results
 
+
 # --------------------------------------------------------------------------
 # Button
 # --------------------------------------------------------------------------

Modified: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-05 
22:04:07 UTC (rev 8379)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-05 
22:48:40 UTC (rev 8380)
@@ -62,9 +62,10 @@
     show_ruler = True
     grid_style = GRID_LINES  # (can be 0=None, 1 = dashed lines, 2=dots)
 
-    def __init__(self, *arguments, **keywords):
-        super(DocumentCanvas, self).__init__(*arguments, **keywords)
+    def __init__(self, tool, *arguments, **keywords):
+        super(DocumentCanvas, self).__init__(tool, *arguments, **keywords)
 
+        self.document = tool.document
         # Set up the color space
         initialize(panel_color = self.GetBackgroundColour())
 
@@ -781,7 +782,8 @@
 
         # Draw a selection box
         sel_x, sel_y, sel_w, sel_h = self.__selection_area.Get()
-        self.__draw_selection_box(memory_dc, 2, 2, sel_w, sel_h)
+        self.__draw_selection_box(memory_dc, sel_x - buff_x, 
+                                  sel_y - buff_y, sel_w, sel_h)
 
         memory_dc.EndDrawing()
 
@@ -943,17 +945,28 @@
         # If there was no mouse movement, no need to do the logic
         if self.__mouse_resize_last_area:
 
-            delta_width = self.__mouse_resize_start_x - x
-            delta_height = self.__mouse_resize_start_y - y
+            orientation = self.__mouse_resize_orientation
 
-            # First, determine if the widget moved while being resized
-            orientation = self.__mouse_resize_orientation
+            delta_width = x - self.__mouse_resize_start_x 
+            delta_height = y - self.__mouse_resize_start_y 
+
+            # Discard width or height if only a side was moved
+            if orientation in ('top','bottom'): 
+                delta_width = 0
+            if orientation in ('left','right'): 
+                delta_height = 0
+
+            # Determine if the widget moved while being resized
             delta_x = 0
             delta_y = 0
             if orientation in ('left','ul','ll') and delta_width:
-                delta_x = -delta_width
+                delta_x = delta_width
+                delta_width *= -1
             if orientation in ('top','ul','ur') and delta_height:
-                delta_y = -delta_height
+                delta_y = delta_height
+                delta_height *= -1
+                
+                
 
             # Figure out the resize amount
             for widget in self.get_selected_widgets():





reply via email to

[Prev in Thread] Current Thread [Next in Thread]