* made notes whose channel is not selected in the track appear gray, see http://www.flickr.com/photos/24012642@N02/2429528120/

git-svn-id: svn://localhost/ardour2/branches/3.0@3272 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2008-04-20 22:33:13 +00:00
parent 20cfa08aea
commit e8c2b6f371
8 changed files with 58 additions and 20 deletions

View file

@ -59,9 +59,11 @@
<Option name="midi note fill max" value="ee33338a"/>
<Option name="midi note fill mid" value="eeee338a"/>
<Option name="midi note fill min" value="33ee338a"/>
<Option name="midi note fill inactive channel" value="bfbfbf88"/>
<Option name="midi note outline max" value="ff2222b0"/>
<Option name="midi note outline mid" value="ffff22b0"/>
<Option name="midi note outline min" value="22ff22b0"/>
<Option name="midi note outline inactive channel" value="bfbfbfff"/>
<Option name="midi note selected outline" value="5566ffee"/>
<Option name="midi select rect fill" value="8888ff88"/>
<Option name="midi select rect outline" value="5555ffff"/>

View file

@ -78,6 +78,22 @@ CanvasMidiEvent::hide_velocity(void)
_text->hide();
}
void
CanvasMidiEvent::on_channel_selection_change(uint16_t selection)
{
// make note change its color if its channel is not marked active
if( (selection & (1 << _note->channel())) == 0 ) {
set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteFillInactiveChannel.get());
set_outline_color(ARDOUR_UI::config()->canvasvar_MidiNoteOutlineInactiveChannel.get());
} else {
set_fill_color(note_fill_color(_note->velocity()));
set_outline_color(note_outline_color(_note->velocity()));
}
// this forces the item to update..... maybe slow...
_item->hide();
_item->show();
}
void
CanvasMidiEvent::on_channel_change(uint8_t channel)
{

View file

@ -44,7 +44,7 @@ namespace Canvas {
*
* A newer, better canvas should remove the need for all the ugly here.
*/
class CanvasMidiEvent {
class CanvasMidiEvent : public sigc::trackable {
public:
CanvasMidiEvent(
MidiRegionView& region,
@ -64,9 +64,10 @@ public:
void hide_velocity();
/**
* This slot is called, when a new channel is selected for the event
* This slot is called, when a new channel is selected for the single event
* */
void on_channel_change(uint8_t channel);
void on_channel_selection_change(uint16_t selection);
void show_channel_selector();

View file

@ -59,9 +59,11 @@ CANVAS_VARIABLE(canvasvar_MidiFrameBase, "midi frame base")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMax, "midi note fill max")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMid, "midi note fill mid")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMin, "midi note fill min")
CANVAS_VARIABLE(canvasvar_MidiNoteFillInactiveChannel, "midi note fill inactive channel")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMax, "midi note outline max")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMid, "midi note outline mid")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMin, "midi note outline min")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineInactiveChannel, "midi note outline inactive channel")
CANVAS_VARIABLE(canvasvar_MidiNoteSelectedOutline, "midi note selected outline")
CANVAS_VARIABLE(canvasvar_MidiSelectRectFill, "midi select rect fill")
CANVAS_VARIABLE(canvasvar_MidiSelectRectOutline, "midi select rect outline")

View file

@ -60,6 +60,7 @@ using namespace ArdourCanvas;
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<MidiRegion> r, double spu, Gdk::Color& basic_color)
: RegionView (parent, tv, r, spu, basic_color)
, last_channel_selection(0xFFFF)
, _default_note_length(0.0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
@ -75,12 +76,14 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<MidiRegion> r, double spu, Gdk::Color& basic_color, TimeAxisViewItem::Visibility visibility)
: RegionView (parent, tv, r, spu, basic_color, visibility)
, last_channel_selection(0xFFFF)
, _default_note_length(0.0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
, _delta_command(NULL)
, _mouse_state(None)
, _pressed_button(0)
{
_note_group->raise_to_top();
}
@ -128,6 +131,8 @@ MidiRegionView::init (Gdk::Color& basic_color, bool wfd)
group->signal_event().connect (mem_fun (this, &MidiRegionView::canvas_event), false);
midi_view()->signal_channel_selection_changed().connect(
mem_fun(this, &MidiRegionView::midi_channel_selection_changed));
}
bool
@ -721,9 +726,6 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
ev_rect->property_x2() = trackview.editor.frame_to_pixel(_region->length());
ev_rect->property_y2() = y1 + floor(midi_stream_view()->note_height());
ev_rect->property_fill_color_rgba() = note_fill_color(note->velocity());
ev_rect->property_outline_color_rgba() = note_outline_color(note->velocity());
if (note->duration() == 0) {
_active_notes[note->note()] = ev_rect;
/* outline all but right edge */
@ -756,8 +758,6 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
CanvasHit* ev_diamond = new CanvasHit(*this, *group, diamond_size, note);
ev_diamond->move(x, y);
ev_diamond->show();
ev_diamond->property_fill_color_rgba() = note_fill_color(note->velocity());
ev_diamond->property_outline_color_rgba() = note_outline_color(note->velocity());
_events.push_back(ev_diamond);
event = ev_diamond;
} else {
@ -768,6 +768,7 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
if(_marked_for_selection.find(event->note()) != _marked_for_selection.end()) {
note_selected(event, true);
}
event->on_channel_selection_change(last_channel_selection);
}
}
@ -1231,3 +1232,14 @@ MidiRegionView::set_frame_color()
}
}
}
void
MidiRegionView::midi_channel_selection_changed(uint16_t selection)
{
for(std::vector<ArdourCanvas::CanvasMidiEvent*>::iterator i = _events.begin();
i != _events.end();
++i) {
(*i)->on_channel_selection_change(selection);
}
last_channel_selection = selection;
}

View file

@ -238,6 +238,9 @@ class MidiRegionView : public RegionView
bool canvas_event(GdkEvent* ev);
bool note_canvas_event(GdkEvent* ev);
uint16_t last_channel_selection;
void midi_channel_selection_changed(uint16_t selection);
void clear_selection_except(ArdourCanvas::CanvasMidiEvent* ev);
void clear_selection() { clear_selection_except(NULL); }
void update_drag_selection(double last_x, double x, double last_y, double y);

View file

@ -91,7 +91,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar
, _note_mode_item(NULL)
, _percussion_mode_item(NULL)
, _midi_expander("MIDI")
, _channel_selector(0)
, _channel_selector(0xFFFF)
{
subplugin_menu.set_name ("ArdourContextMenu");
@ -137,15 +137,14 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar
_view->attach ();
}
// add channel selector
_channel_selector = manage(new MidiMultipleChannelSelector(0xFFFF));
// add channel selector expander
HBox *channel_selector_box = manage(new HBox());
channel_selector_box->pack_start(*_channel_selector, SHRINK, 0);
channel_selector_box->pack_start(_channel_selector, SHRINK, 0);
_midi_expander.add(*channel_selector_box);
_midi_expander.property_expanded().signal_changed().connect(
mem_fun(this, &MidiTimeAxisView::channel_selector_toggled));
controls_vbox.pack_end(_midi_expander, SHRINK, 0);
_channel_selector->selection_changed.connect(
_channel_selector.selection_changed.connect(
mem_fun(*midi_track()->midi_diskstream(), &MidiDiskstream::set_channel_mask));
}
@ -389,7 +388,6 @@ void
MidiTimeAxisView::channel_selector_toggled()
{
static TimeAxisView::TrackHeight previous_height;
assert(_channel_selector);
if(_midi_expander.property_expanded()) {
previous_height = height_style;
@ -401,3 +399,5 @@ MidiTimeAxisView::channel_selector_toggled()
}
}

View file

@ -74,6 +74,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
void update_range();
sigc::signal<void, uint16_t>& signal_channel_selection_changed() { return _channel_selector.selection_changed; }
private:
void append_extra_display_menu_items ();
@ -97,7 +99,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
Gtk::RadioMenuItem* _note_mode_item;
Gtk::RadioMenuItem* _percussion_mode_item;
Gtk::Expander _midi_expander;
MidiMultipleChannelSelector* _channel_selector;
MidiMultipleChannelSelector _channel_selector;
};
#endif /* __ardour_midi_time_axis_h__ */