Remove some dead code. Clean up storage of automation axis menu
items. Fixes #3174. git-svn-id: svn://localhost/ardour2/branches/3.0@7157 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -103,7 +103,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
|
||||
set_state (*xml_node, Stateful::loading_state_version);
|
||||
|
||||
/* if set_state above didn't create a gain automation child, we need to make one */
|
||||
if (automation_track (GainAutomation) == 0) {
|
||||
if (automation_child (GainAutomation) == 0) {
|
||||
create_automation_child (GainAutomation, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -432,10 +432,10 @@ MidiTimeAxisView::change_all_channel_tracks_visibility (bool yn, Evoral::Paramet
|
||||
if (selected_channels & (0x0001 << chn)) {
|
||||
|
||||
Evoral::Parameter fully_qualified_param (param.type(), chn, param.id());
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (fully_qualified_param);
|
||||
|
||||
if (node && node->menu_item) {
|
||||
node->menu_item->set_active (yn);
|
||||
if (menu) {
|
||||
menu->set_active (yn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -487,23 +487,18 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
|
||||
sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::toggle_automation_track),
|
||||
fully_qualified_param)));
|
||||
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (fully_qualified_param);
|
||||
bool visible = false;
|
||||
|
||||
if (node) {
|
||||
if (node->track->marked_for_display()) {
|
||||
if (track) {
|
||||
if (track->marked_for_display()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
|
||||
if (node) {
|
||||
node->menu_item = cmi;
|
||||
}
|
||||
|
||||
_parameter_menu_map[fully_qualified_param] = cmi;
|
||||
cmi->set_active (visible);
|
||||
|
||||
parameter_menu_map[fully_qualified_param] = cmi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,24 +518,19 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
|
||||
sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::toggle_automation_track),
|
||||
fully_qualified_param)));
|
||||
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (fully_qualified_param);
|
||||
bool visible = false;
|
||||
|
||||
if (node) {
|
||||
if (node->track->marked_for_display()) {
|
||||
if (track) {
|
||||
if (track->marked_for_display()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&items.back());
|
||||
if (node) {
|
||||
node->menu_item = cmi;
|
||||
}
|
||||
|
||||
_parameter_menu_map[fully_qualified_param] = cmi;
|
||||
cmi->set_active (visible);
|
||||
|
||||
parameter_menu_map[fully_qualified_param] = cmi;
|
||||
|
||||
/* one channel only */
|
||||
break;
|
||||
}
|
||||
@@ -619,24 +609,18 @@ MidiTimeAxisView::build_controller_menu ()
|
||||
sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::toggle_automation_track),
|
||||
fully_qualified_param)));
|
||||
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (fully_qualified_param);
|
||||
bool visible = false;
|
||||
|
||||
if (node) {
|
||||
if (node->track->marked_for_display()) {
|
||||
if (track) {
|
||||
if (track->marked_for_display()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
|
||||
|
||||
if (node) {
|
||||
node->menu_item = cmi;
|
||||
}
|
||||
|
||||
_parameter_menu_map[fully_qualified_param] = cmi;
|
||||
cmi->set_active (visible);
|
||||
|
||||
parameter_menu_map[fully_qualified_param] = cmi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,24 +640,19 @@ MidiTimeAxisView::build_controller_menu ()
|
||||
sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::toggle_automation_track),
|
||||
fully_qualified_param)));
|
||||
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (fully_qualified_param);
|
||||
bool visible = false;
|
||||
|
||||
if (node) {
|
||||
if (node->track->marked_for_display()) {
|
||||
if (track) {
|
||||
if (track->marked_for_display()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&ctl_items.back());
|
||||
if (node) {
|
||||
node->menu_item = cmi;
|
||||
}
|
||||
|
||||
_parameter_menu_map[fully_qualified_param] = cmi;
|
||||
cmi->set_active (visible);
|
||||
|
||||
|
||||
parameter_menu_map[fully_qualified_param] = cmi;
|
||||
/* one channel only */
|
||||
break;
|
||||
}
|
||||
@@ -1080,9 +1059,9 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
|
||||
|
||||
for (uint32_t chn = 0; chn < 16; ++chn) {
|
||||
Evoral::Parameter fully_qualified_param (MidiCCAutomation, chn, ctl);
|
||||
RouteAutomationNode* node = automation_track (fully_qualified_param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (fully_qualified_param);
|
||||
|
||||
if (!node) {
|
||||
if (!track) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1090,9 +1069,9 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
|
||||
/* channel not in use. hiding it will trigger RouteTimeAxisView::automation_track_hidden()
|
||||
which will cause a redraw. We don't want one per channel, so block that with no_redraw.
|
||||
*/
|
||||
changed = node->track->set_visibility (false) || changed;
|
||||
changed = track->set_visibility (false) || changed;
|
||||
} else {
|
||||
changed = node->track->set_visibility (true) || changed;
|
||||
changed = track->set_visibility (true) || changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +143,6 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||
void add_basic_parameter_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, Evoral::Parameter param);
|
||||
void add_channel_command_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, ARDOUR::AutomationType auto_type, uint8_t cmd);
|
||||
|
||||
typedef std::map<Evoral::Parameter,Gtk::CheckMenuItem*> ParameterMenuMap;
|
||||
ParameterMenuMap parameter_menu_map;
|
||||
|
||||
Gtk::Menu* controller_menu;
|
||||
void build_controller_menu ();
|
||||
void set_channel_mode (ARDOUR::ChannelMode, uint16_t);
|
||||
|
||||
@@ -253,10 +253,6 @@ RouteTimeAxisView::~RouteTimeAxisView ()
|
||||
delete _view;
|
||||
_view = 0;
|
||||
|
||||
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
delete i->second;
|
||||
}
|
||||
|
||||
_automation_tracks.clear ();
|
||||
|
||||
delete route_group_menu;
|
||||
@@ -1212,34 +1208,6 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>&
|
||||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
RouteTimeAxisView::show_automation(Evoral::Parameter param)
|
||||
{
|
||||
return (_show_automation.find(param) != _show_automation.end());
|
||||
}
|
||||
|
||||
/** Retuns 0 if track for \a param doesn't exist.
|
||||
*/
|
||||
RouteTimeAxisView::RouteAutomationNode*
|
||||
RouteTimeAxisView::automation_track (Evoral::Parameter param)
|
||||
{
|
||||
map<Evoral::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.find (param);
|
||||
|
||||
if (i != _automation_tracks.end()) {
|
||||
return i->second;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Shorthand for GainAutomation, etc.
|
||||
*/
|
||||
RouteTimeAxisView::RouteAutomationNode*
|
||||
RouteTimeAxisView::automation_track (AutomationType type)
|
||||
{
|
||||
return automation_track (Evoral::Parameter(type));
|
||||
}
|
||||
|
||||
RouteGroup*
|
||||
RouteTimeAxisView::route_group () const
|
||||
{
|
||||
@@ -1613,14 +1581,16 @@ RouteTimeAxisView::color_handler ()
|
||||
void
|
||||
RouteTimeAxisView::toggle_automation_track (const Evoral::Parameter& param)
|
||||
{
|
||||
RouteAutomationNode* node = automation_track(param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (param);
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (param);
|
||||
|
||||
if (!node) {
|
||||
if (!track) {
|
||||
/* it doesn't exist yet, so we don't care about the button state: just add it */
|
||||
create_automation_child (param, true);
|
||||
} else {
|
||||
bool yn = node->menu_item->get_active();
|
||||
if (node->track->set_visibility (node->menu_item->get_active()) && yn) {
|
||||
assert (menu);
|
||||
bool yn = menu->get_active();
|
||||
if (track->set_visibility (menu->get_active()) && yn) {
|
||||
|
||||
/* we made it visible, now trigger a redisplay. if it was hidden, then automation_track_hidden()
|
||||
will have done that for us.
|
||||
@@ -1636,19 +1606,20 @@ RouteTimeAxisView::toggle_automation_track (const Evoral::Parameter& param)
|
||||
void
|
||||
RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param)
|
||||
{
|
||||
RouteAutomationNode* ran = automation_track(param);
|
||||
boost::shared_ptr<AutomationTimeAxisView> track = automation_child (param);
|
||||
|
||||
if (!ran) {
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if Evoral::Parameter::operator< doesn't obey strict weak ordering, we may crash here....
|
||||
_show_automation.erase (param);
|
||||
ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (param);
|
||||
|
||||
if (ran->menu_item && !_hidden) {
|
||||
// if Evoral::Parameter::operator< doesn't obey strict weak ordering, we may crash here....
|
||||
track->get_state_node()->add_property (X_("shown"), X_("no"));
|
||||
|
||||
if (menu && !_hidden) {
|
||||
ignore_toggle = true;
|
||||
ran->menu_item->set_active (false);
|
||||
menu->set_active (false);
|
||||
ignore_toggle = false;
|
||||
}
|
||||
|
||||
@@ -1665,13 +1636,15 @@ RouteTimeAxisView::show_all_automation ()
|
||||
|
||||
/* Show our automation */
|
||||
|
||||
map<Evoral::Parameter, RouteAutomationNode*>::iterator i;
|
||||
for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
i->second->track->set_marked_for_display (true);
|
||||
i->second->track->canvas_display()->show();
|
||||
i->second->track->get_state_node()->add_property ("shown", X_("yes"));
|
||||
if (i->second->menu_item) {
|
||||
i->second->menu_item->set_active(true);
|
||||
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
i->second->set_marked_for_display (true);
|
||||
i->second->canvas_display()->show();
|
||||
i->second->get_state_node()->add_property ("shown", X_("yes"));
|
||||
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
|
||||
|
||||
if (menu) {
|
||||
menu->set_active(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1702,13 +1675,15 @@ RouteTimeAxisView::show_existing_automation ()
|
||||
|
||||
/* Show our automation */
|
||||
|
||||
map<Evoral::Parameter, RouteAutomationNode*>::iterator i;
|
||||
for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
if (i->second->track->line() && i->second->track->line()->npoints() > 0) {
|
||||
i->second->track->set_marked_for_display (true);
|
||||
i->second->track->canvas_display()->show();
|
||||
i->second->track->get_state_node()->add_property ("shown", X_("yes"));
|
||||
i->second->menu_item->set_active(true);
|
||||
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
if (i->second->line() && i->second->line()->npoints() > 0) {
|
||||
i->second->set_marked_for_display (true);
|
||||
i->second->canvas_display()->show();
|
||||
i->second->get_state_node()->add_property ("shown", X_("yes"));
|
||||
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
|
||||
assert (menu);
|
||||
menu->set_active(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1735,12 +1710,15 @@ RouteTimeAxisView::hide_all_automation ()
|
||||
|
||||
/* Hide our automation */
|
||||
|
||||
for (map<Evoral::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
i->second->track->set_marked_for_display (false);
|
||||
i->second->track->hide ();
|
||||
i->second->track->get_state_node()->add_property ("shown", X_("no"));
|
||||
if (i->second->menu_item) {
|
||||
i->second->menu_item->set_active (false);
|
||||
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
|
||||
i->second->set_marked_for_display (false);
|
||||
i->second->hide ();
|
||||
i->second->get_state_node()->add_property ("shown", X_("no"));
|
||||
|
||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
|
||||
|
||||
if (menu) {
|
||||
menu->set_active (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1752,8 +1730,6 @@ RouteTimeAxisView::hide_all_automation ()
|
||||
}
|
||||
}
|
||||
|
||||
_show_automation.clear();
|
||||
|
||||
no_redraw = false;
|
||||
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
|
||||
}
|
||||
@@ -1947,14 +1923,10 @@ RouteTimeAxisView::add_automation_child (Evoral::Parameter param, boost::shared_
|
||||
}
|
||||
}
|
||||
|
||||
_automation_tracks.insert (std::make_pair (param, new RouteAutomationNode(param, NULL, track)));
|
||||
_automation_tracks[param] = track;
|
||||
|
||||
track->set_visibility (!hideit);
|
||||
|
||||
if (!hideit) {
|
||||
_show_automation.insert (param);
|
||||
}
|
||||
|
||||
if (!no_redraw) {
|
||||
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
|
||||
}
|
||||
@@ -2196,7 +2168,7 @@ RouteTimeAxisView::automation_child(Evoral::Parameter param)
|
||||
{
|
||||
AutomationTracks::iterator i = _automation_tracks.find(param);
|
||||
if (i != _automation_tracks.end()) {
|
||||
return i->second->track;
|
||||
return i->second;
|
||||
} else {
|
||||
return boost::shared_ptr<AutomationTimeAxisView>();
|
||||
}
|
||||
@@ -2388,3 +2360,14 @@ RouteTimeAxisView::set_button_names ()
|
||||
}
|
||||
mute_button_label.set_text (_("m"));
|
||||
}
|
||||
|
||||
Gtk::CheckMenuItem*
|
||||
RouteTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
|
||||
{
|
||||
ParameterMenuMap::iterator i = _parameter_menu_map.find (param);
|
||||
if (i == _parameter_menu_map.end()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ public:
|
||||
void set_selected_regionviews (RegionSelection&);
|
||||
void get_selectables (nframes_t start, nframes_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable*>&);
|
||||
bool show_automation(Evoral::Parameter param);
|
||||
void set_layer_display (LayerDisplay d);
|
||||
LayerDisplay layer_display () const;
|
||||
|
||||
@@ -117,27 +116,18 @@ public:
|
||||
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
/* This is a bit nasty to expose :/ */
|
||||
struct RouteAutomationNode {
|
||||
Evoral::Parameter param;
|
||||
Gtk::CheckMenuItem* menu_item;
|
||||
boost::shared_ptr<AutomationTimeAxisView> track;
|
||||
|
||||
RouteAutomationNode (Evoral::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr)
|
||||
: param (par), menu_item (mi), track (tr) {}
|
||||
};
|
||||
|
||||
virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
|
||||
|
||||
/* make sure we get the right version of this */
|
||||
|
||||
XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
|
||||
|
||||
typedef std::map<Evoral::Parameter, RouteAutomationNode*> AutomationTracks;
|
||||
typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
|
||||
AutomationTracks automation_tracks() { return _automation_tracks; }
|
||||
|
||||
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
|
||||
|
||||
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
||||
|
||||
std::string name() const;
|
||||
StreamView* view() const { return _view; }
|
||||
ARDOUR::RouteGroup* route_group() const;
|
||||
@@ -199,9 +189,6 @@ protected:
|
||||
|
||||
void automation_track_hidden (Evoral::Parameter param);
|
||||
|
||||
RouteAutomationNode* automation_track(Evoral::Parameter param);
|
||||
RouteAutomationNode* automation_track(ARDOUR::AutomationType type);
|
||||
|
||||
ProcessorAutomationNode*
|
||||
find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
|
||||
|
||||
@@ -298,10 +285,9 @@ protected:
|
||||
typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
|
||||
ProcessorAutomationCurves processor_automation_curves;
|
||||
|
||||
// Set from XML so context menu automation buttons can be correctly initialized
|
||||
std::set<Evoral::Parameter> _show_automation;
|
||||
|
||||
AutomationTracks _automation_tracks;
|
||||
typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
|
||||
ParameterMenuMap _parameter_menu_map;
|
||||
|
||||
void post_construct ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user