4 * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "assetedit.h"
25 #include "awindowgui.h"
26 #include "bcprogressbox.h"
27 #include "bcsignals.h"
28 #include "bitspopup.h"
31 #include "cplayback.h"
34 #include "edlsession.h"
37 #include "fileffmpeg.h"
38 #include "filesystem.h"
39 #include "indexable.h"
40 #include "indexfile.h"
41 #include "indexstate.h"
43 #include "mainindexes.h"
45 #include "mwindowgui.h"
48 #include "preferences.h"
49 #include "resizetrackthread.h"
50 #include "removefile.h"
52 #include "transportque.h"
53 #include "interlacemodes.h"
55 #include "edlsession.h"
61 AssetEdit::AssetEdit(MWindow *mwindow)
64 this->mwindow = mwindow;
67 changed_params = new Asset;
72 AssetEdit::~AssetEdit()
75 changed_params->remove_user();
79 void AssetEdit::edit_asset(Indexable *indexable)
86 this->indexable = indexable;
87 this->indexable->add_user();
89 // Copy asset parameters into temporary storage for editing.
90 if(indexable->is_asset)
92 changed_params->copy_from((Asset*)indexable, 0);
96 EDL *nested_edl = (EDL*)indexable;
98 strcpy(changed_params->path, nested_edl->path);
99 changed_params->sample_rate = nested_edl->session->sample_rate;
100 changed_params->channels = nested_edl->session->audio_channels;
102 //printf("AssetEdit::edit_asset %d %f\n", __LINE__, nested_edl->session->frame_rate);
103 changed_params->frame_rate = nested_edl->session->frame_rate;
104 changed_params->width = nested_edl->session->output_w;
105 changed_params->height = nested_edl->session->output_h;
108 BC_DialogThread::start();
111 void AssetEdit::handle_done_event(int result)
114 changed_params->tcstart = ceil(indexable->get_frame_rate() *
115 (atoi(window->tc_hours_textbox->get_text()) * 3600 +
116 atoi(window->tc_minutes_textbox->get_text()) * 60 +
117 atoi(window->tc_seconds_textbox->get_text()))) +
118 atoi(window->tc_rest_textbox->get_text());
122 void AssetEdit::handle_close_event(int result)
130 if(indexable->is_asset)
132 asset = (Asset*)indexable;
133 if(!changed_params->equivalent(*asset, 1, 1))
138 nested_edl = (EDL*)indexable;
139 if(strcmp(changed_params->path, nested_edl->path)
141 // changed_params->sample_rate != nested_edl->session->sample_rate ||
142 // !EQUIV(changed_params->frame_rate, nested_edl->session->frame_rate)
146 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
150 mwindow->gui->lock_window();
151 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
153 // Omit index status from copy since an index rebuild may have been
154 // happening when new_asset was created but not be happening anymore.
157 mwindow->remove_asset_from_caches(asset);
158 //printf("AssetEdit::handle_close_event %d %f\n", __LINE__, asset->get_frame_rate());
159 asset->copy_from(changed_params, 0);
160 //printf("AssetEdit::handle_close_event %d %d %d\n", __LINE__, changed_params->bits, asset->bits);
164 strcpy(nested_edl->path, changed_params->path);
165 // Other parameters can't be changed because they're defined in the other EDL
166 // nested_edl->session->frame_rate = changed_params->frame_rate;
167 // nested_edl->session->sample_rate = changed_params->sample_rate;
169 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
171 mwindow->gui->update(0,
178 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
180 // Start index rebuilding
181 if( (asset && asset->audio_data) || nested_edl)
183 char source_filename[BCTEXTLEN];
184 char index_filename[BCTEXTLEN];
185 IndexFile::get_index_filename(source_filename,
186 mwindow->preferences->index_directory,
189 remove_file(index_filename);
190 indexable->index_state->index_status = INDEX_NOTTESTED;
191 mwindow->mainindexes->add_next_asset(0, indexable);
192 mwindow->mainindexes->start_build();
194 mwindow->gui->unlock_window();
195 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
196 mwindow->awindow->gui->async_update_assets();
198 mwindow->restart_brender();
199 mwindow->sync_parameters(CHANGE_ALL);
200 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
204 this->indexable->remove_user();
206 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
209 BC_Window* AssetEdit::new_gui()
211 window = new AssetEditWindow(mwindow, this);
212 window->create_objects();
224 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
225 : BC_Window(_(PROGRAM_NAME ": Asset Info"),
226 mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
227 mwindow->gui->get_abs_cursor_y(1) - (128 + 64 +
228 (!asset_edit->indexable->have_audio() ? 0 : 180) +
229 (!asset_edit->indexable->have_video() ? 0 : 350)) / 2,
231 (!asset_edit->indexable->have_audio() ? 0 : 180) +
232 (!asset_edit->indexable->have_video() ? 0 : 350)), 0, 0, 1)
234 this->mwindow = mwindow;
235 this->asset_edit = asset_edit;
249 AssetEditWindow::~AssetEditWindow()
251 lock_window("AssetEditWindow::~AssetEditWindow");
252 if(bitspopup) delete bitspopup;
253 if(detail_thread) delete detail_thread;
260 void AssetEditWindow::create_objects()
262 int y = 10, x = 10, x1 = 10, x2 = 160;
263 char string[BCTEXTLEN];
267 BC_TextBox *textboxw;
268 BC_ListBox *listboxw;
269 Interlaceautofix *ilacefixoption_chkboxw;
273 if(asset_edit->indexable->is_asset)
274 asset = (Asset*)asset_edit->indexable;
276 nested_edl = (EDL*)asset_edit->indexable;
278 if(asset && asset->format == FILE_PCM)
283 lock_window("AssetEditWindow::create_objects");
289 add_subwindow(path_text = new AssetEditPathText(this, y));
290 add_subwindow(path_button = new AssetEditPath(mwindow,
294 asset_edit->indexable->path,
295 _(PROGRAM_NAME ": Asset path"), _("Select a file for this asset:")));
300 add_subwindow(new BC_Title(x, y, _("File format:")));
302 add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb,
305 mwindow->theme->assetedit_color));
309 int64_t bytes = fs.get_size(asset->path);
310 add_subwindow(new BC_Title(x, y, _("Bytes:")));
311 sprintf(string, "%jd", bytes);
312 Units::punctuate(string);
315 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
316 if(asset->format == FILE_MPEG || asset->format == FILE_FFMPEG)
318 detail_thread = new DetailAssetThread(mwindow);
319 BC_GenericButton *detail = new DetailAssetButton(this, x2+120, y);
320 add_subwindow(detail);
330 if(asset->audio_length > 0)
331 length = (double)asset->audio_length / asset->sample_rate;
332 if(asset->video_length > 0)
333 length = MAX(length, (double)asset->video_length / asset->frame_rate);
335 if(!EQUIV(length, 0))
336 bitrate = (int64_t)(bytes * 8 / length);
339 add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
340 sprintf(string, "%jd", bitrate);
342 Units::punctuate(string);
343 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
349 if((asset && asset->audio_data) || nested_edl)
351 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
354 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
360 if(asset->get_compression_text(1, 0))
362 add_subwindow(new BC_Title(x, y, _("Compression:")));
364 add_subwindow(new BC_Title(x,
366 asset->get_compression_text(1, 0),
368 mwindow->theme->assetedit_color));
374 add_subwindow(new BC_Title(x, y, _("Channels:")));
375 sprintf(string, "%d", asset_edit->changed_params->channels);
380 BC_TumbleTextBox *textbox = new AssetEditChannels(this,
384 textbox->create_objects();
389 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
394 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
395 sprintf(string, "%d", asset_edit->changed_params->sample_rate);
401 add_subwindow(textbox = new AssetEditRate(this, string, x, y));
402 x += textbox->get_w();
403 add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
407 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
415 add_subwindow(new BC_Title(x, y, _("Bits:")));
419 bitspopup = new BitsPopup(this,
422 &asset_edit->changed_params->bits,
428 bitspopup->create_objects();
431 add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->assetedit_color));
436 add_subwindow(new BC_Title(x, y, _("Header length:")));
437 sprintf(string, "%d", asset->header);
441 add_subwindow(new AssetEditHeader(this, string, x, y));
443 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
448 add_subwindow(new BC_Title(x, y, _("Byte order:")));
454 add_subwindow(lohi = new AssetEditByteOrderLOHI(this,
459 add_subwindow(hilo = new AssetEditByteOrderHILO(this,
468 if(asset->byte_order)
469 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->assetedit_color));
471 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->assetedit_color));
479 // add_subwindow(new BC_Title(x, y, _("Values are signed:")));
480 add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
484 if(!asset->signed_ && asset->bits == 8)
485 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
487 add_subwindow(new BC_Title(x, y, _("Values are signed")));
495 if((asset && asset->video_data) || nested_edl)
497 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
500 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
505 if(asset && asset->get_compression_text(0,1))
507 add_subwindow(new BC_Title(x, y, _("Compression:")));
509 add_subwindow(new BC_Title(x,
511 asset->get_compression_text(0,1),
513 mwindow->theme->assetedit_color));
518 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
520 sprintf(string, "%.4f", asset_edit->changed_params->frame_rate);
522 //printf("AssetEditWindow::create_objects %d %f\n", __LINE__, asset_edit->changed_params->frame_rate);
525 BC_TextBox *framerate;
526 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
528 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
532 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
537 add_subwindow(new BC_Title(x, y, _("Width:")));
539 sprintf(string, "%d", asset_edit->changed_params->width);
540 win_width = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
541 add_subwindow(win_width);
545 add_subwindow(new BC_Title(x, y, _("Height:")));
547 sprintf(string, "%d", asset_edit->changed_params->height);
548 win_height = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
549 add_subwindow(win_height);
550 y += win_height->get_h() + 5;
552 if(asset && (asset->format == FILE_MPEG || asset->format == FILE_FFMPEG ) )
556 add_subwindow(new BC_Title(x, y, _("Actual width:")));
558 sprintf(string, "%d", asset->actual_width);
559 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
561 BC_GenericButton *resize = new ResizeAssetButton(this, x+64, y);
562 add_subwindow(resize);
566 add_subwindow(new BC_Title(x, y, _("Actual height:")));
568 sprintf(string, "%d", asset->actual_height);
569 title = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
570 add_subwindow(title);
571 y += title->get_h() + 5;
574 // --------------------
575 add_subwindow(title = new BC_Title(x1, y, _("Fix interlacing:")));
576 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
577 y += ilacefixoption_chkboxw->get_h() + 5;
578 // --------------------
579 add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:")));
580 add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200));
581 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
582 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
584 &asset->interlace_mode,
585 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
586 ilacefixoption_chkboxw,
587 x2 + textboxw->get_w(),
589 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
590 y += textboxw->get_h() + 5;
592 // --------------------
593 add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:")));
594 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200));
595 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
596 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow,
598 &asset->interlace_fixmethod,
599 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
600 x2 + textboxw->get_w(),
602 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
603 ilacefixoption_chkboxw->showhideotherwidgets();
604 y += textboxw->get_h() + 5;
607 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
609 add_subwindow(new AssetEditReelName(this, x, y));
613 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
615 add_subwindow(new AssetEditReelNumber(this, x, y));
619 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
622 // Calculate values to enter into textboxes
623 char text[32], *tc = text;
624 Units::totext(tc, asset->tcstart / asset->frame_rate,
625 TIME_HMSF, asset->sample_rate, asset->frame_rate);
627 const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest;
628 tc = strchr(tc, ':'); *tc++ = 0; tc_minutes = tc;
629 tc = strchr(tc, ':'); *tc++ = 0; tc_seconds = tc;
630 tc = strchr(tc, ':'); *tc++ = 0; tc_rest = tc;
632 int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT);
633 int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5;
634 add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours));
635 add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":"));
636 add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes));
637 add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":"));
638 add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds));
639 add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":"));
640 add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest));
645 add_subwindow(new BC_OKButton(this));
646 add_subwindow(new BC_CancelButton(this));
651 void AssetEditWindow::show_info_detail()
653 detail_thread->start((Asset*)asset_edit->indexable);
657 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow,
661 : BC_TumbleTextBox(fwindow,
669 this->fwindow = fwindow;
672 int AssetEditChannels::handle_event()
674 Asset *asset = fwindow->asset_edit->changed_params;
675 asset->channels = atol(get_text());
679 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
680 : BC_TextBox(x, y, 100, 1, text)
682 this->fwindow = fwindow;
685 int AssetEditRate::handle_event()
687 Asset *asset = fwindow->asset_edit->changed_params;
688 asset->sample_rate = atol(get_text());
692 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
693 : BC_TextBox(x, y, 100, 1, text)
695 this->fwindow = fwindow;
698 int AssetEditFRate::handle_event()
700 Asset *asset = fwindow->asset_edit->changed_params;
701 asset->frame_rate = atof(get_text());
705 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
707 ((Asset *)fwindow->asset_edit->indexable)->interlace_autofixoption,
708 _("Automatically Fix Interlacing"))
710 this->fwindow = fwindow;
711 this->mwindow = mwindow;
714 Interlaceautofix::~Interlaceautofix()
718 int Interlaceautofix::handle_event()
720 Asset *asset = (Asset *)fwindow->asset_edit->indexable;
721 asset->interlace_autofixoption = get_value();
722 showhideotherwidgets();
726 void Interlaceautofix::showhideotherwidgets()
728 int thevalue = get_value();
730 Asset *asset = (Asset *)fwindow->asset_edit->indexable;
731 if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO)
733 this->ilacemode_textbox->enable();
734 this->ilacemode_listbox->enable();
735 this->ilacefixmethod_textbox->disable();
736 this->ilacefixmethod_listbox->disable();
737 int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,asset->interlace_mode);
738 ilacefixmethod_to_text(string,xx);
739 this->ilacefixmethod_textbox->update(string);
741 if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL)
743 this->ilacemode_textbox->disable();
744 this->ilacemode_listbox->disable();
745 this->ilacefixmethod_textbox->enable();
746 this->ilacefixmethod_listbox->enable();
747 ilacefixmethod_to_text(string,asset->interlace_fixmethod);
748 this->ilacefixmethod_textbox->update(string);
752 InterlacefixmethodItem::InterlacefixmethodItem(const char *text, int value)
753 : BC_ListBoxItem(text)
758 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow,
759 BC_TextBox *output_text, int *output_value,
760 ArrayList<BC_ListBoxItem*> *data, int x, int y)
761 : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
763 this->mwindow = mwindow;
764 this->output_text = output_text;
765 this->output_value = output_value;
766 output_text->update(interlacefixmethod_to_text());
769 int InterlacefixmethodPulldown::handle_event()
771 output_text->update(get_selection(0, 0)->get_text());
772 *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
776 const char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
778 ilacefixmethod_to_text(this->string,*output_value);
779 return (this->string);
782 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
783 : BC_TextBox(x, y, w, 1, text)
785 this->fwindow = fwindow;
786 this->thedefault = thedefault;
789 int AssetEditILaceautofixoption::handle_event()
791 Asset *asset = (Asset *)fwindow->asset_edit->indexable;
792 asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
797 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
798 : BC_TextBox(x, y, w, 1, text)
800 this->fwindow = fwindow;
801 this->thedefault = thedefault;
804 int AssetEditILacemode::handle_event()
806 Asset *asset = (Asset *)fwindow->asset_edit->indexable;
807 asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
811 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow,
812 BC_TextBox *output_text,
814 ArrayList<BC_ListBoxItem*> *data,
815 Interlaceautofix *fixoption_chkboxw,
830 this->fixoption_chkbox = fixoption_chkboxw;
831 this->mwindow = mwindow;
832 this->output_text = output_text;
833 this->output_value = output_value;
834 output_text->update(interlacemode_to_text());
837 int AssetEditInterlacemodePulldown::handle_event()
839 output_text->update(get_selection(0, 0)->get_text());
840 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
841 fixoption_chkbox->showhideotherwidgets();
845 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
847 ilacemode_to_text(this->string,*output_value);
848 return (this->string);
851 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
852 : BC_TextBox(x, y, w, 1, text)
854 this->fwindow = fwindow;
855 this->thedefault = thedefault;
858 int AssetEditILacefixmethod::handle_event()
860 Asset *asset = fwindow->asset_edit->changed_params;
861 asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
865 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
866 : BC_TextBox(x, y, 100, 1, text)
868 this->fwindow = fwindow;
871 int AssetEditHeader::handle_event()
873 Asset *asset = fwindow->asset_edit->changed_params;
874 asset->header = atol(get_text());
878 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow,
882 : BC_Radial(x, y, value, _("Lo-Hi"))
884 this->fwindow = fwindow;
887 int AssetEditByteOrderLOHI::handle_event()
889 Asset *asset = fwindow->asset_edit->changed_params;
890 asset->byte_order = 1;
891 fwindow->hilo->update(0);
896 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow,
900 : BC_Radial(x, y, value, _("Hi-Lo"))
902 this->fwindow = fwindow;
905 int AssetEditByteOrderHILO::handle_event()
907 Asset *asset = fwindow->asset_edit->changed_params;
908 asset->byte_order = 0;
909 fwindow->lohi->update(0);
914 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow,
918 : BC_CheckBox(x, y, value, _("Values are signed"))
920 this->fwindow = fwindow;
923 int AssetEditSigned::handle_event()
925 Asset *asset = fwindow->asset_edit->changed_params;
926 asset->signed_ = get_value();
936 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
937 : BC_TextBox(5, y, 300, 1, fwindow->asset_edit->changed_params->path)
939 this->fwindow = fwindow;
941 AssetEditPathText::~AssetEditPathText()
944 int AssetEditPathText::handle_event()
946 strcpy(fwindow->asset_edit->changed_params->path, get_text());
950 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow,
951 BC_TextBox *textbox, int y, const char *text,
952 const char *window_title, const char *window_caption)
953 : BrowseButton(mwindow, fwindow, textbox, 310, y, text,
954 window_title, window_caption, 0)
956 this->fwindow = fwindow;
959 AssetEditPath::~AssetEditPath() {}
966 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
967 : FormatPopup(fwindow->mwindow->plugindb, 90, y)
969 this->fwindow = fwindow;
971 AssetEditFormat::~AssetEditFormat()
974 int AssetEditFormat::handle_event()
976 Asset *asset = fwindow->asset_edit->changed_params;
977 asset->format = File::strtoformat(fwindow->mwindow->plugindb,
978 get_selection(0, 0)->get_text());
985 DetailAssetButton::DetailAssetButton(AssetEditWindow *fwindow, int x, int y)
986 : BC_GenericButton(x, y, _("Detail"))
988 this->fwindow = fwindow;
992 DetailAssetButton::~DetailAssetButton()
996 int DetailAssetButton::handle_event()
998 fwindow->show_info_detail();
1002 DetailAssetWindow::DetailAssetWindow(MWindow *mwindow, Asset *asset)
1003 : BC_Window(_("Asset Detail"),
1004 mwindow->gui->get_abs_cursor_x(1) - 600/2,
1005 mwindow->gui->get_abs_cursor_y(1) - 500/2,
1008 this->mwindow = mwindow;
1009 this->asset = asset;
1015 DetailAssetWindow::~DetailAssetWindow()
1017 asset->remove_user();
1021 DetailAssetThread::DetailAssetThread(MWindow *mwindow)
1024 this->mwindow = mwindow;
1028 DetailAssetThread::~DetailAssetThread()
1033 void DetailAssetThread::stop()
1035 if( Thread::running() ) {
1036 dwindow->lock_window("DetailAssetThread::stop");
1037 dwindow->set_done(1);
1038 dwindow->unlock_window();
1043 void DetailAssetWindow::create_objects()
1046 char file_name[BCTEXTLEN];
1047 int len = sizeof(info);
1048 strncpy(info,_("no info available"),len);
1049 if( !mwindow->preferences->get_asset_file_path(asset, file_name) ) {
1050 switch( asset->format ) {
1052 FileMPEG::get_info(asset->path, file_name, &info[0],len);
1055 FileFFMPEG::get_info(asset->path, &info[0],len);
1059 lock_window("DetailAssetThread::create_objects");
1060 text = new BC_ScrollTextBox(this, x, y, get_w()-32, 23, info, -len);
1061 text->create_objects(); text->set_text_row(0);
1062 add_subwindow(new BC_OKButton(this));
1067 void DetailAssetThread::start(Asset *asset)
1071 dwindow = new DetailAssetWindow(mwindow, asset);
1075 void DetailAssetThread::run()
1077 // Get length from TOC
1078 dwindow->create_objects();
1079 dwindow->run_window();
1088 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
1089 : BC_TextBox(x, y, 220, 1,
1090 ((Asset *)fwindow->asset_edit->indexable)->reel_name,
1093 this->fwindow = fwindow;
1095 AssetEditReelName::~AssetEditReelName()
1098 int AssetEditReelName::handle_event()
1100 Asset *asset = fwindow->asset_edit->changed_params;
1101 strcpy(asset->reel_name, get_text());
1109 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
1110 : BC_TextBox(x, y, 200, 1, ((Asset *)fwindow->asset_edit->indexable)->reel_number)
1112 this->fwindow = fwindow;
1114 AssetEditReelNumber::~AssetEditReelNumber()
1117 int AssetEditReelNumber::handle_event()
1119 Asset *asset = fwindow->asset_edit->changed_params;
1120 asset->reel_number = atoi(get_text());