6 #include "recordlabel.h"
13 Batch::Batch(MWindow *mwindow, Record *record)
15 this->mwindow = mwindow;
16 this->record = record;
18 start_type = RECORD_START;
24 record_mode = RECORD_INFINITE;
26 // Create default asset
37 assets.append(new Asset);
38 labels = new RecordLabels;
44 for(int i = 0; i < assets.total; i++)
45 delete assets.values[i];
51 int Batch::create_objects()
56 void Batch::start_over()
61 while(labels->last) delete labels->last;
68 void Batch::copy_from(Batch *batch)
70 enabled = batch->enabled;
71 channel = batch->channel;
72 start_type = batch->start_type;
73 duration = batch->duration;
74 start_time = batch->start_time;
75 start_day = batch->start_day;
76 record_mode = batch->record_mode;
80 void Batch::calculate_news()
83 if(record->get_current_batch() == this && record->file)
85 sprintf(news, "Open");
89 // Test file existance
90 FILE *test = fopen(get_current_asset()->path, "r");
94 sprintf(news, "File exists");
102 void Batch::create_default_path()
104 char *path = get_current_asset()->path;
105 char string[BCTEXTLEN];
106 int i, j = -1, k = -1;
107 int number = record->batches.total;
109 strcpy(string, record->default_asset->path);
110 strcpy(path, record->default_asset->path);
112 // Find first number in path
113 for(i = 0; i < strlen(path); i++)
115 if(path[i] >= '0' && path[i] <= '9') j = i;
116 if((path[i] < '0' || path[i] > '9') && j >= 0 && k < 0) k = i;
130 sprintf(&path[j], "%d", record->batches.total);
131 strcat(path, &string[k]);
135 int Batch::text_to_mode(char *text)
137 if(!strcasecmp(mode_to_text(RECORD_INFINITE), text)) return RECORD_INFINITE;
138 if(!strcasecmp(mode_to_text(RECORD_TIMED), text)) return RECORD_TIMED;
139 // if(!strcasecmp(mode_to_text(RECORD_LOOP), text)) return RECORD_LOOP;
140 // if(!strcasecmp(mode_to_text(RECORD_SCENETOSCENE), text)) return RECORD_SCENETOSCENE;
141 return RECORD_INFINITE;
144 char* Batch::mode_to_text(int record_mode)
148 case RECORD_INFINITE:
157 // case RECORD_SCENETOSCENE:
158 // return "Scene to scene";
164 Asset* Batch::get_current_asset()
166 return assets.values[current_asset];
170 Channel* Batch::get_current_channel_struct()
172 if(record->current_channeldb())
174 if(channel >= 0 && channel < record->current_channeldb()->total)
176 return record->current_channeldb()->values[channel];
183 char* Batch::get_source_text()
186 Channel *channel = get_current_channel_struct();
188 return channel->title;
193 void Batch::toggle_label(double position)
195 labels->toggle_label(position);