+/*
+ Copyright (C) 2000-2007 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#include <ardour/ardour.h>
#include "utils.h"
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Location from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
+ act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Edit Cursor"), mem_fun(*this, &Editor::center_edit_cursor));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "playhead-forward", _("Playhead Forward"), mem_fun(*this, &Editor::playhead_forward));
+
+ act = ActionManager::register_action (editor_actions, "scroll-playhead-forward", _("Playhead forward"), bind (mem_fun(*this, &Editor::scroll_playhead), true));;
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "playhead-backward", _("Playhead Backward"), mem_fun(*this, &Editor::playhead_backward));
+ act = ActionManager::register_action (editor_actions, "scroll-playhead-backward", _("Playhead Backward"), bind (mem_fun(*this, &Editor::scroll_playhead), false));
ActionManager::session_sensitive_actions.push_back (act);
+
act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("Playhead to Edit"), bind (mem_fun(*this, &Editor::cursor_align), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Edit to Playhead"), bind (mem_fun(*this, &Editor::cursor_align), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse Region"), mem_fun(*this, &Editor::reverse_region));
+ act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse Regions"), mem_fun(*this, &Editor::reverse_regions));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region));
+ act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Regions"), mem_fun(*this, &Editor::normalize_regions));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection));
ActionManager::session_sensitive_actions.push_back (act);
RadioAction::Group smpte_group;
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_23976));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24976));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_25));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997drop));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30drop));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_5994));
- ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_60));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_23976));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24976));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_25));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997drop));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30drop));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_5994));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_60));
RadioAction::Group pullup_group;
void
Editor::toggle_waveforms_while_recording ()
{
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
+ Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording"));
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
set_show_waveforms_recording (tact->get_active());
RefPtr<Action> act;
const char* action = 0;
- float frames = Config->get_smpte_frames_per_second();
- bool drop = Config->get_smpte_drop_frames();
-
- if ((frames < 23.976 * 1.0005) && !drop)
+ switch (Config->get_smpte_format()) {
+ case smpte_23976:
action = X_("Smpte23976");
- else if ((frames < 24 * 1.0005) && !drop)
+ break;
+ case smpte_24:
action = X_("Smpte24");
- else if ((frames < 24.976 * 1.0005) && !drop)
+ break;
+ case smpte_24976:
action = X_("Smpte24976");
- else if ((frames < 25 * 1.0005) && !drop)
+ break;
+ case smpte_25:
action = X_("Smpte25");
- else if ((frames < 29.97 * 1.0005) && !drop)
+ break;
+ case smpte_2997:
action = X_("Smpte2997");
- else if ((frames < 29.97 * 1.0005) && drop)
+ break;
+ case smpte_2997drop:
action = X_("Smpte2997drop");
- else if ((frames < 30 * 1.0005) && !drop)
+ break;
+ case smpte_30:
action = X_("Smpte30");
- else if ((frames < 30 * 1.0005) && drop)
+ break;
+ case smpte_30drop:
action = X_("Smpte30drop");
- else if ((frames < 59.94 * 1.0005) && !drop)
+ break;
+ case smpte_5994:
action = X_("Smpte5994");
- else if ((frames < 60 * 1.0005) && !drop)
+ break;
+ case smpte_60:
action = X_("Smpte60");
- else {
- fatal << string_compose (_("programming error: Unexpected SMPTE value (%1, drop = %2) in update_smpte_mode. Menu is probably wrong."),
- frames, drop) << endmsg;
- /*NOTREACHED*/
+ break;
}
act = ActionManager::get_action (X_("Editor"), action);
}
void
-Editor::smpte_fps_chosen (Session::SmpteFormat format)
+Editor::smpte_fps_chosen (SmpteFormat format)
{
/* this is driven by a toggle on a radio group, and so is invoked twice,
once for the item that became inactive and once for the one that became
if (session) {
- float fps = 10;
- bool drop = false;
-
RefPtr<Action> act;
switch (format) {
- case Session::smpte_23976: {
- fps=23.976;
- drop = false;
+ case smpte_23976:
act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
- } break;
- case Session::smpte_24: {
- fps=24;
- drop = false;
+ break;
+ case smpte_24:
act = ActionManager::get_action (X_("Editor"), X_("Smpte24"));
- } break;
- case Session::smpte_24976: {
- fps=24.976;
- drop = false;
+ break;
+ case smpte_24976:
act = ActionManager::get_action (X_("Editor"), X_("Smpte24976"));
- } break;
- case Session::smpte_25: {
- fps=25;
- drop = false;
+ break;
+ case smpte_25:
act = ActionManager::get_action (X_("Editor"), X_("Smpte25"));
- } break;
- case Session::smpte_2997: {
- fps=29.97;
- drop = false;
+ break;
+ case smpte_2997:
act = ActionManager::get_action (X_("Editor"), X_("Smpte2997"));
- } break;
- case Session::smpte_2997drop: {
- fps=29.97;
- drop = true;
+ break;
+ case smpte_2997drop:
act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop"));
- } break;
- case Session::smpte_30: {
- fps=30;
- drop = false;
+ break;
+ case smpte_30:
act = ActionManager::get_action (X_("Editor"), X_("Smpte30"));
- } break;
- case Session::smpte_30drop: {
- fps=30;
- drop = true;
+ break;
+ case smpte_30drop:
act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop"));
- } break;
- case Session::smpte_5994: {
- fps=59.94;
- drop = false;
+ break;
+ case smpte_5994:
act = ActionManager::get_action (X_("Editor"), X_("Smpte5994"));
- } break;
- case Session::smpte_60: {
- fps=60;
- drop = false;
+ break;
+ case smpte_60:
act = ActionManager::get_action (X_("Editor"), X_("Smpte60"));
- } break;
+ break;
default:
cerr << "Editor received unexpected smpte type" << endl;
}
if (act) {
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active()) {
- session->set_smpte_type (fps, drop);
+ session->set_smpte_format (format);
}
}
}
void
Editor::toggle_xfade_visibility ()
{
- ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
}
+/** A Configuration parameter has changed.
+ * @param parameter_name Name of the changed parameter.
+ */
void
Editor::parameter_changed (const char* parameter_name)
{
update_punch_range_view (true);
} else if (PARAM_IS ("layer-model")) {
update_layering_model ();
- } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) {
- update_smpte_mode ();
+ } else if (PARAM_IS ("smpte-format")) {
+ update_smpte_mode ();
update_just_smpte ();
} else if (PARAM_IS ("video-pullup")) {
update_video_pullup ();
ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
} else if (PARAM_IS ("xfades-visible")) {
ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
+ update_xfade_visibility ();
} else if (PARAM_IS ("auto-xfade")) {
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
} else if (PARAM_IS ("xfade-model")) {
#undef PARAM_IS
}
+
+void
+Editor::reset_focus ()
+{
+ track_canvas.grab_focus();
+}