add haupauge-1657 dual usb capture support, add deinterlace to recordmonitor, asset...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindowgui.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef MAINWINDOWGUI_H
23 #define MAINWINDOWGUI_H
24
25 #include "androidcontrol.inc"
26 #include "channelinfo.inc"
27 #include "cwindow.inc"
28 #include "editpopup.inc"
29 #include "guicast.h"
30 #include "indexable.inc"
31 #include "keyframepopup.inc"
32 #include "mainclock.inc"
33 #include "maincursor.inc"
34 #include "mainmenu.inc"
35 #include "mbuttons.inc"
36 #include "dbwindow.inc"
37 #include "mtimebar.inc"
38 #include "mwindow.inc"
39 #include "mwindowgui.inc"
40 #include "panedividers.inc"
41 #include "patchbay.inc"
42 #include "pluginpopup.inc"
43 #include "record.inc"
44 #include "remotecontrol.h"
45 #include "record.inc"
46 #include "renderengine.inc"
47 #include "resourcepixmap.h"
48 #include "resourcethread.inc"
49 #include "samplescroll.inc"
50 #include "shbtnprefs.inc"
51 #include "statusbar.inc"
52 #include "swindow.inc"
53 #include "timelinepane.inc"
54 #include "track.inc"
55 #include "trackcanvas.inc"
56 #include "trackpopup.inc"
57 #include "trackscroll.inc"
58 #include "transitionpopup.inc"
59 #include "zoombar.inc"
60
61
62 class PaneButton : public BC_Button
63 {
64 public:
65         PaneButton(MWindow *mwindow, int x, int y);
66         int cursor_motion_event();
67         int button_release_event();
68         MWindow *mwindow;
69 };
70
71 class FFMpegToggle : public BC_Toggle
72 {
73 public:
74         FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
75         ~FFMpegToggle();
76         int handle_event();
77
78         MWindow *mwindow;
79         MButtons *mbuttons;
80 };
81
82 class StackButton : public BC_GenericButton
83 {
84 public:
85         StackButton(MWindow *mwindow, int x, int y);
86         int handle_event();
87         void update();
88
89         MWindow *mwindow;
90 };
91
92 class ProxyToggle : public BC_Toggle
93 {
94 public:
95         ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
96         ~ProxyToggle();
97         int handle_event();
98         int keypress_event();
99         void show();
100         void hide();
101
102         MWindow *mwindow;
103         MButtons *mbuttons;
104         int scaler_images;
105 };
106
107
108 class MWindowGUI : public BC_Window
109 {
110 public:
111         MWindowGUI(MWindow *mwindow);
112         ~MWindowGUI();
113
114         void create_objects();
115 //      void get_scrollbars(int flush);
116
117 // ======================== event handlers
118
119 // Replace with update
120         void redraw_time_dependancies();
121
122         int focus_in_event();
123         int focus_out_event();
124
125 // do_canvas -
126 //   NO_DRAW disable canvas draw
127 //   IGNORE_THREAD to ignore picon thread
128 //   NORMAL_DRAW for incremental drawing of resources
129 //   FORCE_REDRAW for delete and redraw of resources
130         void update(int scrollbars,
131                 int do_canvas,
132                 int timebar,
133                 int zoombar,
134                 int patchbay,
135                 int clock,
136                 int buttonbar);
137         void draw_overlays(int flash_it);
138         void draw_indexes(Indexable *indexable);
139         void update_title(char *path);
140         void update_timebar(int flush_it);
141         void update_timebar_highlights();
142         void update_patchbay();
143         void update_proxy_toggle();
144         void update_plugintoggles();
145         void update_scrollbars(int flush);
146         void draw_canvas(int redraw, int hide_cursor);
147         void flash_canvas(int flush);
148         int show_window(int flush=1);
149         void deactivate_timeline();
150         void activate_timeline();
151         void reset_meters();
152         void stop_meters();
153         void update_meters(ArrayList<double> *module_levels);
154         void draw_cursor(int do_plugintoggles);
155         void show_cursor(int do_plugintoggles /* = 1 */);
156         void hide_cursor(int do_plugintoggles /* = 1 */);
157         void update_cursor();
158         void set_playing_back(int value);
159         void set_editing_mode(int flush);
160         void set_meter_format(int mode, int min, int max);
161         void update_mixers(Track *track, int v);
162         void stop_transport(const char *lock_msg);
163
164         int translation_event();
165         int resize_event(int w, int h);          // handle a resize event
166         int keypress_event();
167         int keyboard_listener(BC_WindowBase *wp);
168         int key_listener(int key);
169         void use_android_remote(int on);
170         int close_event();
171         int quit();
172         void stop_drawing();
173         int save_defaults(BC_Hash *defaults);
174         int menu_w();
175         int menu_h();
176 // Draw on the status bar only.
177         void show_message(const char *message, int msg_color=-1, int box_color=-1);
178         void update_default_message();
179         void reset_default_message();
180         void default_message();
181         void show_error(char *message, int color = BLACK);
182         int repeat_event(int64_t duration);
183 // Entry point for drag events in all windows
184         int drag_motion();
185         int drag_stop();
186         void default_positions();
187         int total_panes();
188 // 1 if there are 2 panes vertically
189         int vertical_panes();
190 // 1 if there are 2 panes horizontally
191         int horizontal_panes();
192
193 // get pane number where cursor updates should be drawn in,
194 // whether active or not
195         TimelinePane* get_focused_pane();
196         void start_x_pane_drag();
197         void start_y_pane_drag();
198         void handle_pane_drag();
199         void stop_pane_drag();
200         void delete_x_pane(int cursor_x);
201         void create_x_pane(int cursor_x);
202         void create_y_pane(int cursor_y);
203         void delete_y_pane(int cursor_y);
204         void update_pane_dividers();
205 // load panes from EDL
206         void load_panes();
207         void draw_samplemovement();
208         void draw_trackmovement();
209
210
211 // Return if the area bounded by x1 and x2 is visible between view_x1 and view_x2
212         static int visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2);
213
214         MWindow *mwindow;
215
216 // For drawing nested EDL's
217         RenderEngine *render_engine;
218 // ID of nested EDL last drawn.
219         int render_engine_id;
220 // sideshow apps
221         Record *record;
222         ChannelInfo *channel_info;
223         DbWindow *db_window;
224         SWindow *swindow;
225 // Popup menus
226         TrackPopup *track_menu;
227         EditPopup *edit_menu;
228         PluginPopup *plugin_menu;
229         KeyframePopup *keyframe_menu;
230         KeyframeHidePopup *keyframe_hide;
231         BC_SubWindow *keyvalue_popup;
232         TransitionPopup *transition_menu;
233
234         MainClock *mainclock;
235         MButtons *mbuttons;
236         FFMpegToggle *ffmpeg_toggle;
237         ProxyToggle *proxy_toggle;
238         StackButton *stack_button;
239         PaneDivider *x_divider;
240         PaneDivider *y_divider;
241         TimelinePane *pane[TOTAL_PANES];
242         ResourceThread *resource_thread;
243         ArrayList<ResourcePixmap*> resource_pixmaps;
244
245
246         MainMenu *mainmenu;
247         MainShBtns *mainshbtns;
248         ZoomBar *zoombar;
249         StatusBar *statusbar;
250         PaneButton *pane_button;
251         BC_Popup *x_pane_drag;
252         BC_Popup *y_pane_drag;
253         int dragging_pane;
254 // Cursor used to select a region in all panes
255 //      MainCursor *cursor;
256 // Dimensions of canvas minus scrollbars
257 //      int view_w, view_h;
258 // pane number where cursor updates should be drawn in, whether active or not
259         int focused_pane;
260
261
262         BC_DragWindow *drag_popup;
263
264 //      PatchBay *patchbay;
265 //      MTimeBar *timebar;
266 //      SampleScroll *samplescroll;
267 //      TrackScroll *trackscroll;
268 //      TrackCanvas *canvas;
269
270 // remote control
271         AndroidControl *android_control;
272         RemoteControl *remote_control;
273         CWindowRemoteHandler *cwindow_remote_handler;
274         RecordRemoteHandler *record_remote_handler;
275 };
276
277 #endif