Do not shade transparent regions in Layered mode

There already is a shaded coverage frame indicating
if a layer is audible. This leads to a more consistent view.

In addition changing layered mode now has to update the
colors (set_frame_color).
This commit is contained in:
Robin Gareus 2022-12-09 05:29:33 +01:00
parent 6c524b3f3b
commit 0bb81a9a18
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
9 changed files with 39 additions and 21 deletions

View File

@ -372,6 +372,22 @@ AudioRegionView::fade_out_active_changed ()
}
}
uint32_t
AudioRegionView::get_fill_color () const
{
Gtkmm2ext::Color f = TimeAxisViewItem::get_fill_color();
char const *modname;
const bool opaque = _region->opaque() || trackview.layer_display () == Stacked;
if (opaque && ( !_dragging && !_region->muted () )) {
modname = "opaque region base";
} else {
modname = "transparent region base";
}
return Gtkmm2ext::HSV(f).mod (UIConfiguration::instance().modifier (modname)).color ();
}
void
AudioRegionView::region_scale_amplitude_changed ()
@ -1597,7 +1613,7 @@ AudioRegionView::set_some_waveform_colors (vector<ArdourWaveView::WaveView*>& wa
} else if (_region->muted()) {
outline = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("waveform outline"), 80);
fill = UINT_INTERPOLATE(fill_color, UIConfiguration::instance().color ("covered region"), 0.7);
} else if (!_region->opaque()) {
} else if (!_region->opaque() && trackview.layer_display () != Stacked) {
outline = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("waveform outline"), 70);
fill = UINT_RGBA_CHANGE_A(UIConfiguration::instance().color ("waveform fill"), 70);
}

View File

@ -116,6 +116,9 @@ public:
void show_region_editor ();
void set_frame_color ();
uint32_t get_fill_color () const;
virtual void entered ();
virtual void exited ();
@ -201,7 +204,6 @@ protected:
void set_colors ();
void set_waveform_colors ();
void reset_width_dependent_items (double pixel_width);
void set_frame_color ();
void color_handler ();

View File

@ -158,6 +158,16 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
return region_view;
}
void
AudioStreamView::set_layer_display (LayerDisplay d)
{
StreamView::set_layer_display (d);
for (auto& rv : region_views) {
rv->set_frame_color ();
}
}
void
AudioStreamView::redisplay_track ()
{

View File

@ -69,6 +69,8 @@ public:
void reload_waves ();
void set_layer_display (LayerDisplay);
ArdourCanvas::Container* region_canvas () const { return _region_group; }
private:

View File

@ -3687,9 +3687,11 @@ MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, boo
uint32_t
MidiRegionView::get_fill_color() const
{
const bool opaque = _region->opaque() || trackview.layer_display () == Stacked;
const std::string mod_name = _dragging ? "dragging region" :
trackview.editor().internal_editing() ? "editable region" :
(_region->opaque() && !_region->muted ()) ? "opaque region base" : "transparent region base";
(opaque && !_region->muted ()) ? "opaque region base" : "transparent region base";
if (_selected) {

View File

@ -262,6 +262,9 @@ MidiStreamView::set_layer_display (LayerDisplay d)
// }
StreamView::set_layer_display (d);
for (auto& rv : region_views) {
rv->set_frame_color ();
}
}
void

View File

@ -743,21 +743,6 @@ RegionView::set_sync_mark_color ()
}
}
uint32_t
RegionView::get_fill_color () const
{
Gtkmm2ext::Color f = TimeAxisViewItem::get_fill_color();
char const *modname;
if (_region->opaque() && ( !_dragging && !_region->muted () )) {
modname = "opaque region base";
} else {
modname = "transparent region base";
}
return Gtkmm2ext::HSV(f).mod (UIConfiguration::instance().modifier (modname)).color ();
}
void
RegionView::show_region_editor ()
{

View File

@ -92,8 +92,6 @@ public:
virtual void region_changed (const PBD::PropertyChange&);
uint32_t get_fill_color () const;
virtual GhostRegion* add_ghost (TimeAxisView&) = 0;
void remove_ghost_in (TimeAxisView&);
void remove_ghost (GhostRegion*);

View File

@ -81,6 +81,7 @@ public:
void set_color (uint32_t);
void set_name_text_color ();
virtual void set_frame_color();
virtual uint32_t get_fill_color () const;
ArdourCanvas::Item* get_canvas_frame();
@ -152,7 +153,6 @@ protected:
virtual bool canvas_group_event (GdkEvent*);
virtual void set_colors();
virtual void set_frame_color();
virtual void set_frame_gradient ();
void set_trim_handle_colors();