Mercurial > code > home > repos > light9
changeset 640:2d058d0bc1ea
zoom crushing fix; c-a-drag zoom fix
Ignore-this: db04ac435d4f1fe7ba8714e836ad7767
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Fri, 17 Jun 2011 08:17:14 +0000 |
parents | 7ee76a895427 |
children | c113c759559b |
files | light9/cursor1.xbm light9/curve.py light9/zoomcontrol.py show/dance2010/readme |
diffstat | 4 files changed, 41 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/cursor1.xbm Fri Jun 17 08:17:14 2011 +0000 @@ -0,0 +1,11 @@ +#define cursor1_width 20 +#define cursor1_height 20 +#define cursor1_x_hot 5 +#define cursor1_y_hot 5 +static char cursor1_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x27, 0x00, 0x00, 0x23, 0x00, 0x80, 0x21, 0x00, + 0x80, 0x21, 0x00, 0x80, 0x23, 0x00, 0x80, 0x3e, 0x00, 0x80, 0x1f, 0x00, + 0x80, 0x71, 0x00, 0x80, 0x47, 0x00, 0x80, 0x7c, 0x00, 0xc0, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, + };
--- a/light9/curve.py Fri Jun 17 06:33:48 2011 +0000 +++ b/light9/curve.py Fri Jun 17 08:17:14 2011 +0000 @@ -238,10 +238,10 @@ self.dragging_dots = False self.selecting = False self.bind("<ButtonPress-1>",#"<Alt-Key>", - self.select_press) + self.select_press, add=True) self.bind("<Motion>", self.select_motion, add=True) self.bind("<ButtonRelease-1>", #"<Alt-KeyRelease>", - self.select_release) + self.select_release, add=True) self.bind("<ButtonPress-1>", self.check_deselect, add=True) @@ -291,6 +291,9 @@ self.highlight_selected_dots() def select_press(self,ev): + # todo: these select_ handlers are getting called on c-a-drag + # zooms too. the dispatching should be more selective than + # just calling both handlers all the time self.print_state("select_press") if self.dragging_dots: return
--- a/light9/zoomcontrol.py Fri Jun 17 06:33:48 2011 +0000 +++ b/light9/zoomcontrol.py Fri Jun 17 08:17:14 2011 +0000 @@ -37,7 +37,19 @@ self._end = v return locals() end = property(**end()) - + + def offset(): + doc = "virtual attr that adjusts start and end together" + def fget(self): + # work off the midpoint so that "crushing works equally + # well in both directions + return (self.start + self.end) / 2 + def fset(self, value): + d = self.end-self.start + self.start = value - d / 2 + self.end = value + d / 2 + return locals() + offset = property(**offset()) def __init__(self,master,**kw): self.maxtime=370 @@ -123,6 +135,7 @@ def release(self,ev): if hasattr(self,'adjustingattr'): del self.adjustingattr if hasattr(self,'lastx'): del self.lastx + def adjust(self,ev,attr=None): if not hasattr(self,'adjustingattr'): @@ -135,17 +148,6 @@ self.lastx = ev.x setattr(self,attr,self.t_for_can(new)) self.redrawzoom() - - def offset(): - doc = "virtual attr that adjusts start and end together" - def fget(self): - return self.start - def fset(self, value): - d = self.end-self.start - self.start = value - self.end = self.start+d - return locals() - offset = property(**offset()) def can_for_t(self,t): return (t-self.mintime)/(self.maxtime-self.mintime)*(self.winfo_width()-30)+20 @@ -163,6 +165,9 @@ self.coords(self.leftbrack,scan+lip,y1,scan,y1,scan,y2,scan+lip,y2) self.coords(self.rightbrack,ecan-lip,y1,ecan,y1,ecan,y2,ecan-lip,y2) self.coords(self.shade,scan+5,y1+lip,ecan-5,y2-lip) + self.redrawTics() + + def redrawTics(self): self.delete("tics") lastx=-1000 for t in range(0,int(self.maxtime)): @@ -193,6 +198,7 @@ #canvas.bind("<Control-Alt-%s>" % evtype, method, add=True) if 1 or evtype != "ButtonPress-1": canvas.bind("<%s>" % evtype, method,add=True) + canvas.bind("<Leave>", self.finish) self.start_t = self.old_cursor = None self.state = self.mods = None @@ -204,6 +210,8 @@ if ev.state == 12: self.mods = "c-a" elif ev.state == 13: + # todo: right now this never happens because only the + # sketching handler gets the event self.mods = "c-s-a" elif ev.state == 0: return # no @@ -217,13 +225,15 @@ can = self.canvas for pos in ('start_t','end_t','hi','lo'): - can.create_line(0,0,50,50, width=3, fill='black', + can.create_line(0,0,50,50, width=3, fill='yellow', tags=("regionzoom",pos)) # if updatelines isn't called here, subsequent updatelines # will fail for reasons i don't understand self.updatelines() - cursors.push(can, "@/home/drewp/projects/light9/cursor1.xbm") + # todo: just holding the modifiers ought to turn on the zoom + # cursor (which is not finished) + cursors.push(can, "@light9/cursor1.xbm") def updatelines(self):
--- a/show/dance2010/readme Fri Jun 17 06:33:48 2011 +0000 +++ b/show/dance2010/readme Fri Jun 17 08:17:14 2011 +0000 @@ -71,7 +71,7 @@ raise RequestError(e) RequestError: [Errno 111] Connection refused - asco stops considerably after the autostop time (according to curvecalc) -- CC should support zoom-crushing towards the left as well +OK CC should support zoom-crushing towards the left as well - vidref's replay 'enabled' button should be completely sticky across sessions - audio process pipeline; RDF graph should track versions of songs (padded, normalized) OK vidref can loop like this if asco goes down: