X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fnew.C;h=58e6eca9d3a463d619a68f9294db76fe2e35525f;hb=74afbc29ac4ce9d94d53e10342979f2c59f1f193;hp=e12e60cca194fedd8d4a42bc1e47cc3679379a4a;hpb=0b78779e9e75131eee81d2e4689b98df0e91c092;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/new.C b/cinelerra-5.1/cinelerra/new.C index e12e60cc..58e6eca9 100644 --- a/cinelerra-5.1/cinelerra/new.C +++ b/cinelerra-5.1/cinelerra/new.C @@ -49,12 +49,11 @@ #include -#define WIDTH 600 -#define HEIGHT 400 - +#define WIDTH 640 +#define HEIGHT 425 New::New(MWindow *mwindow) - : BC_MenuItem(_("New"), "n", 'n') + : BC_MenuItem(_("New Project..."), "n", 'n') { this->mwindow = mwindow; script = 0; @@ -77,8 +76,7 @@ int New::handle_event() mwindow->gui->unlock_window(); mwindow->edl->save_defaults(mwindow->defaults); create_new_edl(); - create_new_project(); -// thread->start(); + thread->start(); mwindow->gui->lock_window("New::handle_event"); return 1; @@ -86,8 +84,7 @@ int New::handle_event() void New::create_new_edl() { - if(!new_edl) - { + if( !new_edl ) { new_edl = new EDL; new_edl->create_objects(); new_edl->load_defaults(mwindow->defaults); @@ -97,31 +94,13 @@ void New::create_new_edl() int New::create_new_project() { - mwindow->cwindow->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); - - for(int i = 0; i < mwindow->vwindows.size(); i++) - { - mwindow->vwindows.get(i)->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); - mwindow->vwindows.get(i)->playback_engine->interrupt_playback(0); - } - - mwindow->cwindow->playback_engine->interrupt_playback(0); - + mwindow->stop_playback(0); mwindow->gui->lock_window(); mwindow->reset_caches(); - - memcpy(new_edl->session->achannel_positions, - &mwindow->preferences->channel_positions[ - MAXCHANNELS * (new_edl->session->audio_channels - 1)], - sizeof(int) * MAXCHANNELS); + &mwindow->preferences->channel_positions[new_edl->session->audio_channels - 1], + sizeof(new_edl->session->achannel_positions)); new_edl->session->boundaries(); new_edl->create_default_tracks(); @@ -137,7 +116,7 @@ int New::create_new_project() // Load file sequence mwindow->update_project(LOADMODE_REPLACE); mwindow->session->changes_made = 0; - mwindow->undo->update_undo_after(_("New"), LOAD_ALL); + mwindow->undo->update_undo_after(_("New Project"), LOAD_ALL); mwindow->gui->unlock_window(); return 0; } @@ -155,8 +134,6 @@ NewThread::~NewThread() close_window(); } - - BC_Window* NewThread::new_gui() { mwindow->edl->save_defaults(mwindow->defaults); @@ -164,8 +141,8 @@ BC_Window* NewThread::new_gui() load_defaults(); mwindow->gui->lock_window("NewThread::new_gui"); - int x = mwindow->gui->get_abs_cursor_x(0) - WIDTH / 2; - int y = mwindow->gui->get_abs_cursor_y(0) - HEIGHT / 2; + int x = mwindow->gui->get_pop_cursor_x(0); + int y = mwindow->gui->get_pop_cursor_y(0); nwindow = new NewWindow(mwindow, this, x, y); nwindow->create_objects(); @@ -173,28 +150,22 @@ BC_Window* NewThread::new_gui() return nwindow; } - - void NewThread::handle_close_event(int result) { - + if( !new_project->new_edl ) return; new_project->new_edl->save_defaults(mwindow->defaults); mwindow->defaults->save(); - if(result) - { + if( result ) { // Aborted if( !new_project->new_edl->Garbage::remove_user() ) new_project->new_edl = 0; } - else - { + else { new_project->create_new_project(); } } - - int NewThread::load_defaults() { auto_aspect = mwindow->defaults->get("AUTOASPECT", 0); @@ -209,8 +180,7 @@ int NewThread::save_defaults() int NewThread::update_aspect() { - if(auto_aspect) - { + if( auto_aspect ) { char string[BCTEXTLEN]; mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w, new_project->new_edl->session->aspect_h, @@ -225,19 +195,9 @@ int NewThread::update_aspect() } - - NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y) - : BC_Window(_(_(PROGRAM_NAME ": New Project")), - x, - y, - WIDTH, - HEIGHT, - -1, - -1, - 0, - 0, - 1) + : BC_Window(_(PROGRAM_NAME ": New Project"), x, y, WIDTH, HEIGHT, + -1, -1, 0, 0, 1) { this->mwindow = mwindow; this->new_thread = new_thread; @@ -248,7 +208,7 @@ NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y) NewWindow::~NewWindow() { lock_window("NewWindow::~NewWindow"); - if(format_presets) delete format_presets; + if( format_presets ) delete format_presets; unlock_window(); } @@ -271,8 +231,6 @@ void NewWindow::create_objects() x = format_presets->x; y = format_presets->y; - - y += 40; y1 = y; add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT)); @@ -307,7 +265,7 @@ void NewWindow::create_objects() y += 30; x1 = x; add_subwindow(new BC_Title(x1, y, _("Tracks:"))); - x1 += 100; + x1 += 115; add_subwindow(vtracks = new NewVTracks(this, "", x1, y)); x1 += vtracks->get_w(); add_subwindow(new NewVTracksTumbler(this, x1, y)); @@ -322,7 +280,7 @@ void NewWindow::create_objects() // y += vchannels->get_h() + 5; x1 = x; add_subwindow(new BC_Title(x1, y, _("Framerate:"))); - x1 += 100; + x1 += 115; add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y)); x1 += frame_rate->get_w(); add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y)); @@ -348,7 +306,7 @@ void NewWindow::create_objects() x1 = x; add_subwindow(new BC_Title(x1, y, _("Canvas size:"))); - x1 += 100; + x1 += 115; add_subwindow(output_w_text = new NewOutputW(this, x1, y)); x1 += output_w_text->get_w() + 2; add_subwindow(new BC_Title(x1, y, "x")); @@ -361,13 +319,13 @@ void NewWindow::create_objects() output_h_text, x1, y)); - x1 += pulldown->get_w() + 5; + x1 += pulldown->get_w() + 10; add_subwindow(new NewSwapExtents(mwindow, this, x1, y)); y += output_h_text->get_h() + 5; x1 = x; add_subwindow(new BC_Title(x1, y, _("Aspect ratio:"))); - x1 += 100; + x1 += 115; add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y)); x1 += aspect_w_text->get_w() + 2; add_subwindow(new BC_Title(x1, y, ":")); @@ -375,34 +333,29 @@ void NewWindow::create_objects() add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y)); x1 += aspect_h_text->get_w(); add_subwindow(new AspectPulldown(mwindow, - aspect_w_text, - aspect_h_text, - x1, - y)); + aspect_w_text, aspect_h_text, x1, y)); x1 = aspect_w_text->get_x(); y += aspect_w_text->get_h() + 5; add_subwindow(new NewAspectAuto(this, x1, y)); y += 40; - add_subwindow(new BC_Title(x, y, _("Color model:"))); - add_subwindow(textbox = new BC_TextBox(x + 100, y, 200, 1, "")); + BC_Title *title; + add_subwindow(title = new BC_Title(x, y, _("Color model:"))); + x1 = x + title->get_w(); + y1 = y; y += title->get_h() + 10; + add_subwindow(title = new BC_Title(x, y, _("Interlace mode:"))); + int x2 = x + title->get_w(); + int y2 = y; y += title->get_h() + 10; + if( x1 < x2 ) x1 = x2; + x1 += 20; + add_subwindow(textbox = new BC_TextBox(x1, y1, 150, 1, "")); add_subwindow(color_model = new ColormodelPulldown(mwindow, - textbox, - &new_edl->session->color_model, - x + 100 + textbox->get_w(), - y)); - y += textbox->get_h() + 5; - - // -------------------- - add_subwindow(new BC_Title(x, y, _("Interlace mode:"))); - add_subwindow(textbox = new BC_TextBox(x + 100, y, 140, 1, "")); + textbox, &new_edl->session->color_model, x1+textbox->get_w(), y1)); + add_subwindow(textbox = new BC_TextBox(x1, y2, 150, 1, "")); add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow, - textbox, - &new_edl->session->interlace_mode, + textbox, &new_edl->session->interlace_mode, (ArrayList*)&mwindow->interlace_project_modes, - x + 100 + textbox->get_w(), - y)); - y += textbox->get_h() + 5; + x1+textbox->get_w(), y2)); add_subwindow(new BC_OKButton(this, mwindow->theme->get_image_set("new_ok_images"))); @@ -431,11 +384,6 @@ int NewWindow::update() } - - - - - NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y) : FormatPresets(mwindow, gui, 0, x, y) { @@ -457,7 +405,6 @@ EDL* NewPresets::get_edl() } - NewATracks::NewATracks(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 90, 1, text) { @@ -490,6 +437,7 @@ int NewATracksTumbler::handle_down_event() return 1; } + NewAChannels::NewAChannels(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 90, 1, text) { @@ -502,6 +450,7 @@ int NewAChannels::handle_event() return 1; } + NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y) : BC_Tumbler(x, y) { @@ -535,18 +484,10 @@ int NewSampleRate::handle_event() return 1; } + SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y) - : BC_ListBox(x, - y, - 100, - 200, - LISTBOX_TEXT, - &mwindow->theme->sample_rates, - 0, - 0, - 1, - 0, - 1) + : BC_ListBox(x, y, 100, 200, LISTBOX_TEXT, + &mwindow->theme->sample_rates, 0, 0, 1, 0, 1) { this->mwindow = mwindow; this->output = output; @@ -560,19 +501,6 @@ int SampleRatePulldown::handle_event() } - - - - - - - - - - - - - NewVTracks::NewVTracks(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 90, 1, text) { @@ -585,6 +513,7 @@ int NewVTracks::handle_event() return 1; } + NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y) : BC_Tumbler(x, y) { @@ -605,6 +534,7 @@ int NewVTracksTumbler::handle_down_event() return 1; } + NewVChannels::NewVChannels(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 90, 1, text) { @@ -617,6 +547,7 @@ int NewVChannels::handle_event() return 1; } + NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y) : BC_Tumbler(x, y) { @@ -637,6 +568,7 @@ int NewVChannelsTumbler::handle_down_event() return 1; } + NewFrameRate::NewFrameRate(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 90, 1, text) { @@ -649,21 +581,11 @@ int NewFrameRate::handle_event() return 1; } + FrameRatePulldown::FrameRatePulldown(MWindow *mwindow, - BC_TextBox *output, - int x, - int y) - : BC_ListBox(x, - y, - 100, - 200, - LISTBOX_TEXT, - &mwindow->theme->frame_rates, - 0, - 0, - 1, - 0, - 1) + BC_TextBox *output, int x, int y) + : BC_ListBox(x, y, 150, 250, LISTBOX_TEXT, + &mwindow->theme->frame_rates, 0, 0, 1, 0, 1) { this->mwindow = mwindow; this->output = output; @@ -677,26 +599,15 @@ int FrameRatePulldown::handle_event() } FrameSizePulldown::FrameSizePulldown(Theme *theme, - BC_TextBox *output_w, - BC_TextBox *output_h, - int x, - int y) - : BC_ListBox(x, - y, - 100, - 250, - LISTBOX_TEXT, - &theme->frame_sizes, - 0, - 0, - 1, - 0, - 1) + BC_TextBox *output_w, BC_TextBox *output_h, int x, int y) + : BC_ListBox(x, y, 180, 250, LISTBOX_TEXT, + &theme->frame_sizes, 0, 0, 1, 0, 1) { this->theme = theme; this->output_w = output_w; this->output_h = output_h; } + int FrameSizePulldown::handle_event() { char *text = get_selection(0, 0)->get_text(); @@ -706,8 +617,7 @@ int FrameSizePulldown::handle_event() strcpy(string, text); ptr = strrchr(string, 'x'); - if(ptr) - { + if( ptr ) { ptr++; h = atol(ptr); @@ -721,6 +631,7 @@ int FrameSizePulldown::handle_event() return 1; } + NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y) : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w) { @@ -733,6 +644,7 @@ int NewOutputW::handle_event() return 1; } + NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y) : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h) { @@ -745,6 +657,7 @@ int NewOutputH::handle_event() return 1; } + NewAspectW::NewAspectW(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 70, 1, text) { @@ -757,6 +670,7 @@ int NewAspectW::handle_event() return 1; } + NewAspectH::NewAspectH(NewWindow *nwindow, const char *text, int x, int y) : BC_TextBox(x, y, 70, 1, text) { @@ -769,27 +683,17 @@ int NewAspectH::handle_event() return 1; } + AspectPulldown::AspectPulldown(MWindow *mwindow, - BC_TextBox *output_w, - BC_TextBox *output_h, - int x, - int y) - : BC_ListBox(x, - y, - 100, - 200, - LISTBOX_TEXT, - &mwindow->theme->aspect_ratios, - 0, - 0, - 1, - 0, - 1) + BC_TextBox *output_w, BC_TextBox *output_h, int x, int y) + : BC_ListBox(x, y, 100, 200, LISTBOX_TEXT, + &mwindow->theme->aspect_ratios, 0, 0, 1, 0, 1) { this->mwindow = mwindow; this->output_w = output_w; this->output_h = output_h; } + int AspectPulldown::handle_event() { char *text = get_selection(0, 0)->get_text(); @@ -799,8 +703,7 @@ int AspectPulldown::handle_event() strcpy(string, text); ptr = strrchr(string, ':'); - if(ptr) - { + if( ptr ) { ptr++; h = atof(ptr); @@ -814,6 +717,7 @@ int AspectPulldown::handle_event() return 1; } + ColormodelItem::ColormodelItem(const char *text, int value) : BC_ListBoxItem(text) { @@ -821,21 +725,9 @@ ColormodelItem::ColormodelItem(const char *text, int value) } ColormodelPulldown::ColormodelPulldown(MWindow *mwindow, - BC_TextBox *output_text, - int *output_value, - int x, - int y) - : BC_ListBox(x, - y, - 200, - 150, - LISTBOX_TEXT, - (ArrayList*)&mwindow->colormodels, - 0, - 0, - 1, - 0, - 1) + BC_TextBox *output_text, int *output_value, int x, int y) + : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, + (ArrayList*)&mwindow->colormodels, 0, 0, 1, 0, 1) { this->mwindow = mwindow; this->output_text = output_text; @@ -852,8 +744,8 @@ int ColormodelPulldown::handle_event() const char* ColormodelPulldown::colormodel_to_text() { - for(int i = 0; i < mwindow->colormodels.total; i++) - if(mwindow->colormodels.values[i]->value == *output_value) + for( int i=0; icolormodels.total; ++i ) + if( mwindow->colormodels.values[i]->value == *output_value ) return mwindow->colormodels.values[i]->get_text(); return _("Unknown"); } @@ -922,12 +814,6 @@ int NewAspectAuto::handle_event() } - - - - - - NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y) : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents")) { @@ -948,6 +834,3 @@ int NewSwapExtents::handle_event() return 1; } - - -