adding rectangle layout

This commit is contained in:
Emmanuel Bretelle 2008-03-05 16:28:20 +00:00
parent 9ebbc671ed
commit 6322a5ba0d
1 changed files with 26 additions and 6 deletions

View File

@ -116,6 +116,7 @@ class TerminatorTerm:
'scrollback_lines' : 100, 'scrollback_lines' : 100,
'focus' : 'sloppy', 'focus' : 'sloppy',
'exit_action' : 'close', 'exit_action' : 'close',
'overlay_type' : "triangle",
'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF',
'word_chars' : '-A-Za-z0-9,./?%&#:_', 'word_chars' : '-A-Za-z0-9,./?%&#:_',
'mouse_autohide' : True, 'mouse_autohide' : True,
@ -214,8 +215,9 @@ class TerminatorTerm:
self._vte.connect ("popup-menu", self.on_vte_popup_menu) self._vte.connect ("popup-menu", self.on_vte_popup_menu)
"""drag and drop""" """drag and drop"""
target = [ ( "vte", 0, 81 ) ] target = [ ( "vte", 0, 81 ), ('text/plain', 0, 0) ]
self._vte.drag_source_set( gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON3_MASK, target, gtk.gdk.ACTION_COPY) self._vte.drag_source_set( gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON3_MASK, target, gtk.gdk.ACTION_COPY)
#self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,target, gtk.gdk.ACTION_COPY)
self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,target, gtk.gdk.ACTION_COPY) self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,target, gtk.gdk.ACTION_COPY)
self._vte.connect("drag-data-get", self.on_drag_data_get, self) self._vte.connect("drag-data-get", self.on_drag_data_get, self)
@ -264,6 +266,7 @@ class TerminatorTerm:
#on self #on self
return return
alloc = widget.allocation alloc = widget.allocation
rect = gtk.gdk.Rectangle(0, 0, alloc.width, alloc.height) rect = gtk.gdk.Rectangle(0, 0, alloc.width, alloc.height)
widget.window.invalidate_rect(rect, True) widget.window.invalidate_rect(rect, True)
@ -287,26 +290,43 @@ class TerminatorTerm:
b2 = alloc.height b2 = alloc.height
topleft = (0,0) topleft = (0,0)
topright = (alloc.width,0) topright = (alloc.width,0)
topmiddle = (alloc.width/2,0)
bottomleft = (0, alloc.height) bottomleft = (0, alloc.height)
bottomright = (alloc.width,alloc.height) bottomright = (alloc.width,alloc.height)
bottommiddle = (alloc.width/2, alloc.height)
middle = (alloc.width/2, alloc.height/2) middle = (alloc.width/2, alloc.height/2)
middleleft = (0, alloc.height/2)
middleright = (alloc.width, alloc.height/2)
overlay_type = self.reconf ('overlay_type')
#print "%f %f %d %d" %(coef1, coef2, b1,b2) #print "%f %f %d %d" %(coef1, coef2, b1,b2)
coord = () coord = ()
if (x*coef1 + b1 > y ) and (x*coef2 + b2 < y ): if (x*coef1 + b1 > y ) and (x*coef2 + b2 < y ):
#print "right" #print "right"
if overlay_type == "triangle":
coord = (topright, middle, bottomright) coord = (topright, middle, bottomright)
else:
coord = (topright, topmiddle, bottommiddle, bottomright)
if (x*coef1 + b1 > y ) and (x*coef2 + b2 > y ): if (x*coef1 + b1 > y ) and (x*coef2 + b2 > y ):
#print "top" #print "top"
if overlay_type == "triangle":
coord = (topleft, middle, topright) coord = (topleft, middle, topright)
else:
coord = (topleft, topright, middleright , middleleft)
if (x*coef1 + b1 < y ) and (x*coef2 + b2 > y ): if (x*coef1 + b1 < y ) and (x*coef2 + b2 > y ):
#print "left" #print "left"
if overlay_type == "triangle":
coord = (topleft, middle, bottomleft) coord = (topleft, middle, bottomleft)
else:
coord = (topleft, topmiddle, bottommiddle, bottomleft)
if (x*coef1 + b1 < y ) and (x*coef2 + b2 < y ): if (x*coef1 + b1 < y ) and (x*coef2 + b2 < y ):
#print "bottom" #print "bottom"
if overlay_type == "triangle":
coord = (bottomleft, middle, bottomright) coord = (bottomleft, middle, bottomright)
else:
coord = (bottomleft, bottomright, middleright , middleleft)
if len(coord) > 0 : if len(coord) > 0 :
context.move_to(coord[2][0],coord[2][1]) context.move_to(coord[len(coord)-1][0],coord[len(coord)-1][1])
for i in coord: for i in coord:
context.line_to(i[0],i[1]) context.line_to(i[0],i[1])