X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fregion_view.cc;h=8f22d716c60b8b2d80c39be5e15ee2318dd48dd8;hb=4050ca5633dda03679f9aa9fab87d3bbf517395b;hp=6c00e89f5256ffebb0a916965f5fdca94f86c1ee;hpb=a0b032efe2c5196764f5d499fcf2133d944ef265;p=ardour.git diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 6c00e89f52..8f22d716c6 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -1,21 +1,27 @@ /* - Copyright (C) 2001-2006 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ + * Copyright (C) 2006-2014 David Robillard + * Copyright (C) 2007-2012 Carl Hetherington + * Copyright (C) 2007-2019 Paul Davis + * Copyright (C) 2007 Doug McLain + * Copyright (C) 2013-2019 Robin Gareus + * Copyright (C) 2015-2017 Nick Mainsbridge + * Copyright (C) 2015 Tim Mayberry + * Copyright (C) 2018 Ben Loftis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ #include #include @@ -71,7 +77,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent, bool automation) : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation, (automation ? TimeAxisViewItem::ShowFrame : - TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText| + TimeAxisViewItem::Visibility ((UIConfiguration::instance().get_show_region_name() ? TimeAxisViewItem::ShowNameText : 0) | TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame))) , _region (r) , sync_mark(0) @@ -203,7 +209,7 @@ RegionView::~RegionView () delete *i; } - drop_silent_samples (); + drop_silent_frames (); delete editor; } @@ -218,12 +224,12 @@ RegionView::canvas_group_event (GdkEvent* event) } void -RegionView::set_silent_samples (const AudioIntervalResult& silences, double /*threshold*/) +RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/) { samplecnt_t shortest = max_samplecnt; - /* remove old silent samples */ - drop_silent_samples (); + /* remove old silent frames */ + drop_silent_frames (); if (silences.empty()) { return; @@ -235,7 +241,7 @@ RegionView::set_silent_samples (const AudioIntervalResult& silences, double /*th ArdourCanvas::Rectangle* cr = new ArdourCanvas::Rectangle (group); cr->set_ignore_events (true); - _silent_samples.push_back (cr); + _silent_frames.push_back (cr); /* coordinates for the rect are relative to the regionview origin */ @@ -319,21 +325,21 @@ RegionView::set_silent_samples (const AudioIntervalResult& silences, double /*th } void -RegionView::hide_silent_samples () +RegionView::hide_silent_frames () { - for (list::iterator i = _silent_samples.begin (); i != _silent_samples.end (); ++i) { + for (list::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) { (*i)->hide (); } _silence_text->hide(); } void -RegionView::drop_silent_samples () +RegionView::drop_silent_frames () { - for (list::iterator i = _silent_samples.begin (); i != _silent_samples.end (); ++i) { + for (list::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) { delete *i; } - _silent_samples.clear (); + _silent_frames.clear (); delete _silence_text; _silence_text = 0; @@ -414,11 +420,11 @@ RegionView::region_resized (const PropertyChange& what_changed) unit_length = _region->length() / samples_per_pixel; - for (vector::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { + for (vector::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { - (*i)->set_duration (unit_length); + (*i)->set_duration (unit_length); - } + } } } @@ -742,7 +748,7 @@ RegionView::set_height (double h) (*i)->set_y1 (h + 1); } - for (list::iterator i = _silent_samples.begin(); i != _silent_samples.end(); ++i) { + for (list::iterator i = _silent_frames.begin(); i != _silent_frames.end(); ++i) { (*i)->set_y1 (h + 1); } @@ -865,7 +871,7 @@ RegionView::trim_front (samplepos_t new_bound, bool no_overlap, const int32_t su } /* Only trim region on the left if the first sample has gone beyond the left region's last sample. */ - if (region_left != 0 && (region_left->last_sample() > _region->first_sample() || regions_touching)) { + if (region_left != 0 && (region_left->last_sample() > _region->first_sample() || regions_touching)) { region_left->trim_end (_region->first_sample() - 1); } } @@ -959,3 +965,17 @@ RegionView::snap_sample_to_sample (sampleoffset_t x, bool ensure_snap) const /* back to region relative, keeping the relevant divisor */ return MusicSample (sample.sample - _region->position(), sample.division); } + +void +RegionView::update_visibility () +{ + /* currently only the name visibility can be changed dynamically */ + + if (UIConfiguration::instance().get_show_region_name()) { + visibility = Visibility (visibility | ShowNameText); + } else { + visibility = Visibility (visibility & ~ShowNameText); + } + + manage_name_text (); +}