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