mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action ("Editor", action);
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action ("Editor", action);
|
||||||
if (act) {
|
tact->set_active (true);
|
||||||
Glib::RefPtr<RadioAction>::cast_dynamic(act)->set_active (true);
|
|
||||||
}
|
|
||||||
|
|
||||||
samplepos_t foo;
|
samplepos_t foo;
|
||||||
bool in_track_canvas;
|
bool in_track_canvas;
|
||||||
|
|
@ -2482,10 +2480,7 @@ Editor::set_state (const XMLNode& node, int version)
|
||||||
|
|
||||||
if (node.get_property ("show-editor-mixer", yn)) {
|
if (node.get_property ("show-editor-mixer", yn)) {
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
|
||||||
assert (act);
|
|
||||||
|
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
|
|
||||||
/* do it twice to force the change */
|
/* 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)) {
|
if (node.get_property ("show-editor-list", yn)) {
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
|
||||||
assert (act);
|
|
||||||
|
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
|
|
||||||
/* do it twice to force the change */
|
/* 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)) {
|
if (node.get_property ("maximised", yn)) {
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalEditor"));
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Common"), X_("ToggleMaximalEditor"));
|
||||||
assert (act);
|
bool fs = tact->get_active();
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
bool fs = tact && tact->get_active();
|
|
||||||
if (yn ^ fs) {
|
if (yn ^ fs) {
|
||||||
ActionManager::do_action ("Common", "ToggleMaximalEditor");
|
ActionManager::do_action ("Common", "ToggleMaximalEditor");
|
||||||
}
|
}
|
||||||
|
|
@ -2550,24 +2540,18 @@ Editor::set_state (const XMLNode& node, int version)
|
||||||
* Not all properties may have been in XML, but
|
* Not all properties may have been in XML, but
|
||||||
* those that are linked to a private variable may need changing
|
* 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;
|
yn = _follow_playhead;
|
||||||
if (act) {
|
if (tact->get_active() != yn) {
|
||||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
tact->set_active (yn);
|
||||||
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;
|
yn = _stationary_playhead;
|
||||||
if (act) {
|
if (tact->get_active() != yn) {
|
||||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
tact->set_active (yn);
|
||||||
if (tact->get_active() != yn) {
|
|
||||||
tact->set_active (yn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2612,17 +2596,11 @@ Editor::get_state ()
|
||||||
node->set_property ("mouse-mode", mouse_mode);
|
node->set_property ("mouse-mode", mouse_mode);
|
||||||
node->set_property ("join-object-range", smart_mode_action->get_active ());
|
node->set_property ("join-object-range", smart_mode_action->get_active ());
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
|
||||||
if (act) {
|
node->set_property (X_("show-editor-mixer"), tact->get_active());
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
node->set_property (X_("show-editor-mixer"), tact->get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
|
||||||
if (act) {
|
node->set_property (X_("show-editor-list"), tact->get_active());
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
node->set_property (X_("show-editor-list"), tact->get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
node->set_property (X_("editor-list-page"), _the_notebook.get_current_page ());
|
node->set_property (X_("editor-list-page"), _the_notebook.get_current_page ());
|
||||||
|
|
||||||
|
|
@ -2815,7 +2793,7 @@ MusicSample
|
||||||
Editor::snap_to_minsec (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
Editor::snap_to_minsec (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
||||||
{
|
{
|
||||||
MusicSample ret(presnap);
|
MusicSample ret(presnap);
|
||||||
|
|
||||||
const samplepos_t one_second = _session->sample_rate();
|
const samplepos_t one_second = _session->sample_rate();
|
||||||
const samplepos_t one_minute = one_second * 60;
|
const samplepos_t one_minute = one_second * 60;
|
||||||
const samplepos_t one_hour = one_minute * 60;
|
const samplepos_t one_hour = one_minute * 60;
|
||||||
|
|
@ -2857,7 +2835,7 @@ Editor::snap_to_minsec (MusicSample presnap, RoundMode direction, SnapPref gpref
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2866,12 +2844,12 @@ Editor::snap_to_cd_frames (MusicSample presnap, RoundMode direction, SnapPref gp
|
||||||
{
|
{
|
||||||
if ((gpref != SnapToGrid_Unscaled) && (minsec_ruler_scale != minsec_show_msecs)) {
|
if ((gpref != SnapToGrid_Unscaled) && (minsec_ruler_scale != minsec_show_msecs)) {
|
||||||
return snap_to_minsec (presnap, direction, gpref);
|
return snap_to_minsec (presnap, direction, gpref);
|
||||||
}
|
}
|
||||||
|
|
||||||
const samplepos_t one_second = _session->sample_rate();
|
const samplepos_t one_second = _session->sample_rate();
|
||||||
|
|
||||||
MusicSample ret(presnap);
|
MusicSample ret(presnap);
|
||||||
|
|
||||||
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
|
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
|
||||||
presnap.sample % (one_second/75) == 0) {
|
presnap.sample % (one_second/75) == 0) {
|
||||||
/* start is already on a whole CD sample, do nothing */
|
/* start is already on a whole CD sample, do nothing */
|
||||||
|
|
@ -2888,7 +2866,7 @@ MusicSample
|
||||||
Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
||||||
{
|
{
|
||||||
MusicSample ret(presnap);
|
MusicSample ret(presnap);
|
||||||
|
|
||||||
if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected
|
if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected
|
||||||
|
|
||||||
int divisor = 2;
|
int divisor = 2;
|
||||||
|
|
@ -2938,7 +2916,7 @@ Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
||||||
} else {
|
} else {
|
||||||
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);
|
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2946,11 +2924,11 @@ ARDOUR::MusicSample
|
||||||
Editor::snap_to_grid (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
Editor::snap_to_grid (MusicSample presnap, RoundMode direction, SnapPref gpref)
|
||||||
{
|
{
|
||||||
MusicSample ret(presnap);
|
MusicSample ret(presnap);
|
||||||
|
|
||||||
if (grid_musical()) {
|
if (grid_musical()) {
|
||||||
ret = snap_to_bbt (presnap, direction, gpref);
|
ret = snap_to_bbt (presnap, direction, gpref);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_grid_type) {
|
switch (_grid_type) {
|
||||||
case GridTypeTimecode:
|
case GridTypeTimecode:
|
||||||
ret = snap_to_timecode(presnap, direction, gpref);
|
ret = snap_to_timecode(presnap, direction, gpref);
|
||||||
|
|
@ -4074,11 +4052,8 @@ Editor::update_grid ()
|
||||||
void
|
void
|
||||||
Editor::toggle_follow_playhead ()
|
Editor::toggle_follow_playhead ()
|
||||||
{
|
{
|
||||||
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
|
RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-follow-playhead"));
|
||||||
if (act) {
|
set_follow_playhead (tact->get_active());
|
||||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
set_follow_playhead (tact->get_active());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param yn true to follow playhead, otherwise false.
|
/** @param yn true to follow playhead, otherwise false.
|
||||||
|
|
@ -4099,11 +4074,8 @@ Editor::set_follow_playhead (bool yn, bool catch_up)
|
||||||
void
|
void
|
||||||
Editor::toggle_stationary_playhead ()
|
Editor::toggle_stationary_playhead ()
|
||||||
{
|
{
|
||||||
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
|
||||||
if (act) {
|
set_stationary_playhead (tact->get_active());
|
||||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
|
||||||
set_stationary_playhead (tact->get_active());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue