mp4chaps Lua script: don't clutter global environment
[ardour.git] / gtk2_ardour / video_monitor.cc
index f15013f57eed2957d94d15bbcdaa7894b21ca17d..56dad67dc87d4bb4c128a168a1410a691e0d793c 100644 (file)
@@ -20,7 +20,7 @@
 #include "pbd/file_utils.h"
 #include "pbd/convert.h"
 #include "gui_thread.h"
-#include "ardour_ui.h"
+#include "timers.h"
 #include "utils.h"
 
 #include <stdio.h>
@@ -28,7 +28,7 @@
 #include "editor.h"
 #include "video_monitor.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace PBD;
@@ -159,10 +159,10 @@ VideoMonitor::open (std::string filename)
                querystate();
                state_clk_divide = 0;
                /* TODO once every two second or so -- state_clk_divide hack below */
-               state_connection = ARDOUR_UI::RapidScreenUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::querystate));
+               state_connection = Timers::rapid_connect (sigc::mem_fun (*this, &VideoMonitor::querystate));
        }
        sync_by_manual_seek = true;
-       clock_connection = ARDOUR_UI::FPSUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
+       clock_connection = Timers::fps_connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
        xjadeo_sync_setup();
 }
 
@@ -255,9 +255,7 @@ VideoMonitor::is_started ()
 void
 VideoMonitor::forward_keyevent (unsigned int keyval)
 {
-       Editor* ed = dynamic_cast<Editor*>(&PublicEditor::instance());
-       if (!ed) return;
-       emulate_key_event(ed, keyval);
+       emulate_key_event (keyval);
 }
 
 void
@@ -432,8 +430,8 @@ VideoMonitor::save_session ()
 
        for(XJSettings::const_iterator it = xjadeo_settings.begin(); it != xjadeo_settings.end(); ++it) {
          XMLNode* child = node->add_child (X_("XJSetting"));
-               child->add_property (X_("k"), it->first);
-               child->add_property (X_("v"), it->second);
+               child->set_property (X_("k"), it->first);
+               child->set_property (X_("v"), it->second);
        }
 }
 
@@ -443,6 +441,7 @@ VideoMonitor::set_session (ARDOUR::Session *s)
 {
        SessionHandlePtr::set_session (s);
        if (!_session) { return; }
+       ARDOUR::Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoMonitor::parameter_changed, this, _1), gui_context());
        _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoMonitor::parameter_changed, this, _1), gui_context());
        XMLNode* node = _session->extra_xml (X_("XJSettings"));
        if (!node) { return;}
@@ -468,7 +467,7 @@ VideoMonitor::get_custom_setting (const std::string k)
        return (xjadeo_settings[k]);
 }
 
-#define NO_OFFSET (1<<63) //< skip setting or modifying offset
+#define NO_OFFSET (ARDOUR::max_framepos) //< skip setting or modifying offset
 void
 VideoMonitor::srsupdate ()
 {
@@ -570,7 +569,7 @@ VideoMonitor::xjadeo_sync_setup ()
                        process->write_to_stdin("jack connect\n");
                } else {
                        process->write_to_stdin("jack disconnect\n");
-                       clock_connection = ARDOUR_UI::FPSUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
+                       clock_connection = Timers::fps_connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
                }
                sync_by_manual_seek = my_manual_seek;
        }