4 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "filexml.inc"
30 #include "labeledit.inc"
31 #include "mwindow.inc"
32 #include "recordlabel.inc"
33 #include "testobject.h"
34 #include "timebar.inc"
35 #include "timelinepane.inc"
36 #include "vwindowgui.inc"
38 class TimeBarLeftArrow;
39 class TimeBarRightArrow;
44 class PresentationGUI;
46 // Operations for cursor
47 #define TIMEBAR_NONE 0
48 #define TIMEBAR_DRAG 1
49 #define TIMEBAR_DRAG_LEFT 2
50 #define TIMEBAR_DRAG_RIGHT 3
51 #define TIMEBAR_DRAG_CENTER 4
52 #define TIMEBAR_DRAG_LABEL 5
54 class LabelGUI : public BC_Toggle
57 LabelGUI(MWindow *mwindow,
65 static int translate_pixel(MWindow *mwindow, int pixel);
66 virtual int handle_event();
67 static int get_y(MWindow *mwindow, TimeBar *timebar);
68 void reposition(int flush = 1);
70 int test_drag_label(int press);
73 int button_press_event();
74 int button_release_event();
82 class TestPointGUI : public LabelGUI
85 TestPointGUI(MWindow *mwindow,
91 class InPointGUI : public LabelGUI
94 InPointGUI(MWindow *mwindow,
98 virtual ~InPointGUI();
99 static int get_y(MWindow *mwindow, TimeBar *timebar);
102 class OutPointGUI : public LabelGUI
105 OutPointGUI(MWindow *mwindow,
109 virtual ~OutPointGUI();
110 static int get_y(MWindow *mwindow, TimeBar *timebar);
113 class PresentationGUI : public LabelGUI
116 PresentationGUI(MWindow *mwindow,
123 class TimeBar : public BC_SubWindow
126 TimeBar(MWindow *mwindow,
134 virtual void create_objects();
135 int update_defaults();
136 virtual int button_press_event();
137 virtual int button_release_event();
138 int cursor_motion_event();
139 int cursor_leave_event();
140 virtual void update_clock(double position);
142 LabelEdit *label_edit;
144 // Synchronize label, in/out, presentation display with master EDL
145 virtual void update(int flush);
146 virtual void draw_time();
147 // Called by update and draw_time.
148 virtual void draw_range();
149 virtual void select_label(double position);
150 virtual void stop_playback();
151 virtual EDL* get_edl();
152 virtual int test_preview(int buttonpress);
153 virtual void update_preview();
154 virtual int64_t position_to_pixel(double position);
155 virtual double pixel_to_position(int pixel);
156 virtual void handle_mwindow_drag();
157 virtual void activate_timeline();
158 int move_preview(int &redraw);
159 // Get highlight status when the cursor is over the timeline.
160 virtual double test_highlight();
161 virtual int has_preview() { return 0; }
162 virtual int is_vwindow() { return 0; }
165 void update_labels();
166 void update_points();
167 // Make sure widgets are highlighted according to selection status
168 void update_highlights();
169 void draw_inout_highlight();
170 // Update highlight cursor during a drag
171 virtual void update_cursor();
173 // ================================= file operations
175 int save(FileXML *xml);
176 int load(FileXML *xml, int undo_type);
178 int delete_project(); // clear timebar of labels
180 int draw(); // draw everything over
181 int samplemovement();
182 int refresh_labels();
184 // ========================================= editing
186 int select_region(double position);
187 double get_edl_length();
192 int flip_vertical(int w, int h);
193 int delete_arrows(); // for flipping vertical
195 // Operation started by a buttonpress
196 int current_operation;
197 LabelGUI *drag_label;
200 int get_preview_pixels(int &x1, int &x2);
202 ArrayList<LabelGUI*> labels;
203 InPointGUI *in_point;
204 OutPointGUI *out_point;
205 ArrayList<PresentationGUI*> presentations;
209 // Records for dragging operations
210 double start_position;
211 double starting_start_position;
212 double starting_end_position;
213 double time_per_pixel;