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, mwindow->edl))
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 = 190;
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, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200));
581 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
582 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
584 &asset_edit->changed_params->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, "", ILACE_FIXDEFAULT, x2, y, 200));
595 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
596 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow,
598 &asset_edit->changed_params->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;
625 Units::totext(tc, asset->tcstart / asset->frame_rate,
626 TIME_HMSF, asset->sample_rate, asset->frame_rate);
628 strcpy(tc, "0:00:00:00");
630 const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest;
631 tc = strchr(tc, ':'); *tc++ = 0; tc_minutes = tc;
632 tc = strchr(tc, ':'); *tc++ = 0; tc_seconds = tc;
633 tc = strchr(tc, ':'); *tc++ = 0; tc_rest = tc;
635 int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT);
636 int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5;
637 add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours));
638 add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":"));
639 add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes));
640 add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":"));
641 add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds));
642 add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":"));
643 add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest));
648 add_subwindow(new BC_OKButton(this));
649 add_subwindow(new BC_CancelButton(this));
654 void AssetEditWindow::show_info_detail()
656 detail_thread->start((Asset*)asset_edit->indexable);
660 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow,
664 : BC_TumbleTextBox(fwindow,
672 this->fwindow = fwindow;
675 int AssetEditChannels::handle_event()
677 Asset *asset = fwindow->asset_edit->changed_params;
678 asset->channels = atol(get_text());
682 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
683 : BC_TextBox(x, y, 100, 1, text)
685 this->fwindow = fwindow;
688 int AssetEditRate::handle_event()
690 Asset *asset = fwindow->asset_edit->changed_params;
691 asset->sample_rate = atol(get_text());
695 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
696 : BC_TextBox(x, y, 100, 1, text)
698 this->fwindow = fwindow;
701 int AssetEditFRate::handle_event()
703 Asset *asset = fwindow->asset_edit->changed_params;
704 asset->frame_rate = atof(get_text());
708 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
710 fwindow->asset_edit->changed_params->interlace_autofixoption,
711 _("Automatically Fix Interlacing"))
713 this->fwindow = fwindow;
714 this->mwindow = mwindow;
717 Interlaceautofix::~Interlaceautofix()
721 int Interlaceautofix::handle_event()
723 Asset *asset = fwindow->asset_edit->changed_params;
724 asset->interlace_autofixoption = get_value();
725 showhideotherwidgets();
729 void Interlaceautofix::showhideotherwidgets()
731 int thevalue = get_value();
733 Asset *asset = fwindow->asset_edit->changed_params;
734 if (thevalue == ILACE_AUTOFIXOPTION_AUTO)
736 this->ilacemode_textbox->enable();
737 this->ilacemode_listbox->enable();
738 this->ilacefixmethod_textbox->disable();
739 this->ilacefixmethod_listbox->disable();
740 int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,asset->interlace_mode);
741 ilacefixmethod_to_text(string,xx);
742 this->ilacefixmethod_textbox->update(string);
744 if (thevalue == ILACE_AUTOFIXOPTION_MANUAL)
746 this->ilacemode_textbox->disable();
747 this->ilacemode_listbox->disable();
748 this->ilacefixmethod_textbox->enable();
749 this->ilacefixmethod_listbox->enable();
750 ilacefixmethod_to_text(string,asset->interlace_fixmethod);
751 this->ilacefixmethod_textbox->update(string);
755 InterlacefixmethodItem::InterlacefixmethodItem(const char *text, int value)
756 : BC_ListBoxItem(text)
761 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow,
762 BC_TextBox *output_text, int *output_value,
763 ArrayList<BC_ListBoxItem*> *data, int x, int y)
764 : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
766 this->mwindow = mwindow;
767 this->output_text = output_text;
768 this->output_value = output_value;
769 output_text->update(interlacefixmethod_to_text());
772 int InterlacefixmethodPulldown::handle_event()
774 output_text->update(get_selection(0, 0)->get_text());
775 *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
779 const char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
781 ilacefixmethod_to_text(this->string,*output_value);
782 return (this->string);
785 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
786 : BC_TextBox(x, y, w, 1, text)
788 this->fwindow = fwindow;
789 this->thedefault = thedefault;
792 int AssetEditILaceautofixoption::handle_event()
794 Asset *asset = fwindow->asset_edit->changed_params;
795 asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
800 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
801 : BC_TextBox(x, y, w, 1, text)
803 this->fwindow = fwindow;
804 this->thedefault = thedefault;
807 int AssetEditILacemode::handle_event()
809 Asset *asset = fwindow->asset_edit->changed_params;
810 asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
814 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow,
815 BC_TextBox *output_text,
817 ArrayList<BC_ListBoxItem*> *data,
818 Interlaceautofix *fixoption_chkboxw,
833 this->fixoption_chkbox = fixoption_chkboxw;
834 this->mwindow = mwindow;
835 this->output_text = output_text;
836 this->output_value = output_value;
837 output_text->update(interlacemode_to_text());
840 int AssetEditInterlacemodePulldown::handle_event()
842 output_text->update(get_selection(0, 0)->get_text());
843 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
844 fixoption_chkbox->showhideotherwidgets();
848 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
850 ilacemode_to_text(this->string,*output_value);
851 return (this->string);
854 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
855 : BC_TextBox(x, y, w, 1, text)
857 this->fwindow = fwindow;
858 this->thedefault = thedefault;
861 int AssetEditILacefixmethod::handle_event()
863 Asset *asset = fwindow->asset_edit->changed_params;
864 asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
868 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
869 : BC_TextBox(x, y, 100, 1, text)
871 this->fwindow = fwindow;
874 int AssetEditHeader::handle_event()
876 Asset *asset = fwindow->asset_edit->changed_params;
877 asset->header = atol(get_text());
881 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow,
885 : BC_Radial(x, y, value, _("Lo-Hi"))
887 this->fwindow = fwindow;
890 int AssetEditByteOrderLOHI::handle_event()
892 Asset *asset = fwindow->asset_edit->changed_params;
893 asset->byte_order = 1;
894 fwindow->hilo->update(0);
899 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow,
903 : BC_Radial(x, y, value, _("Hi-Lo"))
905 this->fwindow = fwindow;
908 int AssetEditByteOrderHILO::handle_event()
910 Asset *asset = fwindow->asset_edit->changed_params;
911 asset->byte_order = 0;
912 fwindow->lohi->update(0);
917 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow,
921 : BC_CheckBox(x, y, value, _("Values are signed"))
923 this->fwindow = fwindow;
926 int AssetEditSigned::handle_event()
928 Asset *asset = fwindow->asset_edit->changed_params;
929 asset->signed_ = get_value();
939 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
940 : BC_TextBox(5, y, 300, 1, fwindow->asset_edit->changed_params->path)
942 this->fwindow = fwindow;
944 AssetEditPathText::~AssetEditPathText()
947 int AssetEditPathText::handle_event()
949 strcpy(fwindow->asset_edit->changed_params->path, get_text());
953 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow,
954 BC_TextBox *textbox, int y, const char *text,
955 const char *window_title, const char *window_caption)
956 : BrowseButton(mwindow->theme, fwindow, textbox, 310, y, text,
957 window_title, window_caption, 0)
959 this->fwindow = fwindow;
962 AssetEditPath::~AssetEditPath() {}
969 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
970 : FormatPopup(fwindow->mwindow->plugindb, 90, y)
972 this->fwindow = fwindow;
974 AssetEditFormat::~AssetEditFormat()
977 int AssetEditFormat::handle_event()
979 Asset *asset = fwindow->asset_edit->changed_params;
980 asset->format = File::strtoformat(fwindow->mwindow->plugindb,
981 get_selection(0, 0)->get_text());
988 DetailAssetButton::DetailAssetButton(AssetEditWindow *fwindow, int x, int y)
989 : BC_GenericButton(x, y, _("Detail"))
991 this->fwindow = fwindow;
995 DetailAssetButton::~DetailAssetButton()
999 int DetailAssetButton::handle_event()
1001 fwindow->show_info_detail();
1005 DetailAssetWindow::DetailAssetWindow(MWindow *mwindow, Asset *asset)
1006 : BC_Window(_("Asset Detail"),
1007 mwindow->gui->get_abs_cursor_x(1) - 600/2,
1008 mwindow->gui->get_abs_cursor_y(1) - 500/2,
1011 this->mwindow = mwindow;
1012 this->asset = asset;
1018 DetailAssetWindow::~DetailAssetWindow()
1020 asset->remove_user();
1024 DetailAssetThread::DetailAssetThread(MWindow *mwindow)
1027 this->mwindow = mwindow;
1031 DetailAssetThread::~DetailAssetThread()
1036 void DetailAssetThread::stop()
1038 if( Thread::running() ) {
1039 dwindow->lock_window("DetailAssetThread::stop");
1040 dwindow->set_done(1);
1041 dwindow->unlock_window();
1046 void DetailAssetWindow::create_objects()
1049 char file_name[BCTEXTLEN];
1050 int len = sizeof(info);
1051 strncpy(info,_("no info available"),len);
1052 if( !mwindow->preferences->get_asset_file_path(asset, file_name) ) {
1053 switch( asset->format ) {
1055 FileMPEG::get_info(asset->path, file_name, &info[0],len);
1058 FileFFMPEG::get_info(asset->path, &info[0],len);
1062 lock_window("DetailAssetThread::create_objects");
1063 text = new BC_ScrollTextBox(this, x, y, get_w()-32, 23, info, -len);
1064 text->create_objects(); text->set_text_row(0);
1065 add_subwindow(new BC_OKButton(this));
1070 void DetailAssetThread::start(Asset *asset)
1074 dwindow = new DetailAssetWindow(mwindow, asset);
1078 void DetailAssetThread::run()
1080 // Get length from TOC
1081 dwindow->create_objects();
1082 dwindow->run_window();
1091 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
1092 : BC_TextBox(x, y, 220, 1, fwindow->asset_edit->changed_params->reel_name,
1095 this->fwindow = fwindow;
1097 AssetEditReelName::~AssetEditReelName()
1100 int AssetEditReelName::handle_event()
1102 Asset *asset = fwindow->asset_edit->changed_params;
1103 strcpy(asset->reel_name, get_text());
1111 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
1112 : BC_TextBox(x, y, 200, 1, fwindow->asset_edit->changed_params->reel_number)
1114 this->fwindow = fwindow;
1116 AssetEditReelNumber::~AssetEditReelNumber()
1119 int AssetEditReelNumber::handle_event()
1121 Asset *asset = fwindow->asset_edit->changed_params;
1122 asset->reel_number = atoi(get_text());