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)
82 this->indexable = indexable;
83 this->indexable->add_user();
85 // Copy asset parameters into temporary storage for editing.
86 if(indexable->is_asset)
88 changed_params->copy_from((Asset*)indexable, 0);
92 EDL *nested_edl = (EDL*)indexable;
94 strcpy(changed_params->path, nested_edl->path);
95 changed_params->sample_rate = nested_edl->session->sample_rate;
96 changed_params->channels = nested_edl->session->audio_channels;
98 //printf("AssetEdit::edit_asset %d %f\n", __LINE__, nested_edl->session->frame_rate);
99 changed_params->frame_rate = nested_edl->session->frame_rate;
100 changed_params->width = nested_edl->session->output_w;
101 changed_params->height = nested_edl->session->output_h;
104 BC_DialogThread::start();
107 void AssetEdit::handle_done_event(int result)
109 if( !result && window->tc_hours_textbox ) {
110 changed_params->tcstart = ceil(indexable->get_frame_rate() *
111 (atoi(window->tc_hours_textbox->get_text()) * 3600 +
112 atoi(window->tc_minutes_textbox->get_text()) * 60 +
113 atoi(window->tc_seconds_textbox->get_text()))) +
114 atoi(window->tc_rest_textbox->get_text());
118 void AssetEdit::handle_close_event(int result)
125 if(indexable->is_asset) {
126 asset = (Asset*)indexable;
127 if( !changed_params->equivalent(*asset, 1, 1, mwindow->edl) )
131 nested_edl = (EDL*)indexable;
132 if( strcmp(changed_params->path, nested_edl->path)
133 // || changed_params->sample_rate != nested_edl->session->sample_rate
134 // || !EQUIV(changed_params->frame_rate, nested_edl->session->frame_rate
139 mwindow->gui->lock_window();
140 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
142 // Omit index status from copy since an index rebuild may have been
143 // happening when new_asset was created but not be happening anymore.
145 mwindow->remove_asset_from_caches(asset);
146 //printf("AssetEdit::handle_close_event %d %f\n", __LINE__, asset->get_frame_rate());
147 asset->copy_from(changed_params, 0);
148 //printf("AssetEdit::handle_close_event %d %d %d\n", __LINE__, changed_params->bits, asset->bits);
151 strcpy(nested_edl->path, changed_params->path);
152 // Other parameters can't be changed because they're defined in the other EDL
153 // nested_edl->session->frame_rate = changed_params->frame_rate;
154 // nested_edl->session->sample_rate = changed_params->sample_rate;
156 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
158 mwindow->gui->update(0, 2, 0, 0, 0, 0, 0);
159 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
161 // Start index rebuilding
162 if( (asset && asset->audio_data) || nested_edl) {
163 char source_filename[BCTEXTLEN];
164 char index_filename[BCTEXTLEN];
165 IndexFile::get_index_filename(source_filename,
166 mwindow->preferences->index_directory,
169 remove_file(index_filename);
170 indexable->index_state->index_status = INDEX_NOTTESTED;
171 mwindow->mainindexes->add_next_asset(0, indexable);
172 mwindow->mainindexes->start_build();
174 mwindow->gui->unlock_window();
175 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
176 mwindow->awindow->gui->update_picon(indexable);
177 mwindow->awindow->gui->async_update_assets();
179 mwindow->restart_brender();
180 mwindow->sync_parameters(CHANGE_ALL);
181 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
185 this->indexable->remove_user();
187 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
190 BC_Window* AssetEdit::new_gui()
192 window = new AssetEditWindow(mwindow, this);
193 window->create_objects();
205 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
206 : BC_Window(_(PROGRAM_NAME ": Asset Info"),
207 mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
208 mwindow->gui->get_abs_cursor_y(1) - (128 + 64 +
209 (!asset_edit->indexable->have_audio() ? 0 : 180) +
210 (!asset_edit->indexable->have_video() ? 0 : 350)) / 2,
212 (!asset_edit->indexable->have_audio() ? 0 : 180) +
213 (!asset_edit->indexable->have_video() ? 0 : 350)), 0, 0, 1)
215 this->mwindow = mwindow;
216 this->asset_edit = asset_edit;
224 tc_hours_textbox = 0;
225 tc_minutes_textbox = 0;
226 tc_seconds_textbox = 0;
236 AssetEditWindow::~AssetEditWindow()
238 lock_window("AssetEditWindow::~AssetEditWindow");
239 if(bitspopup) delete bitspopup;
240 if(detail_thread) delete detail_thread;
247 void AssetEditWindow::create_objects()
249 int y = 10, x = 10, x1 = 10, x2 = 190;
250 char string[BCTEXTLEN];
254 BC_TextBox *textboxw;
255 BC_ListBox *listboxw;
256 Interlaceautofix *ilacefixoption_chkboxw;
260 if(asset_edit->indexable->is_asset)
261 asset = (Asset*)asset_edit->indexable;
263 nested_edl = (EDL*)asset_edit->indexable;
265 if(asset && asset->format == FILE_PCM)
270 lock_window("AssetEditWindow::create_objects");
276 add_subwindow(path_text = new AssetEditPathText(this, y));
277 add_subwindow(path_button = new AssetEditPath(mwindow,
281 asset_edit->indexable->path,
282 _(PROGRAM_NAME ": Asset path"), _("Select a file for this asset:")));
287 add_subwindow(new BC_Title(x, y, _("File format:")));
289 add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb,
292 mwindow->theme->assetedit_color));
296 int64_t bytes = fs.get_size(asset->path);
297 add_subwindow(new BC_Title(x, y, _("Bytes:")));
298 sprintf(string, "%jd", bytes);
299 Units::punctuate(string);
302 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
303 if(asset->format == FILE_MPEG || asset->format == FILE_FFMPEG)
305 detail_thread = new DetailAssetThread(mwindow);
306 BC_GenericButton *detail = new DetailAssetButton(this, x2+120, y);
307 add_subwindow(detail);
317 if(asset->audio_length > 0)
318 length = (double)asset->audio_length / asset->sample_rate;
319 if(asset->video_length > 0)
320 length = MAX(length, (double)asset->video_length / asset->frame_rate);
322 if(!EQUIV(length, 0))
323 bitrate = (int64_t)(bytes * 8 / length);
326 add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
327 sprintf(string, "%jd", bitrate);
329 Units::punctuate(string);
330 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
336 if((asset && asset->audio_data) || nested_edl)
338 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
341 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
347 if(asset->get_compression_text(1, 0))
349 add_subwindow(new BC_Title(x, y, _("Compression:")));
351 add_subwindow(new BC_Title(x,
353 asset->get_compression_text(1, 0),
355 mwindow->theme->assetedit_color));
361 add_subwindow(new BC_Title(x, y, _("Channels:")));
362 sprintf(string, "%d", asset_edit->changed_params->channels);
367 BC_TumbleTextBox *textbox = new AssetEditChannels(this,
371 textbox->create_objects();
376 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
381 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
382 sprintf(string, "%d", asset_edit->changed_params->sample_rate);
388 add_subwindow(textbox = new AssetEditRate(this, string, x, y));
389 x += textbox->get_w();
390 add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
394 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
402 add_subwindow(new BC_Title(x, y, _("Bits:")));
406 bitspopup = new BitsPopup(this,
409 &asset_edit->changed_params->bits,
415 bitspopup->create_objects();
418 add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->assetedit_color));
423 add_subwindow(new BC_Title(x, y, _("Header length:")));
424 sprintf(string, "%d", asset->header);
428 add_subwindow(new AssetEditHeader(this, string, x, y));
430 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
435 add_subwindow(new BC_Title(x, y, _("Byte order:")));
441 add_subwindow(lohi = new AssetEditByteOrderLOHI(this,
446 add_subwindow(hilo = new AssetEditByteOrderHILO(this,
455 if(asset->byte_order)
456 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->assetedit_color));
458 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->assetedit_color));
466 // add_subwindow(new BC_Title(x, y, _("Values are signed:")));
467 add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
471 if(!asset->signed_ && asset->bits == 8)
472 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
474 add_subwindow(new BC_Title(x, y, _("Values are signed")));
482 if((asset && asset->video_data) || nested_edl)
484 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
487 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
492 if(asset && asset->get_compression_text(0,1))
494 add_subwindow(new BC_Title(x, y, _("Compression:")));
496 add_subwindow(new BC_Title(x,
498 asset->get_compression_text(0,1),
500 mwindow->theme->assetedit_color));
505 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
507 sprintf(string, "%.4f", asset_edit->changed_params->frame_rate);
509 //printf("AssetEditWindow::create_objects %d %f\n", __LINE__, asset_edit->changed_params->frame_rate);
512 BC_TextBox *framerate;
513 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
515 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
519 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
524 add_subwindow(new BC_Title(x, y, _("Width:")));
526 sprintf(string, "%d", asset_edit->changed_params->width);
527 win_width = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
528 add_subwindow(win_width);
532 add_subwindow(new BC_Title(x, y, _("Height:")));
534 sprintf(string, "%d", asset_edit->changed_params->height);
535 win_height = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
536 add_subwindow(win_height);
537 y += win_height->get_h() + 5;
539 if(asset && (asset->format == FILE_MPEG || asset->format == FILE_FFMPEG ) )
543 add_subwindow(new BC_Title(x, y, _("Actual width:")));
545 sprintf(string, "%d", asset->actual_width);
546 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
548 BC_GenericButton *resize = new ResizeAssetButton(this, x+64, y);
549 add_subwindow(resize);
553 add_subwindow(new BC_Title(x, y, _("Actual height:")));
555 sprintf(string, "%d", asset->actual_height);
556 title = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
557 add_subwindow(title);
558 y += title->get_h() + 5;
561 // --------------------
562 add_subwindow(title = new BC_Title(x1, y, _("Fix interlacing:")));
563 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
564 y += ilacefixoption_chkboxw->get_h() + 5;
565 // --------------------
566 add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:")));
567 add_subwindow(textboxw = new AssetEditILacemode(this, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200));
568 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
569 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
571 &asset_edit->changed_params->interlace_mode,
572 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
573 ilacefixoption_chkboxw,
574 x2 + textboxw->get_w(),
576 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
577 y += textboxw->get_h() + 5;
579 // --------------------
580 add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:")));
581 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", ILACE_FIXDEFAULT, x2, y, 200));
582 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
583 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow,
585 &asset_edit->changed_params->interlace_fixmethod,
586 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
587 x2 + textboxw->get_w(),
589 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
590 ilacefixoption_chkboxw->showhideotherwidgets();
591 y += textboxw->get_h() + 5;
594 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
596 add_subwindow(new AssetEditReelName(this, x, y));
600 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
602 add_subwindow(new AssetEditReelNumber(this, x, y));
606 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
609 // Calculate values to enter into textboxes
610 char text[32], *tc = text;
612 Units::totext(tc, asset->tcstart / asset->frame_rate,
613 TIME_HMSF, asset->sample_rate, asset->frame_rate);
615 strcpy(tc, "0:00:00:00");
617 const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest;
618 tc = strchr(tc, ':'); *tc++ = 0; tc_minutes = tc;
619 tc = strchr(tc, ':'); *tc++ = 0; tc_seconds = tc;
620 tc = strchr(tc, ':'); *tc++ = 0; tc_rest = tc;
622 int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT);
623 int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5;
624 add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours));
625 add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":"));
626 add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes));
627 add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":"));
628 add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds));
629 add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":"));
630 add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest));
635 add_subwindow(new BC_OKButton(this));
636 add_subwindow(new BC_CancelButton(this));
641 void AssetEditWindow::show_info_detail()
643 detail_thread->start((Asset*)asset_edit->indexable);
647 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow,
651 : BC_TumbleTextBox(fwindow,
659 this->fwindow = fwindow;
662 int AssetEditChannels::handle_event()
664 Asset *asset = fwindow->asset_edit->changed_params;
665 asset->channels = atol(get_text());
669 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
670 : BC_TextBox(x, y, 100, 1, text)
672 this->fwindow = fwindow;
675 int AssetEditRate::handle_event()
677 Asset *asset = fwindow->asset_edit->changed_params;
678 asset->sample_rate = atol(get_text());
682 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
683 : BC_TextBox(x, y, 100, 1, text)
685 this->fwindow = fwindow;
688 int AssetEditFRate::handle_event()
690 Asset *asset = fwindow->asset_edit->changed_params;
691 asset->frame_rate = atof(get_text());
695 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
697 fwindow->asset_edit->changed_params->interlace_autofixoption,
698 _("Automatically Fix Interlacing"))
700 this->fwindow = fwindow;
701 this->mwindow = mwindow;
704 Interlaceautofix::~Interlaceautofix()
708 int Interlaceautofix::handle_event()
710 Asset *asset = fwindow->asset_edit->changed_params;
711 asset->interlace_autofixoption = get_value();
712 showhideotherwidgets();
716 void Interlaceautofix::showhideotherwidgets()
718 int thevalue = get_value();
720 Asset *asset = fwindow->asset_edit->changed_params;
721 if (thevalue == ILACE_AUTOFIXOPTION_AUTO)
723 this->ilacemode_textbox->enable();
724 this->ilacemode_listbox->enable();
725 this->ilacefixmethod_textbox->disable();
726 this->ilacefixmethod_listbox->disable();
727 int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,asset->interlace_mode);
728 ilacefixmethod_to_text(string,xx);
729 this->ilacefixmethod_textbox->update(string);
731 if (thevalue == ILACE_AUTOFIXOPTION_MANUAL)
733 this->ilacemode_textbox->disable();
734 this->ilacemode_listbox->disable();
735 this->ilacefixmethod_textbox->enable();
736 this->ilacefixmethod_listbox->enable();
737 ilacefixmethod_to_text(string,asset->interlace_fixmethod);
738 this->ilacefixmethod_textbox->update(string);
742 InterlacefixmethodItem::InterlacefixmethodItem(const char *text, int value)
743 : BC_ListBoxItem(text)
748 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow,
749 BC_TextBox *output_text, int *output_value,
750 ArrayList<BC_ListBoxItem*> *data, int x, int y)
751 : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
753 this->mwindow = mwindow;
754 this->output_text = output_text;
755 this->output_value = output_value;
756 output_text->update(interlacefixmethod_to_text());
759 int InterlacefixmethodPulldown::handle_event()
761 output_text->update(get_selection(0, 0)->get_text());
762 *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
766 const char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
768 ilacefixmethod_to_text(this->string,*output_value);
769 return (this->string);
772 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
773 : BC_TextBox(x, y, w, 1, text)
775 this->fwindow = fwindow;
776 this->thedefault = thedefault;
779 int AssetEditILaceautofixoption::handle_event()
781 Asset *asset = fwindow->asset_edit->changed_params;
782 asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
787 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
788 : BC_TextBox(x, y, w, 1, text)
790 this->fwindow = fwindow;
791 this->thedefault = thedefault;
794 int AssetEditILacemode::handle_event()
796 Asset *asset = fwindow->asset_edit->changed_params;
797 asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
801 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow,
802 BC_TextBox *output_text,
804 ArrayList<BC_ListBoxItem*> *data,
805 Interlaceautofix *fixoption_chkboxw,
820 this->fixoption_chkbox = fixoption_chkboxw;
821 this->mwindow = mwindow;
822 this->output_text = output_text;
823 this->output_value = output_value;
824 output_text->update(interlacemode_to_text());
827 int AssetEditInterlacemodePulldown::handle_event()
829 output_text->update(get_selection(0, 0)->get_text());
830 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
831 fixoption_chkbox->showhideotherwidgets();
835 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
837 ilacemode_to_text(this->string,*output_value);
838 return (this->string);
841 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
842 : BC_TextBox(x, y, w, 1, text)
844 this->fwindow = fwindow;
845 this->thedefault = thedefault;
848 int AssetEditILacefixmethod::handle_event()
850 Asset *asset = fwindow->asset_edit->changed_params;
851 asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
855 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
856 : BC_TextBox(x, y, 100, 1, text)
858 this->fwindow = fwindow;
861 int AssetEditHeader::handle_event()
863 Asset *asset = fwindow->asset_edit->changed_params;
864 asset->header = atol(get_text());
868 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow,
872 : BC_Radial(x, y, value, _("Lo-Hi"))
874 this->fwindow = fwindow;
877 int AssetEditByteOrderLOHI::handle_event()
879 Asset *asset = fwindow->asset_edit->changed_params;
880 asset->byte_order = 1;
881 fwindow->hilo->update(0);
886 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow,
890 : BC_Radial(x, y, value, _("Hi-Lo"))
892 this->fwindow = fwindow;
895 int AssetEditByteOrderHILO::handle_event()
897 Asset *asset = fwindow->asset_edit->changed_params;
898 asset->byte_order = 0;
899 fwindow->lohi->update(0);
904 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow,
908 : BC_CheckBox(x, y, value, _("Values are signed"))
910 this->fwindow = fwindow;
913 int AssetEditSigned::handle_event()
915 Asset *asset = fwindow->asset_edit->changed_params;
916 asset->signed_ = get_value();
926 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
927 : BC_TextBox(5, y, 300, 1, fwindow->asset_edit->changed_params->path)
929 this->fwindow = fwindow;
931 AssetEditPathText::~AssetEditPathText()
934 int AssetEditPathText::handle_event()
936 strcpy(fwindow->asset_edit->changed_params->path, get_text());
940 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow,
941 BC_TextBox *textbox, int y, const char *text,
942 const char *window_title, const char *window_caption)
943 : BrowseButton(mwindow->theme, fwindow, textbox, 310, y, text,
944 window_title, window_caption, 0)
946 this->fwindow = fwindow;
949 AssetEditPath::~AssetEditPath() {}
956 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
957 : FormatPopup(fwindow->mwindow->plugindb, 90, y)
959 this->fwindow = fwindow;
961 AssetEditFormat::~AssetEditFormat()
964 int AssetEditFormat::handle_event()
966 Asset *asset = fwindow->asset_edit->changed_params;
967 asset->format = File::strtoformat(fwindow->mwindow->plugindb,
968 get_selection(0, 0)->get_text());
975 DetailAssetButton::DetailAssetButton(AssetEditWindow *fwindow, int x, int y)
976 : BC_GenericButton(x, y, _("Detail"))
978 this->fwindow = fwindow;
982 DetailAssetButton::~DetailAssetButton()
986 int DetailAssetButton::handle_event()
988 fwindow->show_info_detail();
992 DetailAssetWindow::DetailAssetWindow(MWindow *mwindow, Asset *asset)
993 : BC_Window(_("Asset Detail"),
994 mwindow->gui->get_abs_cursor_x(1) - 600/2,
995 mwindow->gui->get_abs_cursor_y(1) - 500/2,
998 this->mwindow = mwindow;
1005 DetailAssetWindow::~DetailAssetWindow()
1007 asset->remove_user();
1011 DetailAssetThread::DetailAssetThread(MWindow *mwindow)
1014 this->mwindow = mwindow;
1018 DetailAssetThread::~DetailAssetThread()
1023 void DetailAssetThread::stop()
1025 if( Thread::running() ) {
1026 dwindow->lock_window("DetailAssetThread::stop");
1027 dwindow->set_done(1);
1028 dwindow->unlock_window();
1033 void DetailAssetWindow::create_objects()
1036 char file_name[BCTEXTLEN];
1037 int len = sizeof(info);
1038 strncpy(info,_("no info available"),len);
1039 if( !mwindow->preferences->get_asset_file_path(asset, file_name) ) {
1040 switch( asset->format ) {
1042 FileMPEG::get_info(asset->path, file_name, &info[0],len);
1045 FileFFMPEG::get_info(asset->path, &info[0],len);
1049 lock_window("DetailAssetThread::create_objects");
1050 text = new BC_ScrollTextBox(this, x, y, get_w()-32, 23, info, -len);
1051 text->create_objects(); text->set_text_row(0);
1052 add_subwindow(new BC_OKButton(this));
1057 void DetailAssetThread::start(Asset *asset)
1061 dwindow = new DetailAssetWindow(mwindow, asset);
1065 void DetailAssetThread::run()
1067 // Get length from TOC
1068 dwindow->create_objects();
1069 dwindow->run_window();
1078 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
1079 : BC_TextBox(x, y, 220, 1, fwindow->asset_edit->changed_params->reel_name,
1082 this->fwindow = fwindow;
1084 AssetEditReelName::~AssetEditReelName()
1087 int AssetEditReelName::handle_event()
1089 Asset *asset = fwindow->asset_edit->changed_params;
1090 strcpy(asset->reel_name, get_text());
1098 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
1099 : BC_TextBox(x, y, 200, 1, fwindow->asset_edit->changed_params->reel_number)
1101 this->fwindow = fwindow;
1103 AssetEditReelNumber::~AssetEditReelNumber()
1106 int AssetEditReelNumber::handle_event()
1108 Asset *asset = fwindow->asset_edit->changed_params;
1109 asset->reel_number = atoi(get_text());