rationalize and coordinate handle of region (time axis view item) opacity.
There are still some bugs with this because of the waveview image cache - fixes coming soon.
This commit is contained in:
parent
a50569e787
commit
50fea864db
|
@ -743,7 +743,6 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
|
|||
|
||||
if (first_move) {
|
||||
rv->drag_start ();
|
||||
rv->set_opacity_for_drag (true);
|
||||
|
||||
/* reparent the regionview into a group above all
|
||||
* others
|
||||
|
@ -938,10 +937,6 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
|
|||
void
|
||||
RegionMotionDrag::finished (GdkEvent *, bool)
|
||||
{
|
||||
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
i->view->set_opacity_for_drag (false);
|
||||
}
|
||||
|
||||
for (vector<TimeAxisView*>::iterator i = _time_axis_views.begin(); i != _time_axis_views.end(); ++i) {
|
||||
if (!(*i)->view()) {
|
||||
continue;
|
||||
|
@ -1200,7 +1195,7 @@ RegionMoveDrag::finished_no_copy (
|
|||
visible.
|
||||
*/
|
||||
rv->hide_region_editor();
|
||||
rv->set_opacity_for_drag (false);
|
||||
|
||||
|
||||
remove_region_from_playlist (rv->region(), i->initial_playlist, modified_playlists);
|
||||
|
||||
|
@ -1435,7 +1430,6 @@ RegionMotionDrag::aborted (bool)
|
|||
rv->get_canvas_group()->reparent (rtv->view()->canvas_item());
|
||||
rv->get_canvas_group()->set_y_position (0);
|
||||
rv->drag_end ();
|
||||
rv->set_opacity_for_drag (false);
|
||||
rv->move (-_total_x_delta, 0);
|
||||
rv->set_height (rtv->view()->child_height ());
|
||||
}
|
||||
|
@ -1837,7 +1831,6 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
|
|||
DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt));
|
||||
if (first_move) {
|
||||
rv->drag_start ();
|
||||
rv->set_opacity_for_drag (true);
|
||||
rv->region()->clear_changes ();
|
||||
rv->region()->suspend_property_changes();
|
||||
}
|
||||
|
@ -1885,7 +1878,6 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
|
|||
|
||||
for (list<AVDraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
i->view->drag_end();
|
||||
i->view->set_opacity_for_drag (false);
|
||||
i->view->region()->resume_property_changes ();
|
||||
|
||||
_editor->session()->add_command (new StatefulDiffCommand (i->view->region()));
|
||||
|
@ -2021,7 +2013,6 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
|||
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
RegionView* rv = i->view;
|
||||
rv->set_opacity_for_drag (false);
|
||||
rv->enable_display (false);
|
||||
rv->region()->playlist()->clear_owned_changes ();
|
||||
|
||||
|
@ -2204,7 +2195,6 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
i->view->thaw_after_trim ();
|
||||
i->view->enable_display (true);
|
||||
i->view->set_opacity_for_drag (true);
|
||||
|
||||
/* Trimming one region may affect others on the playlist, so we need
|
||||
to get undo Commands from the whole playlist rather than just the
|
||||
|
|
|
@ -519,6 +519,18 @@ RegionView::set_duration (framecnt_t frames, void *src)
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RegionView::fill_opacity () const
|
||||
{
|
||||
if (!_region->opaque()) {
|
||||
return 60;
|
||||
}
|
||||
|
||||
uint32_t normal_tavi_opacity = TimeAxisViewItem::fill_opacity ();
|
||||
|
||||
return normal_tavi_opacity;
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::set_colors ()
|
||||
{
|
||||
|
@ -534,14 +546,6 @@ RegionView::set_colors ()
|
|||
void
|
||||
RegionView::set_frame_color ()
|
||||
{
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_region->opaque()) {
|
||||
fill_opacity = 60;
|
||||
}
|
||||
|
||||
TimeAxisViewItem::set_frame_color ();
|
||||
}
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ class RegionView : public TimeAxisViewItem
|
|||
virtual void set_frame_color ();
|
||||
virtual void reset_width_dependent_items (double pixel_width);
|
||||
|
||||
uint32_t fill_opacity () const;
|
||||
|
||||
virtual void color_handler () {}
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region> _region;
|
||||
|
|
|
@ -167,7 +167,6 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_c
|
|||
group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
|
||||
|
||||
fill_color = base_color;
|
||||
pre_drag_fill_color = base_color;
|
||||
samples_per_pixel = fpp;
|
||||
frame_position = start;
|
||||
item_duration = duration;
|
||||
|
@ -280,7 +279,6 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_c
|
|||
}
|
||||
|
||||
set_color (base_color);
|
||||
set_opacity_for_drag (false);
|
||||
|
||||
set_duration (item_duration, this);
|
||||
set_position (start, this);
|
||||
|
@ -666,11 +664,7 @@ TimeAxisViewItem::get_name_highlight()
|
|||
void
|
||||
TimeAxisViewItem::set_colors()
|
||||
{
|
||||
/* we cannot be dragging this item when changing colors,
|
||||
so reuse set_opacity_for_drag()
|
||||
*/
|
||||
set_opacity_for_drag (false);
|
||||
set_frame_color();
|
||||
set_frame_color ();
|
||||
|
||||
if (name_highlight) {
|
||||
name_highlight->set_fill_color (fill_color);
|
||||
|
@ -705,19 +699,39 @@ TimeAxisViewItem::set_name_text_color ()
|
|||
name_text->set_color (contrasting_text_color (f));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
TimeAxisViewItem::fill_opacity () const
|
||||
{
|
||||
if (!rect_visible) {
|
||||
/* if the frame/rect is marked as invisible, then the
|
||||
* fill should be transparent. simplest: set
|
||||
|
||||
* alpha/opacity to zero.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_dragging) {
|
||||
return 130;
|
||||
}
|
||||
|
||||
uint32_t col = ARDOUR_UI::config()->get_canvasvar_FrameBase();
|
||||
return UINT_RGBA_A (col);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
TimeAxisViewItem::get_fill_color () const
|
||||
{
|
||||
uint32_t f;
|
||||
uint32_t o;
|
||||
|
||||
o = fill_opacity ();
|
||||
|
||||
if (_selected) {
|
||||
|
||||
f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
|
||||
|
||||
if (fill_opacity != 0) {
|
||||
o = fill_opacity;
|
||||
} else {
|
||||
if (o == 0) {
|
||||
/* some condition of this item has set fill opacity to
|
||||
* zero, but it has been selected, so use a mid-way
|
||||
* alpha value to make it reasonably visible.
|
||||
|
@ -732,23 +746,10 @@ TimeAxisViewItem::get_fill_color () const
|
|||
} else {
|
||||
if ((!Config->get_show_name_highlight() || high_enough_for_name) && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
|
||||
f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
|
||||
/* use the opacity as set for the FrameBase color */
|
||||
o = UINT_RGBA_A (f);
|
||||
} else {
|
||||
f = fill_color;
|
||||
o = fill_opacity;
|
||||
}
|
||||
}
|
||||
|
||||
/* tweak opacity */
|
||||
|
||||
if (!rect_visible) {
|
||||
/* if the frame/rect is marked as invisible, then the
|
||||
* fill should be transparent. simplest: set
|
||||
* alpha/opacity to zero.
|
||||
*/
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return UINT_RGBA_CHANGE_A (f, o);
|
||||
|
@ -785,22 +786,6 @@ TimeAxisViewItem::set_frame_color()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::set_opacity_for_drag (bool drag_starting)
|
||||
{
|
||||
if (drag_starting) {
|
||||
fill_opacity = 130;
|
||||
} else {
|
||||
/* use the alpha/opacity value from the basic color, no matter whether
|
||||
we use the color of our time axis or not.
|
||||
*/
|
||||
|
||||
uint32_t col = ARDOUR_UI::config()->get_canvasvar_FrameBase();
|
||||
fill_opacity = UINT_RGBA_A (col);
|
||||
}
|
||||
set_frame_color ();
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::set_frame_gradient ()
|
||||
{
|
||||
|
@ -1017,3 +1002,17 @@ TimeAxisViewItem::parameter_changed (string p)
|
|||
set_frame_gradient ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::drag_start ()
|
||||
{
|
||||
_dragging = true;
|
||||
set_frame_color ();
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::drag_end ()
|
||||
{
|
||||
_dragging = false;
|
||||
set_frame_color ();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
|||
void set_y (double);
|
||||
void set_color (uint32_t);
|
||||
void set_name_text_color ();
|
||||
void set_opacity_for_drag (bool drag_starting);
|
||||
|
||||
uint32_t get_fill_color () const;
|
||||
|
||||
|
@ -86,8 +85,8 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
|||
|
||||
double get_samples_per_pixel () const;
|
||||
|
||||
virtual void drag_start() { _dragging = true; }
|
||||
virtual void drag_end() { _dragging = false; }
|
||||
virtual void drag_start();
|
||||
virtual void drag_end();
|
||||
bool dragging() const { return _dragging; }
|
||||
|
||||
virtual void raise () { return; }
|
||||
|
@ -230,9 +229,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
|||
/** true if a small vestigial rect should be shown when the item gets very narrow */
|
||||
bool show_vestigial;
|
||||
|
||||
uint32_t fill_opacity;
|
||||
uint32_t fill_color;
|
||||
uint32_t pre_drag_fill_color;
|
||||
|
||||
virtual uint32_t fill_opacity() const;
|
||||
|
||||
uint32_t last_item_width;
|
||||
int name_text_width;
|
||||
|
|
Loading…
Reference in New Issue