]> git.neil.brown.name Git - scribble.git/commitdiff
Use different colour for drawing line that will be converted to text.
authorNeil Brown <neilb@notabene.brown>
Wed, 27 Aug 2008 20:25:05 +0000 (06:25 +1000)
committerNeil Brown <neilb@notabene.brown>
Wed, 27 Aug 2008 20:25:05 +0000 (06:25 +1000)
Blue, to be precise.

scribble.py

index 70be88d0c4e94a1c7748ce90f0bca3eedd4ad435..01b912ae65d8b2a5c23085e0e41570b7dd98d479 100755 (executable)
@@ -725,6 +725,7 @@ class ScribblePad:
         colourmap = page.get_colormap()
         black = gtk.gdk.color_parse("black")
         red = gtk.gdk.color_parse("red")
+        blue = gtk.gdk.color_parse("blue")
         self.colour_black = page.window.new_gc()
         self.colour_black.line_width = 2
         self.colour_black.set_foreground(colourmap.alloc_color(black))
@@ -733,6 +734,10 @@ class ScribblePad:
         self.colour_red.line_width = 2
         self.colour_red.set_foreground(colourmap.alloc_color(red))
 
+        self.colour_textmode = page.window.new_gc()
+        self.colour_textmode.line_width = 2
+        self.colour_textmode.set_foreground(colourmap.alloc_color(blue))
+
         self.colour = self.colour_black
         self.colourname = "black"
         self.bg = page.get_style().bg_gc[gtk.STATE_NORMAL]
@@ -785,7 +790,7 @@ class ScribblePad:
             self.flush_text()
             self.textpos = self.line[1]
             self.texttoggle.set_sensitive(True)
-            c.window.draw_rectangle(self.colour_black, True, int(ev.x),int(ev.y),
+            c.window.draw_rectangle(self.colour_textmode, True, int(ev.x),int(ev.y),
                                     2,2)
             self.line = None
             return
@@ -814,7 +819,10 @@ class ScribblePad:
             prev = self.line[-1]
             if abs(prev[0] - x) < 10 and abs(prev[1] - y) < 10:
                 return
-            c.window.draw_line(self.colour, prev[0],prev[1],x,y)
+            if self.texttoggle.get_active():
+                c.window.draw_line(self.colour_textmode, prev[0],prev[1],x,y)
+            else:
+                c.window.draw_line(self.colour, prev[0],prev[1],x,y)
             self.line.append([x,y])
         return
 
@@ -837,7 +845,7 @@ class ScribblePad:
         if cursor != None:
             (strong,weak) = layout.get_cursor_pos(cursor)
             (x,y,width,height) = strong
-            self.page.window.draw_rectangle(self.colour_black, True,
+            self.page.window.draw_rectangle(self.colour_textmode, True,
                                             pos[0] + x/pango.SCALE,
                                             pos[1], 2,2)
     def add_sym(self, sym):