#include "ardour_ui.h"
#include "selection.h"
#include "audio_time_axis.h"
+#include "automation_time_axis.h"
#include "actions.h"
#include "i18n.h"
void
Editor::set_selected_mixer_strip (TimeAxisView& view)
{
- AudioTimeAxisView* at;
bool show = false;
bool created;
- if (!session || (at = dynamic_cast<AudioTimeAxisView*>(&view)) == 0) {
+ if (!session)
return;
- }
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
if (act) {
created = false;
}
- /* might be nothing to do */
+ //if this is an automation track then we should show the parent
+ boost::shared_ptr<ARDOUR::Route> route;
+ AutomationTimeAxisView *auto_tav;
+ if ( (auto_tav = dynamic_cast<AutomationTimeAxisView*>(&view)) == 0 ) {
+ AudioTimeAxisView* at = dynamic_cast<AudioTimeAxisView*>(&view);
+ if (at != NULL)
+ route = at->route();
+ } else {
+ AudioTimeAxisView *parent = dynamic_cast<AudioTimeAxisView*>( view.get_parent() );
+ if (parent != NULL) {
+ route = parent->route();
+ }
+ }
- if (current_mixer_strip->route() == at->route()) {
+ if (current_mixer_strip->route() == route) {
return;
}
show = true;
}
- current_mixer_strip->set_route (at->route());
+ current_mixer_strip->set_route (route);
if (created) {
current_mixer_strip->set_width (editor_mixer_strip_width, (void*) this);
void
Editor::current_mixer_strip_hidden ()
{
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-
- AudioTimeAxisView* tmp;
-
- if ((tmp = dynamic_cast<AudioTimeAxisView*>(*i)) != 0) {
- if (tmp->route() == current_mixer_strip->route()) {
- (*i)->set_selected (false);
- break;
- }
- }
- }
-
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
if (act) {
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
}
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- if (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end()) {
- (*i)->set_selected (true);
- } else {
- (*i)->set_selected (false);
- }
+ (*i)->set_selected ( *selection );
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
}
void
-TimeAxisView::set_selected (bool yn)
+TimeAxisView::set_selected (Selection &selection)
{
- if (yn == _selected) {
+ //give children a chance to be selected
+ for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
+ (*i)->set_selected (selection);
+ }
+
+ //determine if I am in the selection
+ bool selected = false;
+ if (find (selection.tracks.begin(), selection.tracks.end(), this) != selection.tracks.end()) {
+ selected = true;
+ }
+
+ //bail out here if my state is unchanged
+ if (selected == _selected) {
return;
}
- Selectable::set_selected (yn);
+ Selectable::set_selected (selected);
if (_selected) {
controls_ebox.set_name (controls_base_selected_name);
controls_frame.set_name (controls_base_selected_name);
controls_vbox.set_name (controls_base_selected_name);
- /* propagate any existing selection, if the mode is right */
+ /* propagate any existing selection, if the mode is right */
if (editor.current_mouse_mode() == Editing::MouseRange && !editor.get_selection().time.empty()) {
show_selection (editor.get_selection().time);
}
controls_frame.set_name (controls_base_unselected_name);
controls_vbox.set_name (controls_base_unselected_name);
hide_selection ();
-
- /* children will be set for the yn=true case. but when deselecting
- the editor only has a list of top-level trackviews, so we
- have to do this here.
- */
-
- for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
- (*i)->set_selected (false);
- }
}
resizer.queue_draw ();
double y2;
SelectionRect *rect;
- for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
- (*i)->show_selection (ts);
- }
-
if (canvas_item_visible (selection_group)) {
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
virtual void hide ();
bool hidden() const { return _hidden; }
- virtual void set_selected (bool);
+ virtual void set_selected (Selection&);
/**
* potential handler for entered events
/* state/serialization management */
void set_parent (TimeAxisView& p);
+ TimeAxisView *get_parent () {return parent;}
bool has_state () const;
/* call this on the parent */