using namespace ARDOUR;
using namespace PBD;
+using namespace Gtkmm2ext;
using namespace Gtk;
using namespace Editing;
using namespace sigc;
+using namespace std;
+Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
+
+void
+RouteTimeAxisView::setup_slider_pix ()
+{
+ if ((slider = ::get_icon ("fader_belt_h")) == 0) {
+ throw failed_constructor ();
+ }
+}
RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess),
size_button (_("h")), // height
automation_button (_("a")),
visual_button (_("v")),
- lm (rt, sess)
+ gm (rt, sess, slider, true)
+
{
- lm.set_no_show_all();
- lm.setup_meters(50);
+ gm.get_level_meter().set_no_show_all();
+ gm.get_level_meter().setup_meters(50);
+
_has_state = true;
playlist_menu = 0;
playlist_action_menu = 0;
automation_action_menu = 0;
_view = 0;
+
+ if (!_route->is_hidden()) {
+ _marked_for_display = true;
+ }
+
timestretch_rect = 0;
no_redraw = false;
destructive_track_mode_item = 0;
rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
- controls_table.attach (*rec_enable_button, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
}
- controls_hbox.pack_start(lm, false, false);
+ controls_hbox.pack_start(gm.get_level_meter(), false, false);
_route->meter_change.connect (mem_fun(*this, &RouteTimeAxisView::meter_changed));
_route->input_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
_route->output_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
- controls_table.attach (*mute_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- controls_table.attach (*solo_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ controls_table.attach (edit_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ controls_table.attach (gm.get_gain_slider(), 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
} else {
- controls_table.attach (automation_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+ controls_table.attach (automation_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
if (is_track() && track()->mode() == ARDOUR::Normal) {
- controls_table.attach (playlist_button, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+ controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
y_position = -1;
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
+
+ gm.get_gain_slider().signal_scroll_event().connect(mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false);
+ gm.get_gain_slider().set_name ("TrackGainFader");
}
RouteTimeAxisView::~RouteTimeAxisView ()
/* map current state of the route */
update_diskstream_display ();
+
subplugin_menu.items().clear ();
_route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
_route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
{
}
-void
-RouteTimeAxisView::set_state (const XMLNode& node)
-{
- const XMLProperty *prop;
-
- TimeAxisView::set_state (node);
-
- if ((prop = node.property ("shown_editor")) != 0) {
- if (prop->value() == "no") {
- _marked_for_display = false;
- } else {
- _marked_for_display = true;
- }
- } else {
- _marked_for_display = true;
- }
-
- XMLNodeList nlist = node.children();
- XMLNodeConstIterator niter;
- XMLNode *child_node;
-
- _show_automation.clear();
-
- for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- child_node = *niter;
-
- if (child_node->name() != AutomationTimeAxisView::state_node_name)
- continue;
-
- XMLProperty* prop = child_node->property ("automation-id");
- if (!prop)
- continue;
-
- Parameter param(prop->value());
- if (!param)
- continue;
-
- bool show = false;
-
- prop = child_node->property ("shown");
-
- if (prop && prop->value() == "yes") {
- show = true;
- _show_automation.insert(param);
- }
-
- if (_automation_tracks.find(param) == _automation_tracks.end())
- create_automation_child(param, show);
- }
-}
-
-XMLNode*
-RouteTimeAxisView::get_automation_child_xml_node (Parameter param)
-{
- return RouteUI::get_automation_child_xml_node (param);
-}
-
gint
RouteTimeAxisView::edit_click (GdkEventButton *ev)
{
playlist_action_menu->set_name ("ArdourContextMenu");
build_playlist_menu (playlist_action_menu);
- editor.set_selected_track (*this, Selection::Add);
+
+ conditionally_add_to_selection ();
playlist_action_menu->popup (1, gtk_get_current_event_time());
}
*/
build_display_menu ();
}
- editor.set_selected_track (*this, Selection::Add);
+ conditionally_add_to_selection ();
automation_action_menu->popup (1, gtk_get_current_event_time());
}
route_active_menu_item->set_active (_route->active());
items.push_back (SeparatorElem());
+ items.push_back (MenuElem (_("Hide"), mem_fun(*this, &RouteTimeAxisView::hide_click)));
items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
}
x1 = start / editor.get_current_zoom();
x2 = (end - 1) / editor.get_current_zoom();
- y2 = height - 2;
+ y2 = current_height() - 2;
timestretch_rect->property_x1() = x1;
timestretch_rect->property_y1() = 1.0;
}
void
-RouteTimeAxisView::set_height (TrackHeight h)
+RouteTimeAxisView::set_height (uint32_t h)
{
- int gmlen = (height_to_pixels (h)) - 5;
- bool height_changed = (height == 0) || (h != height_style);
- lm.setup_meters (gmlen);
+ int gmlen = h - 5;
+ bool height_changed = (height == 0) || (h != height);
+ gm.get_level_meter().setup_meters (gmlen);
+
TimeAxisView::set_height (h);
ensure_xml_node ();
if (_view) {
- _view->set_height ((double) height);
+ _view->set_height ((double) current_height());
}
- switch (height_style) {
- case Largest:
- xml_node->add_property ("track_height", "largest");
- break;
-
- case Large:
- xml_node->add_property ("track_height", "large");
- break;
-
- case Larger:
- xml_node->add_property ("track_height", "larger");
- break;
+ char buf[32];
+ snprintf (buf, sizeof (buf), "%u", height);
+ xml_node->add_property ("height", buf);
- case Normal:
- xml_node->add_property ("track_height", "normal");
- break;
-
- case Smaller:
- xml_node->add_property ("track_height", "smaller");
- break;
-
- case Small:
- xml_node->add_property ("track_height", "small");
- break;
- }
-
- switch (height_style) {
- case Largest:
- case Large:
- case Larger:
- case Normal:
+ if (height >= hNormal) {
reset_meter();
show_name_entry ();
hide_name_label ();
+ gm.get_gain_slider().show();
mute_button->show();
solo_button->show();
if (rec_enable_button)
if (is_track() && track()->mode() == ARDOUR::Normal) {
playlist_button.show();
}
- break;
- case Smaller:
+ } else if (height >= hSmaller) {
+
reset_meter();
show_name_entry ();
hide_name_label ();
+ gm.get_gain_slider().hide();
mute_button->show();
solo_button->show();
if (rec_enable_button)
if (is_track() && track()->mode() == ARDOUR::Normal) {
playlist_button.hide ();
}
- break;
- case Small:
+ } else {
+
hide_name_entry ();
show_name_label ();
-
+
+ gm.get_gain_slider().hide();
mute_button->hide();
solo_button->hide();
if (rec_enable_button)
automation_button.hide ();
playlist_button.hide ();
name_label.set_text (_route->name());
- break;
}
if (height_changed) {
nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
- if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
+ if ((_view && ((top < 0.0 && bot < 0.0))) || touched (top, bot)) {
_view->get_selectables (start_adjusted, end_adjusted, results);
}
RouteTimeAxisView::automation_track_hidden (Parameter param)
{
RouteAutomationNode* ran = automation_track(param);
- if (!ran)
+ if (!ran) {
return;
+ }
_show_automation.erase(param);
ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
ran->menu_item->set_active (false);
}
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
no_redraw = false;
-
/* Redraw */
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
}
no_redraw = false;
-
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
_show_automation.clear();
no_redraw = false;
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
RouteTimeAxisView::region_view_added (RegionView* rv)
{
- for (Children::iterator i = children.begin(); i != children.end(); ++i) {
- boost::shared_ptr<AutomationTimeAxisView> atv;
-
- if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) {
- rv->add_ghost (*atv.get());
+ /* XXX need to find out if automation children have automationstreamviews. If yes, no ghosts */
+ if(is_audio_track()) {
+ for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+ boost::shared_ptr<AutomationTimeAxisView> atv;
+
+ if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) {
+ atv->add_ghost(rv);
+ }
}
}
-}
-void
-RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, boost::shared_ptr<AutomationTimeAxisView> atv)
-{
- rv->add_ghost (*atv.get());
+ for (UnderlayMirrorList::iterator i = _underlay_mirrors.begin(); i != _underlay_mirrors.end(); ++i) {
+ (*i)->add_ghost(rv);
+ }
}
RouteTimeAxisView::ProcessorAutomationInfo::~ProcessorAutomationInfo ()
add_child (pan->view);
if (_view) {
- _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), pan->view));
+ _view->foreach_regionview (mem_fun(*pan->view.get(), &TimeAxisView::add_ghost));
}
processor->mark_automation_visible (what, true);
i->mark_automation_visible (pan->what, false);
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
using namespace Menu_Helpers;
XMLProperty* prop;
+ XMLNode* node;
add_child (track);
track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
bool hideit = (!show);
-
- XMLNode* node;
if ((node = track->get_state_node()) != 0) {
if ((prop = node->property ("shown")) != 0) {
}
}
}
-
+
_automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track)));
if (hideit) {
track->hide ();
} else {
- _show_automation.insert(param);
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _show_automation.insert (param);
+
+
+ if (!no_redraw) {
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ }
}
build_display_menu();
/* now trigger a redisplay */
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
}
/* change in visibility was possible */
- _route->gui_changed ("track_height", this);
+ _route->gui_changed ("visible_tracks", this);
}
boost::shared_ptr<AutomationLine>
void
RouteTimeAxisView::fast_update ()
{
- lm.update_meters ();
+ gm.get_level_meter().update_meters ();
}
void
RouteTimeAxisView::hide_meter ()
{
clear_meter ();
- lm.hide_meters ();
+ gm.get_level_meter().hide_meters ();
}
void
RouteTimeAxisView::reset_meter ()
{
if (Config->get_show_track_meters()) {
- lm.setup_meters (height-5);
+ gm.get_level_meter().setup_meters (height-5);
} else {
hide_meter ();
}
void
RouteTimeAxisView::clear_meter ()
{
- lm.clear_meters ();
+ gm.get_level_meter().clear_meters ();
}
void
{
reset_meter ();
}
+
+void
+RouteTimeAxisView::build_underlay_menu(Gtk::Menu* parent_menu) {
+ using namespace Menu_Helpers;
+
+ if(!_underlay_streams.empty()) {
+ MenuList& parent_items = parent_menu->items();
+ Menu* gs_menu = manage (new Menu);
+ gs_menu->set_name ("ArdourContextMenu");
+ MenuList& gs_items = gs_menu->items();
+
+ parent_items.push_back (MenuElem (_("Underlays"), *gs_menu));
+
+ for(UnderlayList::iterator it = _underlay_streams.begin(); it != _underlay_streams.end(); ++it) {
+ gs_items.push_back(MenuElem(string_compose(_("Remove \"%1\""), (*it)->trackview().name()),
+ bind(mem_fun(*this, &RouteTimeAxisView::remove_underlay), *it)));
+ }
+ }
+}
+
+bool
+RouteTimeAxisView::set_underlay_state()
+{
+ if(!underlay_xml_node) {
+ return false;
+ }
+
+ XMLNodeList nlist = underlay_xml_node->children();
+ XMLNodeConstIterator niter;
+ XMLNode *child_node;
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ child_node = *niter;
+
+ if(child_node->name() != "Underlay") {
+ continue;
+ }
+
+ XMLProperty* prop = child_node->property ("id");
+ if(prop) {
+ PBD::ID id(prop->value());
+
+ RouteTimeAxisView* v = editor.get_route_view_by_id(id);
+
+ if(v) {
+ add_underlay(v->view(), false);
+ }
+ }
+ }
+
+ return false;
+}
+
+void
+RouteTimeAxisView::add_underlay(StreamView* v, bool update_xml)
+{
+ if(!v) {
+ return;
+ }
+
+ RouteTimeAxisView& other = v->trackview();
+
+ if(find(_underlay_streams.begin(), _underlay_streams.end(), v) == _underlay_streams.end()) {
+ if(find(other._underlay_mirrors.begin(), other._underlay_mirrors.end(), this) != other._underlay_mirrors.end()) {
+ fatal << _("programming error: underlay reference pointer pairs are inconsistent!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ _underlay_streams.push_back(v);
+ other._underlay_mirrors.push_back(this);
+
+ v->foreach_regionview(mem_fun(*this, &RouteTimeAxisView::add_ghost));
+
+ if(update_xml) {
+ if(!underlay_xml_node) {
+ ensure_xml_node();
+ underlay_xml_node = xml_node->add_child("Underlays");
+ }
+
+ XMLNode* node = underlay_xml_node->add_child("Underlay");
+ XMLProperty* prop = node->add_property("id");
+ prop->set_value(v->trackview().route()->id().to_s());
+ }
+ }
+}
+
+void
+RouteTimeAxisView::remove_underlay(StreamView* v)
+{
+ if(!v) {
+ return;
+ }
+
+ UnderlayList::iterator it = find(_underlay_streams.begin(), _underlay_streams.end(), v);
+ RouteTimeAxisView& other = v->trackview();
+
+ if(it != _underlay_streams.end()) {
+ UnderlayMirrorList::iterator gm = find(other._underlay_mirrors.begin(), other._underlay_mirrors.end(), this);
+
+ if(gm == other._underlay_mirrors.end()) {
+ fatal << _("programming error: underlay reference pointer pairs are inconsistent!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ v->foreach_regionview(mem_fun(*this, &RouteTimeAxisView::remove_ghost));
+
+ _underlay_streams.erase(it);
+ other._underlay_mirrors.erase(gm);
+
+ if(underlay_xml_node) {
+ underlay_xml_node->remove_nodes_and_delete("id", v->trackview().route()->id().to_s());
+ }
+ }
+}
+