Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramartin <olpc@xo-00-CE-12.localdomain>2007-06-29 16:20:39 (GMT)
committer amartin <olpc@xo-00-CE-12.localdomain>2007-06-29 16:20:39 (GMT)
commitc43ee6f6f73b0f579df2b0e2a53552ba78cd1a72 (patch)
tree2e1a8002b15f0efd832c7b270258c8b23aaad102
parent79f52b3e1696d345cc2ecdc1235f7c830a5a2fa6 (diff)
page properties
-rw-r--r--Edit/MainWindow.py12
-rw-r--r--Edit/Properties.py22
-rw-r--r--Util/NoteDB.py24
3 files changed, 42 insertions, 16 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index e6d7118..6e4a902 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -1069,13 +1069,13 @@ class MainWindow( SubActivity ):
balloc = self.GUI["2contextBox"].get_allocation()
walloc = self.GUI["9propertiesPopup"].get_allocation()
if walloc.height != 1: # hack to deal with showing the window before first allocation T_T
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
self.GUI["9propertiesPopup"].show()
if walloc.height == 1:
walloc = self.GUI["9propertiesPopup"].get_allocation()
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].hide()
@@ -1202,13 +1202,13 @@ class MainWindow( SubActivity ):
balloc = self.GUI["2contextBox"].get_allocation()
walloc = self.GUI["9propertiesPopup"].get_allocation()
if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
self.GUI["9propertiesPopup"].show()
if walloc.height == 1:
walloc = self.GUI["9propertiesPopup"].get_allocation()
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].hide()
@@ -1294,13 +1294,13 @@ class MainWindow( SubActivity ):
balloc = self.GUI["2contextBox"].get_allocation()
walloc = self.GUI["9propertiesPopup"].get_allocation()
if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 100, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
self.GUI["9propertiesPopup"].show()
if walloc.height == 1:
walloc = self.GUI["9propertiesPopup"].get_allocation()
- self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 100, balloc.y - walloc.height + winLoc[1] )
else:
self.GUI["9propertiesPopup"].hide()
diff --git a/Edit/Properties.py b/Edit/Properties.py
index 0913966..7e64b4b 100644
--- a/Edit/Properties.py
+++ b/Edit/Properties.py
@@ -61,18 +61,20 @@ class Properties( gtk.VBox ):
beatBox = gtk.VBox()
self.beatAdjust = gtk.Adjustment( 4, 2, 12, 1, 1, 0)
self.GUI['beatSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.beatAdjust, 7 )
- self.beatAdjust.connect("value-changed", self.handleBeat)
+ self.GUI['beatSlider'].connect("button-release-event", self.handleBeat)
self.GUI['beatSlider'].set_snap( 1 )
self.GUI['beatSlider'].set_inverted(True)
self.GUI['beatSlider'].set_size_request(50, 200)
beatBox.pack_start( self.GUI['beatSlider'] )
self.beatLabel = gtk.Image()
self.beatLabel.set_from_file(Config.IMAGE_ROOT + 'volume3.png')
- self.handleBeat( self.beatAdjust )
+ self.beatAdjust.connect("value-changed", self.updateBeatLabel)
+ self.updateBeatLabel( self.beatAdjust )
beatBox.pack_start( self.beatLabel )
self.pageBox.pack_start( beatBox )
colorBox = gtk.VBox()
self.GUI["color0Button"] = ImageRadioButton( None, Config.IMAGE_ROOT+"pageThumbnailBut0.png", Config.IMAGE_ROOT+"pageThumbnailBut0Down.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI["color0Button"].set_size_request( 80, -1 )
self.GUI["color0Button"].connect( "clicked", self.handleColor, 0 )
colorBox.pack_start( self.GUI["color0Button"] )
self.GUI["color1Button"] = ImageRadioButton( self.GUI["color0Button"], Config.IMAGE_ROOT+"pageThumbnailBut1.png", Config.IMAGE_ROOT+"pageThumbnailBut1Down.png", backgroundFill = Config.PANEL_COLOR )
@@ -436,15 +438,17 @@ class Properties( gtk.VBox ):
if len(stream):
self.noteDB.updatePages( [ PARAMETER.PAGE_COLOR, len(stream)//2 ] + stream )
- def handleBeat( self, adjust ):
+ def updateBeatLabel( self, adjust ):
beats = int(adjust.value)
self.beatLabel.set_from_file(Config.IMAGE_ROOT + 'propBeats' + str(beats) + '.png')
- if not self.setup:
- stream = []
- for page in self.pageIds:
- stream += [ page, beats ]
- if len(stream):
- self.noteDB.updatePages( [ PARAMETER.PAGE_BEATS, len(stream)//2 ] + stream )
+
+ def handleBeat( self, widget, signal_id ):
+ beats = int(widget.get_adjustment().value)
+ stream = []
+ for page in self.pageIds:
+ stream += [ page, beats ]
+ if len(stream):
+ self.noteDB.updatePages( [ PARAMETER.PAGE_BEATS, len(stream)//2 ] + stream )
def stepPitch( self, step ):
diff --git a/Util/NoteDB.py b/Util/NoteDB.py
index 7f3266d..014ec5e 100644
--- a/Util/NoteDB.py
+++ b/Util/NoteDB.py
@@ -214,8 +214,30 @@ class NoteDB:
def updatePage( self, page, parameter, value ):
if parameter == PARAMETER.PAGE_BEATS:
+ ticks = value*Config.TICKS_PER_BEAT
+ if self.pages[page].beats > value: # crop some notes
+ dstream = []
+ ustream = []
+ for track in range(Config.NUMBER_OF_TRACKS):
+ dsub = []
+ usub = []
+ for note in self.getNotesByTrack(page, track):
+ if ticks <= note.cs.onset:
+ dsub.append( note.id )
+ elif ticks < note.cs.onset + note.cs.duration:
+ usub.append( note.id )
+ usub.append( ticks - note.cs.onset )
+ if len(dsub):
+ dstream += [ page, track, len(dsub) ] + dsub
+ if len(usub):
+ ustream += [ page, track, PARAMETER.DURATION, len(usub)//2 ] + usub
+ if len(dstream):
+ self.deleteNotes( dstream + [-1] )
+ if len(ustream):
+ self.updateNotes( ustream + [-1] )
+
self.pages[page].beats = value
- self.pages[page].ticks = value*Config.TICKS_PER_BEAT
+ self.pages[page].ticks = ticks
#self._updateBeatsBefore(self.tune.index(page))
elif parameter == PARAMETER.PAGE_COLOR:
self.pages[page].color = value