Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / timebar.h
blobbef3bb0adaeb95fa16d0e03a718e510aadc02311
1 #ifndef TIMEBAR_H
2 #define TIMEBAR_H
4 #include "edl.inc"
5 #include "guicast.h"
6 #include "filexml.inc"
7 #include "labels.inc"
8 #include "labeledit.inc"
9 #include "mwindow.inc"
10 #include "recordlabel.inc"
11 #include "testobject.h"
12 #include "timebar.inc"
13 #include "vwindowgui.inc"
15 class TimeBarLeftArrow;
16 class TimeBarRightArrow;
18 class LabelGUI;
19 class InPointGUI;
20 class OutPointGUI;
21 class PresentationGUI;
23 // Operations for cursor
24 #define TIMEBAR_NONE 0
25 #define TIMEBAR_DRAG 1
26 #define TIMEBAR_DRAG_LEFT 2
27 #define TIMEBAR_DRAG_RIGHT 3
28 #define TIMEBAR_DRAG_CENTER 4
30 class LabelGUI : public BC_Toggle
32 public:
33 LabelGUI(MWindow *mwindow,
34 TimeBar *timebar,
35 int64_t pixel,
36 int y,
37 double position,
38 VFrame **data = 0);
39 virtual ~LabelGUI();
41 static int translate_pixel(MWindow *mwindow, int pixel);
42 virtual int handle_event();
43 static int get_y(MWindow *mwindow, TimeBar *timebar);
44 void reposition();
46 Label *label;
47 int button_press_event();
48 MWindow *mwindow;
49 VWindowGUI *gui;
50 TimeBar *timebar;
51 int64_t pixel;
52 double position;
55 class TestPointGUI : public LabelGUI
57 public:
58 TestPointGUI(MWindow *mwindow,
59 TimeBar *timebar,
60 int64_t pixel,
61 double position);
64 class InPointGUI : public LabelGUI
66 public:
67 InPointGUI(MWindow *mwindow,
68 TimeBar *timebar,
69 int64_t pixel,
70 double position);
71 virtual ~InPointGUI();
72 static int get_y(MWindow *mwindow, TimeBar *timebar);
75 class OutPointGUI : public LabelGUI
77 public:
78 OutPointGUI(MWindow *mwindow,
79 TimeBar *timebar,
80 int64_t pixel,
81 double position);
82 virtual ~OutPointGUI();
83 static int get_y(MWindow *mwindow, TimeBar *timebar);
86 class PresentationGUI : public LabelGUI
88 public:
89 PresentationGUI(MWindow *mwindow,
90 TimeBar *timebar,
91 int64_t pixel,
92 double position);
93 ~PresentationGUI();
96 class TimeBar : public BC_SubWindow
98 public:
99 TimeBar(MWindow *mwindow,
100 BC_WindowBase *gui,
101 int x,
102 int y,
103 int w,
104 int h);
105 virtual ~TimeBar();
107 int create_objects();
108 int update_defaults();
109 int button_press_event();
110 int button_release_event();
111 int cursor_motion_event();
112 int repeat_event(int64_t duration);
114 LabelEdit *label_edit;
116 // Synchronize label, in/out, presentation display with master EDL
117 void update(int do_range = 1, int do_others = 1);
118 virtual void draw_time();
119 // Called by update and draw_time.
120 virtual void draw_range();
121 virtual void select_label(double position);
122 virtual void stop_playback();
123 virtual EDL* get_edl();
124 virtual int test_preview(int buttonpress);
125 virtual void update_preview();
126 virtual int64_t position_to_pixel(double position);
127 int move_preview(int &redraw);
130 void update_labels();
131 void update_points();
132 void update_presentations();
133 // Make sure widgets are highlighted according to selection status
134 void update_highlights();
135 // Update highlight cursor during a drag
136 void update_cursor();
138 // ================================= file operations
140 int save(FileXML *xml);
141 int load(FileXML *xml, int undo_type);
143 int delete_project(); // clear timebar of labels
145 int draw(); // draw everything over
146 int samplemovement();
147 int refresh_labels();
149 // ========================================= editing
151 int select_region(double position);
152 void get_edl_length();
154 MWindow *mwindow;
155 BC_WindowBase *gui;
156 int flip_vertical(int w, int h);
157 int delete_arrows(); // for flipping vertical
159 // Operation started by a buttonpress
160 int current_operation;
163 private:
164 int get_preview_pixels(int &x1, int &x2);
165 int draw_bevel();
166 ArrayList<LabelGUI*> labels;
167 InPointGUI *in_point;
168 OutPointGUI *out_point;
169 ArrayList<PresentationGUI*> presentations;
172 // Records for dragging operations
173 double start_position;
174 double starting_start_position;
175 double starting_end_position;
176 double time_per_pixel;
177 double edl_length;
178 int start_cursor_x;
182 #endif
184 // Local Variables:
185 // mode: C++
186 // c-file-style: "linux"
187 // End: