summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-11-20 14:27:56 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-11-20 14:27:56 +0000
commitec588a28babddb0861ebe871fb9f2187e6ec6284 (patch)
tree9d3834d6efd26f89b81d93859add8794d82783ac /gtk2_ardour
parentaa0fee1e8d2b49f96cf0a8156785555609b42de7 (diff)
configurable subframes-per-frame, defaults to 80
git-svn-id: svn://localhost/ardour2/trunk@1143 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour.menus4
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_actions.cc72
3 files changed, 78 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus
index bd172183e7..0ca98b868f 100644
--- a/gtk2_ardour/ardour.menus
+++ b/gtk2_ardour/ardour.menus
@@ -258,6 +258,10 @@
<menuitem action='PullupMinus4'/>
<menuitem action='PullupMinus4Minus1'/>
</menu>
+ <menu action='Subframes'>
+ <menuitem action='Subframes80'/>
+ <menuitem action='Subframes100'/>
+ </menu>
<separator/>
<menu action='Autoconnect'>
<menuitem action='InputAutoConnectPhysical'/>
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index a88b9b314a..eb2c4a9b67 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -295,10 +295,11 @@ class Editor : public PublicEditor
void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
+ void subframes_per_frame_chosen (uint32_t);
void update_smpte_mode();
void update_video_pullup();
-
+ void update_subframes_per_frame ();
/* xfades */
void toggle_auto_xfade ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index a55aee6232..9dfd87259b 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -42,6 +42,7 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
+ ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes"));
ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Audio"));
/* add named actions for the editor */
@@ -402,6 +403,11 @@ Editor::register_actions ()
ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4"), _("-4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4));
ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4Minus1"), _("-4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Minus1));
+ RadioAction::Group subframe_group;
+
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("Subframes80"), _("80 per frame"), bind (mem_fun (*this, &Editor::subframes_per_frame_chosen), 80));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("Subframes100"), _("100 per frame"), bind (mem_fun (*this, &Editor::subframes_per_frame_chosen), 100));
+
ActionManager::add_action_group (rl_actions);
ActionManager::add_action_group (zoom_actions);
ActionManager::add_action_group (mouse_mode_actions);
@@ -979,6 +985,70 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup)
}
void
+Editor::update_subframes_per_frame ()
+{
+ ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_subframes_per_frame));
+
+ RefPtr<Action> act;
+ const char* action = 0;
+
+ uint32_t sfpf = Config->get_subframes_per_frame();
+
+ if (sfpf == 80) {
+ action = X_("Subframes80");
+ } else if (sfpf == 100) {
+ action = X_("Subframes100");
+ } else {
+ warning << string_compose (_("Configuraton is using unhandled subframes per frame value: %1"), sfpf) << endmsg;
+ /*NOTREACHED*/
+ return;
+ }
+
+ act = ActionManager::get_action (X_("Editor"), action);
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+}
+
+void
+Editor::subframes_per_frame_chosen (uint32_t sfpf)
+{
+ /* 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
+ active.
+ */
+
+ const char* action = 0;
+
+ RefPtr<Action> act;
+
+ if (sfpf == 80) {
+ action = X_("Subframes80");
+ } else if (sfpf == 100) {
+ action = X_("Subframes100");
+ } else {
+ fatal << string_compose (_("programming error: %1 %2"), "Session received unexpected subframes per frame value: ", sfpf) << endmsg;
+ /*NOTREACHED*/
+ }
+
+ act = ActionManager::get_action (X_("Editor"), action);
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
+ }
+
+ } else {
+ error << string_compose (_("programming error: %1"), "Editor::subframes_per_frame_chosen could not find action to match value.") << endmsg;
+ }
+}
+
+void
Editor::toggle_auto_xfade ()
{
ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade);
@@ -1026,6 +1096,8 @@ Editor::parameter_changed (const char* parameter_name)
update_crossfade_model ();
} else if (PARAM_IS ("edit-mode")) {
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
+ } else if (PARAM_IS ("subframes_per_frame")) {
+ update_subframes_per_frame ();
}
#undef PARAM_IS