Author: esr
Date: Sat Oct 18 07:45:35 2008
New Revision: 30244

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30244&view=rev
Log:
trackplacer: UI change, drag markers with middle button.

Modified:
    trunk/data/tools/trackplacer

Modified: trunk/data/tools/trackplacer
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/trackplacer?rev=30244&r1=30243&r2=30244&view=diff
==============================================================================
--- trunk/data/tools/trackplacer (original)
+++ trunk/data/tools/trackplacer Sat Oct 18 07:45:35 2008
@@ -53,7 +53,7 @@
 
 You are editing or creating a set of named tracks; at any given time there 
will one track that is selected for editing.  For campaigns with a linear 
narrative there will be only one track, always selected, and you will not have 
to concern yourself about its name.  If your campaign has a non-linear 
structure, you will want to create one track for each segment.
 
-The radio buttons near the top left corner control which icon is placed by a 
left click.  The two rightmost are special; when the trashcan is clicked a left 
click deletes already-placed icons, and the convert/copy icon tries to copy a 
nearby icon from an unselected track onto the selected one, preserving its 
pixel coordinates exactly. Every time you place an icon, it is added to the 
currently selected track.
+The radio buttons near the top left corner control which icon is placed by a 
left click.  The two rightmost are special; when the trashcan is clicked a left 
click deletes already-placed icons, and the convert/copy icon tries to copy a 
nearby icon from an unselected track onto the selected one, preserving its 
pixel coordinates exactly. Every time you place an icon, it is added to the 
currently selected track.  You may also drag icons with the middle button.
 
 The rule for adding markers to the selected track is as follows: if the two 
markers closest to the mouse pointer are adjacent on the track, insert the new 
marker between them in the track order. Otherwise, append it to the end of the 
track.
 
@@ -726,16 +726,20 @@
         return False
 
     def button_press_event(self, widget, event):
+        if self.pixmap is None:
+            return
         if self.journey.selected_track() is None:
             w = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, 
buttons=gtk.BUTTONS_OK)
             w.set_markup("No track to edit!")
             w.run()
             return
-        if event.button == 1 and self.pixmap != None:
-            a = self.action
-            x = int(event.x)
-            y = int(event.y)
-            self.selected = self.snap_to(x, y)
+        # Pick up state information whatever button is pressed
+        a = self.action
+        x = int(event.x)
+        y = int(event.y)
+        self.selected = self.snap_to(x, y)
+        # Event button 1 - draw
+        if event.button == 1:
             # Skip the redraw in half the cases
             self.log("Action %s at (%d, %d): feature = %s" % (self.action, x, 
y, self.selected))
             if self.selected == None and self.action == "COPY":
@@ -769,6 +773,7 @@
                 self.erase_feature(widget, (a, x, y))
                 self.journey.remove(x, y)
             self.log("Tracks are %s" % self.journey)
+        # If we ever implement a context menu for button 3, it goes here.
         return True
 
     def motion_notify_event(self, widget, event):
@@ -780,8 +785,8 @@
         self.coordwin.set_text("(%d, %d)" % (x, y))
         state = event.state
 
-        # This code enables dragging icons.
-        if state & gtk.gdk.BUTTON1_MASK and self.pixmap != None:            
+        # This code enables dragging icons wit h the middle button.
+        if state & gtk.gdk.BUTTON2_MASK and self.pixmap != None:            
            if self.selected is not None:
                (action, lx, ly) = self.journey[self.selected]
                self.erase_feature(widget, (action, lx, ly))


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to