summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.h4
-rw-r--r--gtk2_ardour/editor_actions.cc2
-rw-r--r--gtk2_ardour/editor_edit_groups.cc3
-rw-r--r--gtk2_ardour/editor_ops.cc28
-rw-r--r--gtk2_ardour/group_tabs.cc1
-rwxr-xr-xgtk2_ardour/track_selection.cc8
-rw-r--r--gtk2_ardour/track_selection.h1
7 files changed, 36 insertions, 11 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 489f8a9e6f..20e9927823 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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 ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index fff32c486b..1799938dab 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -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));
diff --git a/gtk2_ardour/editor_edit_groups.cc b/gtk2_ardour/editor_edit_groups.cc
index 6fea319c0d..272a400f6d 100644
--- a/gtk2_ardour/editor_edit_groups.cc
+++ b/gtk2_ardour/editor_edit_groups.cc
@@ -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)));
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 0530664acd..d60e4aa199 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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;
}
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index 8f82e856a9..57d2ebbd99 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -232,3 +232,4 @@ GroupTabs::click_to_tab (double c, Tab** prev, Tab** next)
return &(*i);
}
+
diff --git a/gtk2_ardour/track_selection.cc b/gtk2_ardour/track_selection.cc
index 3e428b1a94..5e29224491 100755
--- a/gtk2_ardour/track_selection.cc
+++ b/gtk2_ardour/track_selection.cc
@@ -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();
+}
diff --git a/gtk2_ardour/track_selection.h b/gtk2_ardour/track_selection.h
index 2ca7febcf6..8d46a59828 100644
--- a/gtk2_ardour/track_selection.h
+++ b/gtk2_ardour/track_selection.h
@@ -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__ */