7 #include "recordlabel.h"
14 Batch::Batch(MWindow *mwindow, Record *record)
16 this->mwindow = mwindow;
17 this->record = record;
19 start_type = RECORD_START;
25 record_mode = RECORD_INFINITE;
27 // Create default asset
38 assets.append(new Asset);
39 labels = new RecordLabels;
45 for(int i = 0; i < assets.total; i++)
46 Garbage::delete_object(assets.values[i]);
52 int Batch::create_objects()
57 void Batch::start_over()
62 while(labels->last) delete labels->last;
69 void Batch::copy_from(Batch *batch)
71 enabled = batch->enabled;
72 channel = batch->channel;
73 start_type = batch->start_type;
74 duration = batch->duration;
75 start_time = batch->start_time;
76 start_day = batch->start_day;
77 record_mode = batch->record_mode;
81 void Batch::calculate_news()
84 if(record->get_current_batch() == this && record->file)
86 sprintf(news, _("Open"));
90 // Test file existance
91 FILE *test = fopen(get_current_asset()->path, "r");
95 sprintf(news, _("File exists"));
99 sprintf(news, _("OK"));
103 void Batch::create_default_path()
105 char *path = get_current_asset()->path;
106 char string[BCTEXTLEN];
107 int i, j = -1, k = -1;
108 int number = record->batches.total;
110 strcpy(string, record->default_asset->path);
111 strcpy(path, record->default_asset->path);
113 // Find first number in path
114 for(i = 0; i < strlen(path); i++)
116 if(path[i] >= '0' && path[i] <= '9') j = i;
117 if((path[i] < '0' || path[i] > '9') && j >= 0 && k < 0) k = i;
131 sprintf(&path[j], "%d", record->batches.total);
132 strcat(path, &string[k]);
136 int Batch::text_to_mode(char *text)
138 if(!strcasecmp(mode_to_text(RECORD_INFINITE), text)) return RECORD_INFINITE;
139 if(!strcasecmp(mode_to_text(RECORD_TIMED), text)) return RECORD_TIMED;
140 // if(!strcasecmp(mode_to_text(RECORD_LOOP), text)) return RECORD_LOOP;
141 // if(!strcasecmp(mode_to_text(RECORD_SCENETOSCENE), text)) return RECORD_SCENETOSCENE;
142 return RECORD_INFINITE;
145 char* Batch::mode_to_text(int record_mode)
149 case RECORD_INFINITE:
158 // case RECORD_SCENETOSCENE:
159 // return "Scene to scene";
165 Asset* Batch::get_current_asset()
167 return assets.values[current_asset];
171 Channel* Batch::get_current_channel_struct()
173 if(channel >= 0 && channel < record->channeldb->size())
175 return record->channeldb->get(channel);
181 char* Batch::get_source_text()
184 Channel *channel = get_current_channel_struct();
189 //printf("Batch::get_source_text 1 %s\n", channel->title);
190 return channel->title;
196 void Batch::toggle_label(double position)
198 labels->toggle_label(position);