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