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"
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"
55 #include "trackcanvas.inc"
56 #include "trackscroll.inc"
57 #include "transitionpopup.inc"
58 #include "zoombar.inc"
61 class PaneButton : public BC_Button
64 PaneButton(MWindow *mwindow, int x, int y);
65 int cursor_motion_event();
66 int button_release_event();
70 class FFMpegToggle : public BC_Toggle
73 FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
81 class ProxyToggle : public BC_Toggle
84 ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y);
97 class MWindowGUI : public BC_Window
100 MWindowGUI(MWindow *mwindow);
103 void create_objects();
104 // void get_scrollbars(int flush);
106 // ======================== event handlers
108 // Replace with update
109 void redraw_time_dependancies();
111 int focus_in_event();
112 int focus_out_event();
114 // do_canvas - 1 for incremental drawing of resources
115 // FORCE_REDRAW for delete and redraw of resources
116 // IGNORE_THREAD to ignore picon thread
117 void update(int scrollbars,
124 void draw_overlays(int flash_it);
125 void draw_indexes(Indexable *indexable);
126 void update_title(char *path);
127 void update_timebar(int flush_it);
128 void update_timebar_highlights();
129 void update_patchbay();
130 void update_proxy_toggle();
131 void update_plugintoggles();
132 void update_scrollbars(int flush);
133 void draw_canvas(int mode, int hide_cursor);
134 void flash_canvas(int flush);
135 int show_window(int flush=1);
136 void deactivate_timeline();
137 void activate_timeline();
140 void update_meters(ArrayList<double> *module_levels);
141 void draw_cursor(int do_plugintoggles);
142 void show_cursor(int do_plugintoggles /* = 1 */);
143 void hide_cursor(int do_plugintoggles /* = 1 */);
144 void update_cursor();
145 void set_playing_back(int value);
146 void set_editing_mode(int flush);
147 void set_meter_format(int mode, int min, int max);
148 void update_mixers(Track *track, int v);
149 void stop_transport(const char *lock_msg);
151 int translation_event();
152 int resize_event(int w, int h); // handle a resize event
153 int keypress_event();
154 int keyboard_listener(BC_WindowBase *wp);
155 int key_listener(int key);
156 void use_android_remote(int on);
160 int save_defaults(BC_Hash *defaults);
163 // Draw on the status bar only.
164 void show_message(const char *message, int color=-1);
165 void update_default_message();
166 void reset_default_message();
167 void default_message();
168 void show_error(char *message, int color = BLACK);
169 int repeat_event(int64_t duration);
170 // Entry point for drag events in all windows
173 void default_positions();
175 // 1 if there are 2 panes vertically
176 int vertical_panes();
177 // 1 if there are 2 panes horizontally
178 int horizontal_panes();
180 // get pane number where cursor updates should be drawn in,
181 // whether active or not
182 TimelinePane* get_focused_pane();
183 void start_x_pane_drag();
184 void start_y_pane_drag();
185 void handle_pane_drag();
186 void stop_pane_drag();
187 void delete_x_pane(int cursor_x);
188 void create_x_pane(int cursor_x);
189 void create_y_pane(int cursor_y);
190 void delete_y_pane(int cursor_y);
191 void update_pane_dividers();
192 // load panes from EDL
194 void draw_samplemovement();
195 void draw_trackmovement();
198 // Return if the area bounded by x1 and x2 is visible between view_x1 and view_x2
199 static int visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2);
203 // For drawing nested EDL's
204 RenderEngine *render_engine;
205 // ID of nested EDL last drawn.
206 int render_engine_id;
209 ChannelInfo *channel_info;
213 EditPopup *edit_menu;
214 PluginPopup *plugin_menu;
215 KeyframePopup *keyframe_menu;
216 KeyframeHidePopup *keyframe_hide;
217 BC_SubWindow *keyvalue_popup;
218 TransitionPopup *transition_menu;
220 MainClock *mainclock;
222 FFMpegToggle *ffmpeg_toggle;
223 ProxyToggle *proxy_toggle;
224 PaneDivider *x_divider;
225 PaneDivider *y_divider;
226 TimelinePane *pane[TOTAL_PANES];
227 ResourceThread *resource_thread;
228 ArrayList<ResourcePixmap*> resource_pixmaps;
232 MainShBtns *mainshbtns;
234 StatusBar *statusbar;
235 PaneButton *pane_button;
236 BC_Popup *x_pane_drag;
237 BC_Popup *y_pane_drag;
239 // Cursor used to select a region in all panes
240 // MainCursor *cursor;
241 // Dimensions of canvas minus scrollbars
242 // int view_w, view_h;
243 // pane number where cursor updates should be drawn in, whether active or not
247 BC_DragWindow *drag_popup;
249 // PatchBay *patchbay;
250 // MTimeBar *timebar;
251 // SampleScroll *samplescroll;
252 // TrackScroll *trackscroll;
253 // TrackCanvas *canvas;
256 AndroidControl *android_control;
257 RemoteControl *remote_control;
258 CWindowRemoteHandler *cwindow_remote_handler;
259 RecordRemoteHandler *record_remote_handler;