mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
This commit is contained in:
parent
69777d600f
commit
17f5fb81d2
1 changed files with 30 additions and 58 deletions
|
|
@ -2349,10 +2349,8 @@ Editor::set_edit_point_preference (EditPoint ep, bool force)
|
|||
break;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action ("Editor", action);
|
||||
if (act) {
|
||||
Glib::RefPtr<RadioAction>::cast_dynamic(act)->set_active (true);
|
||||
}
|
||||
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action ("Editor", action);
|
||||
tact->set_active (true);
|
||||
|
||||
samplepos_t foo;
|
||||
bool in_track_canvas;
|
||||
|
|
@ -2482,10 +2480,7 @@ Editor::set_state (const XMLNode& node, int version)
|
|||
|
||||
if (node.get_property ("show-editor-mixer", yn)) {
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
||||
assert (act);
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
|
||||
|
||||
/* do it twice to force the change */
|
||||
|
||||
|
|
@ -2495,10 +2490,7 @@ Editor::set_state (const XMLNode& node, int version)
|
|||
|
||||
if (node.get_property ("show-editor-list", yn)) {
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
||||
assert (act);
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
|
||||
|
||||
/* do it twice to force the change */
|
||||
|
||||
|
|
@ -2528,10 +2520,8 @@ Editor::set_state (const XMLNode& node, int version)
|
|||
}
|
||||
|
||||
if (node.get_property ("maximised", yn)) {
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalEditor"));
|
||||
assert (act);
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
bool fs = tact && tact->get_active();
|
||||
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Common"), X_("ToggleMaximalEditor"));
|
||||
bool fs = tact->get_active();
|
||||
if (yn ^ fs) {
|
||||
ActionManager::do_action ("Common", "ToggleMaximalEditor");
|
||||
}
|
||||
|
|
@ -2550,26 +2540,20 @@ Editor::set_state (const XMLNode& node, int version)
|
|||
* Not all properties may have been in XML, but
|
||||
* those that are linked to a private variable may need changing
|
||||
*/
|
||||
RefPtr<Action> act;
|
||||
RefPtr<ToggleAction> tact;
|
||||
|
||||
act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
|
||||
tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-follow-playhead"));
|
||||
yn = _follow_playhead;
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
if (tact->get_active() != yn) {
|
||||
tact->set_active (yn);
|
||||
}
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
||||
tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
||||
yn = _stationary_playhead;
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
if (tact->get_active() != yn) {
|
||||
tact->set_active (yn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2612,17 +2596,11 @@ Editor::get_state ()
|
|||
node->set_property ("mouse-mode", mouse_mode);
|
||||
node->set_property ("join-object-range", smart_mode_action->get_active ());
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
||||
if (act) {
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
|
||||
node->set_property (X_("show-editor-mixer"), tact->get_active());
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
||||
if (act) {
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
|
||||
node->set_property (X_("show-editor-list"), tact->get_active());
|
||||
}
|
||||
|
||||
node->set_property (X_("editor-list-page"), _the_notebook.get_current_page ());
|
||||
|
||||
|
|
@ -4074,11 +4052,8 @@ Editor::update_grid ()
|
|||
void
|
||||
Editor::toggle_follow_playhead ()
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-follow-playhead"));
|
||||
set_follow_playhead (tact->get_active());
|
||||
}
|
||||
}
|
||||
|
||||
/** @param yn true to follow playhead, otherwise false.
|
||||
|
|
@ -4099,11 +4074,8 @@ Editor::set_follow_playhead (bool yn, bool catch_up)
|
|||
void
|
||||
Editor::toggle_stationary_playhead ()
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
||||
set_stationary_playhead (tact->get_active());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue