4 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #ifndef MAINWINDOWGUI_H
23 #define MAINWINDOWGUI_H
25 #include "androidcontrol.inc"
26 #include "channelinfo.inc"
27 #include "cwindow.inc"
28 #include "editpopup.inc"
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"
44 #include "remotecontrol.h"
45 #include "renderengine.inc"
46 #include "resourcepixmap.h"
47 #include "resourcethread.inc"
48 #include "samplescroll.inc"
49 #include "shbtnprefs.inc"
50 #include "statusbar.inc"
51 #include "swindow.inc"
52 #include "timelinepane.inc"
54 #include "trackcanvas.inc"
55 #include "trackpopup.inc"
56 #include "trackscroll.inc"
57 #include "transitionpopup.inc"
60 #include "zoombar.inc"
63 class PaneButton : public BC_Button
66 PaneButton(MWindow *mwindow, int x, int y);
67 int cursor_motion_event();
68 int button_release_event();
72 class FFMpegToggle : public BC_Toggle
75 FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
83 class StackButton : public BC_GenericButton
86 StackButton(MWindow *mwindow, int x, int y);
93 class ProxyToggle : public BC_Toggle
96 ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
109 class MWindowGUI : public BC_Window
112 MWindowGUI(MWindow *mwindow);
115 void create_objects();
116 // void get_scrollbars(int flush);
118 // ======================== event handlers
120 // Replace with update
121 void redraw_time_dependancies();
123 int focus_in_event();
124 int focus_out_event();
127 // NO_DRAW disable canvas draw
128 // IGNORE_THREAD to ignore picon thread
129 // NORMAL_DRAW for incremental drawing of resources
130 // FORCE_REDRAW for delete and redraw of resources
131 void update(int scrollbars,
138 void draw_overlays(int flash_it);
139 void draw_indexes(Indexable *indexable);
140 void update_title(char *path);
141 void update_timebar(int flush_it);
142 void update_timebar_highlights();
143 void update_patchbay();
144 void update_proxy_toggle();
145 void update_plugintoggles();
146 void update_scrollbars(int flush);
147 void draw_canvas(int redraw, int hide_cursor);
148 void flash_canvas(int flush);
149 int show_window(int flush=1);
150 void deactivate_timeline();
151 void activate_timeline();
154 void update_meters(ArrayList<double> *module_levels);
155 void draw_cursor(int do_plugintoggles);
156 void show_cursor(int do_plugintoggles /* = 1 */);
157 void hide_cursor(int do_plugintoggles /* = 1 */);
158 void update_cursor();
159 void set_playing_back(int value);
160 void set_editing_mode(int flush);
161 void set_meter_format(int mode, int min, int max);
162 void update_mixers(Track *track, int v);
163 void stop_transport(const char *lock_msg);
165 int translation_event();
166 int resize_event(int w, int h); // handle a resize event
167 int keypress_event();
168 int keyboard_listener(BC_WindowBase *wp);
169 int key_listener(int key);
170 void use_android_remote(int on);
171 int keyev_grab_remote();
175 int save_defaults(BC_Hash *defaults);
178 // Draw on the status bar only.
179 void show_message(const char *message, int msg_color=-1, int box_color=-1);
180 void update_default_message();
181 void reset_default_message();
182 void default_message();
183 void show_error(char *message, int color = BLACK);
184 int repeat_event(int64_t duration);
185 // Entry point for drag events in all windows
188 void default_positions();
190 // 1 if there are 2 panes vertically
191 int vertical_panes();
192 // 1 if there are 2 panes horizontally
193 int horizontal_panes();
195 // get pane number where cursor updates should be drawn in,
196 // whether active or not
197 TimelinePane* get_focused_pane();
198 void start_x_pane_drag();
199 void start_y_pane_drag();
200 void handle_pane_drag();
201 void stop_pane_drag();
202 void delete_x_pane(int cursor_x);
203 void create_x_pane(int cursor_x);
204 void create_y_pane(int cursor_y);
205 void delete_y_pane(int cursor_y);
206 void update_pane_dividers();
207 // load panes from EDL
209 void draw_samplemovement();
210 void draw_trackmovement();
213 // Return if the area bounded by x1 and x2 is visible between view_x1 and view_x2
214 static int visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2);
218 // For drawing nested EDL's
219 RenderEngine *render_engine;
220 // ID of nested EDL last drawn.
221 int render_engine_id;
224 ChannelInfo *channel_info;
228 TrackPopup *track_menu;
229 EditPopup *edit_menu;
230 PluginPopup *plugin_menu;
231 KeyframePopup *keyframe_menu;
232 KeyframeHidePopup *keyframe_hide;
233 BC_SubWindow *keyvalue_popup;
234 TransitionPopup *transition_menu;
236 MainClock *mainclock;
238 FFMpegToggle *ffmpeg_toggle;
239 ProxyToggle *proxy_toggle;
240 StackButton *stack_button;
241 PaneDivider *x_divider;
242 PaneDivider *y_divider;
243 TimelinePane *pane[TOTAL_PANES];
244 ResourceThread *resource_thread;
245 ArrayList<ResourcePixmap*> resource_pixmaps;
249 MainShBtns *mainshbtns;
251 StatusBar *statusbar;
252 PaneButton *pane_button;
253 BC_Popup *x_pane_drag;
254 BC_Popup *y_pane_drag;
256 // Cursor used to select a region in all panes
257 // MainCursor *cursor;
258 // Dimensions of canvas minus scrollbars
259 // int view_w, view_h;
260 // pane number where cursor updates should be drawn in, whether active or not
264 BC_DragWindow *drag_popup;
266 // PatchBay *patchbay;
267 // MTimeBar *timebar;
268 // SampleScroll *samplescroll;
269 // TrackScroll *trackscroll;
270 // TrackCanvas *canvas;
273 AndroidControl *android_control;
274 RemoteControl *remote_control;
277 RemoteHandler *cwindow_remote_handler;
278 RemoteHandler *record_remote_handler;