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