r827: Fix a crash when no audio output device can be opened.
[cinelerra_cv.git] / cinelerra / assetedit.C
blobaf3487d13a584c9352859a9a5a14db3527ee6466
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                 window->raise_window();
73                 result = window->run_window();
75                 if(!result)
76                 {
77                         if(!asset->equivalent(*new_asset, 1, 1))
78                         {
79                                 mwindow->gui->lock_window();
80 // Omit index status from copy since an index rebuild may have been
81 // happening when new_asset was created but not be happening anymore.
82                                 asset->copy_from(new_asset, 0);
84                                 mwindow->gui->update(0,
85                                         2,
86                                         0,
87                                         0,
88                                         0, 
89                                         0,
90                                         0);
92 // Start index rebuilding
93                                 if(asset->audio_data)
94                                 {
95                                         char source_filename[BCTEXTLEN];
96                                         char index_filename[BCTEXTLEN];
97                                         IndexFile::get_index_filename(source_filename, 
98                                                 mwindow->preferences->index_directory,
99                                                 index_filename, 
100                                                 asset->path);
101                                         remove(index_filename);
102                                         asset->index_status = INDEX_NOTTESTED;
103                                         mwindow->mainindexes->add_next_asset(0, asset);
104                                         mwindow->mainindexes->start_build();
105                                 }
106                                 mwindow->gui->unlock_window();
109                                 mwindow->awindow->gui->lock_window();
110                                 mwindow->awindow->gui->update_assets();
111                                 mwindow->awindow->gui->unlock_window();
113                                 mwindow->restart_brender();
114                                 mwindow->sync_parameters(CHANGE_ALL);
115                         }
116                 }
118                 delete new_asset;
119                 delete window;
120                 window = 0;
121         }
131 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
132  : BC_Window(PROGRAM_NAME ": Asset Info", 
133         mwindow->gui->get_abs_cursor_x(1) - 400 / 2, 
134         mwindow->gui->get_abs_cursor_y(1) - 550 / 2, 
135         400, 
136         660,
137         400,
138         560,
139         0,
140         0,
141         1)
143         this->mwindow = mwindow;
144         this->asset_edit = asset_edit;
145         this->asset = asset_edit->new_asset;
146         bitspopup = 0;
147         if(asset->format == FILE_PCM)
148                 allow_edits = 1;
149         else
150                 allow_edits = 0;
157 AssetEditWindow::~AssetEditWindow()
159         if(bitspopup) delete bitspopup;
165 int AssetEditWindow::create_objects()
167         int y = 10, x = 10, x1 = 10, x2 = 160;
168         char string[1024];
169         int vmargin;
170         int hmargin1 = 180, hmargin2 = 290;
171         FileSystem fs;
172         BC_Title    *titlew;
173         BC_TextBox  *textboxw;
174         BC_CheckBox *chkboxw;
175         BC_ListBox  *listboxw;
176         Interlaceautofix *ilacefixoption_chkboxw;
178         if(allow_edits) 
179                 vmargin = 30;
180         else
181                 vmargin = 20;
183         add_subwindow(path_text = new AssetEditPathText(this, y));
184         add_subwindow(path_button = new AssetEditPath(mwindow, 
185                 this, 
186                 path_text, 
187                 y, 
188                 asset->path, 
189                 PROGRAM_NAME ": Asset path", _("Select a file for this asset:")));
190         y += 30;
192         add_subwindow(new BC_Title(x, y, _("File format:")));
193         x = x2;
194         add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb, asset->format), MEDIUMFONT, mwindow->theme->edit_font_color));
195         x = x1;
196         y += 20;
198         int64_t bytes = fs.get_size(asset->path);
199         add_subwindow(new BC_Title(x, y, _("Bytes:")));
200         sprintf(string, "%lld", bytes);
201         Units::punctuate(string);
202         
204         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
205         y += 20;
206         x = x1;
208         double length;
209         if(asset->audio_length > 0)
210                 length = (double)asset->audio_length / asset->sample_rate;
211         if(asset->video_length > 0)
212                 length = MAX(length, (double)asset->video_length / asset->frame_rate);
213         int64_t bitrate;
214         if(!EQUIV(length, 0))
215                 bitrate = (int64_t)(bytes * 8 / length);
216         else
217                 bitrate = bytes;
218         add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
219         sprintf(string, "%lld", bitrate);
221         Units::punctuate(string);
222         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
224         y += 30;
225         x = x1;
227         if(asset->audio_data)
228         {
229                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
230                 y += 5;
232                 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
234                 y += 30;
236                 if(asset->get_compression_text(1, 0))
237                 {
238                         add_subwindow(new BC_Title(x, y, _("Compression:")));
239                         x = x2;
240                         add_subwindow(new BC_Title(x, 
241                                 y, 
242                                 asset->get_compression_text(1, 0), 
243                                 MEDIUMFONT, 
244                                 mwindow->theme->edit_font_color));
245                         y += vmargin;
246                         x = x1;
247                 }
249                 add_subwindow(new BC_Title(x, y, _("Channels:")));
250                 sprintf(string, "%d", asset->channels);
252                 x = x2;
253                 if(allow_edits)
254                 {
255                         BC_TumbleTextBox *textbox = new AssetEditChannels(this, string, x, y);
256                         textbox->create_objects();
257                         y += vmargin;
258                 }
259                 else
260                 {
261                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
262                         y += 20;
263                 }
265                 x = x1;
266                 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
267                 sprintf(string, "%d", asset->sample_rate);
269                 x = x2;
270 //              if(allow_edits)
271                 if(1)
272                 {
273                         BC_TextBox *textbox;
274                         add_subwindow(textbox = new AssetEditRate(this, string, x, y));
275                         x += textbox->get_w();
276                         add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
277                 }
278                 else
279                 {
280                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
281                 }
283                 y += 30;
284                 x = x1;
286                 add_subwindow(new BC_Title(x, y, _("Bits:")));
287                 x = x2;
288                 if(allow_edits)
289                 {
290                         bitspopup = new BitsPopup(this, 
291                                 x, 
292                                 y, 
293                                 &asset->bits, 
294                                 1, 
295                                 1, 
296                                 1,
297                                 0,
298                                 1);
299                         bitspopup->create_objects();
300                 }
301                 else
302                         add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->edit_font_color));
305                 x = x1;
306                 y += vmargin;
307                 add_subwindow(new BC_Title(x, y, _("Header length:")));
308                 sprintf(string, "%d", asset->header);
310                 x = x2;
311                 if(allow_edits)
312                         add_subwindow(new AssetEditHeader(this, string, x, y));
313                 else
314                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
316                 y += vmargin;
317                 x = x1;
319                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
321                 if(allow_edits)
322                 {
323                         x = x2;
325                         add_subwindow(lohi = new AssetEditByteOrderLOHI(this, 
326                                 asset->byte_order, 
327                                 x, 
328                                 y));
329                         x += 70;
330                         add_subwindow(hilo = new AssetEditByteOrderHILO(this, 
331                                 !asset->byte_order, 
332                                 x, 
333                                 y));
334                         y += vmargin;
335                 }
336                 else
337                 {
338                         x = x2;
339                         if(asset->byte_order)
340                                 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->edit_font_color));
341                         else
342                                 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->edit_font_color));
343                         y += vmargin;
344                 }
347                 x = x1;
348                 if(allow_edits)
349                 {
350 //                      add_subwindow(new BC_Title(x, y, _("Values are signed:")));
351                         add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
352                 }
353                 else
354                 {
355                         if(!asset->signed_ && asset->bits == 8)
356                                 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
357                         else
358                                 add_subwindow(new BC_Title(x, y, _("Values are signed")));
359                 }
361                 y += 30;
362         }
364         x = x1;
365         if(asset->video_data)
366         {
367                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
368                 y += 5;
370                 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
373                 y += 30;
374                 x = x1;
375                 if(asset->get_compression_text(0,1))
376                 {
377                         add_subwindow(new BC_Title(x, y, _("Compression:")));
378                         x = x2;
379                         add_subwindow(new BC_Title(x, 
380                                 y, 
381                                 asset->get_compression_text(0,1), 
382                                 MEDIUMFONT, 
383                                 mwindow->theme->edit_font_color));
384                         y += vmargin;
385                         x = x1;
386                 }
388                 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
389                 x = x2;
390                 sprintf(string, "%.2f", asset->frame_rate);
391                 BC_TextBox *framerate;
392                 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
393                 x += 105;
394                 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
395                 
396                 y += 30;
397                 x = x1;
398                 add_subwindow(new BC_Title(x, y, _("Width:")));
399                 x = x2;
400                 sprintf(string, "%d", asset->width);
401                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
402                 
403                 y += vmargin;
404                 x = x1;
405                 add_subwindow(new BC_Title(x, y, _("Height:")));
406                 x = x2;
407                 sprintf(string, "%d", asset->height);
408                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
409                 y += 30;
411                 // --------------------
412                 add_subwindow(titlew = new BC_Title(x1, y, _("Fix interlacing:")));
413                 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
414                 y += ilacefixoption_chkboxw->get_h() + 5;
416                 // --------------------
417                 add_subwindow(titlew = new BC_Title(x1, y, _("Asset's interlacing:")));
418                 add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200));
419                 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
420                 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
421                                                         textboxw, 
422                                                         &asset->interlace_mode,
423                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
424                                                         ilacefixoption_chkboxw,
425                                                         x2 + textboxw->get_w(), 
426                                                         y)); 
427                 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
428                 y += textboxw->get_h() + 5;
430                 // --------------------
431                 add_subwindow(titlew = new BC_Title(x1, y, _("Interlace correction:")));
432                 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200));
433                 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
434                 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, 
435                                                         textboxw,
436                                                         &asset->interlace_fixmethod,
437                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
438                                                         x2 + textboxw->get_w(), 
439                                                         y)); 
440                 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
441                 ilacefixoption_chkboxw->showhideotherwidgets();
442                 y += textboxw->get_h() + 5;
443                 
444                 x = x1;
445                 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
446                 x = x2;
447                 add_subwindow(new AssetEditReelName(this, x, y));
448                 y += 30;
449                 
450                 x = x1;
451                 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
452                 x = x2;
453                 add_subwindow(new AssetEditReelNumber(this, x, y));
454                 y += 30;
455                 
456                 x = x1;
457                 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
458                 x = x2;
460 // Calculate values to enter into textboxes
461                 char tc[12];
462                 
463                 Units::totext(tc,
464                         asset->tcstart / asset->frame_rate,
465                         TIME_HMSF,
466                         asset->sample_rate,
467                         asset->frame_rate);
468                 
469                 tc[1] = '\0';
470                 tc[4] = '\0';
471                 tc[7] = '\0';
472                 
473                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc), x, y,
474                         (int) (asset->frame_rate * 60 * 60)));
475                 x += 30;
476                 add_subwindow(new BC_Title(x, y, ":"));
477                 x += 10;
478                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 2), x, y,
479                         (int) (asset->frame_rate * 60)));
480                 x += 30;
481                 add_subwindow(new BC_Title(x, y, ":"));
482                 x += 10;
483                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 5), x, y,
484                         (int) (asset->frame_rate)));
485                 x += 30;
486                 add_subwindow(new BC_Title(x, y, ":"));
487                 x += 10;
488                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 8), x, y, 1));
491                 y += 30;
492         }
494         add_subwindow(new BC_OKButton(this));
495         add_subwindow(new BC_CancelButton(this));
496         show_window();
497         flush();
498         return 0;
501 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow, 
502         char *text, 
503         int x,
504         int y)
505  : BC_TumbleTextBox(fwindow, 
506                 (int)atol(text),
507                 (int)1,
508                 (int)MAXCHANNELS,
509                 x, 
510                 y, 
511                 50)
513         this->fwindow = fwindow;
516 int AssetEditChannels::handle_event()
518         fwindow->asset->channels = atol(get_text());
519         return 1;
522 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
523  : BC_TextBox(x, y, 100, 1, text)
525         this->fwindow = fwindow;
528 int AssetEditRate::handle_event()
530         fwindow->asset->sample_rate = atol(get_text());
531         return 1;
534 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
535  : BC_TextBox(x, y, 100, 1, text)
537         this->fwindow = fwindow;
540 int AssetEditFRate::handle_event()
542         fwindow->asset->frame_rate = atof(get_text());
543         return 1;
546 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
547  : BC_CheckBox(x, y, fwindow->asset->interlace_autofixoption, _("Automatically Fix Interlacing"))
549         this->fwindow = fwindow;
550         this->mwindow = mwindow;
553 Interlaceautofix::~Interlaceautofix()
557 int Interlaceautofix::handle_event()
559         fwindow->asset->interlace_autofixoption = get_value();
560         showhideotherwidgets();
561         return 1;
564 void Interlaceautofix::showhideotherwidgets()
566   int thevalue = get_value();
568         if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) 
569           {
570             this->ilacemode_textbox->enable(); 
571             this->ilacemode_listbox->enable(); 
572             this->ilacefixmethod_textbox->disable();
573             this->ilacefixmethod_listbox->disable();
574             int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,fwindow->asset->interlace_mode);
575             ilacefixmethod_to_text(string,xx);
576             this->ilacefixmethod_textbox->update(string);
577           }
578         if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) 
579           {
580             this->ilacemode_textbox->disable(); 
581             this->ilacemode_listbox->disable(); 
582             this->ilacefixmethod_textbox->enable(); 
583             this->ilacefixmethod_listbox->enable(); 
584             ilacefixmethod_to_text(string,fwindow->asset->interlace_fixmethod);
585             this->ilacefixmethod_textbox->update(string);
586           }
589 InterlacefixmethodItem::InterlacefixmethodItem(char *text, int value)
590  : BC_ListBoxItem(text)
592         this->value = value;
595 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow, 
596                 BC_TextBox *output_text, 
597                 int *output_value,
598                 ArrayList<BC_ListBoxItem*> *data,
599                 int x, 
600                 int y)
601  : BC_ListBox(x,
602         y,
603         200,
604         150,
605         LISTBOX_TEXT,
606         data,
607         0,
608         0,
609         1,
610         0,
611         1)
613         char string[BCTEXTLEN];
615         this->mwindow = mwindow;
616         this->output_text = output_text;
617         this->output_value = output_value;
618         output_text->update(interlacefixmethod_to_text());
621 int InterlacefixmethodPulldown::handle_event()
623         output_text->update(get_selection(0, 0)->get_text());
624         *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
625         return 1;
628 char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
630         ilacefixmethod_to_text(this->string,*output_value);
631         return (this->string);
634 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
635  : BC_TextBox(x, y, w, 1, text)
637         this->fwindow = fwindow;
638         this->thedefault = thedefault;
641 int AssetEditILaceautofixoption::handle_event()
643         fwindow->asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
644         return 1;
648 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
649  : BC_TextBox(x, y, w, 1, text)
651         this->fwindow = fwindow;
652         this->thedefault = thedefault;
655 int AssetEditILacemode::handle_event()
657         fwindow->asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
658         return 1;
661 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow, 
662                 BC_TextBox *output_text,
663                 int *output_value,
664                 ArrayList<BC_ListBoxItem*> *data,
665                 Interlaceautofix *fixoption_chkboxw,
666                 int x, 
667                 int y)
668  : BC_ListBox(x,
669         y,
670         200,
671         150,
672         LISTBOX_TEXT,
673         data,
674         0,
675         0,
676         1,
677         0,
678         1)
680         char string[BCTEXTLEN];
681         this->fixoption_chkbox = fixoption_chkboxw;
682         this->mwindow = mwindow;
683         this->output_text = output_text;
684         this->output_value = output_value;
685         output_text->update(interlacemode_to_text());
688 int AssetEditInterlacemodePulldown::handle_event()
690         output_text->update(get_selection(0, 0)->get_text());
691         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
692         fixoption_chkbox->showhideotherwidgets();
693         return 1;
696 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
698         ilacemode_to_text(this->string,*output_value);
699         return (this->string);
702 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
703  : BC_TextBox(x, y, w, 1, text)
705         this->fwindow = fwindow;
706         this->thedefault = thedefault;
709 int AssetEditILacefixmethod::handle_event()
711         fwindow->asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
712         return 1;
715 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
716  : BC_TextBox(x, y, 100, 1, text)
718         this->fwindow = fwindow;
721 int AssetEditHeader::handle_event()
723         fwindow->asset->header = atol(get_text());
724         return 1;
727 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow, 
728         int value, 
729         int x,
730         int y)
731  : BC_Radial(x, y, value, _("Lo-Hi"))
733         this->fwindow = fwindow;
736 int AssetEditByteOrderLOHI::handle_event()
738         fwindow->asset->byte_order = 1;
739         fwindow->hilo->update(0);
740         update(1);
741         return 1;
744 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow, 
745         int value, 
746         int x, 
747         int y)
748  : BC_Radial(x, y, value, _("Hi-Lo"))
750         this->fwindow = fwindow;
753 int AssetEditByteOrderHILO::handle_event()
755         fwindow->asset->byte_order = 0;
756         fwindow->lohi->update(0);
757         update(1);
758         return 1;
761 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow, 
762         int value, 
763         int x, 
764         int y)
765  : BC_CheckBox(x, y, value, _("Values are signed"))
767         this->fwindow = fwindow;
770 int AssetEditSigned::handle_event()
772         fwindow->asset->signed_ = get_value();
773         return 1;
782 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
783  : BC_TextBox(5, y, 300, 1, fwindow->asset->path) 
785         this->fwindow = fwindow; 
787 AssetEditPathText::~AssetEditPathText() 
790 int AssetEditPathText::handle_event() 
792         strcpy(fwindow->asset->path, get_text());
793         return 1;
796 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, char *text, char *window_title, char *window_caption)
797  : BrowseButton(mwindow, fwindow, textbox, 310, y, text, window_title, window_caption, 0) 
799         this->fwindow = fwindow; 
801 AssetEditPath::~AssetEditPath() {}
808 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
809  : FormatPopup(fwindow->mwindow->plugindb, 90, y)
811         this->fwindow = fwindow; 
813 AssetEditFormat::~AssetEditFormat() 
816 int AssetEditFormat::handle_event()
818         fwindow->asset->format = File::strtoformat(fwindow->mwindow->plugindb, get_selection(0, 0)->get_text());
819         return 1;
825 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
826  : BC_TextBox(x, y, 300, 1, fwindow->asset->reel_name)
828         this->fwindow = fwindow;
830 AssetEditReelName::~AssetEditReelName()
833 int AssetEditReelName::handle_event()
835         strcpy(fwindow->asset->reel_name, get_text());
842 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
843  : BC_TextBox(x, y, 200, 1, fwindow->asset->reel_number)
845         this->fwindow = fwindow;
847 AssetEditReelNumber::~AssetEditReelNumber()
850 int AssetEditReelNumber::handle_event()
852         char *text = get_text() + strlen(get_text()) - 1;
853         
854         // Don't let user enter an invalid character -- only numbers here
855         if(*text < 48 ||
856                 *text > 57)
857         {
858                 *text = '\0';
859         }
861         fwindow->asset->reel_number = atoi(get_text());
868 AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
869  : BC_TextBox(x, y, 30, 1, value)
871         this->fwindow = fwindow;
872         this->multiplier = multiplier;
873         previous = value;
875 AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
878 int AssetEditTCStartTextBox::handle_event()
880         fwindow->asset->tcstart -= previous * multiplier;
881         fwindow->asset->tcstart += atoi(get_text()) * multiplier;
882         previous = atoi(get_text());