r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / timebar.h
blob8fcec486096bd8da8c3981f6a6b8e69ed8decaef
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 "mwindow.inc"
9 #include "recordlabel.inc"
10 #include "testobject.h"
11 #include "timebar.inc"
12 #include "vwindowgui.inc"
14 class TimeBarLeftArrow;
15 class TimeBarRightArrow;
17 class LabelGUI;
18 class InPointGUI;
19 class OutPointGUI;
20 class PresentationGUI;
22 // Operations for cursor
23 #define TIMEBAR_NONE 0
24 #define TIMEBAR_DRAG 1
25 #define TIMEBAR_DRAG_LEFT 2
26 #define TIMEBAR_DRAG_RIGHT 3
27 #define TIMEBAR_DRAG_CENTER 4
29 class LabelGUI : public BC_Toggle
31 public:
32 LabelGUI(MWindow *mwindow,
33 TimeBar *timebar,
34 int64_t pixel,
35 int y,
36 double position,
37 VFrame **data = 0);
38 virtual ~LabelGUI();
40 static int translate_pixel(MWindow *mwindow, int pixel);
41 virtual int handle_event();
42 static int get_y(MWindow *mwindow, TimeBar *timebar);
43 void reposition();
45 MWindow *mwindow;
46 VWindowGUI *gui;
47 TimeBar *timebar;
48 int64_t pixel;
49 double position;
52 class TestPointGUI : public LabelGUI
54 public:
55 TestPointGUI(MWindow *mwindow,
56 TimeBar *timebar,
57 int64_t pixel,
58 double position);
61 class InPointGUI : public LabelGUI
63 public:
64 InPointGUI(MWindow *mwindow,
65 TimeBar *timebar,
66 int64_t pixel,
67 double position);
68 virtual ~InPointGUI();
69 static int get_y(MWindow *mwindow, TimeBar *timebar);
72 class OutPointGUI : public LabelGUI
74 public:
75 OutPointGUI(MWindow *mwindow,
76 TimeBar *timebar,
77 int64_t pixel,
78 double position);
79 virtual ~OutPointGUI();
80 static int get_y(MWindow *mwindow, TimeBar *timebar);
83 class PresentationGUI : public LabelGUI
85 public:
86 PresentationGUI(MWindow *mwindow,
87 TimeBar *timebar,
88 int64_t pixel,
89 double position);
90 ~PresentationGUI();
93 class TimeBar : public BC_SubWindow
95 public:
96 TimeBar(MWindow *mwindow,
97 BC_WindowBase *gui,
98 int x,
99 int y,
100 int w,
101 int h);
102 virtual ~TimeBar();
104 int create_objects();
105 int update_defaults();
106 int button_press_event();
107 int button_release_event();
108 int cursor_motion_event();
109 int repeat_event(int64_t duration);
111 // Synchronize label, in/out, presentation display with master EDL
112 void update(int do_range = 1, int do_others = 1);
113 virtual void draw_time();
114 // Called by update and draw_time.
115 virtual void draw_range();
116 virtual void select_label(double position);
117 virtual void stop_playback();
118 virtual EDL* get_edl();
119 virtual int test_preview(int buttonpress);
120 virtual void update_preview();
121 virtual int64_t position_to_pixel(double position);
122 int move_preview(int &redraw);
125 void update_labels();
126 void update_points();
127 void update_presentations();
128 // Make sure widgets are highlighted according to selection status
129 void update_highlights();
130 // Update highlight cursor during a drag
131 void update_cursor();
133 // ================================= file operations
135 int save(FileXML *xml);
136 int load(FileXML *xml, int undo_type);
138 int delete_project(); // clear timebar of labels
140 int draw(); // draw everything over
141 int samplemovement();
142 int refresh_labels();
144 // ========================================= editing
146 int copy(int64_t start, int64_t end, FileXML *xml);
147 int paste(int64_t start, int64_t end, int64_t sample_length, FileXML *xml);
148 int paste_output(int64_t startproject, int64_t endproject, int64_t startsource, int64_t endsource, RecordLabels *new_labels);
149 int clear(int64_t start, int64_t end);
150 int paste_silence(int64_t start, int64_t end);
151 int modify_handles(int64_t oldposition, int64_t newposition, int currentend);
152 int select_region(double position);
153 void get_edl_length();
155 MWindow *mwindow;
156 BC_WindowBase *gui;
157 int flip_vertical(int w, int h);
158 int delete_arrows(); // for flipping vertical
160 // Operation started by a buttonpress
161 int current_operation;
164 private:
165 int get_preview_pixels(int &x1, int &x2);
166 int draw_bevel();
167 ArrayList<LabelGUI*> labels;
168 InPointGUI *in_point;
169 OutPointGUI *out_point;
170 ArrayList<PresentationGUI*> presentations;
173 // Records for dragging operations
174 double start_position;
175 double starting_start_position;
176 double starting_end_position;
177 double time_per_pixel;
178 double edl_length;
179 int start_cursor_x;
183 #endif