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