r936: Sane default sample zoom...
[cinelerra_cv/mob.git] / cinelerra / assetedit.C
blob25d5baf31588ec67f5cd5c38b100191818a58d05
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 "filempeg.h"
13 #include "filesystem.h"
14 #include "indexfile.h"
15 #include "language.h"
16 #include "mainindexes.h"
17 #include "mwindow.h"
18 #include "mwindowgui.h"
19 #include "theme.h"
20 #include "new.h"
21 #include "preferences.h"
22 #include "transportque.h"
23 #include "interlacemodes.h"
24 #include "edl.h"
25 #include "edlsession.h"
27 #include <string.h>
31 AssetEdit::AssetEdit(MWindow *mwindow)
32  : Thread()
34         this->mwindow = mwindow;
35         asset = 0;
36         window = 0;
37         set_synchronous(0);
41 AssetEdit::~AssetEdit()
46 void AssetEdit::edit_asset(Asset *asset)
48         if(asset)
49         {
50 // Allow more than one window
51                 this->asset = asset;
52                 Thread::start();
53         }
57 int AssetEdit::set_asset(Asset *asset)
59         this->asset = asset;
60         return 0;
63 void AssetEdit::run()
65         if(asset)
66         {
67                 new_asset = new Asset(asset->path);
68                 *new_asset = *asset;
69                 int result = 0;
71                 window = new AssetEditWindow(mwindow, this);
72                 window->create_objects();
73                 window->raise_window();
74                 result = window->run_window();
76                 if(!result)
77                 {
78                         if(!asset->equivalent(*new_asset, 1, 1))
79                         {
80                                 mwindow->gui->lock_window();
81                                 mwindow->remove_asset_from_caches(asset);
82 // Omit index status from copy since an index rebuild may have been
83 // happening when new_asset was created but not be happening anymore.
84                                 asset->copy_from(new_asset, 0);
86                                 mwindow->gui->update(0,
87                                         2,
88                                         0,
89                                         0,
90                                         0, 
91                                         0,
92                                         0);
94 // Start index rebuilding
95                                 if(asset->audio_data)
96                                 {
97                                         char source_filename[BCTEXTLEN];
98                                         char index_filename[BCTEXTLEN];
99                                         IndexFile::get_index_filename(source_filename, 
100                                                 mwindow->preferences->index_directory,
101                                                 index_filename, 
102                                                 asset->path);
103                                         remove(index_filename);
104                                         asset->index_status = INDEX_NOTTESTED;
105                                         mwindow->mainindexes->add_next_asset(0, asset);
106                                         mwindow->mainindexes->start_build();
107                                 }
108                                 mwindow->gui->unlock_window();
111                                 mwindow->awindow->gui->async_update_assets();
113                                 mwindow->restart_brender();
114                                 mwindow->sync_parameters(CHANGE_ALL);
115                         }
116                 }
118                 Garbage::delete_object(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[BCTEXTLEN];
169         int vmargin;
170         int hmargin1 = 180, hmargin2 = 290;
171         FileSystem fs;
172         BC_Title *title;
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 = 1;
199         int subtitle_tracks = 0;
200         if(asset->format == FILE_MPEG &&
201                 asset->video_data)
202         {
203 // Get length from TOC
204                 FileMPEG::get_info(asset, &bytes, &subtitle_tracks);
205         }
206         else
207         {
208                 bytes = fs.get_size(asset->path);
209         }
210         add_subwindow(new BC_Title(x, y, _("Bytes:")));
211         sprintf(string, "%lld", bytes);
212         Units::punctuate(string);
213         
215         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
216         y += 20;
217         x = x1;
219         double length;
220         if(asset->audio_length > 0)
221                 length = (double)asset->audio_length / asset->sample_rate;
222         if(asset->video_length > 0)
223                 length = MAX(length, (double)asset->video_length / asset->frame_rate);
224         int64_t bitrate;
225         if(!EQUIV(length, 0))
226                 bitrate = (int64_t)(bytes * 8 / length);
227         else
228                 bitrate = bytes;
229         add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
230         sprintf(string, "%lld", bitrate);
232         Units::punctuate(string);
233         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
235         y += 30;
236         x = x1;
238         if(asset->audio_data)
239         {
240                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
241                 y += 5;
243                 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
245                 y += 30;
247                 if(asset->get_compression_text(1, 0))
248                 {
249                         add_subwindow(new BC_Title(x, y, _("Compression:")));
250                         x = x2;
251                         add_subwindow(new BC_Title(x, 
252                                 y, 
253                                 asset->get_compression_text(1, 0), 
254                                 MEDIUMFONT, 
255                                 mwindow->theme->edit_font_color));
256                         y += vmargin;
257                         x = x1;
258                 }
260                 add_subwindow(new BC_Title(x, y, _("Channels:")));
261                 sprintf(string, "%d", asset->channels);
263                 x = x2;
264                 if(allow_edits)
265                 {
266                         BC_TumbleTextBox *textbox = new AssetEditChannels(this, string, x, y);
267                         textbox->create_objects();
268                         y += vmargin;
269                 }
270                 else
271                 {
272                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
273                         y += 20;
274                 }
276                 x = x1;
277                 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
278                 sprintf(string, "%d", asset->sample_rate);
280                 x = x2;
281 //              if(allow_edits)
282                 if(1)
283                 {
284                         BC_TextBox *textbox;
285                         add_subwindow(textbox = new AssetEditRate(this, string, x, y));
286                         x += textbox->get_w();
287                         add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
288                 }
289                 else
290                 {
291                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
292                 }
294                 y += 30;
295                 x = x1;
297                 add_subwindow(new BC_Title(x, y, _("Bits:")));
298                 x = x2;
299                 if(allow_edits)
300                 {
301                         bitspopup = new BitsPopup(this, 
302                                 x, 
303                                 y, 
304                                 &asset->bits, 
305                                 1, 
306                                 1, 
307                                 1,
308                                 0,
309                                 1);
310                         bitspopup->create_objects();
311                 }
312                 else
313                         add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->edit_font_color));
316                 x = x1;
317                 y += vmargin;
318                 add_subwindow(new BC_Title(x, y, _("Header length:")));
319                 sprintf(string, "%d", asset->header);
321                 x = x2;
322                 if(allow_edits)
323                         add_subwindow(new AssetEditHeader(this, string, x, y));
324                 else
325                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
327                 y += vmargin;
328                 x = x1;
330                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
332                 if(allow_edits)
333                 {
334                         x = x2;
336                         add_subwindow(lohi = new AssetEditByteOrderLOHI(this, 
337                                 asset->byte_order, 
338                                 x, 
339                                 y));
340                         x += 70;
341                         add_subwindow(hilo = new AssetEditByteOrderHILO(this, 
342                                 !asset->byte_order, 
343                                 x, 
344                                 y));
345                         y += vmargin;
346                 }
347                 else
348                 {
349                         x = x2;
350                         if(asset->byte_order)
351                                 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->edit_font_color));
352                         else
353                                 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->edit_font_color));
354                         y += vmargin;
355                 }
358                 x = x1;
359                 if(allow_edits)
360                 {
361 //                      add_subwindow(new BC_Title(x, y, _("Values are signed:")));
362                         add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
363                 }
364                 else
365                 {
366                         if(!asset->signed_ && asset->bits == 8)
367                                 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
368                         else
369                                 add_subwindow(new BC_Title(x, y, _("Values are signed")));
370                 }
372                 y += 30;
373         }
375         x = x1;
376         if(asset->video_data)
377         {
378                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
379                 y += 5;
381                 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
384                 y += 30;
385                 x = x1;
386                 if(asset->get_compression_text(0,1))
387                 {
388                         add_subwindow(new BC_Title(x, y, _("Compression:")));
389                         x = x2;
390                         add_subwindow(new BC_Title(x, 
391                                 y, 
392                                 asset->get_compression_text(0,1), 
393                                 MEDIUMFONT, 
394                                 mwindow->theme->edit_font_color));
395                         y += vmargin;
396                         x = x1;
397                 }
399                 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
400                 x = x2;
401                 sprintf(string, "%.2f", asset->frame_rate);
402                 BC_TextBox *framerate;
403                 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
404                 x += 105;
405                 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
406                 
407                 y += 30;
408                 x = x1;
409                 add_subwindow(new BC_Title(x, y, _("Width:")));
410                 x = x2;
411                 sprintf(string, "%d", asset->width);
412                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
413                 
414                 y += vmargin;
415                 x = x1;
416                 add_subwindow(new BC_Title(x, y, _("Height:")));
417                 x = x2;
418                 sprintf(string, "%d", asset->height);
419                 add_subwindow(title = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
420                 y += title->get_h() + 5;
422                 if(asset->format == FILE_MPEG)
423                 {
424                         x = x1;
425                         add_subwindow(new BC_Title(x, y, _("Subtitle tracks:")));
426                         x = x2;
427                         sprintf(string, "%d", subtitle_tracks);
428                         add_subwindow(title = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
429                         y += title->get_h() + 5;
430                 }
432                 // --------------------
433                 add_subwindow(title = new BC_Title(x1, y, _("Fix interlacing:")));
434                 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
435                 y += ilacefixoption_chkboxw->get_h() + 5;
437                 // --------------------
438                 add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:")));
439                 add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200));
440                 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
441                 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
442                                                         textboxw, 
443                                                         &asset->interlace_mode,
444                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
445                                                         ilacefixoption_chkboxw,
446                                                         x2 + textboxw->get_w(), 
447                                                         y)); 
448                 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
449                 y += textboxw->get_h() + 5;
451                 // --------------------
452                 add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:")));
453                 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200));
454                 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
455                 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, 
456                                                         textboxw,
457                                                         &asset->interlace_fixmethod,
458                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
459                                                         x2 + textboxw->get_w(), 
460                                                         y)); 
461                 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
462                 ilacefixoption_chkboxw->showhideotherwidgets();
463                 y += textboxw->get_h() + 5;
464                 
465                 x = x1;
466                 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
467                 x = x2;
468                 add_subwindow(new AssetEditReelName(this, x, y));
469                 y += 30;
470                 
471                 x = x1;
472                 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
473                 x = x2;
474                 add_subwindow(new AssetEditReelNumber(this, x, y));
475                 y += 30;
476                 
477                 x = x1;
478                 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
479                 x = x2;
481 // Calculate values to enter into textboxes
482                 char tc[12];
483                 
484                 Units::totext(tc,
485                         asset->tcstart / asset->frame_rate,
486                         TIME_HMSF,
487                         asset->sample_rate,
488                         asset->frame_rate);
489                 
490                 tc[1] = '\0';
491                 tc[4] = '\0';
492                 tc[7] = '\0';
493                 
494                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc), x, y,
495                         (int) (asset->frame_rate * 60 * 60)));
496                 x += 30;
497                 add_subwindow(new BC_Title(x, y, ":"));
498                 x += 10;
499                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 2), x, y,
500                         (int) (asset->frame_rate * 60)));
501                 x += 30;
502                 add_subwindow(new BC_Title(x, y, ":"));
503                 x += 10;
504                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 5), x, y,
505                         (int) (asset->frame_rate)));
506                 x += 30;
507                 add_subwindow(new BC_Title(x, y, ":"));
508                 x += 10;
509                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 8), x, y, 1));
512                 y += 30;
513         }
515         add_subwindow(new BC_OKButton(this));
516         add_subwindow(new BC_CancelButton(this));
517         show_window();
518         flush();
519         return 0;
522 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow, 
523         char *text, 
524         int x,
525         int y)
526  : BC_TumbleTextBox(fwindow, 
527                 (int)atol(text),
528                 (int)1,
529                 (int)MAXCHANNELS,
530                 x, 
531                 y, 
532                 50)
534         this->fwindow = fwindow;
537 int AssetEditChannels::handle_event()
539         fwindow->asset->channels = atol(get_text());
540         return 1;
543 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
544  : BC_TextBox(x, y, 100, 1, text)
546         this->fwindow = fwindow;
549 int AssetEditRate::handle_event()
551         fwindow->asset->sample_rate = atol(get_text());
552         return 1;
555 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
556  : BC_TextBox(x, y, 100, 1, text)
558         this->fwindow = fwindow;
561 int AssetEditFRate::handle_event()
563         fwindow->asset->frame_rate = atof(get_text());
564         return 1;
567 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
568  : BC_CheckBox(x, y, fwindow->asset->interlace_autofixoption, _("Automatically Fix Interlacing"))
570         this->fwindow = fwindow;
571         this->mwindow = mwindow;
574 Interlaceautofix::~Interlaceautofix()
578 int Interlaceautofix::handle_event()
580         fwindow->asset->interlace_autofixoption = get_value();
581         showhideotherwidgets();
582         return 1;
585 void Interlaceautofix::showhideotherwidgets()
587   int thevalue = get_value();
589         if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) 
590           {
591             this->ilacemode_textbox->enable(); 
592             this->ilacemode_listbox->enable(); 
593             this->ilacefixmethod_textbox->disable();
594             this->ilacefixmethod_listbox->disable();
595             int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,fwindow->asset->interlace_mode);
596             ilacefixmethod_to_text(string,xx);
597             this->ilacefixmethod_textbox->update(string);
598           }
599         if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) 
600           {
601             this->ilacemode_textbox->disable(); 
602             this->ilacemode_listbox->disable(); 
603             this->ilacefixmethod_textbox->enable(); 
604             this->ilacefixmethod_listbox->enable(); 
605             ilacefixmethod_to_text(string,fwindow->asset->interlace_fixmethod);
606             this->ilacefixmethod_textbox->update(string);
607           }
610 InterlacefixmethodItem::InterlacefixmethodItem(char *text, int value)
611  : BC_ListBoxItem(text)
613         this->value = value;
616 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow, 
617                 BC_TextBox *output_text, 
618                 int *output_value,
619                 ArrayList<BC_ListBoxItem*> *data,
620                 int x, 
621                 int y)
622  : BC_ListBox(x,
623         y,
624         200,
625         150,
626         LISTBOX_TEXT,
627         data,
628         0,
629         0,
630         1,
631         0,
632         1)
634         char string[BCTEXTLEN];
636         this->mwindow = mwindow;
637         this->output_text = output_text;
638         this->output_value = output_value;
639         output_text->update(interlacefixmethod_to_text());
642 int InterlacefixmethodPulldown::handle_event()
644         output_text->update(get_selection(0, 0)->get_text());
645         *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
646         return 1;
649 char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
651         ilacefixmethod_to_text(this->string,*output_value);
652         return (this->string);
655 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
656  : BC_TextBox(x, y, w, 1, text)
658         this->fwindow = fwindow;
659         this->thedefault = thedefault;
662 int AssetEditILaceautofixoption::handle_event()
664         fwindow->asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
665         return 1;
669 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
670  : BC_TextBox(x, y, w, 1, text)
672         this->fwindow = fwindow;
673         this->thedefault = thedefault;
676 int AssetEditILacemode::handle_event()
678         fwindow->asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
679         return 1;
682 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow, 
683                 BC_TextBox *output_text,
684                 int *output_value,
685                 ArrayList<BC_ListBoxItem*> *data,
686                 Interlaceautofix *fixoption_chkboxw,
687                 int x, 
688                 int y)
689  : BC_ListBox(x,
690         y,
691         200,
692         150,
693         LISTBOX_TEXT,
694         data,
695         0,
696         0,
697         1,
698         0,
699         1)
701         char string[BCTEXTLEN];
702         this->fixoption_chkbox = fixoption_chkboxw;
703         this->mwindow = mwindow;
704         this->output_text = output_text;
705         this->output_value = output_value;
706         output_text->update(interlacemode_to_text());
709 int AssetEditInterlacemodePulldown::handle_event()
711         output_text->update(get_selection(0, 0)->get_text());
712         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
713         fixoption_chkbox->showhideotherwidgets();
714         return 1;
717 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
719         ilacemode_to_text(this->string,*output_value);
720         return (this->string);
723 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
724  : BC_TextBox(x, y, w, 1, text)
726         this->fwindow = fwindow;
727         this->thedefault = thedefault;
730 int AssetEditILacefixmethod::handle_event()
732         fwindow->asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
733         return 1;
736 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
737  : BC_TextBox(x, y, 100, 1, text)
739         this->fwindow = fwindow;
742 int AssetEditHeader::handle_event()
744         fwindow->asset->header = atol(get_text());
745         return 1;
748 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow, 
749         int value, 
750         int x,
751         int y)
752  : BC_Radial(x, y, value, _("Lo-Hi"))
754         this->fwindow = fwindow;
757 int AssetEditByteOrderLOHI::handle_event()
759         fwindow->asset->byte_order = 1;
760         fwindow->hilo->update(0);
761         update(1);
762         return 1;
765 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow, 
766         int value, 
767         int x, 
768         int y)
769  : BC_Radial(x, y, value, _("Hi-Lo"))
771         this->fwindow = fwindow;
774 int AssetEditByteOrderHILO::handle_event()
776         fwindow->asset->byte_order = 0;
777         fwindow->lohi->update(0);
778         update(1);
779         return 1;
782 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow, 
783         int value, 
784         int x, 
785         int y)
786  : BC_CheckBox(x, y, value, _("Values are signed"))
788         this->fwindow = fwindow;
791 int AssetEditSigned::handle_event()
793         fwindow->asset->signed_ = get_value();
794         return 1;
803 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
804  : BC_TextBox(5, y, 300, 1, fwindow->asset->path) 
806         this->fwindow = fwindow; 
808 AssetEditPathText::~AssetEditPathText() 
811 int AssetEditPathText::handle_event() 
813         strcpy(fwindow->asset->path, get_text());
814         return 1;
817 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, char *text, char *window_title, char *window_caption)
818  : BrowseButton(mwindow, fwindow, textbox, 310, y, text, window_title, window_caption, 0) 
820         this->fwindow = fwindow; 
822 AssetEditPath::~AssetEditPath() {}
829 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
830  : FormatPopup(fwindow->mwindow->plugindb, 90, y)
832         this->fwindow = fwindow; 
834 AssetEditFormat::~AssetEditFormat() 
837 int AssetEditFormat::handle_event()
839         fwindow->asset->format = File::strtoformat(fwindow->mwindow->plugindb, get_selection(0, 0)->get_text());
840         return 1;
846 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
847  : BC_TextBox(x, y, 300, 1, fwindow->asset->reel_name)
849         this->fwindow = fwindow;
851 AssetEditReelName::~AssetEditReelName()
854 int AssetEditReelName::handle_event()
856         strcpy(fwindow->asset->reel_name, get_text());
863 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
864  : BC_TextBox(x, y, 200, 1, fwindow->asset->reel_number)
866         this->fwindow = fwindow;
868 AssetEditReelNumber::~AssetEditReelNumber()
871 int AssetEditReelNumber::handle_event()
873         char *text = get_text() + strlen(get_text()) - 1;
874         
875         // Don't let user enter an invalid character -- only numbers here
876         if(*text < 48 ||
877                 *text > 57)
878         {
879                 *text = '\0';
880         }
882         fwindow->asset->reel_number = atoi(get_text());
889 AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
890  : BC_TextBox(x, y, 30, 1, value)
892         this->fwindow = fwindow;
893         this->multiplier = multiplier;
894         previous = value;
896 AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
899 int AssetEditTCStartTextBox::handle_event()
901         fwindow->asset->tcstart -= previous * multiplier;
902         fwindow->asset->tcstart += atoi(get_text()) * multiplier;
903         previous = atoi(get_text());