Grey-out patch changes on inactive channels rather than not

plotting them at all (part of #4207).


git-svn-id: svn://localhost/ardour2/branches/3.0@12600 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-06-08 12:17:33 +00:00
parent f13119d2e1
commit ef213e49a7
6 changed files with 31 additions and 19 deletions

View File

@ -73,6 +73,8 @@
<Option name="midi note velocity text" value="f4f214bc"/>
<Option name="midi patch change fill" value="0000ffa0"/>
<Option name="midi patch change outline" value="a7a7d4ff"/>
<Option name="midi patch change inactive channel fill" value="00000000"/>
<Option name="midi patch change inactive channel outline" value="222222ff"/>
<Option name="midi sysex fill" value="f1e139a0"/>
<Option name="midi sysex outline" value="a7a7d4ff"/>
<Option name="midi select rect fill" value="8888ff88"/>

View File

@ -46,13 +46,18 @@ CanvasPatchChange::CanvasPatchChange(
double y,
string& model_name,
string& custom_device_mode,
ARDOUR::MidiModel::PatchChangePtr patch)
ARDOUR::MidiModel::PatchChangePtr patch,
bool active_channel)
: CanvasFlag(
region,
parent,
height,
ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get(),
ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get(),
active_channel ?
ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get() :
ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelOutline.get(),
active_channel ?
ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get() :
ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelFill.get(),
x,
y)
, _model_name(model_name)

View File

@ -45,7 +45,8 @@ public:
double y,
string& model_name,
string& custom_device_mode,
ARDOUR::MidiModel::PatchChangePtr patch
ARDOUR::MidiModel::PatchChangePtr patch,
bool
);
virtual ~CanvasPatchChange();

View File

@ -67,6 +67,8 @@ CANVAS_VARIABLE(canvasvar_MidiNoteSelected, "midi note selected")
CANVAS_VARIABLE(canvasvar_MidiNoteVelocityText, "midi note velocity text")
CANVAS_VARIABLE(canvasvar_MidiPatchChangeFill, "midi patch change fill")
CANVAS_VARIABLE(canvasvar_MidiPatchChangeOutline, "midi patch change outline")
CANVAS_VARIABLE(canvasvar_MidiPatchChangeInactiveChannelFill, "midi patch change inactive channel fill")
CANVAS_VARIABLE(canvasvar_MidiPatchChangeInactiveChannelOutline, "midi patch change inactive channel outline")
CANVAS_VARIABLE(canvasvar_MidiSysExFill, "midi sysex fill")
CANVAS_VARIABLE(canvasvar_MidiSysExOutline, "midi sysex outline")
CANVAS_VARIABLE(canvasvar_MidiSelectRectFill, "midi select rect fill")

View File

@ -1184,15 +1184,15 @@ MidiRegionView::display_patch_changes ()
uint16_t chn_mask = mtv->channel_selector().get_selected_channels();
for (uint8_t i = 0; i < 16; ++i) {
if (chn_mask & (1<<i)) {
display_patch_changes_on_channel (i);
}
/* TODO gray-out patch instad of not displaying it */
display_patch_changes_on_channel (i, chn_mask & (1 << i));
}
}
/** @param active_channel true to display patch changes fully, false to display
* them `greyed-out' (as on an inactive channel)
*/
void
MidiRegionView::display_patch_changes_on_channel (uint8_t channel)
MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_channel)
{
for (MidiModel::PatchChanges::const_iterator i = _model->patch_changes().begin(); i != _model->patch_changes().end(); ++i) {
@ -1207,12 +1207,12 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel)
_model_name, _custom_device_mode, channel, patch_key);
if (patch != 0) {
add_canvas_patch_change (*i, patch->name());
add_canvas_patch_change (*i, patch->name(), active_channel);
} else {
char buf[16];
/* program and bank numbers are zero-based: convert to one-based: MIDI_BP_ZERO */
snprintf (buf, 16, "%d %d", (*i)->program() + MIDI_BP_ZERO , (*i)->bank() + MIDI_BP_ZERO);
add_canvas_patch_change (*i, buf);
add_canvas_patch_change (*i, buf, active_channel);
}
}
}
@ -1756,8 +1756,13 @@ MidiRegionView::step_sustain (Evoral::MusicalTime beats)
change_note_lengths (false, false, beats, false, true);
}
/** Add a new patch change flag to the canvas.
* @param patch the patch change to add
* @param the text to display in the flag
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
*/
void
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext)
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool active_channel)
{
assert (patch->time() >= 0);
@ -1773,7 +1778,8 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
x, 1.0,
_model_name,
_custom_device_mode,
patch)
patch,
active_channel)
);
// Show unless patch change is beyond the region bounds

View File

@ -118,11 +118,7 @@ public:
void cut_copy_clear (Editing::CutCopyOp);
void paste (framepos_t pos, float times, const MidiCutBuffer&);
/** Add a new patch change flag to the canvas.
* @param patch the patch change to add
* @param the text to display in the flag
*/
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext);
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool);
/** Look up the given time and channel in the 'automation' and set keys accordingly.
* @param time the time of the patch change event
@ -466,7 +462,7 @@ private:
void maybe_select_by_position (GdkEventButton* ev, double x, double y);
void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0);
void display_patch_changes_on_channel (uint8_t);
void display_patch_changes_on_channel (uint8_t, bool);
void connect_to_diskstream ();
void data_recorded (boost::weak_ptr<ARDOUR::MidiSource>);