#include "ardour_ui.h"
#include "automation_time_axis.h"
+#include "automation_streamview.h"
#include "route_time_axis.h"
#include "automation_line.h"
#include "public_editor.h"
#include "simplerect.h"
#include "selection.h"
-#include "ghostregion.h"
#include "rgb_macros.h"
#include "automation_selectable.h"
#include "point_selection.h"
AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r,
boost::shared_ptr<Automatable> a, boost::shared_ptr<AutomationControl> c,
- PublicEditor& e, TimeAxisView& rent,
+ PublicEditor& e, TimeAxisView& parent, bool show_regions,
ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent)
: AxisView (s),
- TimeAxisView (s, e, &rent, canvas),
+ TimeAxisView (s, e, &parent, canvas),
_route (r),
_control (c),
_automatable (a),
_controller(AutomationController::create(a, c->list(), c)),
_base_rect (0),
+ _view (show_regions ? new AutomationStreamView(*this) : NULL),
_name (nom),
height_button (_("h")),
clear_button (_("clear")),
}
automation_menu = 0;
- in_destructor = false;
auto_off_item = 0;
auto_touch_item = 0;
auto_write_item = 0;
_base_rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_automation_track_event),
_base_rect, this));
+ _base_rect->lower_to_bottom();
+
hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
height_button.set_name ("TrackSizeButton");
set_state (*xml_node);
}
- boost::shared_ptr<AutomationLine> line(new AutomationLine (
- _control->parameter().to_string(),
- *this,
- *canvas_display,
- _control->list()));
-
- line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get());
- line->queue_reset ();
- add_line (line);
+ /* ask for notifications of any new RegionViews */
+ if (show_regions) {
+
+ assert(_view);
+ _view->attach ();
+
+ /* no regions, just a single line for the entire track (e.g. bus gain) */
+ } else {
+
+ boost::shared_ptr<AutomationLine> line(new AutomationLine (
+ _control->parameter().to_string(),
+ *this,
+ *canvas_display,
+ _control->list()));
+
+ line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get());
+ line->queue_reset ();
+ add_line (line);
+ }
/* make sure labels etc. are correct */
AutomationTimeAxisView::~AutomationTimeAxisView ()
{
- in_destructor = true;
-
- for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- delete *i;
- }
}
void
}
}
- _line->set_interpolation(style);
+ if (_line)
+ _line->set_interpolation(style);
}
void
AutomationTimeAxisView::set_interpolation (AutomationList::InterpolationStyle style)
{
_control->list()->set_interpolation(style);
+ if (_line)
_line->set_interpolation(style);
}
AutomationTimeAxisView::clear_clicked ()
{
_session.begin_reversible_command (_("clear automation"));
- _line->clear ();
+ if (_line)
+ _line->clear ();
_session.commit_reversible_command ();
}
TimeAxisView::set_height (ht);
_base_rect->property_y2() = h;
-
+
if (_line)
_line->set_y_position_and_height (0, h);
-
- for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->set_height ();
+
+ if (_view) {
+ _view->set_height(h);
+ _view->update_contents_y_position_and_height();
}
TimeAxisView* state_parent = get_parent_with_state ();
void
AutomationTimeAxisView::set_samples_per_unit (double spu)
{
- TimeAxisView::set_samples_per_unit (editor.get_current_zoom());
+ TimeAxisView::set_samples_per_unit (spu);
- _line->reset ();
+ if (_line)
+ _line->reset ();
+
+ if (_view)
+ _view->set_samples_per_unit (spu);
}
void
void
AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y)
{
+ if (!_line)
+ return;
+
double x = 0;
canvas_display->w2i (x, y);
return true;
}
-void
-AutomationTimeAxisView::add_ghost (GhostRegion* gr)
-{
- ghosts.push_back (gr);
- gr->GoingAway.connect (mem_fun(*this, &AutomationTimeAxisView::remove_ghost));
-}
-
-void
-AutomationTimeAxisView::remove_ghost (GhostRegion* gr)
-{
- if (in_destructor) {
- return;
- }
-
- list<GhostRegion*>::iterator i;
-
- for (i = ghosts.begin(); i != ghosts.end(); ++i) {
- if ((*i) == gr) {
- ghosts.erase (i);
- break;
- }
- }
-}
-
void
AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
{
botfrac = 1.0 - ((bot - y_position) / height);
}
- _line->get_selectables (start, end, botfrac, topfrac, results);
+ if (_line)
+ _line->get_selectables (start, end, botfrac, topfrac, results);
}
}
void
AutomationTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
{
- _line->get_inverted_selectables (sel, result);
+ if (_line)
+ _line->get_inverted_selectables (sel, result);
}
void
AutomationTimeAxisView::set_selected_points (PointSelection& points)
{
- _line->set_selected_points (points);
+ if (_line)
+ _line->set_selected_points (points);
}
void
void
AutomationTimeAxisView::entered()
{
- _line->track_entered();
+ if (_line)
+ _line->track_entered();
}
void
AutomationTimeAxisView::exited ()
{
- _line->track_exited();
+ if (_line)
+ _line->track_exited();
}
-void
+/*void
AutomationTimeAxisView::set_colors ()
{
for (list<GhostRegion*>::iterator i=ghosts.begin(); i != ghosts.end(); i++ ) {
(*i)->set_colors();
}
- _line->set_colors();
-}
+ if (_line)
+ _line->set_colors();
+ }*/
void
AutomationTimeAxisView::color_handler ()
{
- set_colors ();
+ if (_line) {
+ _line->set_colors();
+ }
}
void