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