Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

assetedit.C

Go to the documentation of this file.
00001 #include "asset.h"
00002 #include "assetedit.h"
00003 #include "awindow.h"
00004 #include "awindowgui.h"
00005 #include "bcprogressbox.h"
00006 #include "bitspopup.h"
00007 #include "cache.h"
00008 #include "clip.h"
00009 #include "cplayback.h"
00010 #include "cwindow.h"
00011 #include "file.h"
00012 #include "filesystem.h"
00013 #include "indexfile.h"
00014 #include "language.h"
00015 #include "mainindexes.h"
00016 #include "mwindow.h"
00017 #include "mwindowgui.h"
00018 #include "theme.h"
00019 #include "new.h"
00020 #include "preferences.h"
00021 #include "transportque.h"
00022 #include "interlacemodes.h"
00023 #include "edl.h"
00024 #include "edlsession.h"
00025 
00026 #include <string.h>
00027 
00028 
00029 
00030 AssetEdit::AssetEdit(MWindow *mwindow)
00031  : Thread()
00032 {
00033         this->mwindow = mwindow;
00034         asset = 0;
00035         window = 0;
00036         set_synchronous(0);
00037 }
00038 
00039 
00040 AssetEdit::~AssetEdit()
00041 {
00042 }
00043 
00044 
00045 void AssetEdit::edit_asset(Asset *asset)
00046 {
00047         if(asset)
00048         {
00049 // Allow more than one window
00050                 this->asset = asset;
00051                 Thread::start();
00052         }
00053 }
00054 
00055 
00056 int AssetEdit::set_asset(Asset *asset)
00057 {
00058         this->asset = asset;
00059         return 0;
00060 }
00061 
00062 void AssetEdit::run()
00063 {
00064         if(asset)
00065         {
00066                 new_asset = new Asset(asset->path);
00067                 *new_asset = *asset;
00068                 int result = 0;
00069 
00070                 window = new AssetEditWindow(mwindow, this);
00071                 window->create_objects();
00072                 result = window->run_window();
00073 
00074                 if(!result)
00075                 {
00076                         if(!asset->equivalent(*new_asset, 1, 1))
00077                         {
00078                                 mwindow->gui->lock_window();
00079 // Omit index status from copy since an index rebuild may have been
00080 // happening when new_asset was created but not be happening anymore.
00081                                 asset->copy_from(new_asset, 0);
00082 
00083                                 mwindow->gui->update(0,
00084                                         2,
00085                                         0,
00086                                         0,
00087                                         0, 
00088                                         0,
00089                                         0);
00090 
00091 // Start index rebuilding
00092                                 if(asset->audio_data)
00093                                 {
00094                                         char source_filename[BCTEXTLEN];
00095                                         char index_filename[BCTEXTLEN];
00096                                         IndexFile::get_index_filename(source_filename, 
00097                                                 mwindow->preferences->index_directory,
00098                                                 index_filename, 
00099                                                 asset->path);
00100                                         remove(index_filename);
00101                                         asset->index_status = INDEX_NOTTESTED;
00102                                         mwindow->mainindexes->add_next_asset(0, asset);
00103                                         mwindow->mainindexes->start_build();
00104                                 }
00105                                 mwindow->gui->unlock_window();
00106 
00107 
00108                                 mwindow->awindow->gui->lock_window();
00109                                 mwindow->awindow->gui->update_assets();
00110                                 mwindow->awindow->gui->unlock_window();
00111 
00112                                 mwindow->restart_brender();
00113                                 mwindow->sync_parameters(CHANGE_ALL);
00114                         }
00115                 }
00116 
00117                 delete new_asset;
00118                 delete window;
00119                 window = 0;
00120         }
00121 }
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
00131  : BC_Window(PROGRAM_NAME ": Asset Info", 
00132         mwindow->gui->get_abs_cursor_x(1) - 400 / 2, 
00133         mwindow->gui->get_abs_cursor_y(1) - 550 / 2, 
00134         400, 
00135         660,
00136         400,
00137         560,
00138         0,
00139         0,
00140         1)
00141 {
00142         this->mwindow = mwindow;
00143         this->asset_edit = asset_edit;
00144         this->asset = asset_edit->new_asset;
00145         bitspopup = 0;
00146         if(asset->format == FILE_PCM)
00147                 allow_edits = 1;
00148         else
00149                 allow_edits = 0;
00150 }
00151 
00152 
00153 
00154 
00155 
00156 AssetEditWindow::~AssetEditWindow()
00157 {
00158         if(bitspopup) delete bitspopup;
00159 }
00160 
00161 
00162 
00163 
00164 int AssetEditWindow::create_objects()
00165 {
00166         int y = 10, x = 10, x1 = 10, x2 = 160;
00167         char string[1024];
00168         int vmargin;
00169         int hmargin1 = 180, hmargin2 = 290;
00170         FileSystem fs;
00171         BC_Title    *titlew;
00172         BC_TextBox  *textboxw;
00173         BC_CheckBox *chkboxw;
00174         BC_ListBox  *listboxw;
00175         Interlaceautofix *ilacefixoption_chkboxw;
00176 
00177         if(allow_edits) 
00178                 vmargin = 30;
00179         else
00180                 vmargin = 20;
00181 
00182         add_subwindow(path_text = new AssetEditPathText(this, y));
00183         add_subwindow(path_button = new AssetEditPath(mwindow, 
00184                 this, 
00185                 path_text, 
00186                 y, 
00187                 asset->path, 
00188                 PROGRAM_NAME ": Asset path", _("Select a file for this asset:")));
00189         y += 30;
00190 
00191         add_subwindow(new BC_Title(x, y, _("File format:")));
00192         x = x2;
00193         add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb, asset->format), MEDIUMFONT, mwindow->theme->edit_font_color));
00194         x = x1;
00195         y += 20;
00196 
00197         int64_t bytes = fs.get_size(asset->path);
00198         add_subwindow(new BC_Title(x, y, _("Bytes:")));
00199         sprintf(string, "%lld", bytes);
00200         Units::punctuate(string);
00201         
00202 
00203         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00204         y += 20;
00205         x = x1;
00206 
00207         double length;
00208         if(asset->audio_length > 0)
00209                 length = (double)asset->audio_length / asset->sample_rate;
00210         if(asset->video_length > 0)
00211                 length = MAX(length, (double)asset->video_length / asset->frame_rate);
00212         int64_t bitrate;
00213         if(!EQUIV(length, 0))
00214                 bitrate = (int64_t)(bytes * 8 / length);
00215         else
00216                 bitrate = bytes;
00217         add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
00218         sprintf(string, "%lld", bitrate);
00219 
00220         Units::punctuate(string);
00221         add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00222 
00223         y += 30;
00224         x = x1;
00225 
00226         if(asset->audio_data)
00227         {
00228                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
00229                 y += 5;
00230 
00231                 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
00232 
00233                 y += 30;
00234 
00235                 if(asset->get_compression_text(1, 0))
00236                 {
00237                         add_subwindow(new BC_Title(x, y, _("Compression:")));
00238                         x = x2;
00239                         add_subwindow(new BC_Title(x, 
00240                                 y, 
00241                                 asset->get_compression_text(1, 0), 
00242                                 MEDIUMFONT, 
00243                                 mwindow->theme->edit_font_color));
00244                         y += vmargin;
00245                         x = x1;
00246                 }
00247 
00248                 add_subwindow(new BC_Title(x, y, _("Channels:")));
00249                 sprintf(string, "%d", asset->channels);
00250 
00251                 x = x2;
00252                 if(allow_edits)
00253                 {
00254                         BC_TumbleTextBox *textbox = new AssetEditChannels(this, string, x, y);
00255                         textbox->create_objects();
00256                         y += vmargin;
00257                 }
00258                 else
00259                 {
00260                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00261                         y += 20;
00262                 }
00263 
00264                 x = x1;
00265                 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
00266                 sprintf(string, "%d", asset->sample_rate);
00267 
00268                 x = x2;
00269 //              if(allow_edits)
00270                 if(1)
00271                 {
00272                         BC_TextBox *textbox;
00273                         add_subwindow(textbox = new AssetEditRate(this, string, x, y));
00274                         x += textbox->get_w();
00275                         add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
00276                 }
00277                 else
00278                 {
00279                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00280                 }
00281 
00282                 y += 30;
00283                 x = x1;
00284 
00285                 add_subwindow(new BC_Title(x, y, _("Bits:")));
00286                 x = x2;
00287                 if(allow_edits)
00288                 {
00289                         bitspopup = new BitsPopup(this, 
00290                                 x, 
00291                                 y, 
00292                                 &asset->bits, 
00293                                 1, 
00294                                 1, 
00295                                 1,
00296                                 0,
00297                                 1);
00298                         bitspopup->create_objects();
00299                 }
00300                 else
00301                         add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->edit_font_color));
00302 
00303 
00304                 x = x1;
00305                 y += vmargin;
00306                 add_subwindow(new BC_Title(x, y, _("Header length:")));
00307                 sprintf(string, "%d", asset->header);
00308 
00309                 x = x2;
00310                 if(allow_edits)
00311                         add_subwindow(new AssetEditHeader(this, string, x, y));
00312                 else
00313                         add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00314 
00315                 y += vmargin;
00316                 x = x1;
00317 
00318                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
00319 
00320                 if(allow_edits)
00321                 {
00322                         x = x2;
00323 
00324                         add_subwindow(lohi = new AssetEditByteOrderLOHI(this, 
00325                                 asset->byte_order, 
00326                                 x, 
00327                                 y));
00328                         x += 70;
00329                         add_subwindow(hilo = new AssetEditByteOrderHILO(this, 
00330                                 !asset->byte_order, 
00331                                 x, 
00332                                 y));
00333                         y += vmargin;
00334                 }
00335                 else
00336                 {
00337                         x = x2;
00338                         if(asset->byte_order)
00339                                 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->edit_font_color));
00340                         else
00341                                 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->edit_font_color));
00342                         y += vmargin;
00343                 }
00344 
00345 
00346                 x = x1;
00347                 if(allow_edits)
00348                 {
00349 //                      add_subwindow(new BC_Title(x, y, _("Values are signed:")));
00350                         add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
00351                 }
00352                 else
00353                 {
00354                         if(!asset->signed_ && asset->bits == 8)
00355                                 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
00356                         else
00357                                 add_subwindow(new BC_Title(x, y, _("Values are signed")));
00358                 }
00359 
00360                 y += 30;
00361         }
00362 
00363         x = x1;
00364         if(asset->video_data)
00365         {
00366                 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
00367                 y += 5;
00368 
00369                 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
00370 
00371 
00372                 y += 30;
00373                 x = x1;
00374                 if(asset->get_compression_text(0,1))
00375                 {
00376                         add_subwindow(new BC_Title(x, y, _("Compression:")));
00377                         x = x2;
00378                         add_subwindow(new BC_Title(x, 
00379                                 y, 
00380                                 asset->get_compression_text(0,1), 
00381                                 MEDIUMFONT, 
00382                                 mwindow->theme->edit_font_color));
00383                         y += vmargin;
00384                         x = x1;
00385                 }
00386 
00387                 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
00388                 x = x2;
00389                 sprintf(string, "%.2f", asset->frame_rate);
00390                 BC_TextBox *framerate;
00391                 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
00392                 x += 105;
00393                 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
00394                 
00395                 y += 30;
00396                 x = x1;
00397                 add_subwindow(new BC_Title(x, y, _("Width:")));
00398                 x = x2;
00399                 sprintf(string, "%d", asset->width);
00400                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00401                 
00402                 y += vmargin;
00403                 x = x1;
00404                 add_subwindow(new BC_Title(x, y, _("Height:")));
00405                 x = x2;
00406                 sprintf(string, "%d", asset->height);
00407                 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->edit_font_color));
00408                 y += 30;
00409 
00410                 // --------------------
00411                 add_subwindow(titlew = new BC_Title(x1, y, _("Fix interlacing:")));
00412                 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
00413                 y += ilacefixoption_chkboxw->get_h() + 5;
00414 
00415                 // --------------------
00416                 add_subwindow(titlew = new BC_Title(x1, y, _("Asset's interlacing:")));
00417                 add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200));
00418                 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
00419                 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
00420                                                         textboxw, 
00421                                                         &asset->interlace_mode,
00422                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
00423                                                         ilacefixoption_chkboxw,
00424                                                         x2 + textboxw->get_w(), 
00425                                                         y)); 
00426                 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
00427                 y += textboxw->get_h() + 5;
00428 
00429                 // --------------------
00430                 add_subwindow(titlew = new BC_Title(x1, y, _("Interlace correction:")));
00431                 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200));
00432                 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
00433                 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, 
00434                                                         textboxw,
00435                                                         &asset->interlace_fixmethod,
00436                                                         (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
00437                                                         x2 + textboxw->get_w(), 
00438                                                         y)); 
00439                 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
00440                 ilacefixoption_chkboxw->showhideotherwidgets();
00441                 y += textboxw->get_h() + 5;
00442                 
00443                 x = x1;
00444                 add_subwindow(new BC_Title(x, y, _("Reel Name:")));
00445                 x = x2;
00446                 add_subwindow(new AssetEditReelName(this, x, y));
00447                 y += 30;
00448                 
00449                 x = x1;
00450                 add_subwindow(new BC_Title(x, y, _("Reel Number:")));
00451                 x = x2;
00452                 add_subwindow(new AssetEditReelNumber(this, x, y));
00453                 y += 30;
00454                 
00455                 x = x1;
00456                 add_subwindow(new BC_Title(x, y, _("Time Code Start:")));
00457                 x = x2;
00458 
00459 // Calculate values to enter into textboxes
00460                 char tc[12];
00461                 
00462                 Units::totext(tc,
00463                         asset->tcstart / asset->frame_rate,
00464                         TIME_HMSF,
00465                         asset->sample_rate,
00466                         asset->frame_rate);
00467                 
00468                 tc[1] = '\0';
00469                 tc[4] = '\0';
00470                 tc[7] = '\0';
00471                 
00472                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc), x, y,
00473                         (int) (asset->frame_rate * 60 * 60)));
00474                 x += 30;
00475                 add_subwindow(new BC_Title(x, y, ":"));
00476                 x += 10;
00477                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 2), x, y,
00478                         (int) (asset->frame_rate * 60)));
00479                 x += 30;
00480                 add_subwindow(new BC_Title(x, y, ":"));
00481                 x += 10;
00482                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 5), x, y,
00483                         (int) (asset->frame_rate)));
00484                 x += 30;
00485                 add_subwindow(new BC_Title(x, y, ":"));
00486                 x += 10;
00487                 add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc + 8), x, y, 1));
00488 
00489 
00490                 y += 30;
00491         }
00492 
00493         add_subwindow(new BC_OKButton(this));
00494         add_subwindow(new BC_CancelButton(this));
00495         show_window();
00496         flush();
00497         return 0;
00498 }
00499 
00500 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow, 
00501         char *text, 
00502         int x,
00503         int y)
00504  : BC_TumbleTextBox(fwindow, 
00505                 (int)atol(text),
00506                 (int)1,
00507                 (int)MAXCHANNELS,
00508                 x, 
00509                 y, 
00510                 50)
00511 {
00512         this->fwindow = fwindow;
00513 }
00514 
00515 int AssetEditChannels::handle_event()
00516 {
00517         fwindow->asset->channels = atol(get_text());
00518         return 1;
00519 }
00520 
00521 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
00522  : BC_TextBox(x, y, 100, 1, text)
00523 {
00524         this->fwindow = fwindow;
00525 }
00526 
00527 int AssetEditRate::handle_event()
00528 {
00529         fwindow->asset->sample_rate = atol(get_text());
00530         return 1;
00531 }
00532 
00533 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
00534  : BC_TextBox(x, y, 100, 1, text)
00535 {
00536         this->fwindow = fwindow;
00537 }
00538 
00539 int AssetEditFRate::handle_event()
00540 {
00541         fwindow->asset->frame_rate = atof(get_text());
00542         return 1;
00543 }
00544 
00545 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
00546  : BC_CheckBox(x, y, fwindow->asset->interlace_autofixoption, _("Automatically Fix Interlacing"))
00547 {
00548         this->fwindow = fwindow;
00549         this->mwindow = mwindow;
00550 }
00551 
00552 Interlaceautofix::~Interlaceautofix()
00553 {
00554 }
00555 
00556 int Interlaceautofix::handle_event()
00557 {
00558         fwindow->asset->interlace_autofixoption = get_value();
00559         showhideotherwidgets();
00560         return 1;
00561 }
00562 
00563 void Interlaceautofix::showhideotherwidgets()
00564 {
00565   int thevalue = get_value();
00566 
00567         if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) 
00568           {
00569             this->ilacemode_textbox->enable(); 
00570             this->ilacemode_listbox->enable(); 
00571             this->ilacefixmethod_textbox->disable();
00572             this->ilacefixmethod_listbox->disable();
00573             int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,fwindow->asset->interlace_mode);
00574             ilacefixmethod_to_text(string,xx);
00575             this->ilacefixmethod_textbox->update(string);
00576           }
00577         if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) 
00578           {
00579             this->ilacemode_textbox->disable(); 
00580             this->ilacemode_listbox->disable(); 
00581             this->ilacefixmethod_textbox->enable(); 
00582             this->ilacefixmethod_listbox->enable(); 
00583             ilacefixmethod_to_text(string,fwindow->asset->interlace_fixmethod);
00584             this->ilacefixmethod_textbox->update(string);
00585           }
00586 }
00587 
00588 InterlacefixmethodItem::InterlacefixmethodItem(char *text, int value)
00589  : BC_ListBoxItem(text)
00590 {
00591         this->value = value;
00592 }
00593 
00594 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow, 
00595                 BC_TextBox *output_text, 
00596                 int *output_value,
00597                 ArrayList<BC_ListBoxItem*> *data,
00598                 int x, 
00599                 int y)
00600  : BC_ListBox(x,
00601         y,
00602         200,
00603         150,
00604         LISTBOX_TEXT,
00605         data,
00606         0,
00607         0,
00608         1,
00609         0,
00610         1)
00611 {
00612         char string[BCTEXTLEN];
00613 
00614         this->mwindow = mwindow;
00615         this->output_text = output_text;
00616         this->output_value = output_value;
00617         output_text->update(interlacefixmethod_to_text());
00618 }
00619 
00620 int InterlacefixmethodPulldown::handle_event()
00621 {
00622         output_text->update(get_selection(0, 0)->get_text());
00623         *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
00624         return 1;
00625 }
00626 
00627 char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
00628 {
00629         ilacefixmethod_to_text(this->string,*output_value);
00630         return (this->string);
00631 }
00632 
00633 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
00634  : BC_TextBox(x, y, w, 1, text)
00635 {
00636         this->fwindow = fwindow;
00637         this->thedefault = thedefault;
00638 }
00639 
00640 int AssetEditILaceautofixoption::handle_event()
00641 {
00642         fwindow->asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
00643         return 1;
00644 }
00645 
00646 
00647 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
00648  : BC_TextBox(x, y, w, 1, text)
00649 {
00650         this->fwindow = fwindow;
00651         this->thedefault = thedefault;
00652 }
00653 
00654 int AssetEditILacemode::handle_event()
00655 {
00656         fwindow->asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
00657         return 1;
00658 }
00659 
00660 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow, 
00661                 BC_TextBox *output_text,
00662                 int *output_value,
00663                 ArrayList<BC_ListBoxItem*> *data,
00664                 Interlaceautofix *fixoption_chkboxw,
00665                 int x, 
00666                 int y)
00667  : BC_ListBox(x,
00668         y,
00669         200,
00670         150,
00671         LISTBOX_TEXT,
00672         data,
00673         0,
00674         0,
00675         1,
00676         0,
00677         1)
00678 {
00679         char string[BCTEXTLEN];
00680         this->fixoption_chkbox = fixoption_chkboxw;
00681         this->mwindow = mwindow;
00682         this->output_text = output_text;
00683         this->output_value = output_value;
00684         output_text->update(interlacemode_to_text());
00685 }
00686 
00687 int AssetEditInterlacemodePulldown::handle_event()
00688 {
00689         output_text->update(get_selection(0, 0)->get_text());
00690         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
00691         fixoption_chkbox->showhideotherwidgets();
00692         return 1;
00693 }
00694 
00695 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
00696 {
00697         ilacemode_to_text(this->string,*output_value);
00698         return (this->string);
00699 }
00700 
00701 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
00702  : BC_TextBox(x, y, w, 1, text)
00703 {
00704         this->fwindow = fwindow;
00705         this->thedefault = thedefault;
00706 }
00707 
00708 int AssetEditILacefixmethod::handle_event()
00709 {
00710         fwindow->asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
00711         return 1;
00712 }
00713 
00714 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
00715  : BC_TextBox(x, y, 100, 1, text)
00716 {
00717         this->fwindow = fwindow;
00718 }
00719 
00720 int AssetEditHeader::handle_event()
00721 {
00722         fwindow->asset->header = atol(get_text());
00723         return 1;
00724 }
00725 
00726 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow, 
00727         int value, 
00728         int x,
00729         int y)
00730  : BC_Radial(x, y, value, _("Lo-Hi"))
00731 {
00732         this->fwindow = fwindow;
00733 }
00734 
00735 int AssetEditByteOrderLOHI::handle_event()
00736 {
00737         fwindow->asset->byte_order = 1;
00738         fwindow->hilo->update(0);
00739         update(1);
00740         return 1;
00741 }
00742 
00743 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow, 
00744         int value, 
00745         int x, 
00746         int y)
00747  : BC_Radial(x, y, value, _("Hi-Lo"))
00748 {
00749         this->fwindow = fwindow;
00750 }
00751 
00752 int AssetEditByteOrderHILO::handle_event()
00753 {
00754         fwindow->asset->byte_order = 0;
00755         fwindow->lohi->update(0);
00756         update(1);
00757         return 1;
00758 }
00759 
00760 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow, 
00761         int value, 
00762         int x, 
00763         int y)
00764  : BC_CheckBox(x, y, value, _("Values are signed"))
00765 {
00766         this->fwindow = fwindow;
00767 }
00768 
00769 int AssetEditSigned::handle_event()
00770 {
00771         fwindow->asset->signed_ = get_value();
00772         return 1;
00773 }
00774 
00775 
00776 
00777 
00778 
00779 
00780 
00781 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
00782  : BC_TextBox(5, y, 300, 1, fwindow->asset->path) 
00783 {
00784         this->fwindow = fwindow; 
00785 }
00786 AssetEditPathText::~AssetEditPathText() 
00787 {
00788 }
00789 int AssetEditPathText::handle_event() 
00790 {
00791         strcpy(fwindow->asset->path, get_text());
00792         return 1;
00793 }
00794 
00795 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, char *text, char *window_title, char *window_caption)
00796  : BrowseButton(mwindow, fwindow, textbox, 310, y, text, window_title, window_caption, 0) 
00797 { 
00798         this->fwindow = fwindow; 
00799 }
00800 AssetEditPath::~AssetEditPath() {}
00801 
00802 
00803 
00804 
00805 
00806 
00807 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
00808  : FormatPopup(fwindow->mwindow->plugindb, 90, y)
00809 { 
00810         this->fwindow = fwindow; 
00811 }
00812 AssetEditFormat::~AssetEditFormat() 
00813 {
00814 }
00815 int AssetEditFormat::handle_event()
00816 {
00817         fwindow->asset->format = File::strtoformat(fwindow->mwindow->plugindb, get_selection(0, 0)->get_text());
00818         return 1;
00819 }
00820 
00821 
00822 
00823 
00824 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
00825  : BC_TextBox(x, y, 300, 1, fwindow->asset->reel_name)
00826 {
00827         this->fwindow = fwindow;
00828 }
00829 AssetEditReelName::~AssetEditReelName()
00830 {
00831 }
00832 int AssetEditReelName::handle_event()
00833 {
00834         strcpy(fwindow->asset->reel_name, get_text());
00835 }
00836 
00837 
00838 
00839 
00840 
00841 AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y)
00842  : BC_TextBox(x, y, 200, 1, fwindow->asset->reel_number)
00843 {
00844         this->fwindow = fwindow;
00845 }
00846 AssetEditReelNumber::~AssetEditReelNumber()
00847 {
00848 }
00849 int AssetEditReelNumber::handle_event()
00850 {
00851         char *text = get_text() + strlen(get_text()) - 1;
00852         
00853         // Don't let user enter an invalid character -- only numbers here
00854         if(*text < 48 ||
00855                 *text > 57)
00856         {
00857                 *text = '\0';
00858         }
00859 
00860         fwindow->asset->reel_number = atoi(get_text());
00861 }
00862 
00863 
00864 
00865 
00866 
00867 AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
00868  : BC_TextBox(x, y, 30, 1, value)
00869 {
00870         this->fwindow = fwindow;
00871         this->multiplier = multiplier;
00872         previous = value;
00873 }
00874 AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
00875 {
00876 }
00877 int AssetEditTCStartTextBox::handle_event()
00878 {
00879         fwindow->asset->tcstart -= previous * multiplier;
00880         fwindow->asset->tcstart += atoi(get_text()) * multiplier;
00881         previous = atoi(get_text());
00882 }

Generated on Sun Jan 8 13:38:50 2006 for Cinelerra-svn by  doxygen 1.4.4