Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / vwindowgui.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 VWINDOWGUI_H
23 #define VWINDOWGUI_H
24
25 #include "asset.inc"
26 #include "canvas.h"
27 #include "editpanel.h"
28 #include "guicast.h"
29 #include "mainclock.inc"
30 #include "meterpanel.h"
31 #include "mwindow.inc"
32 #include "playtransport.h"
33
34 #include "timebar.h"
35
36 #include "vtimebar.inc"
37 #include "vwindow.inc"
38 #include "zoompanel.h"
39
40 class VWindowZoom;
41 class VWindowSource;
42 class VWindowTransport;
43 class VWindowEditing;
44 class VWindowCanvas;
45 class VWindowMeters;
46 class VWindowInPoint;
47 class VWindowOutPoint;
48
49 class VWindowGUI : public BC_Window
50 {
51 public:
52         VWindowGUI(MWindow *mwindow, VWindow *vwindow);
53         ~VWindowGUI();
54
55         void create_objects();
56         int resize_event(int w, int h);
57         int translation_event();
58         int close_event();
59         int keypress_event();
60         int button_press_event();
61         int cursor_leave_event();
62         int cursor_enter_event();
63         int button_release_event();
64         int cursor_motion_event();
65 // Update source pulldown with new assets
66         void update_sources(const char *title);
67 // Update GUI to reflect new source
68         void change_source(EDL *edl, const char *title);
69         void drag_motion();
70         int drag_stop();
71 //      void update_labels();
72 //      void update_points();
73         void update_meters();
74
75         MWindow *mwindow;
76         VWindow *vwindow;
77
78 // Meters are numbered from right to left
79         VWindowCanvas *canvas;
80
81         BC_Title *fps_title;
82         MainClock *clock;
83         VTimeBar *timebar;
84         VWindowZoom *zoom_panel;
85         VWindowTransport *transport;
86         VWindowEditing *edit_panel;
87 //      VWindowSource *source;
88         VWindowMeters *meters;
89         ArrayList<BC_ListBoxItem*> sources;
90         ArrayList<LabelGUI*> labels;
91         VWindowInPoint *in_point;
92         VWindowOutPoint *out_point;
93         char loaded_title[BCTEXTLEN];
94 private:
95         void get_scrollbars(int &canvas_x, int &canvas_y, int &canvas_w, int &canvas_h);
96 };
97
98
99 class VWindowMeters : public MeterPanel
100 {
101 public:
102         VWindowMeters(MWindow *mwindow, VWindowGUI *gui, int x, int y, int h);
103         ~VWindowMeters();
104
105         int change_status_event(int new_status);
106
107         MWindow *mwindow;
108         VWindowGUI *gui;
109 };
110
111
112 class VWindowCanvas : public Canvas
113 {
114 public:
115         VWindowCanvas(MWindow *mwindow, VWindowGUI *gui);
116
117         void zoom_resize_window(float percentage);
118         void draw_refresh(int flush = 1);
119         void draw_overlays();
120         void close_source();
121         int get_fullscreen();
122         void set_fullscreen(int value);
123
124         MWindow *mwindow;
125         VWindowGUI *gui;
126 };
127
128 class VWindowEditing : public EditPanel
129 {
130 public:
131         VWindowEditing(MWindow *mwindow, VWindow *vwindow);
132         virtual ~VWindowEditing();
133
134         void copy_selection();
135         void splice_selection();
136         void overwrite_selection();
137         void set_inpoint();
138         void set_outpoint();
139         void clear_inpoint();
140         void clear_outpoint();
141         void to_clip();
142         void toggle_label();
143         void prev_label();
144         void next_label();
145         double get_position();
146         void set_position(double position);
147
148         MWindow *mwindow;
149         VWindow *vwindow;
150 };
151
152 class VWindowZoom : public ZoomPanel
153 {
154 public:
155         VWindowZoom(MWindow *mwindow, VWindowGUI *gui, int x, int y);
156         ~VWindowZoom();
157         int handle_event();
158         MWindow *mwindow;
159         VWindowGUI *gui;
160 };
161
162
163 class VWindowSource : public BC_PopupTextBox
164 {
165 public:
166         VWindowSource(MWindow *mwindow, VWindowGUI *vwindow, int x, int y);
167         ~VWindowSource();
168         int handle_event();
169         VWindowGUI *vwindow;
170         MWindow *mwindow;
171 };
172
173 class VWindowTransport : public PlayTransport
174 {
175 public:
176         VWindowTransport(MWindow *mwindow,
177                 VWindowGUI *gui,
178                 int x,
179                 int y);
180         EDL* get_edl();
181         void goto_start();
182         void goto_end();
183
184         VWindowGUI *gui;
185 };
186
187 class VWindowInPoint : public InPointGUI
188 {
189 public:
190         VWindowInPoint(MWindow *mwindow,
191                 TimeBar *timebar,
192                 VWindowGUI *gui,
193                 long pixel,
194                 double position);
195         int handle_event();
196         VWindowGUI *gui;
197 };
198
199
200 class VWindowOutPoint : public OutPointGUI
201 {
202 public:
203         VWindowOutPoint(MWindow *mwindow,
204                 TimeBar *timebar,
205                 VWindowGUI *gui,
206                 long pixel,
207                 double position);
208         int handle_event();
209         VWindowGUI *gui;
210 };
211
212 #endif