Option to fit a route group to the editor window.
git-svn-id: svn://localhost/ardour2/branches/3.0@5241 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
442eef90ab
commit
c9e37fcc14
@ -1872,6 +1872,7 @@ public:
|
||||
void new_route_group_from_rec_enabled ();
|
||||
void new_route_group_from_soloed ();
|
||||
void edit_route_group (ARDOUR::RouteGroup *);
|
||||
void fit_route_group (ARDOUR::RouteGroup *);
|
||||
void route_group_list_button_clicked ();
|
||||
gint route_group_list_button_press_event (GdkEventButton* ev);
|
||||
void add_route_group (ARDOUR::RouteGroup* group);
|
||||
@ -2221,7 +2222,8 @@ public:
|
||||
BundleManager* _bundle_manager;
|
||||
GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
|
||||
|
||||
void fit_tracks ();
|
||||
void fit_tracks (TrackSelection &);
|
||||
void fit_selected_tracks ();
|
||||
void set_track_height (uint32_t h);
|
||||
|
||||
void remove_tracks ();
|
||||
|
@ -612,7 +612,7 @@ Editor::register_actions ()
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
ActionManager::track_selection_sensitive_actions.push_back (act);
|
||||
|
||||
act = ActionManager::register_action (editor_actions, "fit-tracks", _("Fit Selected Tracks"), (mem_fun(*this, &Editor::fit_tracks)));
|
||||
act = ActionManager::register_action (editor_actions, "fit-tracks", _("Fit Selected Tracks"), mem_fun(*this, &Editor::fit_selected_tracks));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), bind (
|
||||
mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLargest));
|
||||
|
@ -64,7 +64,8 @@ Editor::build_route_group_list_menu (RouteGroup* g)
|
||||
items.push_back (MenuElem (_("New Group..."), mem_fun(*this, &Editor::new_route_group)));
|
||||
items.push_back (MenuElem (_("New Group From"), *new_from));
|
||||
if (g) {
|
||||
items.push_back (MenuElem (_("Edit Group..."), bind (mem_fun(*this, &Editor::edit_route_group), g)));
|
||||
items.push_back (MenuElem (_("Edit Group..."), bind (mem_fun (*this, &Editor::edit_route_group), g)));
|
||||
items.push_back (MenuElem (_("Fit Group to Window"), bind (mem_fun (*this, &Editor::fit_route_group), g)));
|
||||
}
|
||||
items.push_back (SeparatorElem());
|
||||
items.push_back (MenuElem (_("Activate All"), mem_fun(*this, &Editor::activate_all_route_groups)));
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "ardour/dB.h"
|
||||
#include "ardour/quantize.h"
|
||||
#include "ardour/strip_silence.h"
|
||||
#include "ardour/route_group.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "editor.h"
|
||||
@ -6328,15 +6329,28 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
|
||||
}
|
||||
|
||||
void
|
||||
Editor::fit_tracks ()
|
||||
Editor::fit_selected_tracks ()
|
||||
{
|
||||
if (selection->tracks.empty()) {
|
||||
fit_tracks (selection->tracks);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::fit_route_group (RouteGroup *g)
|
||||
{
|
||||
TrackSelection ts = axis_views_from_routes (g->route_list ());
|
||||
fit_tracks (ts);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::fit_tracks (TrackSelection & tracks)
|
||||
{
|
||||
if (tracks.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t child_heights = 0;
|
||||
|
||||
for (TrackSelection::iterator t = selection->tracks.begin(); t != selection->tracks.end(); ++t) {
|
||||
for (TrackSelection::iterator t = tracks.begin(); t != tracks.end(); ++t) {
|
||||
|
||||
if (!(*t)->marked_for_display()) {
|
||||
continue;
|
||||
@ -6345,11 +6359,11 @@ Editor::fit_tracks ()
|
||||
child_heights += (*t)->effective_height() - (*t)->current_height();
|
||||
}
|
||||
|
||||
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize)/selection->tracks.size());
|
||||
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / tracks.size());
|
||||
double first_y_pos = DBL_MAX;
|
||||
|
||||
if (h < TimeAxisView::hSmall) {
|
||||
MessageDialog msg (*this, _("There are too many selected tracks to fit in the current window"));
|
||||
MessageDialog msg (*this, _("There are too many tracks to fit in the current window"));
|
||||
/* too small to be displayed */
|
||||
return;
|
||||
}
|
||||
@ -6359,7 +6373,7 @@ Editor::fit_tracks ()
|
||||
/* operate on all tracks, hide unselected ones that are in the middle of selected ones */
|
||||
|
||||
bool prev_was_selected = false;
|
||||
bool is_selected = selection->selected (track_views.front());
|
||||
bool is_selected = tracks.contains (track_views.front());
|
||||
bool next_is_selected;
|
||||
|
||||
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
|
||||
@ -6370,7 +6384,7 @@ Editor::fit_tracks ()
|
||||
++next;
|
||||
|
||||
if (next != track_views.end()) {
|
||||
next_is_selected = selection->selected (*next);
|
||||
next_is_selected = tracks.contains (*next);
|
||||
} else {
|
||||
next_is_selected = false;
|
||||
}
|
||||
|
@ -232,3 +232,4 @@ GroupTabs::click_to_tab (double c, Tab** prev, Tab** next)
|
||||
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ TrackSelection::add (list<TimeAxisView*> const & t)
|
||||
list<TimeAxisView*> added;
|
||||
|
||||
for (TrackSelection::const_iterator i = t.begin(); i != t.end(); ++i) {
|
||||
if (find (begin(), end(), *i) == end()) {
|
||||
if (!contains (*i)) {
|
||||
added.push_back (*i);
|
||||
push_back (*i);
|
||||
}
|
||||
@ -17,3 +17,9 @@ TrackSelection::add (list<TimeAxisView*> const & t)
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
bool
|
||||
TrackSelection::contains (TimeAxisView const * t) const
|
||||
{
|
||||
return find (begin(), end(), t) != end();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class TrackSelection : public std::list<TimeAxisView*>
|
||||
{
|
||||
public:
|
||||
std::list<TimeAxisView*> add (std::list<TimeAxisView*> const &);
|
||||
bool contains (TimeAxisView const *) const;
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_track_selection_h__ */
|
||||
|
Loading…
Reference in New Issue
Block a user