1 #ifndef RECORDBATCHES_H
2 #define RECORDBATCHES_H
7 #include "bclistboxitem.inc"
8 #include "channeldb.inc"
11 #include "recordbatches.inc"
12 #include "timeentry.h"
16 class RecordBatchesGUI;
21 static const char* batch_titles[];
22 static const int default_columnwidth[];
23 RecordBatchesGUI *gui;
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.
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];
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);
48 RecordBatches(MWindow *mwindow);
52 class RecordBatchesGUI : public BC_ListBox
55 RecordBatches &batches;
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);
80 class Dir : public BC_TextBox {
82 RecordBatches &batches;
83 char (&directory)[BCTEXTLEN];
84 ArrayList<BC_ListBoxItem*> *dir_entries;
85 char entries_dir[BCTEXTLEN];
88 void load_dirs(const char *path);
89 char *get_directory() { return directory; }
91 Dir(RecordBatches &batches, const char *dir, int x, int y);
95 class Path : public BC_TextBox {
97 RecordBatches &batches;
98 ArrayList<BC_ListBoxItem*> *file_entries;
102 Path(RecordBatches &batches, int x, int y);
106 class StartTime : public TimeEntry {
108 RecordBatches &batches;
110 StartTime(BC_Window *win, RecordBatches &batches,
111 int x, int y, int w=DEFAULT_TIMEW);
114 class Duration : public TimeEntry
117 RecordBatches &batches;
119 Duration(BC_Window *win, RecordBatches &batches,
120 int x, int y, int w=DEFAULT_TIMEW);
123 class Margin : public TimeEntry
125 RecordBatches &batches;
127 Margin(BC_Window *win, RecordBatches &batches, int x, int y);
133 ArrayList<BC_ListBoxItem*> sources;
136 class Source : protected Sources, public BC_PopupTextBox {
138 RecordBatches &batches;
140 Source(BC_Window *win, RecordBatches &batches, int x, int y);
143 class News : public BC_TextBox {
145 RecordBatches &batches;
147 News(RecordBatches &batches, int x, int y);
150 class NewBatch : public BC_GenericButton {
152 RecordBatches &batches;
154 NewBatch(RecordBatches &batches, int x, int y);
157 class DeleteBatch : public BC_GenericButton {
159 RecordBatches &batches;
161 DeleteBatch(RecordBatches &batches, int x, int y);
164 class StartBatches : public BC_GenericButton {
166 RecordBatches &batches;
168 StartBatches(RecordBatches &batches, int x, int y);
171 class StopBatches : public BC_GenericButton {
173 RecordBatches &batches;
175 StopBatches(RecordBatches &batches, int x, int y);
178 class ActivateBatch : public BC_GenericButton {
180 RecordBatches &batches;
182 ActivateBatch(RecordBatches &batches, int x, int y);
185 class ClearBatch : public BC_GenericButton {
187 RecordBatches &batches;
189 ClearBatch(RecordBatches &batches, int x, int y);