Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Edit
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-01-15 13:07:03 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-01-18 19:59:59 (GMT)
commite256881651711fb39323bdf8cde091ed926187fa (patch)
treea3993789799a4fe10447c16e64f7129af800cf7e /Edit
parent54958856d3f85349b750d0f81aac890cfbb02c0d (diff)
Ported TamTamEdit toolbars to Gtk3. Fixed some bugs
Signed-off-by: Aaron Gordon <aaronsgordon@yahoo.com>
Diffstat (limited to 'Edit')
-rw-r--r--Edit/EditToolbars.py68
-rw-r--r--Edit/HitInterface.py5
-rw-r--r--Edit/MainWindow.py30
-rw-r--r--Edit/NoteInterface.py17
-rw-r--r--Edit/TrackInterface.py14
-rw-r--r--Edit/TuneInterface.py1
6 files changed, 69 insertions, 66 deletions
diff --git a/Edit/EditToolbars.py b/Edit/EditToolbars.py
index 9d7eb46..8a5af14 100644
--- a/Edit/EditToolbars.py
+++ b/Edit/EditToolbars.py
@@ -313,15 +313,17 @@ class paintPalette(Palette):
self.noteDurBox.set_active(len)
def handleNoteDur(self, widget):
- data = widget.props.value
- noteDur = int(self.noteDurs[data])
- self.edit.trackInterface.setPaintNoteDur(noteDur)
+ pass
+ #data = widget.get_property("value")
+ #noteDur = int(self.noteDurs[data])
+ #self.edit.trackInterface.setPaintNoteDur(noteDur)
def handleSnapGrid(self, widget):
- data = widget.props.value
- grid = int(self.gridDurs[data])
- self.edit.trackInterface.setPaintGrid(grid)
- self.resizeNoteDur()
+ pass
+ #data = widget.get_active_text()
+ #grid = int(self.gridDurs[data])
+ #self.edit.trackInterface.setPaintGrid(grid)
+ #self.resizeNoteDur()
class volumeTempoPalette(Palette):
def __init__(self, label, edit):
@@ -404,7 +406,7 @@ class generationPalette(Palette):
self.YSlider1BottomLabelBox.pack_start(self.YSlider1Img, False, False, padding = 5)
self.YSlider1BottomLabelBox.pack_start(self.YSlider1BottomLabel, False, False, padding = 5)
self.XYSlider1MainBox.pack_start(self.XYSlider1TopLabel, False, False, padding = 5)
- self.XYSlider1MainBox.pack_start(self.XYSlider1, False, False, padding = 2)
+ #self.XYSlider1MainBox.pack_start(self.XYSlider1, False, False, padding = 2)
self.XYSlider1MainBox.pack_start(self.XSlider1BottomLabelBox, False, False, padding = 2)
self.XYSlider1MainBox.pack_start(self.YSlider1BottomLabelBox, False, False, padding = 2)
@@ -431,7 +433,7 @@ class generationPalette(Palette):
self.YSlider2BottomLabelBox.pack_start(self.YSlider2Img, False, False, padding = 5)
self.YSlider2BottomLabelBox.pack_start(self.YSlider2BottomLabel, False, False, padding = 5)
self.XYSlider2MainBox.pack_start(self.XYSlider2TopLabel, False, False, padding = 5)
- self.XYSlider2MainBox.pack_start(self.XYSlider2, False, False, padding = 2)
+ #self.XYSlider2MainBox.pack_start(self.XYSlider2, False, False, padding = 2)
self.XYSlider2MainBox.pack_start(self.XSlider2BottomLabelBox, False, False, padding = 2)
self.XYSlider2MainBox.pack_start(self.YSlider2BottomLabelBox, False, False, padding = 2)
@@ -458,7 +460,7 @@ class generationPalette(Palette):
self.YSlider3BottomLabelBox.pack_start(self.YSlider3Img, False, False, padding = 5)
self.YSlider3BottomLabelBox.pack_start(self.YSlider3BottomLabel, False, False, padding = 5)
self.XYSlider3MainBox.pack_start(self.XYSlider3TopLabel, False, False, padding = 5)
- self.XYSlider3MainBox.pack_start(self.XYSlider3, False, False, padding = 2)
+ #self.XYSlider3MainBox.pack_start(self.XYSlider3, False, False, padding = 2)
self.XYSlider3MainBox.pack_start(self.XSlider3BottomLabelBox, False, False, padding = 2)
self.XYSlider3MainBox.pack_start(self.YSlider3BottomLabelBox, False, False, padding = 2)
@@ -555,10 +557,10 @@ class generationPalette(Palette):
# self.sampleNoteMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_##height() )
# self.sampleNoteMask.endOffset = pix.get_width()-3
- colormap = self.previewDA.get_colormap()
- self.colors = { "Beat_Line": colormap.alloc_color( "#959595", True, True ),
- "Note_Border": colormap.alloc_color( Config.BG_COLOR, True, True ),
- "Note_Fill": colormap.alloc_color( Config.FG_COLOR, True, True ) }
+ #colormap = self.previewDA.get_colormap()
+ #self.colors = { "Beat_Line": colormap.alloc_color( "#959595", True, True ),
+ # "Note_Border": colormap.alloc_color( Config.BG_COLOR, True, True ),
+ # "Note_Fill": colormap.alloc_color( Config.FG_COLOR, True, True ) }
self.scaleBox.set_active(0)
self.modeBox.set_active(0)
@@ -1018,25 +1020,25 @@ class propertiesPalette(Palette):
self.decisionBox.pack_start(self.cancelButton, False, False, padding = 5)
self.decisionBox.pack_start(self.acceptButton, False, False, padding = 5)
- self.mainBox.pack_start(self.gridDivisionBox, padding = 3)
- self.mainBox.pack_start(self.pageColorBox, padding = 3)
- self.mainBox.pack_start(self.pageSeparator, padding = 10)
- self.mainBox.pack_start(self.transposeBox, padding = 3)
- self.mainBox.pack_start(self.volumeBox, padding = 3)
- self.mainBox.pack_start(self.panBox, padding = 3)
- self.mainBox.pack_start(self.reverbBox, padding = 3)
- self.mainBox.pack_start(self.attackDurBox, padding = 3)
- self.mainBox.pack_start(self.decayDurBox, padding = 3)
- self.mainBox.pack_start(self.filterTypeBox, padding = 3)
- self.mainBox.pack_start(self.filterCutoffBox, padding = 3)
- self.generationMainBox.pack_start(self.generationSeparator, padding = 5)
- self.generationMainBox.pack_start(self.generationLabel, padding = 10)
- self.generationMainBox.pack_start(self.generationTypeBox, padding = 3)
- self.generationMainBox.pack_start(self.minimumBox, padding = 3)
- self.generationMainBox.pack_start(self.maximumBox, padding = 3)
- self.generationMainBox.pack_start(self.randomBox, padding = 3)
- self.generationMainBox.pack_start(self.decisionBox, padding = 3)
- self.mainBox.pack_start(self.generationMainBox, padding = 3)
+ self.mainBox.pack_start(self.gridDivisionBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.pageColorBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.pageSeparator, True, True, padding = 10)
+ self.mainBox.pack_start(self.transposeBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.volumeBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.panBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.reverbBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.attackDurBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.decayDurBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.filterTypeBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.filterCutoffBox, True, True, padding = 3)
+ self.generationMainBox.pack_start(self.generationSeparator, True, True, padding = 5)
+ self.generationMainBox.pack_start(self.generationLabel, True, True, padding = 10)
+ self.generationMainBox.pack_start(self.generationTypeBox, True, True, padding = 3)
+ self.generationMainBox.pack_start(self.minimumBox, True, True, padding = 3)
+ self.generationMainBox.pack_start(self.maximumBox, True, True, padding = 3)
+ self.generationMainBox.pack_start(self.randomBox, True, True, padding = 3)
+ self.generationMainBox.pack_start(self.decisionBox, True, True, padding = 3)
+ self.mainBox.pack_start(self.generationMainBox, True, True, padding = 3)
self.mainBox.show_all()
self.generationMainBox.hide()
diff --git a/Edit/HitInterface.py b/Edit/HitInterface.py
index 84e0356..db8700f 100644
--- a/Edit/HitInterface.py
+++ b/Edit/HitInterface.py
@@ -192,8 +192,9 @@ class HitInterface( NoteInterface ):
if self.selected: img = self.imageSelected
else: img = self.image
- cxt.set_source_surface(img, 0, 0)
- cxt.paint()
+ cxt.set_source_surface(img, self.imgX, self.imgY)
+ cxt.rectangle(self.x+2, self.y+2, self.width-4, self.height-4)
+ cxt.fill()
#win.draw_pixbuf( gc, img, 0, 0, self.imgX, self.imgY, self.imgWidth, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
return True # we drew something
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index 9269a19..3ea2a19 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -418,13 +418,13 @@ class MainWindow(Gtk.EventBox):
separator.set_expand(False)
self.activity.toolbox.toolbar.insert(separator, -1)
- #self._generateToolbar = generateToolbar(self)
- #self._generateToolbar.show()
- #generate_toolbar_button = ToolbarButton(label=_('Generate'),
- # page=self._generateToolbar,
- # icon_name='diceB')
- #generate_toolbar_button.show()
- #self.activity.toolbox.toolbar.insert(generate_toolbar_button, -1)
+ self._generateToolbar = generateToolbar(self)
+ self._generateToolbar.show()
+ generate_toolbar_button = ToolbarButton(label=_('Generate'),
+ page=self._generateToolbar,
+ icon_name='diceB')
+ generate_toolbar_button.show()
+ self.activity.toolbox.toolbar.insert(generate_toolbar_button, -1)
self._recordToolbar = recordToolbar(self)
self._recordToolbar.show()
@@ -435,13 +435,13 @@ class MainWindow(Gtk.EventBox):
self.activity.toolbox.toolbar.insert(record_toolbar_button, -1)
self._record_button = self._recordToolbar.recordButton
- #self._toolsToolbar = toolsToolbar(self)
- #self._toolsToolbar.show()
- #tools_toolbar_button = ToolbarButton(label=_('Tools'),
- # page=self._toolsToolbar,
- # icon_name='preferences-system')
- #tools_toolbar_button.show()
- #self.activity.toolbox.toolbar.insert(tools_toolbar_button, -1)
+ self._toolsToolbar = toolsToolbar(self)
+ self._toolsToolbar.show()
+ tools_toolbar_button = ToolbarButton(label=_('Tools'),
+ page=self._toolsToolbar,
+ icon_name='preferences-system')
+ tools_toolbar_button.show()
+ self.activity.toolbox.toolbar.insert(tools_toolbar_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
@@ -946,7 +946,7 @@ class MainWindow(Gtk.EventBox):
def handleTempo(self, widget):
self._data['tempo'] = round(widget.get_value())
- img = min(7,int(8*(self._data["tempo"]-widget.lower)/(widget.upper-widget.lower)))+1 # tempo 1-8
+ img = min(7,int(8*(self._data["tempo"] - widget.get_lower())/(widget.get_upper() - widget.get_lower())))+1 # tempo 1-8
#self.GUI["2tempoImage"].set_from_file(imagefile('tempo' + str(img) + '.png'))
if self.playing:
self.csnd.setTempo(self._data['tempo'])
diff --git a/Edit/NoteInterface.py b/Edit/NoteInterface.py
index 5e3da41..7ba04b8 100644
--- a/Edit/NoteInterface.py
+++ b/Edit/NoteInterface.py
@@ -176,7 +176,7 @@ class NoteInterface:
playSample = False
- if event.type == gtk.gdk._2BUTTON_PRESS: # select bar
+ if event.type == Gdk.EventType._2BUTTON_PRESS: # select bar
self.potentialDeselect = False
start = 0
check = self.note.cs.onset - Config.TICKS_PER_BEAT
@@ -185,7 +185,7 @@ class NoteInterface:
check += self.note.cs.duration
while stop < check: stop += Config.TICKS_PER_BEAT
emitter.selectNotesByBar( self.note.track, start, stop )
- elif event.type == gtk.gdk._3BUTTON_PRESS: # select track
+ elif event.type == Gdk.EventType._3BUTTON_PRESS: # select track
self.potentialDeselect = False
emitter.selectNotesByTrack( self.note.track )
else:
@@ -337,16 +337,19 @@ class NoteInterface:
if startX > self.imgX + self.imgWidth: return True # we don't need to draw, but maybe a later note does
cxt = cairo.Context(surface)
cxt.set_source_rgb(*gdk_color_to_cairo(self.color))
- cxt.rectangle(self.x+1, self.y+1, self.width-2, self.height-2 )
+ cxt.rectangle(self.x+1, self.y, self.width-2, self.height-2 )
cxt.fill()
if self.selected: img = self.imageSelected
else: img = self.image
#win.draw_pixbuf( gc, img, 0, 0, self.imgX, self.imgY, self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
- cxt.set_source_surface(img, 0, 0)
- cxt.paint()
- cxt.set_source_surface(img, Config.NOTE_IMAGE_TAIL, 0)
- cxt.paint()
+ cxt.set_source_surface(img, self.x+1, self.y)
+ cxt.rectangle(self.x+1, self.y, self.width-2, self.height-2)
+ cxt.fill()
+
+ #cxt.set_source_surface(img, self.imgX+self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgY)
+ #cxt.rectangle(self.imgX+self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgY, self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgHeight)
+ #cxt.fill()
#win.draw_pixbuf( gc, img, Config.NOTE_IMAGE_TAIL, 0, self.imgX+self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgY, Config.NOTE_IMAGE_ENDLENGTH, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
return True # we drew something
diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py
index d7ee42b..ea50dab 100644
--- a/Edit/TrackInterface.py
+++ b/Edit/TrackInterface.py
@@ -148,8 +148,7 @@ class TrackInterface( Gtk.EventBox ):
#self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
def preparePixbuf( name ):
- path = "common/Resources/Images/"
- self.image[name] = cairo.ImageSurface.create_from_png(path + name + '.png')
+ self.image[name] = cairo.ImageSurface.create_from_png(imagefile(name + '.png'))
prepareDrawable( "trackBG", width )
prepareDrawable( "trackBGSelected", width )
@@ -386,7 +385,7 @@ class TrackInterface( Gtk.EventBox ):
def handleButtonPress( self, widget, event ):
TP.ProfileBegin( "TI::handleButtonPress" )
-
+ print event.x, event.y
self.clickButton = event.button
if event.type == Gdk.EventType._2BUTTON_PRESS: self.buttonPressCount = 2
@@ -576,9 +575,8 @@ class TrackInterface( Gtk.EventBox ):
def handleMotion( self, widget, event ):
TP.ProfileBegin( "TI::handleMotion::Common" )
- #if event.is_hint:
- if True:
- x, y = widget.get_pointer()
+ if event.is_hint:
+ x, y = event.x, event.y
event.x = float(x)
event.y = float(y)
#event.state = state
@@ -652,7 +650,6 @@ class TrackInterface( Gtk.EventBox ):
self.updateTooltip( event )
TP.ProfileEnd( "TI::handleMotion::Hover" )
return
-
if self.curAction == "paste":
TP.ProfileBegin( "TI::handleMotion::Paste" )
top = Config.NUMBER_OF_TRACKS
@@ -663,7 +660,8 @@ class TrackInterface( Gtk.EventBox ):
break
self.updatePaste( self.pixelsToTicksFloor( self.curBeats, event.x ), top )
TP.ProfileEnd( "TI::handleMotion::Paste" )
- elif event.state & gtk.gdk.BUTTON1_MASK:
+
+ elif event.state & Gdk.EventMask.BUTTON1_MOTION_MASK:
TP.ProfileBegin( "TI::handleMotion::Drag" )
if not self.curAction: # no action is in progress yet we're dragging, start a marquee
diff --git a/Edit/TuneInterface.py b/Edit/TuneInterface.py
index 7a94080..fb145c4 100644
--- a/Edit/TuneInterface.py
+++ b/Edit/TuneInterface.py
@@ -618,7 +618,6 @@ class TuneInterface( Gtk.EventBox ):
#self.gc.set_clip_origin( 0, 0 )
self.drawThumbnail( pageId, self.thumbnail[pageId], self.thumbnailDirtyRect[pageId] )
#self.gc.set_clip_origin( x, self.pageY )
- print "Coordinates ", x, self.pageY
cr.set_source_surface(self.thumbnail[pageId], x, self.pageY)
cr.paint()