Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/SynthLab
diff options
context:
space:
mode:
authoramartin <olpc@xo-05-28-21.localdomain>2007-09-10 10:00:47 (GMT)
committer amartin <olpc@xo-05-28-21.localdomain>2007-09-10 10:00:47 (GMT)
commitbbda4f776235580b1f4a09510b2731ccded104ad (patch)
treef72d36e499a1f50196c404d4cea0ff44988e1d22 /SynthLab
parent29cd63fb5df66cf4c0abc772f3b0bd55fa7906f1 (diff)
synthlab mask and fixes
Diffstat (limited to 'SynthLab')
-rwxr-xr-xSynthLab/SynthLabConstants.py28
-rw-r--r--SynthLab/SynthLabToolbars.py6
-rw-r--r--SynthLab/SynthLabWindow.py10
3 files changed, 24 insertions, 20 deletions
diff --git a/SynthLab/SynthLabConstants.py b/SynthLab/SynthLabConstants.py
index e40d4d3..a16ffe3 100755
--- a/SynthLab/SynthLabConstants.py
+++ b/SynthLab/SynthLabConstants.py
@@ -10,30 +10,30 @@ class SynthLabConstants:
GT_CONTROL_INPUT = 1
GT_SOUND_OUTPUT = 2
GT_SOUND_INPUT = 3
- # GATE_POINT[ojecttype][gatetype][gatenum] = (x,y)
+ # GATE_POINT[objecttype][gatetype][gatenum] = (x,y)
# relative to object center
- GATE_POINT = [ [ [ (0,34) ] ],
- [ [], [ (-25,-35),(-9,-35),(8,-35),(25,-35) ], [ (0,35) ] ],
- [ [], [ (33,-20),(33,-7),(33,7),(33,20) ], [ (-2,34) ], [ (-2,-34) ] ],
- [ [], [], [], [ (0,-35) ] ] ]
+ GATE_POINT = [ [ [ (-1,33) ] ],
+ [ [], [ (-24,-34),(-9,-34),(8,-34),(24,-34) ], [ (-1,33) ] ],
+ [ [], [ (31,-20),(31,-6),(31,6),(31,19) ], [ (-3,33) ], [ (-3,-34) ] ],
+ [ [], [], [], [ (2,-35) ] ] ]
# GATE_MAP[objecttype][gatetype][gatenum] = [ sx, sy, ex, ey, (wireX,wireY) ]
# gate locations relative to object center
- GATE_MAP = [ [ [ [-6,28,6,40] ] ],
- [ [], [[-31,-40,-18,-28], [-16,-40,-3,-28], [2,-40,15,-28], [19,-40,32,-28]], [[-6,28,7,40]] ],
- [ [], [[26,-26,38,-13], [26,-13,38,0], [26,0,38,13], [26,13,38,26]], [[-8,28,5,40]], [[-8,-40,5,-28]] ],
- [ [], [], [], [[-6,-40,7,-28]] ] ]
+ GATE_MAP = [ [ [ [-7,26,4,39] ] ],
+ [ [], [[-30,-40,-19,-28], [-15,-40,-3,-28], [3,-40,14,-28], [19,-40,28,-28]], [[-6,28,5,40]] ],
+ [ [], [[25,-25,37,-14], [25,-12,37,-1], [25,1,37,12], [25,13,37,25]], [[-8,27,3,40]], [[-8,-40,3,-27]] ],
+ [ [], [], [], [[-4,-40,7,-29]] ] ]
# insert wire locations into map
- GATE_OFFSET = 7
+ GATE_OFFSET = 15
for oT in GATE_MAP:
for gT in oT:
for m in gT:
x = (m[2]+m[0])//2
y = (m[3]+m[1])//2
# snap to edges
- if x < -HALF_SIZE+GATE_OFFSET: x = -HALF_SIZE
- elif x > HALF_SIZE-GATE_OFFSET: x = HALF_SIZE
- if y < -HALF_SIZE+GATE_OFFSET: y = -HALF_SIZE
- elif y > HALF_SIZE-GATE_OFFSET: y = HALF_SIZE
+ if x < -HALF_SIZE+GATE_OFFSET: x = m[0]
+ elif x > HALF_SIZE-GATE_OFFSET: x = m[2]
+ if y < -HALF_SIZE+GATE_OFFSET: y = m[1]
+ elif y > HALF_SIZE-GATE_OFFSET: y = m[3]
m.append( ( x, y ) )
OBJ_Y_LOC = 710
diff --git a/SynthLab/SynthLabToolbars.py b/SynthLab/SynthLabToolbars.py
index 0d64632..8b535eb 100644
--- a/SynthLab/SynthLabToolbars.py
+++ b/SynthLab/SynthLabToolbars.py
@@ -15,7 +15,7 @@ class mainToolbar(gtk.Toolbar):
def _insertSeparator(x = 1):
for i in range(x):
self.separator = gtk.SeparatorToolItem()
- self.separator.set_draw(True)
+ self.separator.set_draw(False)
self.insert(self.separator,-1)
self.separator.show()
@@ -102,7 +102,7 @@ class presetToolbar(gtk.Toolbar):
def _insertSeparator(x = 1):
for i in range(x):
self.separator = gtk.SeparatorToolItem()
- self.separator.set_draw(True)
+ self.separator.set_draw(False)
self.insert(self.separator,-1)
self.separator.show()
@@ -167,4 +167,4 @@ class presetToolbar(gtk.Toolbar):
self.preset10Button.connect('clicked',self.synthLab.presetCallback,10)
self.insert(self.preset10Button, -1)
self.preset10Button.show()
- self.preset10Button.set_tooltip(_('Preset 10')) \ No newline at end of file
+ self.preset10Button.set_tooltip(_('Preset 10'))
diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py
index 6d3154a..194f71e 100644
--- a/SynthLab/SynthLabWindow.py
+++ b/SynthLab/SynthLabWindow.py
@@ -567,8 +567,12 @@ class SynthLabWindow(SubActivity):
if event.button == 1:
for i in range(self.objectCount-1,-1,-1):
- if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
- gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
+ if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
+ if self.locations[i][1] == SynthLabConstants.INIT_LOCATIONS[i][1] \
+ and i != self.objectCount-1:
+ gate = False
+ else:
+ gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
if gate:
if self.action == "draw-wire":
self.connectWire( i, gate )
@@ -607,7 +611,7 @@ class SynthLabWindow(SubActivity):
and i != self.objectCount-1: continue
if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
- if gate and gate != self.wireGate:
+ if gate and ( gate != self.wireGate or i != self.wireObj ):
if gate[0] == SynthLabConstants.GT_CONTROL_OUTPUT or gate[0] == SynthLabConstants.GT_SOUND_OUTPUT:
ok = self.testConnection( i, gate, self.wireObj, self.wireGate )
else: