/*
Copyright (C) 2007 Paul Davis
- Author: Dave Robillard
+ Author: David Robillard
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
CanvasNoteEvent::show_channel_selector(void)
{
if (_channel_selector_widget == 0) {
+
+ if(_region.channel_selector_scoped_note() != 0){
+ _region.channel_selector_scoped_note()->hide_channel_selector();
+ _region.set_channel_selector_scoped_note(0);
+ }
+
SingleMidiChannelSelector* _channel_selector = new SingleMidiChannelSelector(_note->channel());
_channel_selector->show_all();
_channel_selector->channel_selected.connect(
_channel_selector_widget->property_width() = 100;
_channel_selector_widget->raise_to_top();
_channel_selector_widget->show();
+
+ _region.set_channel_selector_scoped_note(this);
} else {
hide_channel_selector();
}
_selected = selected;
set_fill_color (base_color ());
-
+
if (_selected) {
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
+
+ if(_region.channel_selector_scoped_note() != 0){
+ _region.channel_selector_scoped_note()->hide_channel_selector();
+ _region.set_channel_selector_scoped_note(0);
+ }
} else {
set_outline_color(calculate_outline(base_color()));
+ hide_channel_selector();
}
}
SCALE_USHORT_TO_UINT8_T(color.get_red()),
SCALE_USHORT_TO_UINT8_T(color.get_green()),
SCALE_USHORT_TO_UINT8_T(color.get_blue()),
- opacity),
+ opacity),
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(), 0.5);
}
case ChannelColors:
return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (CanvasNoteEvent::midi_channel_colors[_note->channel()],
- opacity),
+ opacity),
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(), 0.5);
default:
_mouse_y_fraction = yf;
if (notify) {
- _region.note_mouse_position (_mouse_x_fraction, _mouse_y_fraction, set_cursor);
+ if (big_enough_to_trim()) {
+ _region.note_mouse_position (_mouse_x_fraction, _mouse_y_fraction, set_cursor);
+ } else {
+ /* pretend the mouse is in the middle, because this is not big enough
+ to trim right now.
+ */
+ _region.note_mouse_position (0.5, 0.5, set_cursor);
+ }
}
}
case GDK_BUTTON_PRESS:
set_mouse_fractions (ev);
- if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state)) {
+ if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state) && _selected) {
show_channel_selector();
return true;
}
(_mouse_x_fraction >= 0.75 && _mouse_x_fraction < 1.0);
}
+bool
+CanvasNoteEvent::big_enough_to_trim () const
+{
+ return (x2() - x1()) > 10; /* canvas units, really pixels */
+}
+
} // namespace Canvas
} // namespace Gnome