} else if (ev->button == 3) {
RouteGroup* g = t ? t->group : 0;
- Menu* m = get_menu (g);
- if (m) {
- m->popup (ev->button, ev->time);
+
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier) && g) {
+ /* edit */
+ RouteGroupDialog d (g, false);
+ d.do_run ();
+ } else {
+ Menu* m = get_menu (g);
+ if (m) {
+ m->popup (ev->button, ev->time);
+ }
}
-
}
return true;
if (_dragging == 0) {
return false;
}
-
+
if (!_drag_moved) {
-
+
if (_dragging->group) {
-
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
-
- /* edit */
- RouteGroupDialog d (_dragging->group, false);
- d.do_run ();
-
- } else {
-
- /* toggle active state */
- _dragging->group->set_active (!_dragging->group->is_active (), this);
-
- }
+ /* toggle active state */
+ _dragging->group->set_active (!_dragging->group->is_active (), this);
}
-
+
} else {
/* finish drag */
RouteList routes = routes_for_tab (_dragging);
-
+
if (!routes.empty()) {
if (_dragging_new_tab) {
RouteGroup* g = create_and_add_group ();
} else {
boost::shared_ptr<RouteList> r = _session->get_routes ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
-
+
bool const was_in_tab = find (
_initial_dragging_routes.begin(), _initial_dragging_routes.end(), *i
) != _initial_dragging_routes.end ();
-
+
bool const now_in_tab = find (routes.begin(), routes.end(), *i) != routes.end();
-
+
if (was_in_tab && !now_in_tab) {
_dragging->group->remove (*i);
} else if (!was_in_tab && now_in_tab) {
}
}
}
-
+
set_dirty ();
queue_draw ();
}
-
+
_dragging = 0;
_initial_dragging_routes.clear ();
/* background */
cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0, 0, _width, _height);
+ cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
/* tabs */
}
struct CollectSorter {
- CollectSorter (std::string const & key) : _key (key) {}
+ CollectSorter (string const & key) : _key (key) {}
bool operator () (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
return a->order_key (_key) < b->order_key (_key);
}
- std::string _key;
+ string _key;
+};
+
+struct OrderSorter {
+ OrderSorter (string const & key) : _key (key) {}
+
+ bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+ /* use of ">" forces the correct sort order */
+ return a->order_key (_key) < b->order_key (_key);
+ }
+
+ string _key;
};
/** Collect all members of a RouteGroup so that they are together in the Editor or Mixer.
RouteList::iterator i = group_routes->begin ();
boost::shared_ptr<RouteList> routes = _session->get_routes ();
+ routes->sort (OrderSorter (order_key ()));
RouteList::const_iterator j = routes->begin ();
int diff = 0;
}
void
-GroupTabs::route_added_to_route_group (RouteGroup* rg, boost::weak_ptr<Route> w)
+GroupTabs::route_added_to_route_group (RouteGroup*, boost::weak_ptr<Route> w)
{
/* Similarly-spirited hack as in route_group_property_changed */
-
+
boost::shared_ptr<Route> r = w.lock ();
if (!r) {
return;
}
r->gui_changed (X_("color"), 0);
+
+ set_dirty ();
}
void
-GroupTabs::route_removed_from_route_group (RouteGroup* rg, boost::weak_ptr<Route> w)
+GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr<Route> w)
{
/* Similarly-spirited hack as in route_group_property_changed */
}
r->gui_changed (X_("color"), 0);
+
+ set_dirty ();
}
void