#include "i18n.h"
#include "ardour_ui.h"
#include "rgb_macros.h"
+#include "ui_config.h"
#include "utils.h"
using namespace std;
, _dragging_new_tab (0)
{
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
- UIConfiguration::ColorsChanged.connect (sigc::mem_fun (*this, &GroupTabs::queue_draw));
+ UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &GroupTabs::queue_draw));
}
GroupTabs::~GroupTabs ()
_session->RouteRemovedFromRouteGroup.connect (
_session_connections, invalidator (*this), boost::bind (&GroupTabs::route_removed_from_route_group, this, _1, _2), gui_context()
);
-
+
_session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&GroupTabs::set_dirty, this), gui_context());
}
}
} else if (ev->button == 3) {
RouteGroup* g = t ? t->group : 0;
-
+
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier) && g) {
/* edit */
RouteGroupDialog d (g, false);
d.do_run ();
} else {
- Menu* m = get_menu (g);
+ Menu* m = get_menu (g, true);
if (m) {
m->popup (ev->button, ev->time);
}
if (_dragging == 0) {
return false;
}
-
+
if (!_drag_moved) {
-
+
if (_dragging->group) {
/* 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 ();
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
-
+
/* tabs */
for (list<Tab>::const_iterator i = _tabs.begin(); i != _tabs.end(); ++i) {
}
Gtk::Menu*
-GroupTabs::get_menu (RouteGroup* g)
+GroupTabs::get_menu (RouteGroup* g, bool TabArea)
{
using namespace Menu_Helpers;
_menu->set_name ("ArdourContextMenu");
MenuList& items = _menu->items();
- items.push_back (MenuElem (_("Create New Group ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group))));
+ if (!TabArea) {
+ items.push_back (MenuElem (_("Create New Group ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group))));
+ }
+
items.push_back (MenuElem (_("Create New Group From"), *new_from));
if (g) {
run_new_group_dialog (soloed);
}
-PBD::PropertyList
-GroupTabs::default_properties () const
-{
- PBD::PropertyList plist;
-
- plist.add (Properties::route_active, true);
- plist.add (Properties::active, true);
- plist.add (Properties::gain, true);
- plist.add (Properties::relative, true);
- plist.add (Properties::color, true);
- plist.add (Properties::monitoring, true);
- plist.add (Properties::select, true);
- plist.add (Properties::mute, true);
- plist.add (Properties::solo, true);
- plist.add (Properties::gain, true);
- plist.add (Properties::recenable, true);
-
- return plist;
-}
-
void
GroupTabs::run_new_group_dialog (RouteList const & rl)
{
RouteGroup* g = new RouteGroup (*_session, "");
- g->apply_changes (default_properties ());
-
RouteGroupDialog d (g, true);
if (d.do_run ()) {
GroupTabs::create_and_add_group () const
{
RouteGroup* g = new RouteGroup (*_session, "");
-
- g->apply_changes (default_properties ());
-
RouteGroupDialog d (g, true);
if (d.do_run ()) {
g = 25;
b = 25;
}
-
+
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
char buf[64];
-
+
/* for historical reasons the colors must be stored as 16 bit color
* values. Ugh.
*/
snprintf (buf, sizeof (buf), "%d:%d:%d", (r<<8), (g<<8), (b<<8));
gui_state.set_property (group_gui_id (group), "color", buf);
-
+
/* the group color change notification */
-
+
PBD::PropertyChange change;
change.add (Properties::color);
group->PropertyChanged (change);
GroupTabs::group_color (RouteGroup* group)
{
assert (group);
-
+
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
string const gui_id = group_gui_id (group);
bool empty;
*/
emit_gui_changed_for_members (rg);
-
+
set_dirty ();
}