self.label_name_event_box = Gtk.EventBox()
self.label_name_event_box.connect("button-press-event", self.on_label_mouse)
self.label_name_event_box.add(self.label_name)
+
+ entries = [Gtk.TargetEntry.new("INPUT_CHANNEL", Gtk.TargetFlags.SAME_APP, 0)]
+ self.label_name_event_box.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, entries,
+ Gdk.DragAction.MOVE)
+ self.label_name_event_box.connect("drag-data-get", self.on_drag_data_get)
+ self.drag_dest_set(Gtk.DestDefaults.ALL, entries, Gdk.DragAction.MOVE)
+ self.connect_after("drag-data-received", self.on_drag_data_received)
+
self.vbox.pack_start(self.label_name_event_box, True, True, 0)
# self.label_stereo = Gtk.Label()
# if self.stereo:
self.monitor_button.connect('toggled', self.on_monitor_button_toggled)
self.pack_start(self.monitor_button, False, False, 0)
+ def on_drag_data_get(self, widget, drag_context, data, info, time):
+ channel = widget.get_parent().get_parent()
+ data.set(data.get_target(), 8, channel._channel_name.encode('utf-8'))
+
+ def on_drag_data_received(self, widget, drag_context, x, y, data, info, time):
+ source_name = data.get_data().decode('utf-8')
+ if source_name == self._channel_name:
+ return
+ self.emit("input-channel-order-changed", source_name, self._channel_name)
+
def add_control_group(self, channel):
control_group = ControlGroup(channel, self)
control_group.show_all()
return True
return Channel.unserialize_property(self, name, value)
+GObject.signal_new("input-channel-order-changed", InputChannel,
+ GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
+ None, [GObject.TYPE_STRING, GObject.TYPE_STRING])
+
class OutputChannel(Channel):
_display_solo_buttons = False
self.label_name_event_box = Gtk.EventBox()
self.label_name_event_box.connect('button-press-event', self.on_label_mouse)
self.label_name_event_box.add(self.label_name)
+
+ entries = [Gtk.TargetEntry.new("OUTPUT_CHANNEL", Gtk.TargetFlags.SAME_APP, 0)]
+ self.label_name_event_box.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, entries,
+ Gdk.DragAction.MOVE)
+ self.label_name_event_box.connect("drag-data-get", self.on_drag_data_get)
+ self.drag_dest_set(Gtk.DestDefaults.ALL, entries, Gdk.DragAction.MOVE)
+ self.connect_after("drag-data-received", self.on_drag_data_received)
+
if not hasattr(self, 'color'):
self.color = random_color()
set_background_color(self.label_name_event_box, self.css_name,
self._init_prefader_channels = None
channel_properties_dialog = None
+
+ def on_drag_data_get(self, widget, drag_context, data, info, time):
+ channel = widget.get_parent().get_parent()
+ data.set(data.get_target(), 8, channel._channel_name.encode('utf-8'))
+
+ def on_drag_data_received(self, widget, drag_context, x, y, data, info, time):
+ source_name = data.get_data().decode('utf-8')
+ if source_name == self._channel_name:
+ return
+ self.emit("output-channel-order-changed", source_name, self._channel_name)
+
def on_channel_properties(self):
if not self.channel_properties_dialog:
self.channel_properties_dialog = OutputChannelPropertiesDialog(self, self.app)
sensitive = True
self.ok_button.set_sensitive(sensitive)
+GObject.signal_new("output-channel-order-changed", OutputChannel,
+ GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
+ None, [GObject.TYPE_STRING, GObject.TYPE_STRING])
+
class NewChannelDialog(ChannelPropertiesDialog):
def create_ui(self):
sys.path = old_path
log = logging.getLogger("jack_mixer")
-
class JackMixer(SerializedObject):
# scales suitable as meter scales
channel.channel.solo_midi_cc = solo_cc
else:
channel.channel.autoset_solo_midi_cc()
+
return channel
def add_channel_precreated(self, channel):
channel.post_fader_output_channel.volume = 0
channel.post_fader_output_channel.set_solo(channel.channel, True)
+ channel.connect('input-channel-order-changed', self.on_input_channel_order_changed)
+
+ def on_input_channel_order_changed(self, widget, source_name, dest_name):
+ self.channels.clear()
+
+ channel_box = self.hbox_inputs
+ frames = channel_box.get_children()
+
+ for f in frames:
+ c = f.get_child()
+ if source_name == c._channel_name:
+ source_frame = f
+ break
+
+ for f in frames:
+ c = f.get_child()
+ if (dest_name == c._channel_name):
+ pos = frames.index(f)
+ channel_box.reorder_child(source_frame, pos)
+ break
+
+ for frame in self.hbox_inputs.get_children():
+ c = frame.get_child()
+ self.channels.append(c)
+
def read_meters(self):
for channel in self.channels:
channel.read_meter()
self.channel_remove_output_menu_item.set_sensitive(True)
self.output_channels.append(channel)
+ channel.connect('output-channel-order-changed', self.on_output_channel_order_changed)
+
+ def on_output_channel_order_changed(self, widget, source_name, dest_name):
+ self.output_channels.clear()
+ channel_box = self.hbox_outputs
+
+ frames = channel_box.get_children()
+
+ for f in frames:
+ c = f.get_child()
+ if source_name == c._channel_name:
+ source_frame = f
+ break
+
+ for f in frames:
+ c = f.get_child()
+ if (dest_name == c._channel_name):
+ pos = len(frames) - 1 - frames.index(f)
+ channel_box.reorder_child(source_frame, pos)
+ break
+
+ for frame in self.hbox_outputs.get_children():
+ c = frame.get_child()
+ self.output_channels.append(c)
_monitored_channel = None
def get_monitored_channel(self):