VKeybd: Pass on primary (Ctrl/Cmd) shortcuts
[ardour.git] / gtk2_ardour / video_monitor.h
1 /*
2  * Copyright (C) 2013-2018 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 #ifndef __ardour_video_monitor_h__
19 #define __ardour_video_monitor_h__
20
21 #include <string>
22
23 #include "ardour/ardour.h"
24 #include "ardour/types.h"
25 #include "ardour/session.h"
26 #include "ardour/session_handle.h"
27 #include "ardour/system_exec.h"
28
29 namespace ARDOUR {
30         class Session;
31 }
32 class PublicEditor;
33
34 enum XJSettingOptions {
35         XJ_WINDOW_SIZE = 1,
36         XJ_WINDOW_POS = 2,
37         XJ_WINDOW_ONTOP = 4,
38         XJ_LETTERBOX = 8,
39         XJ_OSD = 16,
40         XJ_OFFSET = 32,
41         XJ_FULLSCREEN = 64,
42 };
43
44 /** @class VideoMonitor
45  *  @brief communication with xjadeo's remote-control interface
46  */
47 class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
48 {
49         public:
50         VideoMonitor (PublicEditor*, std::string);
51         virtual ~VideoMonitor ();
52
53         void set_filename (std::string filename);
54         void set_fps (float f) {fps = f;}
55         bool is_started ();
56         bool start ();
57         void quit ();
58         void open (std::string);
59
60         void set_session (ARDOUR::Session *s);
61         void save_session ();
62         void query_full_state (bool);
63         bool set_custom_setting (const std::string, const std::string);
64         const std::string get_custom_setting (const std::string);
65         void restore_settings_mask (int i)  { _restore_settings_mask = i;}
66         int restore_settings_mask () const { return _restore_settings_mask;}
67
68         void set_offset (ARDOUR::sampleoffset_t);
69         void manual_seek (ARDOUR::samplepos_t, bool, ARDOUR::sampleoffset_t);
70         void srsupdate ();
71         void querystate ();
72         bool synced_by_manual_seeks() { return sync_by_manual_seek; }
73
74         sigc::signal<void> Terminated;
75         PBD::Signal1<void,std::string> UiState;
76         void send_cmd (int what, int param);
77
78 #if 1
79         void set_debug (bool onoff) { debug_enable = onoff; }
80 #endif
81
82         protected:
83         PublicEditor *editor;
84         ARDOUR::SystemExec *process;
85         float fps;
86         void parse_output (std::string d, size_t s);
87         void terminated ();
88         void forward_keyevent (unsigned int);
89
90         void parameter_changed (std::string const & p);
91
92         typedef std::map<std::string,std::string> XJSettings;
93
94         int _restore_settings_mask;
95         bool skip_setting(std::string);
96         XJSettings xjadeo_settings;
97
98         void xjadeo_sync_setup ();
99         ARDOUR::samplepos_t manually_seeked_frame;
100         ARDOUR::sampleoffset_t video_offset;
101         bool sync_by_manual_seek;
102         sigc::connection clock_connection;
103         sigc::connection state_connection;
104         int state_clk_divide;
105         int starting;
106         int knownstate;
107         int osdmode;
108
109         PBD::Signal1<void, unsigned int> XJKeyEvent;
110 #if 1
111         bool debug_enable;
112 #endif
113 };
114
115 #endif /* __ardour_video_monitor_h__ */