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.push_back(Asset_GC(new Asset));
39 labels = new RecordLabels;
50 int Batch::create_objects()
55 void Batch::start_over()
60 while(labels->last) delete labels->last;
67 void Batch::copy_from(Batch *batch)
69 enabled = batch->enabled;
70 channel = batch->channel;
71 start_type = batch->start_type;
72 duration = batch->duration;
73 start_time = batch->start_time;
74 start_day = batch->start_day;
75 record_mode = batch->record_mode;
79 void Batch::calculate_news()
82 if(record->get_current_batch() == this && record->file)
84 sprintf(news, _("Open"));
88 // Test file existance
89 FILE *test = fopen(get_current_asset()->path, "r");
93 sprintf(news, _("File exists"));
97 sprintf(news, _("OK"));
101 void Batch::create_default_path()
103 char *path = get_current_asset()->path;
104 char string[BCTEXTLEN];
105 int i, j = -1, k = -1;
106 int number = record->batches.total;
108 strcpy(string, record->default_asset->path);
109 strcpy(path, record->default_asset->path);
111 // Find first number in path
112 for(i = 0; i < strlen(path); i++)
114 if(path[i] >= '0' && path[i] <= '9') j = i;
115 if((path[i] < '0' || path[i] > '9') && j >= 0 && k < 0) k = i;
129 sprintf(&path[j], "%d", record->batches.total);
130 strcat(path, &string[k]);
134 int Batch::text_to_mode(char *text)
136 if(!strcasecmp(mode_to_text(RECORD_INFINITE), text)) return RECORD_INFINITE;
137 if(!strcasecmp(mode_to_text(RECORD_TIMED), text)) return RECORD_TIMED;
138 // if(!strcasecmp(mode_to_text(RECORD_LOOP), text)) return RECORD_LOOP;
139 // if(!strcasecmp(mode_to_text(RECORD_SCENETOSCENE), text)) return RECORD_SCENETOSCENE;
140 return RECORD_INFINITE;
143 char* Batch::mode_to_text(int record_mode)
147 case RECORD_INFINITE:
156 // case RECORD_SCENETOSCENE:
157 // return "Scene to scene";
163 Asset_GC Batch::get_current_asset()
165 return assets[current_asset];
169 Channel* Batch::get_current_channel_struct()
171 if(channel >= 0 && channel < record->channeldb->size())
173 return record->channeldb->get(channel);
179 char* Batch::get_source_text()
182 Channel *channel = get_current_channel_struct();
187 //printf("Batch::get_source_text 1 %s\n", channel->title);
188 return channel->title;
194 void Batch::toggle_label(double position)
196 labels->toggle_label(position);
201 // c-file-style: "linux"