r665: Merged the official release 2.0.
[cinelerra_cv.git] / cinelerra / assetedit.C
blobca6a99b662b76864d4dce92d484ca5cbb2cf7141
1 #include "asset.h"
2 #include "assetedit.h"
3 #include "awindow.h"
4 #include "awindowgui.h"
5 #include "bcprogressbox.h"
6 #include "bitspopup.h"
7 #include "cache.h"
8 #include "clip.h"
9 #include "cplayback.h"
10 #include "cwindow.h"
11 #include "file.h"
12 #include "filesystem.h"
13 #include "indexfile.h"
14 #include "language.h"
15 #include "mainindexes.h"
16 #include "mwindow.h"
17 #include "mwindowgui.h"
18 #include "theme.h"
19 #include "new.h"
20 #include "preferences.h"
21 #include "transportque.h"
22 #include "interlacemodes.h"
23 #include "edl.h"
24 #include "edlsession.h"
26 #include <string.h>
30 AssetEdit::AssetEdit(MWindow *mwindow)
31  : Thread()
33         this->mwindow = mwindow;
34         asset = 0;
35         window = 0;
36         set_synchronous(0);
40 AssetEdit::~AssetEdit()
45 void AssetEdit::edit_asset(Asset *asset)
47         if(asset)
48         {
49 // Allow more than one window
50                 this->asset = asset;
51                 Thread::start();
52         }
56 int AssetEdit::set_asset(Asset *asset)
58         this->asset = asset;
59         return 0;
62 void AssetEdit::run()
64         if(asset)
65         {
66                 new_asset = new Asset(asset->path);
67                 *new_asset = *asset;
68                 int result = 0;
70                 window = new AssetEditWindow(mwindow, this);
71                 window->create_objects();
72                 result = window->run_window();
74                 if(!result)
75                 {
76                         if(!asset->equivalent(*new_asset, 1, 1))
77                         {
78                                 mwindow->gui->lock_window();
79 // Omit index status from copy since an index rebuild may have been
80 // happening when new_asset was created but not be happening anymore.
81                                 asset->copy_from(new_asset, 0);
83                                 mwindow->gui->update(0,
84                                         2,
85                                         0,
86                                         0,
87                                         0, 
88                                         0,
89                                         0);
91 // Start index rebuilding
92                                 if(asset->audio_data)
93                                 {
94                                         char source_filename[BCTEXTLEN];
95                                         char index_filename[BCTEXTLEN];
96                                         IndexFile::get_index_filename(source_filename, 
97                                                 mwindow->preferences->index_directory,
98                                                 index_filename, 
99                                                 asset->path);
100                                         remove(index_filename);
101                                         asset->index_status = INDEX_NOTTESTED;
102                                         mwindow->mainindexes->add_next_asset(0, asset);
103                                         mwindow->mainindexes->start_build();
104                                 }
105                                 mwindow->gui->unlock_window();
108                                 mwindow->awindow->gui->lock_window();
109                                 mwindow->awindow->gui->update_assets();
110                                 mwindow->awindow->gui->unlock_window();
112                                 mwindow->restart_brender();
113                                 mwindow->sync_parameters(CHANGE_ALL);
114                         }
115                 }
117                 delete new_asset;
118                 delete window;
119                 window = 0;
120         }
130 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
131  : BC_Window(PROGRAM_NAME ": Asset Info", 
132         mwindow->gui->get_abs_cursor_x(1) - 400 / 2, 
133         mwindow->gui->get_abs_cursor_y(1) - 550 / 2, 
134         400, 
135         660,
136         400,
137         560,
138         0,
139         0,
140         1)
142         this->mwindow = mwindow;
143         this->asset_edit = asset_edit;
144         this->asset = asset_edit->new_asset;
145         bitspopup = 0;
146         if(asset->format == FILE_PCM)
147                 allow_edits = 1;
148         else
149                 allow_edits = 0;
156 AssetEditWindow::~AssetEditWindow()
158         if(bitspopup) delete bitspopup;
164 int AssetEditWindow::create_objects()
166         int y = 10, x = 10, x1 = 10, x2 = 160;
167         char string[1024];
168         int vmargin;
169         int hmargin1 = 180, hmargin2 = 290;
170         FileSystem fs;
171         BC_Title    *titlew;
172         BC_TextBox  *textboxw;
173         BC_CheckBox *chkboxw;
174         BC_ListBox  *listboxw;
175         Interlaceautofix *ilacefixoption_chkboxw;
177         if(allow_edits) 
178                 vmargin = 30;
179         else
180                 vmargin = 20;
182         add_subwindow(path_text = new AssetEditPathText(this, y));
183         add_subwindow(path_button = new AssetEditPath(mwindow, 
184                 this, 
185                 path_text, 
186                 y, 
187                 asset->path, 
188                 PROGRAM_NAME ": Asset path", _("Select a file for this asset:")));
189         y += 30;
191         add_subwindow(new BC_Title(x, y, _("File format:")));
192         x = x2;
193         add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb, asset->format), MEDIUMFONT, mwindow->theme->edit_font_color));
194         x = x1;
195         y += 20;
197         int64_t bytes = fs.get_size(asset->path);
198         add_subwindow(new BC_Title(x, y, _("Bytes:")));
199         sprintf(string, "%lld", bytes);
200         Units::punctuate(string);
201         
203         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
204         y += 20;
205         x = x1;
207         double length;
208         if(asset->audio_length > 0)
209                 length = (double)asset->audio_length / asset->sample_rate;
210         if(asset->video_length > 0)
211                 length = MAX(length, (double)asset->video_length / asset->frame_rate);
212         int64_t bitrate;
213         if(!EQUIV(length, 0))
214                 bitrate = (int64_t)(bytes * 8 / length);
215         else
216                 bitrate = bytes;
217         add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
218         sprintf(string, "%lld", bitrate);
220         Units::punctuate(string);
221         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
223         y += 30;
224         x = x1;
226         if(asset->audio_data)
227         {
228                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
229                 y += 5;
231                 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
233                 y += 30;
235                 if(asset->get_compression_text(1, 0))
236                 {
237                         add_subwindow(new BC_Title(x, y, _("Compression:")));
238                         x = x2;
239                         add_subwindow(new BC_Title(x, 
240                                 y, 
241                                 asset->get_compression_text(1, 0), 
242                                 MEDIUMFONT, 
243                                 mwindow->theme->edit_font_color));
244                         y += vmargin;
245                         x = x1;
246                 }
248                 add_subwindow(new BC_Title(x, y, _("Channels:")));
249                 sprintf(string, "%d", asset->channels);
251                 x = x2;
252                 if(allow_edits)
253                 {
254                         BC_TumbleTextBox *textbox = new AssetEditChannels(this, string, x, y);
255                         textbox->create_objects();
256                         y += vmargin;
257                 }
258                 else
259                 {
260                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
261                         y += 20;
262                 }
264                 x = x1;
265                 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
266                 sprintf(string, "%d", asset->sample_rate);
268                 x = x2;
269 //              if(allow_edits)
270                 if(1)
271                 {
272                         BC_TextBox *textbox;
273                         add_subwindow(textbox = new AssetEditRate(this, string, x, y));
274                         x += textbox->get_w();
275                         add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
276                 }
277                 else
278                 {
279                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
280                 }
282                 y += 30;
283                 x = x1;
285                 add_subwindow(new BC_Title(x, y, _("Bits:")));
286                 x = x2;
287                 if(allow_edits)
288                 {
289                         bitspopup = new BitsPopup(this, 
290                                 x, 
291                                 y, 
292                                 &asset->bits, 
293                                 1, 
294                                 1, 
295                                 1,
296                                 0,
297                                 1);
298                         bitspopup->create_objects();
299                 }
300                 else
301                         add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->edit_font_color));
304                 x = x1;
305                 y += vmargin;
306                 add_subwindow(new BC_Title(x, y, _("Header length:")));
307                 sprintf(string, "%d", asset->header);
309                 x = x2;
310                 if(allow_edits)
311                         add_subwindow(new AssetEditHeader(this, string, x, y));
312                 else
313                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
315                 y += vmargin;
316                 x = x1;
318                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
320                 if(allow_edits)
321                 {
322                         x = x2;
324                         add_subwindow(lohi = new AssetEditByteOrderLOHI(this, 
325                                 asset->byte_order, 
326                                 x, 
327                                 y));
328                         x += 70;
329                         add_subwindow(hilo = new AssetEditByteOrderHILO(this, 
330                                 !asset->byte_order, 
331                                 x, 
332                                 y));
333                         y += vmargin;
334                 }
335                 else
336                 {
337                         x = x2;
338                         if(asset->byte_order)
339                                 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->edit_font_color));
340                         else
341                                 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->edit_font_color));
342                         y += vmargin;
343                 }
346                 x = x1;
347                 if(allow_edits)
348                 {
349 //                      add_subwindow(new BC_Title(x, y, _("Values are signed:")));
350                         add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
351                 }
352                 else
353                 {
354                         if(!asset->signed_ && asset->bits == 8)
355                                 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
356                         else
357                                 add_subwindow(new BC_Title(x, y, _("Values are signed")));
358                 }
360                 y += 30;
361         }
363         x = x1;
364         if(asset->video_data)
365         {
366                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
367                 y += 5;
369                 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
372                 y += 30;
373                 x = x1;
374                 if(asset->get_compression_text(0,1))
375                 {
376                         add_subwindow(new BC_Title(x, y, _("Compression:")));
377                         x = x2;
378                         add_subwindow(new BC_Title(x, 
379                                 y, 
380                                 asset->get_compression_text(0,1), 
381                                 MEDIUMFONT, 
382                                 mwindow->theme->edit_font_color));
383                         y += vmargin;
384                         x = x1;
385                 }
387                 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
388                 x = x2;
389                 sprintf(string, "%.2f", asset->frame_rate);
390                 BC_TextBox *framerate;
391                 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
392                 x += 105;
393                 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
394                 
395                 y += 30;
396                 x = x1;
397                 add_subwindow(new BC_Title(x, y, _("Width:")));
398                 x = x2;
399                 sprintf(string, "%d", asset->width);
400                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
401                 
402                 y += vmargin;
403                 x = x1;
404                 add_subwindow(new BC_Title(x, y, _("Height:")));
405                 x = x2;
406                 sprintf(string, "%d", asset->height);
407                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
408                 y += 30;
410                 // --------------------
411                 add_subwindow(titlew = new BC_Title(x1, y, _("Fix interlacing:")));
412                 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
413                 y += ilacefixoption_chkboxw->get_h() + 5;
415                 // --------------------
416                 add_subwindow(titlew = new BC_Title(x1, y, _("Asset's interlacing:")));
417                 add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200));
418                 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
419                 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
420                                                         textboxw, 
421                                                         &asset->interlace_mode,
422                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
423                                                         ilacefixoption_chkboxw,
424                                                         x2 + textboxw->get_w(), 
425                                                         y)); 
426                 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
427                 y += textboxw->get_h() + 5;
429                 // --------------------
430                 add_subwindow(titlew = new BC_Title(x1, y, _("Interlace correction:")));
431                 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200));
432                 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
433                 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, 
434                                                         textboxw,
435                                                         &asset->interlace_fixmethod,
436                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
437                                                         x2 + textboxw->get_w(), 
438                                                         y)); 
439                 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
440                 ilacefixoption_chkboxw->showhideotherwidgets();
441                 y += textboxw->get_h() + 5;
442                 
443                 x = x1;
444                 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
445                 x = x2;
446                 add_subwindow(new AssetEditReelName(this, x, y));
447                 y += 30;
448                 
449                 x = x1;
450                 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
451                 x = x2;
452                 add_subwindow(new AssetEditReelNumber(this, x, y));
453                 y += 30;
454                 
455                 x = x1;
456                 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
457                 x = x2;
459 // Calculate values to enter into textboxes
460                 char tc[12];
461                 
462                 Units::totext(tc,
463                         asset->tcstart / asset->frame_rate,
464                         TIME_HMSF,
465                         asset->sample_rate,
466                         asset->frame_rate);
467                 
468                 tc[1] = '\0';
469                 tc[4] = '\0';
470                 tc[7] = '\0';
471                 
472                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc), x, y,
473                         (int) (asset->frame_rate * 60 * 60)));
474                 x += 30;
475                 add_subwindow(new BC_Title(x, y, ":"));
476                 x += 10;
477                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 2), x, y,
478                         (int) (asset->frame_rate * 60)));
479                 x += 30;
480                 add_subwindow(new BC_Title(x, y, ":"));
481                 x += 10;
482                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 5), x, y,
483                         (int) (asset->frame_rate)));
484                 x += 30;
485                 add_subwindow(new BC_Title(x, y, ":"));
486                 x += 10;
487                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 8), x, y, 1));
490                 y += 30;
491         }
493         add_subwindow(new BC_OKButton(this));
494         add_subwindow(new BC_CancelButton(this));
495         show_window();
496         flush();
497         return 0;
500 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow, 
501         char *text, 
502         int x,
503         int y)
504  : BC_TumbleTextBox(fwindow, 
505                 (int)atol(text),
506                 (int)1,
507                 (int)MAXCHANNELS,
508                 x, 
509                 y, 
510                 50)
512         this->fwindow = fwindow;
515 int AssetEditChannels::handle_event()
517         fwindow->asset->channels = atol(get_text());
518         return 1;
521 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
522  : BC_TextBox(x, y, 100, 1, text)
524         this->fwindow = fwindow;
527 int AssetEditRate::handle_event()
529         fwindow->asset->sample_rate = atol(get_text());
530         return 1;
533 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
534  : BC_TextBox(x, y, 100, 1, text)
536         this->fwindow = fwindow;
539 int AssetEditFRate::handle_event()
541         fwindow->asset->frame_rate = atof(get_text());
542         return 1;
545 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
546  : BC_CheckBox(x, y, fwindow->asset->interlace_autofixoption, _("Automatically Fix Interlacing"))
548         this->fwindow = fwindow;
549         this->mwindow = mwindow;
552 Interlaceautofix::~Interlaceautofix()
556 int Interlaceautofix::handle_event()
558         fwindow->asset->interlace_autofixoption = get_value();
559         showhideotherwidgets();
560         return 1;
563 void Interlaceautofix::showhideotherwidgets()
565   int thevalue = get_value();
567         if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) 
568           {
569             this->ilacemode_textbox->enable(); 
570             this->ilacemode_listbox->enable(); 
571             this->ilacefixmethod_textbox->disable();
572             this->ilacefixmethod_listbox->disable();
573             int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,fwindow->asset->interlace_mode);
574             ilacefixmethod_to_text(string,xx);
575             this->ilacefixmethod_textbox->update(string);
576           }
577         if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) 
578           {
579             this->ilacemode_textbox->disable(); 
580             this->ilacemode_listbox->disable(); 
581             this->ilacefixmethod_textbox->enable(); 
582             this->ilacefixmethod_listbox->enable(); 
583             ilacefixmethod_to_text(string,fwindow->asset->interlace_fixmethod);
584             this->ilacefixmethod_textbox->update(string);
585           }
588 InterlacefixmethodItem::InterlacefixmethodItem(char *text, int value)
589  : BC_ListBoxItem(text)
591         this->value = value;
594 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow, 
595                 BC_TextBox *output_text, 
596                 int *output_value,
597                 ArrayList<BC_ListBoxItem*> *data,
598                 int x, 
599                 int y)
600  : BC_ListBox(x,
601         y,
602         200,
603         150,
604         LISTBOX_TEXT,
605         data,
606         0,
607         0,
608         1,
609         0,
610         1)
612         char string[BCTEXTLEN];
614         this->mwindow = mwindow;
615         this->output_text = output_text;
616         this->output_value = output_value;
617         output_text->update(interlacefixmethod_to_text());
620 int InterlacefixmethodPulldown::handle_event()
622         output_text->update(get_selection(0, 0)->get_text());
623         *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
624         return 1;
627 char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
629         ilacefixmethod_to_text(this->string,*output_value);
630         return (this->string);
633 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
634  : BC_TextBox(x, y, w, 1, text)
636         this->fwindow = fwindow;
637         this->thedefault = thedefault;
640 int AssetEditILaceautofixoption::handle_event()
642         fwindow->asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
643         return 1;
647 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
648  : BC_TextBox(x, y, w, 1, text)
650         this->fwindow = fwindow;
651         this->thedefault = thedefault;
654 int AssetEditILacemode::handle_event()
656         fwindow->asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
657         return 1;
660 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow, 
661                 BC_TextBox *output_text,
662                 int *output_value,
663                 ArrayList<BC_ListBoxItem*> *data,
664                 Interlaceautofix *fixoption_chkboxw,
665                 int x, 
666                 int y)
667  : BC_ListBox(x,
668         y,
669         200,
670         150,
671         LISTBOX_TEXT,
672         data,
673         0,
674         0,
675         1,
676         0,
677         1)
679         char string[BCTEXTLEN];
680         this->fixoption_chkbox = fixoption_chkboxw;
681         this->mwindow = mwindow;
682         this->output_text = output_text;
683         this->output_value = output_value;
684         output_text->update(interlacemode_to_text());
687 int AssetEditInterlacemodePulldown::handle_event()
689         output_text->update(get_selection(0, 0)->get_text());
690         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
691         fixoption_chkbox->showhideotherwidgets();
692         return 1;
695 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
697         ilacemode_to_text(this->string,*output_value);
698         return (this->string);
701 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
702  : BC_TextBox(x, y, w, 1, text)
704         this->fwindow = fwindow;
705         this->thedefault = thedefault;
708 int AssetEditILacefixmethod::handle_event()
710         fwindow->asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
711         return 1;
714 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
715  : BC_TextBox(x, y, 100, 1, text)
717         this->fwindow = fwindow;
720 int AssetEditHeader::handle_event()
722         fwindow->asset->header = atol(get_text());
723         return 1;
726 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow, 
727         int value, 
728         int x,
729         int y)
730  : BC_Radial(x, y, value, _("Lo-Hi"))
732         this->fwindow = fwindow;
735 int AssetEditByteOrderLOHI::handle_event()
737         fwindow->asset->byte_order = 1;
738         fwindow->hilo->update(0);
739         update(1);
740         return 1;
743 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow, 
744         int value, 
745         int x, 
746         int y)
747  : BC_Radial(x, y, value, _("Hi-Lo"))
749         this->fwindow = fwindow;
752 int AssetEditByteOrderHILO::handle_event()
754         fwindow->asset->byte_order = 0;
755         fwindow->lohi->update(0);
756         update(1);
757         return 1;
760 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow, 
761         int value, 
762         int x, 
763         int y)
764  : BC_CheckBox(x, y, value, _("Values are signed"))
766         this->fwindow = fwindow;
769 int AssetEditSigned::handle_event()
771         fwindow->asset->signed_ = get_value();
772         return 1;
781 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
782  : BC_TextBox(5, y, 300, 1, fwindow->asset->path) 
784         this->fwindow = fwindow; 
786 AssetEditPathText::~AssetEditPathText() 
789 int AssetEditPathText::handle_event() 
791         strcpy(fwindow->asset->path, get_text());
792         return 1;
795 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, char *text, char *window_title, char *window_caption)
796  : BrowseButton(mwindow, fwindow, textbox, 310, y, text, window_title, window_caption, 0) 
798         this->fwindow = fwindow; 
800 AssetEditPath::~AssetEditPath() {}
807 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
808  : FormatPopup(fwindow->mwindow->plugindb, 90, y)
810         this->fwindow = fwindow; 
812 AssetEditFormat::~AssetEditFormat() 
815 int AssetEditFormat::handle_event()
817         fwindow->asset->format = File::strtoformat(fwindow->mwindow->plugindb, get_selection(0, 0)->get_text());
818         return 1;
824 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
825  : BC_TextBox(x, y, 300, 1, fwindow->asset->reel_name)
827         this->fwindow = fwindow;
829 AssetEditReelName::~AssetEditReelName()
832 int AssetEditReelName::handle_event()
834         strcpy(fwindow->asset->reel_name, get_text());
841 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
842  : BC_TextBox(x, y, 200, 1, fwindow->asset->reel_number)
844         this->fwindow = fwindow;
846 AssetEditReelNumber::~AssetEditReelNumber()
849 int AssetEditReelNumber::handle_event()
851         char *text = get_text() + strlen(get_text()) - 1;
852         
853         // Don't let user enter an invalid character -- only numbers here
854         if(*text < 48 ||
855                 *text > 57)
856         {
857                 *text = '\0';
858         }
860         fwindow->asset->reel_number = atoi(get_text());
867 AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
868  : BC_TextBox(x, y, 30, 1, value)
870         this->fwindow = fwindow;
871         this->multiplier = multiplier;
872         previous = value;
874 AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
877 int AssetEditTCStartTextBox::handle_event()
879         fwindow->asset->tcstart -= previous * multiplier;
880         fwindow->asset->tcstart += atoi(get_text()) * multiplier;
881         previous = atoi(get_text());