no longer need ffmpeg patch0 which was for Termux
[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 "renderengine.inc"
46 #include "resourcepixmap.h"
47 #include "resourcethread.inc"
48 #include "samplescroll.inc"
49 #include "shbtnprefs.inc"
50 #include "statusbar.inc"
51 #include "swindow.inc"
52 #include "timelinepane.inc"
53 #include "track.inc"
54 #include "trackcanvas.inc"
55 #include "trackpopup.inc"
56 #include "trackscroll.inc"
57 #include "transitionpopup.inc"
58 #include "wintv.inc"
59 #include "x10tv.inc"
60 #include "zoombar.inc"
61
62
63 class PaneButton : public BC_Button
64 {
65 public:
66         PaneButton(MWindow *mwindow, int x, int y);
67         int cursor_motion_event();
68         int button_release_event();
69         MWindow *mwindow;
70 };
71
72 class FFMpegToggle : public BC_Toggle
73 {
74 public:
75         FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
76         ~FFMpegToggle();
77         int handle_event();
78
79         MWindow *mwindow;
80         MButtons *mbuttons;
81 };
82
83 class StackButton : public BC_GenericButton
84 {
85 public:
86         StackButton(MWindow *mwindow, int x, int y);
87         int handle_event();
88         void update();
89
90         MWindow *mwindow;
91 };
92
93 class ProxyToggle : public BC_Toggle
94 {
95 public:
96         ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
97         ~ProxyToggle();
98         int handle_event();
99         int keypress_event();
100         void show();
101         void hide();
102
103         MWindow *mwindow;
104         MButtons *mbuttons;
105         int scaler_images;
106 };
107
108
109 class MWindowGUI : public BC_Window
110 {
111 public:
112         MWindowGUI(MWindow *mwindow);
113         ~MWindowGUI();
114
115         void create_objects();
116 //      void get_scrollbars(int flush);
117
118 // ======================== event handlers
119
120 // Replace with update
121         void redraw_time_dependancies();
122
123         int focus_in_event();
124         int focus_out_event();
125
126 // do_canvas -
127 //   NO_DRAW disable canvas draw
128 //   IGNORE_THREAD to ignore picon thread
129 //   NORMAL_DRAW for incremental drawing of resources
130 //   FORCE_REDRAW for delete and redraw of resources
131         void update(int scrollbars,
132                 int do_canvas,
133                 int timebar,
134                 int zoombar,
135                 int patchbay,
136                 int clock,
137                 int buttonbar);
138         void draw_overlays(int flash_it);
139         void draw_indexes(Indexable *indexable);
140         void update_title(char *path);
141         void update_timebar(int flush_it);
142         void update_timebar_highlights();
143         void update_patchbay();
144         void update_proxy_toggle();
145         void update_plugintoggles();
146         void update_scrollbars(int flush);
147         void draw_canvas(int redraw, int hide_cursor);
148         void flash_canvas(int flush);
149         int show_window(int flush=1);
150         void deactivate_timeline();
151         void activate_timeline();
152         void reset_meters();
153         void stop_meters();
154         void update_meters(ArrayList<double> *module_levels);
155         void draw_cursor(int do_plugintoggles);
156         void show_cursor(int do_plugintoggles /* = 1 */);
157         void hide_cursor(int do_plugintoggles /* = 1 */);
158         void update_cursor();
159         void set_playing_back(int value);
160         void set_editing_mode(int flush);
161         void set_meter_format(int mode, int min, int max);
162         void update_mixers(Track *track, int v);
163         void stop_transport(const char *lock_msg);
164         void close_keyvalue_popup();
165         void open_keyvalue_popup(BC_SubWindow *popup);
166
167         int translation_event();
168         int resize_event(int w, int h);          // handle a resize event
169         int keypress_event();
170         int keyboard_listener(BC_WindowBase *wp);
171         int key_listener(int key);
172         void use_android_remote(int on);
173         int keyev_grab_remote();
174         int close_event();
175         int quit();
176         void stop_drawing();
177         int save_defaults(BC_Hash *defaults);
178         int menu_w();
179         int menu_h();
180 // Draw on the status bar only.
181         void show_message(const char *message, int msg_color=-1, int box_color=-1);
182         void update_default_message();
183         void reset_default_message();
184         void default_message();
185         void show_error(char *message, int color = BLACK);
186         int repeat_event(int64_t duration);
187 // Entry point for drag events in all windows
188         int drag_motion();
189         int drag_stop();
190         void default_positions();
191         int total_panes();
192 // 1 if there are 2 panes vertically
193         int vertical_panes();
194 // 1 if there are 2 panes horizontally
195         int horizontal_panes();
196
197 // get pane number where cursor updates should be drawn in,
198 // whether active or not
199         TimelinePane* get_focused_pane();
200         void start_x_pane_drag();
201         void start_y_pane_drag();
202         void handle_pane_drag();
203         void stop_pane_drag();
204         void delete_x_pane(int cursor_x);
205         void create_x_pane(int cursor_x);
206         void create_y_pane(int cursor_y);
207         void delete_y_pane(int cursor_y);
208         void update_pane_dividers();
209 // load panes from EDL
210         void load_panes();
211         void draw_samplemovement();
212         void draw_trackmovement();
213
214
215 // Return if the area bounded by x1 and x2 is visible between view_x1 and view_x2
216         static int visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2);
217
218         MWindow *mwindow;
219
220 // For drawing nested EDL's
221         RenderEngine *render_engine;
222 // ID of nested EDL last drawn.
223         int render_engine_id;
224 // sideshow apps
225         Record *record;
226         ChannelInfo *channel_info;
227         DbWindow *db_window;
228         SWindow *swindow;
229 // Popup menus
230         TrackPopup *track_menu;
231         EditPopup *edit_menu;
232         PluginPopup *plugin_menu;
233         KeyframePopup *keyframe_menu;
234         KeyframeHidePopup *keyframe_hide;
235         BC_SubWindow *keyvalue_popup;
236         TransitionPopup *transition_menu;
237
238         MainClock *mainclock;
239         MButtons *mbuttons;
240         FFMpegToggle *ffmpeg_toggle;
241         ProxyToggle *proxy_toggle;
242         StackButton *stack_button;
243         PaneDivider *x_divider;
244         PaneDivider *y_divider;
245         TimelinePane *pane[TOTAL_PANES];
246         ResourceThread *resource_thread;
247         ArrayList<ResourcePixmap*> resource_pixmaps;
248
249
250         MainMenu *mainmenu;
251         MainShBtns *mainshbtns;
252         ZoomBar *zoombar;
253         StatusBar *statusbar;
254         PaneButton *pane_button;
255         BC_Popup *x_pane_drag;
256         BC_Popup *y_pane_drag;
257         int dragging_pane;
258 // Cursor used to select a region in all panes
259 //      MainCursor *cursor;
260 // Dimensions of canvas minus scrollbars
261 //      int view_w, view_h;
262 // pane number where cursor updates should be drawn in, whether active or not
263         int focused_pane;
264
265
266         BC_DragWindow *drag_popup;
267
268 //      PatchBay *patchbay;
269 //      MTimeBar *timebar;
270 //      SampleScroll *samplescroll;
271 //      TrackScroll *trackscroll;
272 //      TrackCanvas *canvas;
273
274 // remote control
275         AndroidControl *android_control;
276         RemoteControl *remote_control;
277         WinTV *wintv;
278         X10TV *x10tv;
279         RemoteHandler *cwindow_remote_handler;
280         RemoteHandler *record_remote_handler;
281 };
282
283 #endif