add bluray dv, misc fixes
[goodguy/history.git] / cinelerra-5.1 / cinelerra / recordbatches.h
1 #ifndef RECORDBATCHES_H
2 #define RECORDBATCHES_H
3
4 #include "arraylist.h"
5 #include "batch.h"
6 #include "bclistbox.h"
7 #include "bclistboxitem.inc"
8 #include "channeldb.inc"
9 #include "guicast.h"
10 #include "record.inc"
11 #include "recordbatches.inc"
12 #include "timeentry.h"
13
14 #include <string.h>
15
16 class RecordBatchesGUI;
17
18 class RecordBatches
19 {
20 public:
21         static const char* batch_titles[];
22         static const int default_columnwidth[];
23         RecordBatchesGUI *gui;
24         MWindow *mwindow;
25 //  Don't want to interrupt recording to edit a different batch.
26         int current_item; // Current batch being recorded.
27         int editing_item; // Current batch being edited.
28         int batch_active;
29         int column_widths[BATCH_COLUMNS];
30         ArrayList<BC_ListBoxItem*> data[BATCH_COLUMNS];
31         ArrayList<Batch*> batches;
32         double early_margin, late_margin;
33         char default_directory[BCTEXTLEN];
34
35         void load_defaults(ChannelDB *channeldb, Record *record=0);
36         void save_defaults(ChannelDB *channeldb);
37         void save_default_channel(ChannelDB *channeldb);
38         Batch *&operator [](int i) { return batches.values[i]; }
39         Batch* get_current_batch() { return batches.values[current_item]; }
40         Batch* get_editing_batch() { return batches.values[editing_item]; }
41         double *get_early_margin() { return &early_margin; }
42         double *get_late_margin() { return &late_margin; }
43         char *get_default_directory() { return default_directory; }
44         int total() { return batches.total; }
45         void append(Batch *batch) { batches.append(batch); }
46         void remove(Batch *batch);
47         void clear();
48         RecordBatches(MWindow *mwindow);
49         ~RecordBatches();
50 };
51
52 class RecordBatchesGUI : public BC_ListBox
53 {
54 public:
55         RecordBatches &batches;
56         int dragging_item;
57
58         int handle_event();
59         virtual int selection_changed() = 0;
60         int update(int highlighted_item, int recalc_positions);
61         int update() { return update(get_highlighted_item(), 0); }
62         int column_resize_event();
63         int drag_start_event();
64         int drag_motion_event();
65         int drag_stop_event();
66         void set_row_color(int i, int color);
67         void calculate_batches(int selection_number);
68         void update_batch_news(int item);
69         void update_batches(int selection_item);
70         void update_batches() { return update_batches(get_selection_number(0, 0)); }
71         int editing_batch() { return batches.editing_item; }
72         int set_editing_batch(int i) { return batches.editing_item=i; }
73         int current_batch() { return batches.current_item; }
74         int set_current_batch(int i) { return batches.current_item=i; }
75         int count() { return batches.data[0].total; }
76         Batch* get_current_batch() { return batches.get_current_batch(); }
77         Batch* get_editing_batch() { return batches.get_editing_batch(); }
78         RecordBatchesGUI(RecordBatches &batches, int x, int y, int w, int h);
79
80         class Dir : public BC_TextBox {
81         public:
82                 RecordBatches &batches;
83                 char (&directory)[BCTEXTLEN];
84                 ArrayList<BC_ListBoxItem*> *dir_entries;
85                 char entries_dir[BCTEXTLEN];
86
87                 int handle_event();
88                 void load_dirs(const char *path);
89                 char *get_directory() { return directory; }
90
91                 Dir(RecordBatches &batches, const char *dir, int x, int y);
92                 ~Dir();
93         };
94
95         class Path : public BC_TextBox {
96         public:
97                 RecordBatches &batches;
98
99                 int handle_event();
100
101                 Path(RecordBatches &batches, int x, int y);
102                 ~Path();
103         };
104
105         class StartTime : public TimeEntry {
106         public:
107                 RecordBatches &batches;
108                 int handle_event();
109                 StartTime(BC_Window *win, RecordBatches &batches,
110                         int x, int y, int w=DEFAULT_TIMEW);
111         };
112
113         class Duration : public TimeEntry
114         {
115         public:
116                 RecordBatches &batches;
117                 int handle_event();
118                 Duration(BC_Window *win, RecordBatches &batches,
119                         int x, int y, int w=DEFAULT_TIMEW);
120         };
121
122         class Margin : public TimeEntry
123         {
124                 RecordBatches &batches;
125                 int handle_event();
126                 Margin(BC_Window *win, RecordBatches &batches, int x, int y);
127         };
128
129         class Sources
130         {
131         public:
132                 ArrayList<BC_ListBoxItem*> sources;
133         };
134
135         class Source : protected Sources, public BC_PopupTextBox {
136         public:
137                 RecordBatches &batches;
138                 int handle_event();
139                 Source(BC_Window *win, RecordBatches &batches, int x, int y);
140         };
141
142         class News : public BC_TextBox {
143         public:
144                 RecordBatches &batches;
145                 int handle_event();
146                 News(RecordBatches &batches, int x, int y);
147         };
148
149         class NewBatch : public BC_GenericButton {
150         public:
151                 RecordBatches &batches;
152                 int handle_event();
153                 NewBatch(RecordBatches &batches, int x, int y);
154         };
155
156         class DeleteBatch : public BC_GenericButton {
157         public:
158                 RecordBatches &batches;
159                 int handle_event();
160                 DeleteBatch(RecordBatches &batches, int x, int y);
161         };
162
163         class StartBatches : public BC_GenericButton {
164         public:
165                 RecordBatches &batches;
166                 int handle_event();
167                 StartBatches(RecordBatches &batches, int x, int y);
168         };
169
170         class StopBatches : public BC_GenericButton {
171         public:
172                 RecordBatches &batches;
173                 int handle_event();
174                 StopBatches(RecordBatches &batches, int x, int y);
175         };
176
177         class ActivateBatch : public BC_GenericButton {
178         public:
179                 RecordBatches &batches;
180                 int handle_event();
181                 ActivateBatch(RecordBatches &batches, int x, int y);
182         };
183
184         class ClearBatch : public BC_GenericButton {
185         public:
186                 RecordBatches &batches;
187                 int handle_event();
188                 ClearBatch(RecordBatches &batches, int x, int y);
189         };
190 };
191
192 #endif