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
27 #include "filexml.inc"
29 #include "mwindow.inc"
30 #include "recordlabel.inc"
31 #include "testobject.h"
32 #include "timebar.inc"
33 #include "timelinepane.inc"
34 #include "vwindowgui.inc"
36 class TimeBarLeftArrow;
37 class TimeBarRightArrow;
42 class PresentationGUI;
44 // Operations for cursor
45 #define TIMEBAR_NONE 0
46 #define TIMEBAR_DRAG 1
47 #define TIMEBAR_DRAG_LEFT 2
48 #define TIMEBAR_DRAG_RIGHT 3
49 #define TIMEBAR_DRAG_CENTER 4
51 class LabelGUI : public BC_Toggle
54 LabelGUI(MWindow *mwindow,
62 static int translate_pixel(MWindow *mwindow, int pixel);
63 virtual int handle_event();
64 static int get_y(MWindow *mwindow, TimeBar *timebar);
65 void reposition(int flush = 1);
74 class TestPointGUI : public LabelGUI
77 TestPointGUI(MWindow *mwindow,
83 class InPointGUI : public LabelGUI
86 InPointGUI(MWindow *mwindow,
90 virtual ~InPointGUI();
91 static int get_y(MWindow *mwindow, TimeBar *timebar);
94 class OutPointGUI : public LabelGUI
97 OutPointGUI(MWindow *mwindow,
101 virtual ~OutPointGUI();
102 static int get_y(MWindow *mwindow, TimeBar *timebar);
105 class PresentationGUI : public LabelGUI
108 PresentationGUI(MWindow *mwindow,
115 class TimeBar : public BC_SubWindow
118 TimeBar(MWindow *mwindow,
126 virtual void create_objects();
127 int update_defaults();
128 virtual int button_press_event();
129 virtual int button_release_event();
130 int cursor_motion_event();
131 int cursor_leave_event();
132 virtual void update_clock(double position);
134 // Synchronize label, in/out, presentation display with master EDL
135 virtual void update(int flush);
136 virtual void draw_time();
137 // Called by update and draw_time.
138 virtual void draw_range();
139 virtual void select_label(double position);
140 virtual void stop_playback();
141 virtual EDL* get_edl();
142 virtual int test_preview(int buttonpress);
143 virtual void update_preview();
144 virtual int64_t position_to_pixel(double position);
145 virtual double pixel_to_position(int pixel);
146 virtual void handle_mwindow_drag();
147 virtual void activate_timeline();
148 int move_preview(int &redraw);
149 // Get highlight status when the cursor is over the timeline.
150 virtual double test_highlight();
151 virtual int has_preview() { return 0; }
154 void update_labels();
155 void update_points();
156 // Make sure widgets are highlighted according to selection status
157 void update_highlights();
158 // Update highlight cursor during a drag
159 virtual void update_cursor();
161 // ================================= file operations
163 int save(FileXML *xml);
164 int load(FileXML *xml, int undo_type);
166 int delete_project(); // clear timebar of labels
168 int draw(); // draw everything over
169 int samplemovement();
170 int refresh_labels();
172 // ========================================= editing
174 int select_region(double position);
175 double get_edl_length();
180 int flip_vertical(int w, int h);
181 int delete_arrows(); // for flipping vertical
183 // Operation started by a buttonpress
184 int current_operation;
187 int get_preview_pixels(int &x1, int &x2);
189 ArrayList<LabelGUI*> labels;
190 InPointGUI *in_point;
191 OutPointGUI *out_point;
192 ArrayList<PresentationGUI*> presentations;
196 // Records for dragging operations
197 double start_position;
198 double starting_start_position;
199 double starting_end_position;
200 double time_per_pixel;