add option to show/hide region names

This commit is contained in:
Paul Davis 2019-05-29 15:16:00 -06:00
parent b1587940e4
commit 8463fb728f
10 changed files with 50 additions and 3 deletions

View File

@ -3677,6 +3677,14 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_color_regions_using_track_color)
));
add_option (_("Appearance/Editor"),
new BoolOption (
"show-region-names",
_("Show Region Names"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_region_name),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_region_name)
));
#ifndef MIXBUS // hide this setting in Mixbus. Always on, 4px
ComboOption<uint32_t>* gap = new ComboOption<uint32_t> (
"vertical-region-gap",

View File

@ -71,7 +71,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)
@ -959,3 +959,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 ();
}

View File

@ -128,6 +128,8 @@ public:
ARDOUR::MusicSample snap_sample_to_sample (ARDOUR::sampleoffset_t, bool ensure_snap = false) const;
void update_visibility ();
protected:
/** Allows derived types to specify their visibility requirements

View File

@ -724,3 +724,14 @@ StreamView::setup_new_rec_layer_time (boost::shared_ptr<Region> region)
_new_rec_layer_time = max_samplepos;
}
}
void
StreamView::parameter_handler (string const & what)
{
std::cerr << "SV ph for " << what << std::endl;
if (what == "show-region-name") {
for (RegionViewList::iterator i = region_views.begin (); i != region_views.end (); ++i) {
(*i)->update_visibility ();
}
}
}

View File

@ -125,6 +125,8 @@ public:
/** Emitted when the height of regions has changed */
sigc::signal<void> ContentsHeightChanged;
virtual void parameter_handler (std::string const &);
protected:
StreamView (RouteTimeAxisView&, ArdourCanvas::Container* canvas_group = 0);

View File

@ -1199,6 +1199,10 @@ TimeAxisView::parameter_changed (string const & p)
show_selection (_editor.get_selection().time);
}
}
if (view()) {
view()->parameter_handler (what);
}
}
/** @return Pair: TimeAxisView, layer index.

View File

@ -306,6 +306,8 @@ protected:
void color_handler ();
void parameter_changed (std::string const &);
virtual void parameter_handler (std::string const &);
void conditionally_add_to_selection ();
void build_size_menu ();

View File

@ -870,7 +870,7 @@ TimeAxisViewItem::manage_name_text ()
return;
}
if (!wide_enough_for_name || !high_enough_for_name) {
if (!(visibility & ShowNameText) || (!wide_enough_for_name || !high_enough_for_name)) {
name_text->hide ();
return;
}

View File

@ -152,6 +152,8 @@ public:
FullWidthNameHighlight = 0x80
};
virtual void update_visibility () {}
protected:
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color,
samplepos_t, samplecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
@ -237,10 +239,11 @@ protected:
bool _dragging;
double _width;
void manage_name_text ();
private:
void parameter_changed (std::string);
void manage_name_highlight ();
void manage_name_text ();
}; /* class TimeAxisViewItem */

View File

@ -118,3 +118,4 @@ UI_CONFIG_VARIABLE (bool, snap_to_grid, "snap-to-grid", true)
UI_CONFIG_VARIABLE (bool, show_grids_ruler, "show-grids-ruler", true)
UI_CONFIG_VARIABLE (bool, rulers_follow_grid, "rulers-follow-grid", false)
UI_CONFIG_VARIABLE (bool, grid_follows_internal, "grid-follows-internal", false) //this feature is deprecated, default it FALSE for now; remove it in v6
UI_CONFIG_VARIABLE (bool, show_region_name, "show-region-name", true)