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