r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / assetedit.C
blobd659ce38559820d3ddff3d1d17586a934dc5941f
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                 char *tc_hours = tc;
491                 char *tc_minutes = strchr(tc, ':') + 1;
492                 *(tc_minutes - 1) = 0;
493                 char *tc_seconds = strchr(tc_minutes, ':') + 1;
494                 *(tc_seconds - 1) = 0;
495                 char *tc_rest = strchr(tc_seconds, ':') + 1;
496                 *(tc_rest - 1) = 0;
497                 
498                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_hours), x, y,
499                         (int) (asset->frame_rate * 60 * 60)));
500                 x += 30;
501                 add_subwindow(new BC_Title(x, y, ":"));
502                 x += 10;
503                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_minutes), x, y,
504                         (int) (asset->frame_rate * 60)));
505                 x += 30;
506                 add_subwindow(new BC_Title(x, y, ":"));
507                 x += 10;
508                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_seconds), x, y,
509                         (int) (asset->frame_rate)));
510                 x += 30;
511                 add_subwindow(new BC_Title(x, y, ":"));
512                 x += 10;
513                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_rest), x, y, 1));
516                 y += 30;
517         }
519         add_subwindow(new BC_OKButton(this));
520         add_subwindow(new BC_CancelButton(this));
521         show_window();
522         flush();
523         return 0;
526 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow, 
527         char *text, 
528         int x,
529         int y)
530  : BC_TumbleTextBox(fwindow, 
531                 (int)atol(text),
532                 (int)1,
533                 (int)MAXCHANNELS,
534                 x, 
535                 y, 
536                 50)
538         this->fwindow = fwindow;
541 int AssetEditChannels::handle_event()
543         fwindow->asset->channels = atol(get_text());
544         return 1;
547 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
548  : BC_TextBox(x, y, 100, 1, text)
550         this->fwindow = fwindow;
553 int AssetEditRate::handle_event()
555         fwindow->asset->sample_rate = atol(get_text());
556         return 1;
559 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
560  : BC_TextBox(x, y, 100, 1, text)
562         this->fwindow = fwindow;
565 int AssetEditFRate::handle_event()
567         fwindow->asset->frame_rate = atof(get_text());
568         return 1;
571 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
572  : BC_CheckBox(x, y, fwindow->asset->interlace_autofixoption, _("Automatically Fix Interlacing"))
574         this->fwindow = fwindow;
575         this->mwindow = mwindow;
578 Interlaceautofix::~Interlaceautofix()
582 int Interlaceautofix::handle_event()
584         fwindow->asset->interlace_autofixoption = get_value();
585         showhideotherwidgets();
586         return 1;
589 void Interlaceautofix::showhideotherwidgets()
591   int thevalue = get_value();
593         if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) 
594           {
595             this->ilacemode_textbox->enable(); 
596             this->ilacemode_listbox->enable(); 
597             this->ilacefixmethod_textbox->disable();
598             this->ilacefixmethod_listbox->disable();
599             int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,fwindow->asset->interlace_mode);
600             ilacefixmethod_to_text(string,xx);
601             this->ilacefixmethod_textbox->update(string);
602           }
603         if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) 
604           {
605             this->ilacemode_textbox->disable(); 
606             this->ilacemode_listbox->disable(); 
607             this->ilacefixmethod_textbox->enable(); 
608             this->ilacefixmethod_listbox->enable(); 
609             ilacefixmethod_to_text(string,fwindow->asset->interlace_fixmethod);
610             this->ilacefixmethod_textbox->update(string);
611           }
614 InterlacefixmethodItem::InterlacefixmethodItem(char *text, int value)
615  : BC_ListBoxItem(text)
617         this->value = value;
620 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow, 
621                 BC_TextBox *output_text, 
622                 int *output_value,
623                 ArrayList<BC_ListBoxItem*> *data,
624                 int x, 
625                 int y)
626  : BC_ListBox(x,
627         y,
628         200,
629         150,
630         LISTBOX_TEXT,
631         data,
632         0,
633         0,
634         1,
635         0,
636         1)
638         char string[BCTEXTLEN];
640         this->mwindow = mwindow;
641         this->output_text = output_text;
642         this->output_value = output_value;
643         output_text->update(interlacefixmethod_to_text());
646 int InterlacefixmethodPulldown::handle_event()
648         output_text->update(get_selection(0, 0)->get_text());
649         *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
650         return 1;
653 char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
655         ilacefixmethod_to_text(this->string,*output_value);
656         return (this->string);
659 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
660  : BC_TextBox(x, y, w, 1, text)
662         this->fwindow = fwindow;
663         this->thedefault = thedefault;
666 int AssetEditILaceautofixoption::handle_event()
668         fwindow->asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
669         return 1;
673 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
674  : BC_TextBox(x, y, w, 1, text)
676         this->fwindow = fwindow;
677         this->thedefault = thedefault;
680 int AssetEditILacemode::handle_event()
682         fwindow->asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
683         return 1;
686 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow, 
687                 BC_TextBox *output_text,
688                 int *output_value,
689                 ArrayList<BC_ListBoxItem*> *data,
690                 Interlaceautofix *fixoption_chkboxw,
691                 int x, 
692                 int y)
693  : BC_ListBox(x,
694         y,
695         200,
696         150,
697         LISTBOX_TEXT,
698         data,
699         0,
700         0,
701         1,
702         0,
703         1)
705         char string[BCTEXTLEN];
706         this->fixoption_chkbox = fixoption_chkboxw;
707         this->mwindow = mwindow;
708         this->output_text = output_text;
709         this->output_value = output_value;
710         output_text->update(interlacemode_to_text());
713 int AssetEditInterlacemodePulldown::handle_event()
715         output_text->update(get_selection(0, 0)->get_text());
716         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
717         fixoption_chkbox->showhideotherwidgets();
718         return 1;
721 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
723         ilacemode_to_text(this->string,*output_value);
724         return (this->string);
727 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
728  : BC_TextBox(x, y, w, 1, text)
730         this->fwindow = fwindow;
731         this->thedefault = thedefault;
734 int AssetEditILacefixmethod::handle_event()
736         fwindow->asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
737         return 1;
740 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
741  : BC_TextBox(x, y, 100, 1, text)
743         this->fwindow = fwindow;
746 int AssetEditHeader::handle_event()
748         fwindow->asset->header = atol(get_text());
749         return 1;
752 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow, 
753         int value, 
754         int x,
755         int y)
756  : BC_Radial(x, y, value, _("Lo-Hi"))
758         this->fwindow = fwindow;
761 int AssetEditByteOrderLOHI::handle_event()
763         fwindow->asset->byte_order = 1;
764         fwindow->hilo->update(0);
765         update(1);
766         return 1;
769 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow, 
770         int value, 
771         int x, 
772         int y)
773  : BC_Radial(x, y, value, _("Hi-Lo"))
775         this->fwindow = fwindow;
778 int AssetEditByteOrderHILO::handle_event()
780         fwindow->asset->byte_order = 0;
781         fwindow->lohi->update(0);
782         update(1);
783         return 1;
786 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow, 
787         int value, 
788         int x, 
789         int y)
790  : BC_CheckBox(x, y, value, _("Values are signed"))
792         this->fwindow = fwindow;
795 int AssetEditSigned::handle_event()
797         fwindow->asset->signed_ = get_value();
798         return 1;
807 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
808  : BC_TextBox(5, y, 300, 1, fwindow->asset->path) 
810         this->fwindow = fwindow; 
812 AssetEditPathText::~AssetEditPathText() 
815 int AssetEditPathText::handle_event() 
817         strcpy(fwindow->asset->path, get_text());
818         return 1;
821 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, char *text, char *window_title, char *window_caption)
822  : BrowseButton(mwindow, fwindow, textbox, 310, y, text, window_title, window_caption, 0) 
824         this->fwindow = fwindow; 
826 AssetEditPath::~AssetEditPath() {}
833 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
834  : FormatPopup(fwindow->mwindow->plugindb, 90, y)
836         this->fwindow = fwindow; 
838 AssetEditFormat::~AssetEditFormat() 
841 int AssetEditFormat::handle_event()
843         fwindow->asset->format = File::strtoformat(fwindow->mwindow->plugindb, get_selection(0, 0)->get_text());
844         return 1;
850 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
851  : BC_TextBox(x, y, 300, 1, fwindow->asset->reel_name)
853         this->fwindow = fwindow;
855 AssetEditReelName::~AssetEditReelName()
858 int AssetEditReelName::handle_event()
860         strcpy(fwindow->asset->reel_name, get_text());
867 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
868  : BC_TextBox(x, y, 200, 1, fwindow->asset->reel_number)
870         this->fwindow = fwindow;
872 AssetEditReelNumber::~AssetEditReelNumber()
875 int AssetEditReelNumber::handle_event()
877         char *text = get_text() + strlen(get_text()) - 1;
878         
879         // Don't let user enter an invalid character -- only numbers here
880         if(*text < 48 ||
881                 *text > 57)
882         {
883                 *text = '\0';
884         }
886         fwindow->asset->reel_number = atoi(get_text());
893 AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
894  : BC_TextBox(x, y, 30, 1, value)
896         this->fwindow = fwindow;
897         this->multiplier = multiplier;
898         previous = value;
900 AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
903 int AssetEditTCStartTextBox::handle_event()
905         fwindow->asset->tcstart -= previous * multiplier;
906         fwindow->asset->tcstart += atoi(get_text()) * multiplier;
907         previous = atoi(get_text());