diff options
author | David Robillard <d@drobilla.net> | 2014-12-12 20:22:16 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-12-18 20:23:23 -0500 |
commit | 026f7bf5b7bd4b28209a2fa9d421a5a73ec29dc4 (patch) | |
tree | 0b52b020baa3b405f65286268e4645bfc34284e9 /gtk2_ardour/midi_region_view.cc | |
parent | 7ab8a11fb53782dfcf67b652dc65d8d177b0a1b6 (diff) |
Make MIDI regions translucent for internal tools.
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 197e190761..18ea905ce4 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -317,6 +317,10 @@ MidiRegionView::init (bool wfd) boost::bind (&MidiRegionView::snap_changed, this), gui_context()); + trackview.editor().MouseModeChanged.connect(_mouse_mode_connection, invalidator (*this), + boost::bind (&MidiRegionView::mouse_mode_changed, this), + gui_context ()); + Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context()); connect_to_diskstream (); @@ -413,10 +417,6 @@ MidiRegionView::canvas_group_event(GdkEvent* ev) bool MidiRegionView::enter_notify (GdkEventCrossing* ev) { - trackview.editor().MouseModeChanged.connect ( - _mouse_mode_connection, invalidator (*this), boost::bind (&MidiRegionView::mouse_mode_changed, this), gui_context () - ); - enter_internal(); _entered = true; @@ -437,12 +437,17 @@ MidiRegionView::leave_notify (GdkEventCrossing*) void MidiRegionView::mouse_mode_changed () { - if (trackview.editor().internal_editing()) { - // Switched in to internal editing mode while entered - enter_internal(); - } else { - // Switched out of internal editing mode while entered - leave_internal(); + // Adjust frame colour (become more transparent for internal tools) + set_frame_color(); + + if (_entered) { + if (trackview.editor().internal_editing()) { + // Switched in to internal editing mode while entered + enter_internal(); + } else { + // Switched out of internal editing mode while entered + leave_internal(); + } } } @@ -3236,6 +3241,19 @@ MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, boo } } +uint32_t +MidiRegionView::fill_opacity() const +{ + uint32_t a = RegionView::fill_opacity(); + if (trackview.editor().current_mouse_mode() == MouseDraw || + trackview.editor().current_mouse_mode() == MouseContent) { + /* Make rect more transparent when in an internal mode. This should + probably be configurable somehow. */ + a /= 2; + } + return a; +} + void MidiRegionView::set_frame_color() { @@ -3255,9 +3273,7 @@ MidiRegionView::set_frame_color() f = fill_color; } - if (!rect_visible) { - f = UINT_RGBA_CHANGE_A (f, 80); - } + f = UINT_RGBA_CHANGE_A (f, fill_opacity()); frame->set_fill_color (f); } |