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;
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 */
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 */
}
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");
}
* 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);
- }
+ 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);
- }
+ if (tact->get_active() != yn) {
+ tact->set_active (yn);
}
}
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);
- node->set_property (X_("show-editor-mixer"), tact->get_active());
- }
+ 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);
- node->set_property (X_("show-editor-list"), tact->get_active());
- }
+ 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 ());
Editor::snap_to_minsec (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
const samplepos_t one_second = _session->sample_rate();
const samplepos_t one_minute = one_second * 60;
const samplepos_t one_hour = one_minute * 60;
}
} break;
}
-
+
return ret;
}
{
if ((gpref != SnapToGrid_Unscaled) && (minsec_ruler_scale != minsec_show_msecs)) {
return snap_to_minsec (presnap, direction, gpref);
- }
-
+ }
+
const samplepos_t one_second = _session->sample_rate();
MusicSample ret(presnap);
-
+
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
presnap.sample % (one_second/75) == 0) {
/* start is already on a whole CD sample, do nothing */
Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected
int divisor = 2;
} else {
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);
}
-
+
return ret;
}
Editor::snap_to_grid (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
if (grid_musical()) {
ret = snap_to_bbt (presnap, direction, gpref);
}
-
+
switch (_grid_type) {
case GridTypeTimecode:
ret = snap_to_timecode(presnap, direction, gpref);
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);
- set_follow_playhead (tact->get_active());
- }
+ 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.
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);
- set_stationary_playhead (tact->get_active());
- }
+ RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
+ set_stationary_playhead (tact->get_active());
}
void