mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Fix confusion with midi note selection and channel
selection (#4208). git-svn-id: svn://localhost/ardour2/branches/3.0@10823 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e5dd712ac4
commit
0f2efef73e
2 changed files with 22 additions and 12 deletions
|
|
@ -55,6 +55,7 @@ CanvasNoteEvent::CanvasNoteEvent(MidiRegionView& region, Item* item, const boost
|
||||||
, _valid (true)
|
, _valid (true)
|
||||||
, _mouse_x_fraction (-1.0)
|
, _mouse_x_fraction (-1.0)
|
||||||
, _mouse_y_fraction (-1.0)
|
, _mouse_y_fraction (-1.0)
|
||||||
|
, _channel_selection (0xffff)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,14 +114,11 @@ CanvasNoteEvent::hide_velocity()
|
||||||
void
|
void
|
||||||
CanvasNoteEvent::on_channel_selection_change(uint16_t selection)
|
CanvasNoteEvent::on_channel_selection_change(uint16_t selection)
|
||||||
{
|
{
|
||||||
// make note change its color if its channel is not marked active
|
_channel_selection = selection;
|
||||||
if ( (selection & (1 << _note->channel())) == 0 ) {
|
|
||||||
set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get());
|
/* this takes into account whether or not the note should be drawn as inactive */
|
||||||
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
|
set_selected (_selected);
|
||||||
} else {
|
|
||||||
// set the color according to the notes selection state
|
|
||||||
set_selected(_selected);
|
|
||||||
}
|
|
||||||
// this forces the item to update..... maybe slow...
|
// this forces the item to update..... maybe slow...
|
||||||
_item->hide();
|
_item->hide();
|
||||||
_item->show();
|
_item->show();
|
||||||
|
|
@ -187,20 +185,31 @@ CanvasNoteEvent::set_selected(bool selected)
|
||||||
}
|
}
|
||||||
|
|
||||||
_selected = selected;
|
_selected = selected;
|
||||||
set_fill_color (base_color ());
|
|
||||||
|
|
||||||
if (_selected) {
|
bool const active = (_channel_selection & (1 << _note->channel())) != 0;
|
||||||
|
|
||||||
|
if (_selected && active) {
|
||||||
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
|
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
|
||||||
|
|
||||||
if(_region.channel_selector_scoped_note() != 0){
|
if(_region.channel_selector_scoped_note() != 0){
|
||||||
_region.channel_selector_scoped_note()->hide_channel_selector();
|
_region.channel_selector_scoped_note()->hide_channel_selector();
|
||||||
_region.set_channel_selector_scoped_note(0);
|
_region.set_channel_selector_scoped_note(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_fill_color (base_color ());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
set_fill_color(base_color());
|
||||||
set_outline_color(calculate_outline(base_color()));
|
set_outline_color(calculate_outline(base_color()));
|
||||||
hide_channel_selector();
|
} else {
|
||||||
|
set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get());
|
||||||
|
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hide_channel_selector();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257)
|
#define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257)
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ class CanvasNoteEvent : virtual public sigc::trackable
|
||||||
bool _valid;
|
bool _valid;
|
||||||
float _mouse_x_fraction;
|
float _mouse_x_fraction;
|
||||||
float _mouse_y_fraction;
|
float _mouse_y_fraction;
|
||||||
|
uint16_t _channel_selection;
|
||||||
|
|
||||||
void set_mouse_fractions (GdkEvent*);
|
void set_mouse_fractions (GdkEvent*);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue