From: Good Guy Date: Mon, 29 Apr 2019 22:48:41 +0000 (-0600) Subject: PKGBUILD fix libva/vdpau deps X-Git-Tag: 2019-08~61 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=c905fabd0678fcc8ab9e32e4443ad8709adafefd;p=goodguy%2Fcinelerra.git PKGBUILD fix libva/vdpau deps tweak want shuttle in configure.ac no view popup play clips CIN_FINISH glfinish workaround mixer reload segvs unset in/out pts on replace project cleanup stop playback renderengine race conditions proxy orig h tweaks when using scaler disable F_interlace (fails), use F_tinterlace instead dialog thread join fix symetric draw_triangle_down_flat appearance tracer plugin info 15 plugins, clears for slider bars user contrib c99 for lv2 builds sketcher/motion51 popupmenw text w tweaks sketcher uses ctrl+alt instead of alt, wm collision --- diff --git a/cinelerra-5.1/blds/PKGBUILD b/cinelerra-5.1/blds/PKGBUILD index 70d20d81..79d1020b 100644 --- a/cinelerra-5.1/blds/PKGBUILD +++ b/cinelerra-5.1/blds/PKGBUILD @@ -15,7 +15,7 @@ DEPENDS=( 'alsa-lib' 'atk' 'bzip2' 'cairo' 'expat' 'fftw' 'flac' 'libvpx' 'libx11' 'libxau' 'libxcb' 'libxcomposite' 'libxcursor' 'libxdamage' 'libxdmcp' 'libxext' 'libxfixes' 'libxft' 'libxi' 'libxinerama' 'libxrandr' 'libxrender' 'libxv' 'numactl' 'opus' - 'pango' 'pcre' 'pixman' 'xz' 'zlib' 'xorg-server' 'libva' + 'pango' 'pcre' 'pixman' 'xz' 'zlib' 'xorg-server' 'xorg-fonts-misc' 'ttf-dejavu' 'inkscape' 'dvdauthor' 'udftools' ) makedepends=( 'autoconf' 'automake' 'yasm' 'nasm' 'cmake' 'libtool' diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index e0d94a3e..1bd04ab6 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -592,10 +592,9 @@ shudmp: shudmp.C @g++ $(CFLAGS) shudmp.C -o $@ -lusb-1.0 clean: - rm -rf $(OBJDIR) + rm -rf $(OBJDIR) tags rm -f shuttle_keys.h - tags: ctags -R -h default --langmap=c:+.inc . ../guicast/ ../libzmpeg3 ../plugins ../thirdparty/ffmpeg-* @@ -616,10 +615,6 @@ $(OBJDIR)/lv2ui.o: lv2ui.C $(OBJDIR)/pluginlv2ui.o $(OBJDIR)/lv2ui.o: $(CXX) `cat $(OBJDIR)/c_flags` $(GTK2_INCS) -DMSGQUAL=$* -c $< -o $@ -$(OBJDIR)/shuttle.o: shuttle.C shuttle_keys.h -shuttle_keys.h: /usr/include/X11/keysymdef.h - sed -n < /usr/include/X11/keysymdef.h > shuttle_keys.h -f shuttle.sed - $(OBJDIR)/lv2ui: $(LV2OBJS) @echo $(CXX) \`cat $(OBJDIR)/c_flags\` $^ -o $@ @$(CXX) `cat $(OBJDIR)/c_flags` $^ -o $@ $(LIBS) $(GTK2_LIBS) @@ -635,6 +630,12 @@ install-lv2ui: install: install-lv2ui endif +ifneq ($(WANT_SHUTTLE),no) +$(OBJDIR)/shuttle.o: shuttle.C shuttle_keys.h +shuttle_keys.h: /usr/include/X11/keysymdef.h + sed -n < /usr/include/X11/keysymdef.h > shuttle_keys.h -f shuttle.sed +endif + $(OBJDIR)/pluginlv2gui.o: pluginlv2gui.C $(CXX) `cat $(OBJDIR)/c_flags` $(GTK2_INCS) -DMSGQUAL=$* -c $< -o $@ diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 0caedce4..091fd140 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -2839,7 +2839,8 @@ int AWindowAssets::selection_changed() case AW_CLIP_FOLDER: if( get_buttonpress() == LEFT_BUTTON ) { AssetVIcon *vicon = 0; - if( !gui->vicon_thread->vicon ) + AssetVIconThread *avt = gui->vicon_thread; + if( !avt->vicon && gui->vicon_drawing != AVICON_NO_PLAY ) vicon = item->vicon; gui->vicon_thread->set_view_popup(vicon, ASSET_VIEW_ICON); } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 2491571d..b62bd09b 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -1131,7 +1131,17 @@ void CWindowCanvas::draw_refresh(int flush) get_canvas()->unlock_window(); get_canvas()->flush(); get_canvas()->sync_display(); - mwindow->playback_3d->finish_output(); +// this code is to idle rendering before drawing overlays on refresh frame +// if this is not done, occationally opengl finishs late, and overwrites +// the x11 refresh frame and the overlay is not visible. Rarely happens. +// bug in gl libs may segv if glfinish is called, workaround is no finish + static int cin_finish = -1; + if( cin_finish < 0 ) { + const char *cp = getenv("CIN_FINISH"); + cin_finish = !cp ? 1 : atoi(cp); + } + if( cin_finish ) + mwindow->playback_3d->finish_output(); get_canvas()->lock_window("CWindowCanvas::draw_refresh"); } if( refresh_frame && refresh_frame->get_w()>0 && refresh_frame->get_h()>0 ) { diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 66b37fa9..e86eb4b8 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -1182,8 +1182,12 @@ ZWindow *MWindow::get_mixer(Mixer *&mixer) zwindows_lock->lock("MWindow::get_mixer"); if( !mixer ) mixer = edl->mixers.new_mixer(); ZWindow *zwindow = 0; - for( int i=0; !zwindow && iidx < 0 ) zwindow = zwindows[i]; + for( int i=0; !zwindow && irunning() ) continue; + if( zwdw->idx >= 0 ) continue; + zwindow = zwindows[i]; + } if( !zwindow ) zwindows.append(zwindow = new ZWindow(this)); zwindow->idx = mixer->idx; @@ -1313,6 +1317,7 @@ void MWindow::close_mixers(int destroy) for( int i=zwindows.size(); --i>=0; ) { ZWindow *zwindow = zwindows[i]; if( zwindow->idx < 0 ) continue; + zwindow->idx = -1; zwindow->destroy = destroy; ZWindowGUI *zgui = zwindow->zgui; zgui->lock_window("MWindow::select_zwindow 0"); @@ -2194,6 +2199,8 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); edl->local_session->loop_playback = 0; edl->local_session->set_selectionstart(0); edl->local_session->set_selectionend(0); + edl->local_session->unset_inpoint(); + edl->local_session-> unset_outpoint(); set_brender_active(0, 0); fit_selection(); goto_start(); diff --git a/cinelerra-5.1/cinelerra/overlayframe.C b/cinelerra-5.1/cinelerra/overlayframe.C index c8690339..270755cc 100644 --- a/cinelerra-5.1/cinelerra/overlayframe.C +++ b/cinelerra-5.1/cinelerra/overlayframe.C @@ -122,7 +122,7 @@ OverlayKernel::OverlayKernel(int interpolation_type) OverlayKernel::~OverlayKernel() { - if(lookup) delete [] lookup; + delete [] lookup; } OverlayFrame::OverlayFrame(int cpus) @@ -137,16 +137,14 @@ OverlayFrame::OverlayFrame(int cpus) OverlayFrame::~OverlayFrame() { - if(temp_frame) delete temp_frame; - - if(direct_engine) delete direct_engine; - if(nn_engine) delete nn_engine; - if(sample_engine) delete sample_engine; - - if(kernel[NEAREST_NEIGHBOR]) delete kernel[NEAREST_NEIGHBOR]; - if(kernel[BILINEAR]) delete kernel[BILINEAR]; - if(kernel[BICUBIC]) delete kernel[BICUBIC]; - if(kernel[LANCZOS]) delete kernel[LANCZOS]; + delete direct_engine; + delete nn_engine; + delete sample_engine; + delete temp_frame; + delete kernel[NEAREST_NEIGHBOR]; + delete kernel[BILINEAR]; + delete kernel[BICUBIC]; + delete kernel[LANCZOS]; } static float epsilon_snap(float f) diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index b9845f33..b59e609b 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -130,7 +130,11 @@ int PlaybackEngine::create_render_engine() void PlaybackEngine::delete_render_engine() { renderengine_lock->lock("PlaybackEngine::delete_render_engine"); - delete render_engine; render_engine = 0; + if( render_engine ) { + render_engine->interrupt_playback(); + render_engine->wait_done(); + delete render_engine; render_engine = 0; + } renderengine_lock->unlock(); } diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index a53dcf6c..fd1ba562 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -137,9 +137,6 @@ void ProxyDialog::calculate_sizes() } total_sizes = 1; - int orig_w = mwindow->edl->session->output_w * orig_scale; - int orig_h = mwindow->edl->session->output_h * orig_scale; - if( !use_scaler ) { // w,h should stay even for yuv int ow = orig_w, oh = orig_h; @@ -340,7 +337,7 @@ int ProxyRender::create_needed_proxies(int new_scale) ProxyFarm engine(mwindow, this, &needed_idxbls, &needed_proxies); engine.process_packages(); -printf("failed=%d canceled=%d\n", failed, progress->is_cancelled()); +printf("proxy: failed=%d canceled=%d\n", failed, progress->is_cancelled()); // stop progress bar canceled = progress->is_cancelled(); @@ -381,6 +378,12 @@ void ProxyWindow::create_objects() dialog->auto_scale = mwindow->edl->session->proxy_auto_scale; dialog->beep = mwindow->edl->session->proxy_beep; dialog->new_scale = dialog->orig_scale; + dialog->orig_w = mwindow->edl->session->output_w; + dialog->orig_h = mwindow->edl->session->output_h; + if( !dialog->use_scaler ) { + dialog->orig_w *= dialog->orig_scale; + dialog->orig_h *= dialog->orig_scale; + } int x = margin; int y = margin+10; @@ -391,7 +394,7 @@ void ProxyWindow::create_objects() add_subwindow(text = new BC_Title(x, y, _("Scale factor:"))); x += text->get_w() + margin; - int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, dialog->size_text[0])); + int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, dialog->size_text[0])+15); add_subwindow(scale_factor = new ProxyMenu(mwindow, this, x, y, popupmenu_w, "")); scale_factor->update_sizes(); x += scale_factor->get_w() + margin; @@ -446,11 +449,9 @@ void ProxyFormatTools::update_format() void ProxyWindow::update() { char string[BCSTRLEN]; - int orig_w = mwindow->edl->session->output_w * dialog->orig_scale; - int orig_h = mwindow->edl->session->output_h * dialog->orig_scale; - int new_w = orig_w / dialog->new_scale; + int new_w = dialog->orig_w / dialog->new_scale; if( new_w & 1 ) ++new_w; - int new_h = orig_h / dialog->new_scale; + int new_h = dialog->orig_h / dialog->new_scale; if( new_h & 1 ) ++new_h; sprintf(string, "%dx%d", new_w, new_h); new_dimensions->update(string); @@ -550,7 +551,6 @@ int ProxyMenu::handle_event() for( int i = 0; i < dialog->total_sizes; i++ ) { if( !strcmp(get_text(), pwindow->dialog->size_text[i]) ) { dialog->new_scale = pwindow->dialog->size_factors[i]; - if( dialog->new_scale == 1 ) dialog->use_scaler = 0; pwindow->update(); break; } diff --git a/cinelerra-5.1/cinelerra/proxy.h b/cinelerra-5.1/cinelerra/proxy.h index c98f2e04..f48df968 100644 --- a/cinelerra-5.1/cinelerra/proxy.h +++ b/cinelerra-5.1/cinelerra/proxy.h @@ -108,10 +108,9 @@ public: Asset *asset; ProxyRender *proxy_render; - int new_scale; - int orig_scale; - int use_scaler; - int auto_scale; + int orig_scale, new_scale; + int use_scaler, auto_scale; + int orig_w, orig_h; int beep; char *size_text[MAX_SIZES]; int size_factors[MAX_SIZES]; diff --git a/cinelerra-5.1/cinelerra/virtualvconsole.C b/cinelerra-5.1/cinelerra/virtualvconsole.C index 14488944..7a4fe8f6 100644 --- a/cinelerra-5.1/cinelerra/virtualvconsole.C +++ b/cinelerra-5.1/cinelerra/virtualvconsole.C @@ -48,10 +48,7 @@ VirtualVConsole::VirtualVConsole(RenderEngine *renderengine, VRender *vrender) VirtualVConsole::~VirtualVConsole() { - if(output_temp) - { - delete output_temp; - } + delete output_temp; } VDeviceBase* VirtualVConsole::get_vdriver() diff --git a/cinelerra-5.1/cinelerra/virtualvnode.C b/cinelerra-5.1/cinelerra/virtualvnode.C index bd32638c..dd7e4fe7 100644 --- a/cinelerra-5.1/cinelerra/virtualvnode.C +++ b/cinelerra-5.1/cinelerra/virtualvnode.C @@ -64,14 +64,14 @@ VirtualVNode::VirtualVNode(RenderEngine *renderengine, track, parent_node) { //VRender *vrender = ((VirtualVConsole*)vconsole)->vrender; - fader = new FadeEngine(renderengine->preferences->processors); + //fader = new FadeEngine(renderengine->preferences->processors); masker = new MaskEngine(renderengine->preferences->processors); alpha = 1; } VirtualVNode::~VirtualVNode() { - delete fader; + //delete fader; delete masker; } diff --git a/cinelerra-5.1/cinelerra/virtualvnode.h b/cinelerra-5.1/cinelerra/virtualvnode.h index a1de9a97..42f31f49 100644 --- a/cinelerra-5.1/cinelerra/virtualvnode.h +++ b/cinelerra-5.1/cinelerra/virtualvnode.h @@ -95,7 +95,7 @@ private: int use_opengl); float alpha; - FadeEngine *fader; +// FadeEngine *fader; MaskEngine *masker; }; diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index 3ef17f04..3f27a35d 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -75,9 +75,9 @@ VModule::VModule(RenderEngine *renderengine, VModule::~VModule() { - if(overlay_temp) delete overlay_temp; - if(input_temp) delete input_temp; - if(transition_temp) delete transition_temp; + if( overlay_temp ) delete overlay_temp; + if( input_temp ) delete input_temp; + if( transition_temp ) delete transition_temp; delete masker; } @@ -94,17 +94,13 @@ int VModule::get_buffer_size() CICache* VModule::get_cache() { - if(renderengine) + if( renderengine ) return renderengine->get_vcache(); else return cache; } - - - - int VModule::import_frame(VFrame *output, VEdit *current_edit, int64_t input_position, double frame_rate, int direction, int use_opengl) { @@ -119,84 +115,75 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, int64_t input_position_project = Units::to_int64(input_position * edl_rate / frame_rate + 0.001); - if(!output) printf("VModule::import_frame %d output=%p\n", __LINE__, output); + if( !output ) printf("VModule::import_frame %d output=%p\n", __LINE__, output); //output->dump_params(); - if(debug) printf("VModule::import_frame %d this=%p input_position=%lld direction=%d\n", + if( debug ) printf("VModule::import_frame %d this=%p input_position=%lld direction=%d\n", __LINE__, this, (long long)input_position, direction); // Convert to position corrected for direction direction_position = input_position; - if(direction == PLAY_REVERSE) { + if( direction == PLAY_REVERSE ) { if( direction_position > 0 ) direction_position--; if( input_position_project > 0 ) input_position_project--; } - if(!output) printf("VModule::import_frame %d output=%p\n", __LINE__, output); + if( !output ) printf("VModule::import_frame %d output=%p\n", __LINE__, output); VDeviceX11 *x11_device = 0; - if(use_opengl) - { - if(renderengine && renderengine->video) - { + if( use_opengl ) { + if( renderengine && renderengine->video ) { x11_device = (VDeviceX11*)renderengine->video->get_output_base(); output->set_opengl_state(VFrame::RAM); - if(!x11_device) use_opengl = 0; + if( !x11_device ) use_opengl = 0; } } - if(!output) printf("VModule::import_frame %d output=%p x11_device=%p nested_edl=%p\n", + if( !output ) printf("VModule::import_frame %d output=%p x11_device=%p nested_edl=%p\n", __LINE__, output, x11_device, nested_edl); - if(debug) printf("VModule::import_frame %d current_edit=%p\n", + if( debug ) printf("VModule::import_frame %d current_edit=%p\n", __LINE__, current_edit); // Load frame into output // Create objects for nested EDL - if(current_edit && current_edit->nested_edl) { + if( current_edit && current_edit->nested_edl ) { int command; - if(debug) printf("VModule::import_frame %d nested_edl=%p current_edit->nested_edl=%p\n", + if( debug ) printf("VModule::import_frame %d nested_edl=%p current_edit->nested_edl=%p\n", __LINE__, nested_edl, current_edit->nested_edl); // Convert requested direction to command if( renderengine->command->command == CURRENT_FRAME || - renderengine->command->command == LAST_FRAME ) - { + renderengine->command->command == LAST_FRAME ) { command = renderengine->command->command; } else - if(direction == PLAY_REVERSE) - { - if(renderengine->command->single_frame()) + if( direction == PLAY_REVERSE ) { + if( renderengine->command->single_frame() ) command = SINGLE_FRAME_REWIND; else command = NORMAL_REWIND; } - else - { - if(renderengine->command->single_frame()) + else { + if( renderengine->command->single_frame() ) command = SINGLE_FRAME_FWD; else command = NORMAL_FWD; } - if(!nested_edl || nested_edl->id != current_edit->nested_edl->id) - { + if( !nested_edl || nested_edl->id != current_edit->nested_edl->id ) { nested_edl = current_edit->nested_edl; - if(nested_renderengine) - { + if( nested_renderengine ) { delete nested_renderengine; nested_renderengine = 0; } - if(!nested_command) - { + if( !nested_command ) { nested_command = new TransportCommand; } - if(!nested_renderengine) - { + if( !nested_renderengine ) { nested_command->command = command; nested_command->get_edl()->copy_all(nested_edl); nested_command->change_type = CHANGE_ALL; @@ -206,8 +193,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, nested_renderengine->arm_command(nested_command); } } - else - { + else { // Update nested command nested_renderengine->command->command = command; @@ -217,11 +203,10 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, // Update nested video driver for opengl nested_renderengine->video = renderengine->video; } - else - { + else { nested_edl = 0; } - if(debug) printf("VModule::import_frame %d\n", __LINE__); + if( debug ) printf("VModule::import_frame %d\n", __LINE__); if( output ) { if( use_opengl ) @@ -232,10 +217,9 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, else printf("VModule::import_frame %d output=%p\n", __LINE__, output); - if(current_edit && + if( current_edit && (current_edit->asset || - (current_edit->nested_edl && nested_renderengine->vrender))) - { + (current_edit->nested_edl && nested_renderengine->vrender)) ) { File *file = 0; //printf("VModule::import_frame %d cache=%p\n", __LINE__, get_cache()); @@ -247,8 +231,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, } // File found - if(file || nested_edl) - { + if( file || nested_edl ) { // Make all positions based on requested frame rate. int64_t edit_startproject = Units::to_int64(current_edit->startproject * frame_rate / @@ -267,8 +250,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, // apply speed curve to source position so the timeline agrees with the playback - if(track->has_speed()) - { + if( track->has_speed() ) { // integrate position from start of edit. double speed_position = edit_startsource; FloatAutos *speed_autos = (FloatAutos*)track->automation->autos[AUTOMATION_SPEED]; @@ -284,7 +266,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, int asset_w; int asset_h; - if(debug) printf("VModule::import_frame %d\n", __LINE__); + if( debug ) printf("VModule::import_frame %d\n", __LINE__); // maybe apply speed curve here, so timeline reflects actual playback @@ -293,22 +275,20 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, // if we hit the end of stream, freeze at last frame uint64_t max_position = 0; - if(file) - { + if( file ) { max_position = Units::to_int64((double)file->get_video_length() * frame_rate / current_edit->asset->frame_rate - 1); } - else - { + else { max_position = Units::to_int64(nested_edl->tracks->total_length() * frame_rate - 1); } - if(position > max_position) position = max_position; + if( position > max_position ) position = max_position; else - if(position < 0) position = 0; + if( position < 0 ) position = 0; int use_cache = renderengine && renderengine->command->single_frame(); @@ -319,10 +299,9 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, //// renderengine->command->realtime && // renderengine->get_edl()->session->video_asynchronous; - if(file) - { - if(debug) printf("VModule::import_frame %d\n", __LINE__); -// if(use_asynchronous) + if( file ) { + if( debug ) printf("VModule::import_frame %d\n", __LINE__); +// if( use_asynchronous ) // file->start_video_decode_thread(); // else file->stop_video_thread(); @@ -341,23 +320,21 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, asset_h = current_edit->asset->height; //printf("VModule::import_frame %d normalized_position=%lld\n", __LINE__, normalized_position); } - else - { - if(debug) printf("VModule::import_frame %d\n", __LINE__); + else { + if( debug ) printf("VModule::import_frame %d\n", __LINE__); asset_w = nested_edl->session->output_w; asset_h = nested_edl->session->output_h; // Get source position in nested frame rate in direction of playback. nested_position = Units::to_int64(position * nested_edl->session->frame_rate / frame_rate); - if(direction == PLAY_REVERSE) + if( direction == PLAY_REVERSE ) nested_position++; } // Auto scale if required - if(output->get_params()->get("AUTOSCALE", 0)) - { + if( output->get_params()->get("AUTOSCALE", 0) ) { float autoscale_w = output->get_params()->get("AUTOSCALE_W", 1024); float autoscale_h = output->get_params()->get("AUTOSCALE_H", 1024); float x_scale = autoscale_w / asset_w; @@ -369,13 +346,11 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, in_w = asset_w; in_h = asset_h; - if(x_scale < y_scale) - { + if( x_scale < y_scale ) { out_w = in_w * x_scale; out_h = in_h * x_scale; } - else - { + else { out_w = in_w * y_scale; out_h = in_h * y_scale; } @@ -383,29 +358,16 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, out_x = track->track_w / 2 - out_w / 2; out_y = track->track_h / 2 - out_h / 2; } - else + else { // Apply camera - { ((VTrack*)track)->calculate_input_transfer(asset_w, - asset_h, - input_position_project, - direction, - in_x, - in_y, - in_w, - in_h, - out_x, - out_y, - out_w, - out_h); + asset_h, input_position_project, direction, + in_x, in_y, in_w, in_h, + out_x, out_y, out_w, out_h); } // printf("VModule::import_frame %d %f %d %f %d\n", -// __LINE__, -// in_w, -// asset_w, -// in_h, -// asset_h); +// __LINE__, in_w, asset_w, in_h, asset_h); // // printf("VModule::import_frame 1 [ilace] Project: mode (%d) Asset: autofixoption (%d), mode (%d), method (%d)\n", // get_edl()->session->interlace_mode, @@ -425,7 +387,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, // printf("VModule::import_frame 1 [ilace] Compensating by using: '%s'\n",string); // Compensate for the said interlacing... - switch (interlace_fixmethod) { + switch( interlace_fixmethod ) { case ILACE_FIXMETHOD_NONE: break; @@ -449,68 +411,50 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, !EQUIV(out_w, track->track_w) || !EQUIV(out_h, track->track_h) || !EQUIV(in_w, asset_w) || - !EQUIV(in_h, asset_h)) - { + !EQUIV(in_h, asset_h)) { //printf("VModule::import_frame %d file -> temp -> output\n", __LINE__); - - - - // Get temporary input buffer VFrame **input = 0; // Realtime playback - if(commonrender) - { + if( commonrender ) { VRender *vrender = (VRender*)commonrender; //printf("VModule::import_frame %d vrender->input_temp=%p\n", __LINE__, vrender->input_temp); input = &vrender->input_temp; } - else + else { // Menu effect - { input = &input_temp; } - if((*input) && - ((*input)->get_w() != asset_w || - (*input)->get_h() != asset_h)) - { + if( (*input) && + ((*input)->get_w() != asset_w || + (*input)->get_h() != asset_h) ) { delete (*input); (*input) = 0; } - - - - - if(!(*input)) - { + if( !(*input) ) { (*input) = new VFrame(asset_w, asset_h, get_edl()->session->color_model); } - - - (*input)->copy_stacks(output); // file -> temp // Cache for single frame only - if(file) - { - if(debug) printf("VModule::import_frame %d this=%p file=%s\n", + if( file ) { + if( debug ) printf("VModule::import_frame %d this=%p file=%s\n", __LINE__, this, current_edit->asset->path); - if(use_cache) file->set_cache_frames(1); + if( use_cache ) file->set_cache_frames(1); result = file->read_frame((*input)); - if(use_cache) file->set_cache_frames(0); + if( use_cache ) file->set_cache_frames(0); (*input)->set_opengl_state(VFrame::RAM); } else - if(nested_edl) - { + if( nested_edl ) { // If the colormodels differ, change input to nested colormodel int nested_cmodel = nested_renderengine->get_edl()->session->color_model; int current_cmodel = output->get_color_model(); @@ -518,118 +462,67 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, int output_h = output->get_h(); VFrame *input2 = (*input); - if(nested_cmodel != current_cmodel) - { + if( nested_cmodel != current_cmodel ) { // If opengl, input -> input -> output - if(use_opengl) - { - } - else - { + if( use_opengl ) { } + else { // If software, input2 -> input -> output // Use output as a temporary. input2 = output; } - if(debug) printf("VModule::import_frame %d this=%p nested_cmodel=%d\n", + if( debug ) printf("VModule::import_frame %d this=%p nested_cmodel=%d\n", __LINE__, this, nested_cmodel); input2->dump(); - input2->reallocate(0, - -1, - 0, - 0, - 0, - (*input)->get_w(), - (*input)->get_h(), - nested_cmodel, - -1); + input2->reallocate(0, -1, 0, 0, 0, + (*input)->get_w(), (*input)->get_h(), + nested_cmodel, -1); input2->dump(); } - if(debug) printf("VModule::import_frame %d this=%p nested_edl=%s input2=%p\n", - __LINE__, - this, - nested_edl->path, - input2); + if( debug ) printf("VModule::import_frame %d this=%p nested_edl=%s input2=%p\n", + __LINE__, this, nested_edl->path, input2); result = nested_renderengine->vrender->process_buffer( - input2, - nested_position, - use_opengl); + input2, nested_position, use_opengl); - if(debug) printf("VModule::import_frame %d this=%p nested_edl=%s\n", + if( debug ) printf("VModule::import_frame %d this=%p nested_edl=%s\n", __LINE__, this, nested_edl->path); - if(nested_cmodel != current_cmodel) - { - if(debug) printf("VModule::import_frame %d\n", __LINE__); - if(use_opengl) - { + if( nested_cmodel != current_cmodel ) { + if( debug ) printf("VModule::import_frame %d\n", __LINE__); + if( use_opengl ) { // Change colormodel in hardware. - if(debug) printf("VModule::import_frame %d\n", __LINE__); + if( debug ) printf("VModule::import_frame %d\n", __LINE__); x11_device->convert_cmodel(input2, current_cmodel); // The converted color model is now in hardware, so return the input2 buffer // to the expected color model. - input2->reallocate(0, - -1, - 0, - 0, - 0, - (*input)->get_w(), - (*input)->get_h(), - current_cmodel, - -1); + input2->reallocate(0, -1, 0, 0, 0, + (*input)->get_w(), (*input)->get_h(), + current_cmodel, -1); } - else - { + else { // Transfer from input2 to input -if(debug) printf("VModule::import_frame %d nested_cmodel=%d current_cmodel=%d input2=%p input=%p output=%p\n", -__LINE__, -nested_cmodel, -current_cmodel, -input2, -(*input), -output); - BC_CModels::transfer((*input)->get_rows(), - input2->get_rows(), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - input2->get_w(), - input2->get_h(), - 0, - 0, - (*input)->get_w(), - (*input)->get_h(), - nested_cmodel, - current_cmodel, - 0, - input2->get_w(), - (*input)->get_w()); +if( debug ) printf("VModule::import_frame %d nested_cmodel=%d current_cmodel=%d input2=%p input=%p output=%p\n", + __LINE__, nested_cmodel, current_cmodel, input2, (*input), output); + BC_CModels::transfer((*input)->get_rows(), input2->get_rows(), + 0, 0, 0, 0, 0, 0, + 0, 0, input2->get_w(), input2->get_h(), + 0, 0, (*input)->get_w(), (*input)->get_h(), + nested_cmodel, current_cmodel, 0, + input2->get_w(), (*input)->get_w()); //printf("VModule::import_frame %d\n", __LINE__); // input2 was the output buffer, so it must be restored - input2->reallocate(0, - -1, - 0, - 0, - 0, - output_w, - output_h, - current_cmodel, - -1); + input2->reallocate(0, -1, 0, 0, 0, + output_w, output_h, current_cmodel, -1); //printf("VModule::import_frame %d\n", __LINE__); } } @@ -640,92 +533,55 @@ output); OverlayFrame *overlayer = 0; // OpenGL playback uses hardware - if(use_opengl) - { + if( use_opengl ) { //printf("VModule::import_frame %d\n", __LINE__); } - else + else if( commonrender ) { // Realtime playback - if(commonrender) - { VRender *vrender = (VRender*)commonrender; overlayer = vrender->overlayer; } - else + else { // Menu effect - { - if(!plugin_array) + if( !plugin_array ) printf("VModule::import_frame neither plugin_array nor commonrender is defined.\n"); - if(!overlay_temp) - { + if( !overlay_temp ) { overlay_temp = new OverlayFrame(plugin_array->mwindow->preferences->processors); } overlayer = overlay_temp; } // printf("VModule::import_frame 1 %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f\n", -// in_x, -// in_y, -// in_w, -// in_h, -// out_x, -// out_y, -// out_w, -// out_h); +// in_x, in_y, in_w, in_h, out_x, out_y, out_w, out_h); // temp -> output -// for(int j = 0; j < output->get_w() * 3 * 5; j++) +// for( int j = 0; j < output->get_w() * 3 * 5; j++ ) // output->get_rows()[0][j] = 255; - if(use_opengl) - { - x11_device->do_camera(output, - (*input), - in_x, - in_y, - in_x + in_w, - in_y + in_h, - out_x, - out_y, - out_x + out_w, - out_y + out_h); -if(debug) printf("VModule::import_frame %d %d %d\n", -__LINE__, -output->get_opengl_state(), -(*input)->get_opengl_state()); + if( use_opengl ) { + x11_device->do_camera(output, (*input), + in_x, in_y, in_x + in_w, in_y + in_h, + out_x, out_y, out_x + out_w, out_y + out_h); +if( debug ) printf("VModule::import_frame %d %d %d\n", + __LINE__, output->get_opengl_state(), (*input)->get_opengl_state()); } - else - { - - - + else { output->clear_frame(); - - // get_cache()->check_in(current_edit->asset); // return; // TRANSFER_REPLACE is the fastest transfer mode but it has the disadvantage // of producing green borders in floating point translation of YUV int mode = TRANSFER_REPLACE; - if(get_edl()->session->interpolation_type != NEAREST_NEIGHBOR && - BC_CModels::is_yuv(output->get_color_model())) + if( get_edl()->session->interpolation_type != NEAREST_NEIGHBOR && + BC_CModels::is_yuv(output->get_color_model()) ) mode = TRANSFER_NORMAL; - if(debug) printf("VModule::import_frame %d temp -> output\n", __LINE__); - overlayer->overlay(output, - (*input), - in_x, - in_y, - in_x + in_w, - in_y + in_h, - out_x, - out_y, - out_x + out_w, - out_y + out_h, - 1, - mode, - get_edl()->session->interpolation_type); + if( debug ) printf("VModule::import_frame %d temp -> output\n", __LINE__); + overlayer->overlay(output, (*input), + in_x, in_y, in_x + in_w, in_y + in_h, + out_x, out_y, out_x + out_w, out_y + out_h, + 1, mode, get_edl()->session->interpolation_type); } result = 1; @@ -736,148 +592,93 @@ output->get_opengl_state(), //(*input)->dump_params(); //output->dump_params(); } - else + else { // file -> output - { - if(debug) printf("VModule::import_frame %d file -> output nested_edl=%p file=%p\n", - __LINE__, - nested_edl, - file); - if(nested_edl) - { + if( debug ) printf("VModule::import_frame %d file -> output nested_edl=%p file=%p\n", + __LINE__, nested_edl, file); + if( nested_edl ) { VFrame **input = &output; // If colormodels differ, reallocate output in nested colormodel. int nested_cmodel = nested_renderengine->get_edl()->session->color_model; int current_cmodel = output->get_color_model(); -if(debug) printf("VModule::import_frame %d nested_cmodel=%d current_cmodel=%d\n", +if( debug ) printf("VModule::import_frame %d nested_cmodel=%d current_cmodel=%d\n", __LINE__, nested_cmodel, current_cmodel); - if(nested_cmodel != current_cmodel) - { - if(use_opengl) - { - } - else - { - if(commonrender) - { + if( nested_cmodel != current_cmodel ) { + if( use_opengl ) { } + else { + if( commonrender ) { input = &((VRender*)commonrender)->input_temp; } - else - { + else { input = &input_temp; } - if(!(*input)) (*input) = new VFrame; + if( !(*input) ) (*input) = new VFrame; } - (*input)->reallocate(0, - -1, - 0, - 0, - 0, - output->get_w(), - output->get_h(), - nested_cmodel, - -1); -if(debug) printf("VModule::import_frame %d\n", -__LINE__); + (*input)->reallocate(0, -1, 0, 0, 0, + output->get_w(), output->get_h(), + nested_cmodel, -1); +if( debug ) printf("VModule::import_frame %d\n", __LINE__); //(*input)->dump(); //(*input)->clear_frame(); } -if(debug) printf("VModule::import_frame %d %p %p\n", -__LINE__, -(*input)->get_rows(), -(*input)); +if( debug ) printf("VModule::import_frame %d %p %p\n", + __LINE__, (*input)->get_rows(), (*input)); result = nested_renderengine->vrender->process_buffer( - (*input), - nested_position, - use_opengl); -if(debug) printf("VModule::import_frame %d\n", + (*input), nested_position, use_opengl); +if( debug ) printf("VModule::import_frame %d\n", __LINE__); // If colormodels differ, change colormodels in opengl if possible. // Swap output for temp if not possible. - if(nested_cmodel != current_cmodel) - { - if(use_opengl) - { + if( nested_cmodel != current_cmodel ) { + if( use_opengl ) { x11_device->convert_cmodel(output, current_cmodel); // The color model was changed in place, so return output buffer - output->reallocate(0, - -1, - 0, - 0, - 0, - output->get_w(), - output->get_h(), - current_cmodel, - -1); + output->reallocate(0, -1, 0, 0, 0, + output->get_w(), output->get_h(), + current_cmodel, -1); } - else - { + else { // Transfer from temporary to output -if(debug) printf("VModule::import_frame %d %d %d %d %d %d %d\n", -__LINE__, -(*input)->get_w(), -(*input)->get_h(), -output->get_w(), -output->get_h(), -nested_cmodel, -current_cmodel); - BC_CModels::transfer(output->get_rows(), - (*input)->get_rows(), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - (*input)->get_w(), - (*input)->get_h(), - 0, - 0, - output->get_w(), - output->get_h(), - nested_cmodel, - current_cmodel, - 0, - (*input)->get_w(), - output->get_w()); +if( debug ) printf("VModule::import_frame %d %d %d %d %d %d %d\n", + __LINE__, (*input)->get_w(), (*input)->get_h(), + output->get_w(), output->get_h(), nested_cmodel, current_cmodel); + BC_CModels::transfer(output->get_rows(), (*input)->get_rows(), + 0, 0, 0, 0, 0, 0, + 0, 0, (*input)->get_w(), (*input)->get_h(), + 0, 0, output->get_w(), output->get_h(), + nested_cmodel, current_cmodel, 0, + (*input)->get_w(), output->get_w()); } } - } - else - if(file) - { + else if( file ) { // Cache single frames //memset(output->get_rows()[0], 0xff, 1024); - if(use_cache) file->set_cache_frames(1); + if( use_cache ) file->set_cache_frames(1); result = file->read_frame(output); - if(use_cache) file->set_cache_frames(0); + if( use_cache ) file->set_cache_frames(0); output->set_opengl_state(VFrame::RAM); } } - if(file) - { + if( file ) { get_cache()->check_in(current_edit->asset); file = 0; } } - else + else { // Source not found - { result = 1; } @@ -886,68 +687,51 @@ current_cmodel); // get_cache()); } - else + else { // Source is silence - { - if(debug) printf("VModule::import_frame %d\n", __LINE__); - if(use_opengl) - { + if( debug ) printf("VModule::import_frame %d\n", __LINE__); + if( use_opengl ) { x11_device->clear_input(output); } - else - { + else { output->clear_frame(); } } - if(debug) printf("VModule::import_frame %d done\n", __LINE__); + if( debug ) printf("VModule::import_frame %d done\n", __LINE__); return result; } - int VModule::render(VFrame *output, - int64_t start_position, - int direction, - double frame_rate, - int use_nudge, - int debug_render, - int use_opengl) + int64_t start_position, int direction, double frame_rate, + int use_nudge, int debug_render, int use_opengl) { int result = 0; double edl_rate = get_edl()->session->frame_rate; //printf("VModule::render %d %ld\n", __LINE__, start_position); - if(use_nudge) start_position += Units::to_int64(track->nudge * + if( use_nudge ) start_position += Units::to_int64(track->nudge * frame_rate / edl_rate); int64_t start_position_project = Units::to_int64(start_position * edl_rate / frame_rate + 0.5); - update_transition(start_position_project, - direction); + update_transition(start_position_project, direction); VEdit* current_edit = (VEdit*)track->edits->editof(start_position_project, - direction, - 0); + direction, 0); VEdit* previous_edit = 0; //printf("VModule::render %d %p %ld %d\n", __LINE__, current_edit, start_position_project, direction); - if(debug_render) + if( debug_render ) printf(" VModule::render %d %d %jd %s transition=%p opengl=%d current_edit=%p output=%p\n", - __LINE__, - use_nudge, - start_position_project, - track->title, - transition, - use_opengl, - current_edit, - output); - - if(!current_edit) - { + __LINE__, use_nudge, start_position_project, track->title, + transition, use_opengl, current_edit, output); + + if( !current_edit ) { output->clear_frame(); // We do not apply mask here, since alpha is 0, and neither substracting nor multypling changes it // Another mask mode - "addition" should be added to be able to create mask from empty frames @@ -959,32 +743,27 @@ int VModule::render(VFrame *output, // Process transition - if(transition && transition->on) - { + if( transition && transition->on ) { // Get temporary buffer VFrame **transition_input = 0; - if(commonrender) - { + if( commonrender ) { VRender *vrender = (VRender*)commonrender; transition_input = &vrender->transition_temp; } - else - { + else { transition_input = &transition_temp; } - if((*transition_input) && + if( (*transition_input) && ((*transition_input)->get_w() != track->track_w || - (*transition_input)->get_h() != track->track_h)) - { + (*transition_input)->get_h() != track->track_h) ) { delete (*transition_input); (*transition_input) = 0; } // Load incoming frame - if(!(*transition_input)) - { + if( !(*transition_input) ) { (*transition_input) = new VFrame(track->track_w, track->track_h, get_edl()->session->color_model); @@ -994,51 +773,34 @@ int VModule::render(VFrame *output, //printf("VModule::render %d\n", __LINE__); result = import_frame((*transition_input), - current_edit, - start_position, - frame_rate, - direction, - use_opengl); + current_edit, start_position, frame_rate, + direction, use_opengl); // Load transition buffer previous_edit = (VEdit*)current_edit->previous; result |= import_frame(output, - previous_edit, - start_position, - frame_rate, - direction, - use_opengl); -//printf("VModule::render %d\n", __LINE__); - -// printf("VModule::render %d %p %p %p %p\n", -// __LINE__, -// (*transition_input), -// (*transition_input)->get_pbuffer(), -// output, -// output->get_pbuffer()); - + previous_edit, start_position, frame_rate, + direction, use_opengl); +//printf("VModule::render %d %p %p %p %p\n", __LINE__, +// (*transition_input), (*transition_input)->get_pbuffer(), +// output, output->get_pbuffer()); // Execute plugin with transition_input and output here - if(renderengine) + if( renderengine ) transition_server->set_use_opengl(use_opengl, renderengine->video); - transition_server->process_transition((*transition_input), - output, + transition_server->process_transition((*transition_input), output, (direction == PLAY_FORWARD) ? (start_position_project - current_edit->startproject) : (start_position_project - current_edit->startproject - 1), transition->length); } - else - { + else { // Load output buffer result = import_frame(output, - current_edit, - start_position, - frame_rate, - direction, - use_opengl); + current_edit, start_position, frame_rate, + direction, use_opengl); } Auto *current = 0; @@ -1051,7 +813,7 @@ int VModule::render(VFrame *output, if( keyframe->apply_before_plugins ) { VDeviceX11 *x11_device = 0; - if(use_opengl && renderengine && renderengine->video) { + if( use_opengl && renderengine && renderengine->video ) { x11_device = (VDeviceX11*)renderengine->video->get_output_base(); if( !x11_device->can_mask(mask_position, keyframe_set) ) use_opengl = 0; @@ -1075,17 +837,8 @@ int VModule::render(VFrame *output, } - - - - void VModule::create_objects() { Module::create_objects(); } - - - - - diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index 9e6bbc1c..3aa1b24d 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -74,9 +74,10 @@ VRender::VRender(RenderEngine *renderengine) VRender::~VRender() { - if(input_temp) delete input_temp; - if(transition_temp) delete transition_temp; - if(overlayer) delete overlayer; + renderengine->wait_done(); + delete overlayer; + delete input_temp; + delete transition_temp; } diff --git a/cinelerra-5.1/cinelerra/zwindow.C b/cinelerra-5.1/cinelerra/zwindow.C index 65c3f31c..7f6d2800 100644 --- a/cinelerra-5.1/cinelerra/zwindow.C +++ b/cinelerra-5.1/cinelerra/zwindow.C @@ -207,9 +207,10 @@ BC_Window* ZWindow::new_gui() void ZWindow::handle_done_event(int result) { + idx = -1; + stop_playback(1); if( destroy ) mwindow->del_mixer(this); - idx = -1; } void ZWindow::handle_close_event(int result) { diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index 22d358ef..bb41ed93 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -653,6 +653,11 @@ CHECK_WANT([ESOUND], [no], [use esd], [ CHECK_LIB([audiofile], [audiofile], [afOpenFile]) CHECK_HEADERS([audiofile], [audiofile headers], [audiofile.h])]) +CHECK_WANT([SHUTTLE], [yes], [shuttle dev support], [ + CHECK_HEADERS([keysyms], [x11 keysym defs], [X11/keysymdef.h])]) +if test "x$WANT_SHUTTLE" = "xno"; then + WANT_SHUTTLE_USB="no" +fi CHECK_WANT([SHUTTLE_USB], [yes], [use libusb-1.0], [ CHECK_LIB([libusbx], [usb-1.0], [libusb_init]) CHECK_HEADERS([libusbx], [libusb headers], [libusb-1.0/libusb.h])]) diff --git a/cinelerra-5.1/db/Makefile b/cinelerra-5.1/db/Makefile index 38364651..990ffeb2 100644 --- a/cinelerra-5.1/db/Makefile +++ b/cinelerra-5.1/db/Makefile @@ -36,7 +36,6 @@ $(OBJECTS) $(OBJDIR)/xsch.o $(OBJDIR)/tst.o: $(OBJDIR)/db.a: $(OBJECTS) ar rcs $@ $(OBJECTS) - ctags -R . s.C: $(OBJDIR)/xsch sch.txt $(OBJDIR)/xsch < sch.txt diff --git a/cinelerra-5.1/ffmpeg/plugin.opts b/cinelerra-5.1/ffmpeg/plugin.opts index 6b7c87bc..fcf06e74 100644 --- a/cinelerra-5.1/ffmpeg/plugin.opts +++ b/cinelerra-5.1/ffmpeg/plugin.opts @@ -158,7 +158,7 @@ hue idet il inflate -interlace +#interlace ###Operation not permitted, use tinterlace #interleave ###Operation not permitted #join kerndeint diff --git a/cinelerra-5.1/guicast/bcdialog.C b/cinelerra-5.1/guicast/bcdialog.C index 64960351..0a855f68 100644 --- a/cinelerra-5.1/guicast/bcdialog.C +++ b/cinelerra-5.1/guicast/bcdialog.C @@ -34,6 +34,7 @@ BC_DialogThread::BC_DialogThread() gui = 0; startup_lock = new Condition(1, "BC_DialogThread::startup_lock"); window_lock = new Mutex("BC_DialogThread::window_lock"); + active_lock = new Mutex("BC_DialogThread::active_lock"); } BC_DialogThread::~BC_DialogThread() @@ -49,6 +50,7 @@ BC_DialogThread::~BC_DialogThread() delete startup_lock; delete window_lock; + delete active_lock; } void BC_DialogThread::lock_dialog(const char *location) @@ -93,6 +95,7 @@ void BC_DialogThread::start() void BC_DialogThread::run() { + active_lock->lock("BC_DialogThread::run"); gui = new_gui(); startup_lock->unlock(); int result = gui->run_window(); @@ -105,6 +108,7 @@ void BC_DialogThread::run() window_lock->unlock(); handle_close_event(result); + active_lock->unlock(); } BC_Window* BC_DialogThread::new_gui() @@ -139,6 +143,11 @@ void BC_DialogThread::close_window() join(); } - +void BC_DialogThread::join() +{ + if( !running() ) return; + active_lock->lock("BC_DialogThread::join"); + active_lock->unlock(); +} diff --git a/cinelerra-5.1/guicast/bcdialog.h b/cinelerra-5.1/guicast/bcdialog.h index 1318a996..6f229e0c 100644 --- a/cinelerra-5.1/guicast/bcdialog.h +++ b/cinelerra-5.1/guicast/bcdialog.h @@ -68,18 +68,12 @@ public: // Called by user to close the GUI from outside the thread void close_window(); - + void join(); private: BC_Window *gui; Condition *startup_lock; Mutex *window_lock; + Mutex *active_lock; }; - - - - - - - #endif diff --git a/cinelerra-5.1/guicast/bcwindowdraw.C b/cinelerra-5.1/guicast/bcwindowdraw.C index dd0aee2f..76a47a73 100644 --- a/cinelerra-5.1/guicast/bcwindowdraw.C +++ b/cinelerra-5.1/guicast/bcwindowdraw.C @@ -631,11 +631,12 @@ void BC_WindowBase::draw_triangle_down_flat(int x, int y, int w, int h) int x1, y1, x2, y2, x3; XPoint point[3]; - x1 = x; x2 = x + w / 2; x3 = x + w - 1; - y1 = y; y2 = y + h - 1; + x1 = x+1; x2 = x + w/2; x3 = x+w-1; + y1 = y; y2 = y+h-1; - point[0].x = x2; point[0].y = y2; point[1].x = x3; - point[1].y = y1; point[2].x = x1; point[2].y = y1; + point[0].x = x2; point[0].y = y2; + point[1].x = x3; point[1].y = y1; + point[2].x = x1; point[2].y = y1; XFillPolygon(top_level->display, pixmap->opaque_pixmap, @@ -644,6 +645,7 @@ void BC_WindowBase::draw_triangle_down_flat(int x, int y, int w, int h) 3, Nonconvex, CoordModeOrigin); + draw_line(x1,y1, x3,y1); } void BC_WindowBase::draw_triangle_up(int x, int y, int w, int h, diff --git a/cinelerra-5.1/info/plugins.txt b/cinelerra-5.1/info/plugins.txt index 30168703..1afa51c1 100644 --- a/cinelerra-5.1/info/plugins.txt +++ b/cinelerra-5.1/info/plugins.txt @@ -200,6 +200,7 @@ Title: Add text/timestamp/background pngs to video along with . color, font, alpha, size, png, bold, italic, blink, . ul, caps, sup(super/sub script), fixed, nudge. Special characters are <, >, \, /, # (see manual). +Tracer: Trace an outline of an object for a mask like operation. Translate: Allows displacing, cropping and/or scaling video horizontally/vertically. Unsharp: Applies a traditional darkroom technique, unsharp diff --git a/cinelerra-5.1/plugins/brightness/brightness.C b/cinelerra-5.1/plugins/brightness/brightness.C index ccfcd904..604d249f 100644 --- a/cinelerra-5.1/plugins/brightness/brightness.C +++ b/cinelerra-5.1/plugins/brightness/brightness.C @@ -37,15 +37,23 @@ REGISTER_PLUGIN(BrightnessMain) BrightnessConfig::BrightnessConfig() { - reset(); + reset(0); } -void BrightnessConfig::reset() - +void BrightnessConfig::reset(int clear) { - brightness = 0; - contrast = 0; - luma = 1; + switch(clear) { + case RESET_CONTRAST : contrast = 0; + break; + case RESET_BRIGHTNESS : brightness = 0; + break; + case RESET_ALL : + default: + brightness = 0; + contrast = 0; + luma = 1; + break; + } } int BrightnessConfig::equivalent(BrightnessConfig &that) diff --git a/cinelerra-5.1/plugins/brightness/brightness.h b/cinelerra-5.1/plugins/brightness/brightness.h index 216dd4e4..a9b3f713 100644 --- a/cinelerra-5.1/plugins/brightness/brightness.h +++ b/cinelerra-5.1/plugins/brightness/brightness.h @@ -36,7 +36,7 @@ public: BrightnessConfig(); int equivalent(BrightnessConfig &that); - void reset(); + void reset(int clear); void copy_from(BrightnessConfig &that); void interpolate(BrightnessConfig &prev, BrightnessConfig &next, diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.C b/cinelerra-5.1/plugins/brightness/brightnesswindow.C index 5a455e01..72d9e82a 100644 --- a/cinelerra-5.1/plugins/brightness/brightnesswindow.C +++ b/cinelerra-5.1/plugins/brightness/brightnesswindow.C @@ -32,12 +32,7 @@ BrightnessWindow::BrightnessWindow(BrightnessMain *client) - : PluginClientWindow(client, - 330, - 160, - 330, - 160, - 0) + : PluginClientWindow(client, 370, 155, 370, 155, 0) { this->client = client; } @@ -48,22 +43,28 @@ BrightnessWindow::~BrightnessWindow() void BrightnessWindow::create_objects() { - int x = 10, y = 10; + int x = 10, y = 10, x1 = x + 90; + int x2 = 0; int clrBtn_w = 50; + add_tool(new BC_Title(x, y, _("Brightness/Contrast"))); y += 25; add_tool(new BC_Title(x, y,_("Brightness:"))); add_tool(brightness = new BrightnessSlider(client, &(client->config.brightness), - x + 80, + x1, y, 1)); + x2 = x1 + brightness->get_w() + 10; + add_subwindow(brightnessClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 1)); y += 25; add_tool(new BC_Title(x, y, _("Contrast:"))); add_tool(contrast = new BrightnessSlider(client, &(client->config.contrast), - x + 80, + x1, y, 0)); + + add_subwindow(contrastClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 0)); y += 30; add_tool(luma = new BrightnessLuma(client, x, @@ -77,11 +78,20 @@ void BrightnessWindow::create_objects() } // for Reset button -void BrightnessWindow::update() +void BrightnessWindow::update_gui(int clear) { - brightness->update(client->config.brightness); - contrast->update(client->config.contrast); - luma->update(client->config.luma); + switch(clear) { + case RESET_CONTRAST : contrast->update(client->config.contrast); + break; + case RESET_BRIGHTNESS: brightness->update(client->config.brightness); + break; + case RESET_ALL : + default: + brightness->update(client->config.brightness); + contrast->update(client->config.contrast); + luma->update(client->config.luma); + break; + } } BrightnessSlider::BrightnessSlider(BrightnessMain *client, @@ -162,8 +172,28 @@ BrightnessReset::~BrightnessReset() } int BrightnessReset::handle_event() { - client->config.reset(); - window->update(); + client->config.reset(RESET_ALL); // clear=0 ==> reset all + window->update_gui(RESET_ALL); + client->send_configure_change(); + return 1; +} + +BrightnessSliderClr::BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->client = client; + this->window = window; + this->is_brightness = is_brightness; +} +BrightnessSliderClr::~BrightnessSliderClr() +{ +} +int BrightnessSliderClr::handle_event() +{ + // is_brightness==0 means Contrast slider ==> "clear=1" + // is_brightness==1 means Brightness slider ==> "clear=2" + client->config.reset(is_brightness + 1); + window->update_gui(is_brightness + 1); client->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.h b/cinelerra-5.1/plugins/brightness/brightnesswindow.h index 1d4300df..1b122ed3 100644 --- a/cinelerra-5.1/plugins/brightness/brightnesswindow.h +++ b/cinelerra-5.1/plugins/brightness/brightnesswindow.h @@ -22,18 +22,22 @@ #ifndef BRIGHTNESSWINDOW_H #define BRIGHTNESSWINDOW_H +#include "brightness.h" +#include "guicast.h" +#include "mutex.h" +#include "pluginvclient.h" +#include "thread.h" + +#define RESET_ALL 0 +#define RESET_CONTRAST 1 +#define RESET_BRIGHTNESS 2 class BrightnessThread; class BrightnessWindow; class BrightnessSlider; class BrightnessLuma; class BrightnessReset; - -#include "brightness.h" -#include "guicast.h" -#include "mutex.h" -#include "pluginvclient.h" -#include "thread.h" +class BrightnessSliderClr; class BrightnessWindow : public PluginClientWindow @@ -41,7 +45,7 @@ class BrightnessWindow : public PluginClientWindow public: BrightnessWindow(BrightnessMain *client); ~BrightnessWindow(); - void update(); + void update_gui(int clear); void create_objects(); BrightnessMain *client; @@ -49,6 +53,8 @@ public: BrightnessSlider *contrast; BrightnessLuma *luma; BrightnessReset *reset; + BrightnessSliderClr *brightnessClr; + BrightnessSliderClr *contrastClr; }; class BrightnessSlider : public BC_FSlider @@ -85,6 +91,17 @@ public: BrightnessWindow *window; }; +class BrightnessSliderClr : public BC_GenericButton +{ +public: + BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness); + ~BrightnessSliderClr(); + int handle_event(); + BrightnessMain *client; + BrightnessWindow *window; + int is_brightness; +}; + #endif diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalance.C b/cinelerra-5.1/plugins/colorbalance/colorbalance.C index 7b8f0cff..338466ca 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalance.C +++ b/cinelerra-5.1/plugins/colorbalance/colorbalance.C @@ -43,11 +43,28 @@ REGISTER_PLUGIN(ColorBalanceMain) ColorBalanceConfig::ColorBalanceConfig() { - cyan = 0; - magenta = 0; - yellow = 0; - lock_params = 0; - preserve = 0; + reset(RESET_ALL); +} + +void ColorBalanceConfig::reset(int clear) +{ + switch(clear) { + case RESET_CYAN : cyan = 0; + break; + case RESET_MAGENTA : magenta = 0; + break; + case RESET_YELLOW : yellow = 0; + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + cyan = 0; + magenta = 0; + yellow = 0; + lock_params = 0; + preserve = 0; + break; + } } int ColorBalanceConfig::equivalent(ColorBalanceConfig &that) diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalance.h b/cinelerra-5.1/plugins/colorbalance/colorbalance.h index ecc4f18a..e0dbf395 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalance.h +++ b/cinelerra-5.1/plugins/colorbalance/colorbalance.h @@ -39,6 +39,7 @@ class ColorBalanceConfig { public: ColorBalanceConfig(); + void reset(int clear); int equivalent(ColorBalanceConfig &that); void copy_from(ColorBalanceConfig &that); diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.C b/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.C index 263f15ea..1719fee8 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.C +++ b/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.C @@ -34,12 +34,7 @@ ColorBalanceWindow::ColorBalanceWindow(ColorBalanceMain *client) - : PluginClientWindow(client, - 330, - 250, - 330, - 250, - 0) + : PluginClientWindow(client, 400, 210, 400, 210, 0) { this->client = client; } @@ -51,37 +46,60 @@ ColorBalanceWindow::~ColorBalanceWindow() void ColorBalanceWindow::create_objects() { int x = 10, y = 10; + int clrBtn_w = 50; + int x1 = 400 - clrBtn_w - 10; // (window_width - clrBtn_width - margin_rx) + add_tool(new BC_Title(x, y, _("Color Balance"))); y += 25; add_tool(new BC_Title(x, y, _("Cyan"))); add_tool(cyan = new ColorBalanceSlider(client, &(client->config.cyan), x + 70, y)); - add_tool(new BC_Title(x + 270, y, _("Red"))); + add_tool(new BC_Title(x + 280, y, _("Red"))); + add_subwindow(cyanClr = new ColorBalanceSliderClr(client, this, x1, y, clrBtn_w, 1)); + y += 25; add_tool(new BC_Title(x, y, _("Magenta"))); add_tool(magenta = new ColorBalanceSlider(client, &(client->config.magenta), x + 70, y)); - add_tool(new BC_Title(x + 270, y, _("Green"))); + add_tool(new BC_Title(x + 280, y, _("Green"))); + add_subwindow(magentaClr = new ColorBalanceSliderClr(client, this, x1, y, clrBtn_w, 2)); + y += 25; add_tool(new BC_Title(x, y, _("Yellow"))); add_tool(yellow = new ColorBalanceSlider(client, &(client->config.yellow), x + 70, y)); - add_tool(new BC_Title(x + 270, y, _("Blue"))); + add_tool(new BC_Title(x + 280, y, _("Blue"))); + add_subwindow(yellowClr = new ColorBalanceSliderClr(client, this, x1, y, clrBtn_w, 3)); + y += 25; - add_tool(preserve = new ColorBalancePreserve(client, x + 70, y)); + add_tool(preserve = new ColorBalancePreserve(client, x, y)); y += preserve->get_h() + 10; - add_tool(lock_params = new ColorBalanceLock(client, x + 70, y)); - y += lock_params->get_h() + 10; - add_tool(new ColorBalanceWhite(client, this, x, y)); - y += lock_params->get_h() + 10; + add_tool(lock_params = new ColorBalanceLock(client, x, y)); + + y += lock_params->get_h() + 15; add_tool(new ColorBalanceReset(client, this, x, y)); + add_tool(new ColorBalanceWhite(client, this, int(400 / 2), y)); show_window(); flush(); } -void ColorBalanceWindow::update() +void ColorBalanceWindow::update_gui(int clear) { - cyan->update((int64_t)client->config.cyan); - magenta->update((int64_t)client->config.magenta); - yellow->update((int64_t)client->config.yellow); + switch(clear) { + case RESET_CYAN : cyan->update((int64_t)client->config.cyan); + break; + case RESET_MAGENTA : magenta->update((int64_t)client->config.magenta); + break; + case RESET_YELLOW : yellow->update((int64_t)client->config.yellow); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + cyan->update((int64_t)client->config.cyan); + magenta->update((int64_t)client->config.magenta); + yellow->update((int64_t)client->config.yellow); + preserve->update(client->config.preserve); + lock_params->update(client->config.lock_params); + break; + } } @@ -195,7 +213,7 @@ int ColorBalanceWhite::handle_event() plugin->config.cyan = plugin->calculate_slider(r_factor); plugin->config.magenta = plugin->calculate_slider(g_factor); plugin->config.yellow = plugin->calculate_slider(b_factor); - gui->update(); + gui->update_gui(RESET_DEFAULT_SETTINGS); plugin->send_configure_change(); return 1; @@ -214,12 +232,29 @@ ColorBalanceReset::ColorBalanceReset(ColorBalanceMain *plugin, int ColorBalanceReset::handle_event() { - plugin->config.cyan = 0; - plugin->config.magenta = 0; - plugin->config.yellow = 0; - gui->update(); + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +ColorBalanceSliderClr::ColorBalanceSliderClr(ColorBalanceMain *plugin, + ColorBalanceWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +ColorBalanceSliderClr::~ColorBalanceSliderClr() +{ +} +int ColorBalanceSliderClr::handle_event() +{ + plugin->config.reset(clear); + gui->update_gui(clear); + plugin->send_configure_change(); + return 1; +} + diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.h b/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.h index 835ade06..02b3e39a 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.h +++ b/cinelerra-5.1/plugins/colorbalance/colorbalancewindow.h @@ -22,6 +22,11 @@ #ifndef COLORBALANCEWINDOW_H #define COLORBALANCEWINDOW_H +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_CYAN 1 +#define RESET_MAGENTA 2 +#define RESET_YELLOW 3 class ColorBalanceThread; class ColorBalanceWindow; @@ -30,6 +35,7 @@ class ColorBalancePreserve; class ColorBalanceLock; class ColorBalanceWhite; class ColorBalanceReset; +class ColorBalanceSliderClr; #include "filexml.h" #include "guicast.h" @@ -46,16 +52,19 @@ public: ~ColorBalanceWindow(); void create_objects(); - void update(); + void update_gui(int clear); ColorBalanceMain *client; ColorBalanceSlider *cyan; ColorBalanceSlider *magenta; ColorBalanceSlider *yellow; - ColorBalanceLock *lock_params; - ColorBalancePreserve *preserve; + ColorBalanceLock *lock_params; + ColorBalancePreserve *preserve; ColorBalanceWhite *use_eyedrop; ColorBalanceReset *reset; + ColorBalanceSliderClr *cyanClr; + ColorBalanceSliderClr *magentaClr; + ColorBalanceSliderClr *yellowClr; }; class ColorBalanceSlider : public BC_ISlider @@ -68,7 +77,7 @@ public: ColorBalanceMain *client; float *output; - float old_value; + float old_value; char string[BCTEXTLEN]; }; @@ -110,4 +119,15 @@ public: ColorBalanceWindow *gui; }; +class ColorBalanceSliderClr : public BC_GenericButton +{ +public: + ColorBalanceSliderClr(ColorBalanceMain *plugin, ColorBalanceWindow *gui, int x, int y, int w, int clear); + ~ColorBalanceSliderClr(); + int handle_event(); + ColorBalanceMain *plugin; + ColorBalanceWindow *gui; + int clear; +}; + #endif diff --git a/cinelerra-5.1/plugins/huesaturation/huesaturation.C b/cinelerra-5.1/plugins/huesaturation/huesaturation.C index 7f050232..c6a23290 100644 --- a/cinelerra-5.1/plugins/huesaturation/huesaturation.C +++ b/cinelerra-5.1/plugins/huesaturation/huesaturation.C @@ -46,12 +46,23 @@ REGISTER_PLUGIN(HueEffect) HueConfig::HueConfig() { - reset(); + reset(RESET_ALL); } -void HueConfig::reset() +void HueConfig::reset(int clear) { - hue = saturation = value = 0; + switch(clear) { + case RESET_HUV : hue = 0; + break; + case RESET_SAT : saturation = 0; + break; + case RESET_VAL : value = 0; + break; + case RESET_ALL : + default: + hue = saturation = value = 0; + break; + } } void HueConfig::copy_from(HueConfig &src) @@ -183,8 +194,30 @@ HueReset::~HueReset() } int HueReset::handle_event() { - plugin->config.reset(); - gui->update(); + plugin->config.reset(RESET_ALL); // clear=0 ==> reset all + gui->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +HueSliderClr::HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +HueSliderClr::~HueSliderClr() +{ +} +int HueSliderClr::handle_event() +{ + // clear==1 ==> Hue slider + // clear==2 ==> Saturation slider + // clear==3 ==> Value slider + plugin->config.reset(clear); + gui->update_gui(clear); plugin->send_configure_change(); return 1; } @@ -193,21 +226,30 @@ int HueReset::handle_event() HueWindow::HueWindow(HueEffect *plugin) - : PluginClientWindow(plugin, 345, 145, 345, 145, 0) + : PluginClientWindow(plugin, 370, 140, 370, 140, 0) { this->plugin = plugin; } void HueWindow::create_objects() { int x = 10, y = 10, x1 = 100; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("Hue:"))); add_subwindow(hue = new HueSlider(plugin, x1, y, 200)); + x2 = x1 + hue->get_w() + 10; + add_subwindow(hueClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_HUV)); + y += 30; add_subwindow(new BC_Title(x, y, _("Saturation:"))); add_subwindow(saturation = new SaturationSlider(plugin, x1, y, 200)); + add_subwindow(satClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_SAT)); + y += 30; add_subwindow(new BC_Title(x, y, _("Value:"))); add_subwindow(value = new ValueSlider(plugin, x1, y, 200)); + add_subwindow(valClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_VAL)); + y += 40; add_subwindow(reset = new HueReset(plugin, this, x, y)); show_window(); @@ -216,11 +258,22 @@ void HueWindow::create_objects() // for Reset button -void HueWindow::update() +void HueWindow::update_gui(int clear) { - hue->update(plugin->config.hue); - saturation->update(plugin->config.saturation); - value->update(plugin->config.value); + switch(clear) { + case RESET_HUV : hue->update(plugin->config.hue); + break; + case RESET_SAT : saturation->update(plugin->config.saturation); + break; + case RESET_VAL : value->update(plugin->config.value); + break; + case RESET_ALL : + default: + hue->update(plugin->config.hue); + saturation->update(plugin->config.saturation); + value->update(plugin->config.value); + break; + } } diff --git a/cinelerra-5.1/plugins/huesaturation/huesaturation.h b/cinelerra-5.1/plugins/huesaturation/huesaturation.h index f7e1b814..a591a852 100644 --- a/cinelerra-5.1/plugins/huesaturation/huesaturation.h +++ b/cinelerra-5.1/plugins/huesaturation/huesaturation.h @@ -42,6 +42,7 @@ class HueEffect; class HueWindow; class HueReset; +class HueSliderClr; #define MINHUE -180 #define MAXHUE 180 @@ -50,9 +51,10 @@ class HueReset; #define MINVALUE -100 #define MAXVALUE 100 - - - +#define RESET_ALL 0 +#define RESET_HUV 1 +#define RESET_SAT 2 +#define RESET_VAL 3 class HueConfig @@ -62,7 +64,7 @@ public: void copy_from(HueConfig &src); int equivalent(HueConfig &src); - void reset(); + void reset(int clear); void interpolate(HueConfig &prev, HueConfig &next, long prev_frame, @@ -109,17 +111,31 @@ public: HueWindow *gui; }; +class HueSliderClr : public BC_GenericButton +{ +public: + HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear); + ~HueSliderClr(); + int handle_event(); + HueEffect *plugin; + HueWindow *gui; + int clear; +}; + class HueWindow : public PluginClientWindow { public: HueWindow(HueEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); HueEffect *plugin; HueSlider *hue; SaturationSlider *saturation; ValueSlider *value; HueReset *reset; + HueSliderClr *hueClr; + HueSliderClr *satClr; + HueSliderClr *valClr; }; diff --git a/cinelerra-5.1/plugins/linearblur/linearblur.C b/cinelerra-5.1/plugins/linearblur/linearblur.C index e389b082..d5d326f0 100644 --- a/cinelerra-5.1/plugins/linearblur/linearblur.C +++ b/cinelerra-5.1/plugins/linearblur/linearblur.C @@ -47,18 +47,38 @@ REGISTER_PLUGIN(LinearBlurMain) LinearBlurConfig::LinearBlurConfig() { - reset(); -} - -void LinearBlurConfig::reset() -{ - radius = 10; - angle = 0; - steps = 10; - r = 1; - g = 1; - b = 1; - a = 1; + reset(RESET_DEFAULT_SETTINGS); +} + +void LinearBlurConfig::reset(int clear) +{ + switch(clear) { + case RESET_ALL : + radius = 0; + angle = 0; + steps = 1; + r = 1; + g = 1; + b = 1; + a = 1; + break; + case RESET_RADIUS : radius = 0; + break; + case RESET_ANGLE : angle = 0; + break; + case RESET_STEPS : steps = 1; + break; + case RESET_DEFAULT_SETTINGS : + default: + radius = 10; + angle = 0; + steps = 10; + r = 1; + g = 1; + b = 1; + a = 1; + break; + } } int LinearBlurConfig::equivalent(LinearBlurConfig &that) @@ -114,9 +134,9 @@ void LinearBlurConfig::interpolate(LinearBlurConfig &prev, LinearBlurWindow::LinearBlurWindow(LinearBlurMain *plugin) : PluginClientWindow(plugin, - 230, + 280, 320, - 230, + 280, 320, 0) { @@ -130,18 +150,27 @@ LinearBlurWindow::~LinearBlurWindow() void LinearBlurWindow::create_objects() { int x = 10, y = 10; + int x1 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; add_subwindow(new BC_Title(x, y, _("Length:"))); y += 20; add_subwindow(radius = new LinearBlurSize(plugin, x, y, &plugin->config.radius, 0, 100)); + x1 = x + radius->get_w() + 10; + add_subwindow(radiusClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); + y += 30; add_subwindow(new BC_Title(x, y, _("Angle:"))); y += 20; add_subwindow(angle = new LinearBlurSize(plugin, x, y, &plugin->config.angle, -180, 180)); + add_subwindow(angleClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); + y += 30; add_subwindow(new BC_Title(x, y, _("Steps:"))); y += 20; add_subwindow(steps = new LinearBlurSize(plugin, x, y, &plugin->config.steps, 1, 200)); + add_subwindow(stepsClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + y += 30; add_subwindow(r = new LinearBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); y += 30; @@ -152,6 +181,8 @@ void LinearBlurWindow::create_objects() add_subwindow(a = new LinearBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); y += 40; add_subwindow(reset = new LinearBlurReset(plugin, this, x, y)); + add_subwindow(default_settings = new LinearBlurDefaultSettings(plugin, this, + (280 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -159,15 +190,27 @@ void LinearBlurWindow::create_objects() // for Reset button -void LinearBlurWindow::update() -{ - radius->update(plugin->config.radius); - angle->update(plugin->config.angle); - steps->update(plugin->config.steps); - r->update(plugin->config.r); - g->update(plugin->config.g); - b->update(plugin->config.b); - a->update(plugin->config.a); +void LinearBlurWindow::update_gui(int clear) +{ + switch(clear) { + case RESET_RADIUS : radius->update(plugin->config.radius); + break; + case RESET_ANGLE : angle->update(plugin->config.angle); + break; + case RESET_STEPS : steps->update(plugin->config.steps); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + radius->update(plugin->config.radius); + angle->update(plugin->config.angle); + steps->update(plugin->config.steps); + r->update(plugin->config.r); + g->update(plugin->config.g); + b->update(plugin->config.b); + a->update(plugin->config.a); + break; + } } @@ -233,8 +276,48 @@ LinearBlurReset::~LinearBlurReset() } int LinearBlurReset::handle_event() { - plugin->config.reset(); - gui->update(); + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +LinearBlurDefaultSettings::LinearBlurDefaultSettings(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->gui = gui; +} +LinearBlurDefaultSettings::~LinearBlurDefaultSettings() +{ +} +int LinearBlurDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + gui->update_gui(RESET_DEFAULT_SETTINGS); + plugin->send_configure_change(); + return 1; +} + + +LinearBlurSliderClr::LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +LinearBlurSliderClr::~LinearBlurSliderClr() +{ +} +int LinearBlurSliderClr::handle_event() +{ + // clear==1 ==> Radius slider + // clear==2 ==> Angle slider + // clear==3 ==> Steps slider + plugin->config.reset(clear); + gui->update_gui(clear); plugin->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/linearblur/linearblur.h b/cinelerra-5.1/plugins/linearblur/linearblur.h index b0dfc7ed..88f49a81 100644 --- a/cinelerra-5.1/plugins/linearblur/linearblur.h +++ b/cinelerra-5.1/plugins/linearblur/linearblur.h @@ -37,13 +37,18 @@ #include "pluginvclient.h" #include "vframe.h" - +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_RADIUS 1 +#define RESET_ANGLE 2 +#define RESET_STEPS 3 class LinearBlurMain; class LinearBlurWindow; class LinearBlurEngine; class LinearBlurReset; - +class LinearBlurDefaultSettings; +class LinearBlurSliderClr; @@ -52,7 +57,7 @@ class LinearBlurConfig public: LinearBlurConfig(); - void reset(); + void reset(int clear); int equivalent(LinearBlurConfig &that); void copy_from(LinearBlurConfig &that); void interpolate(LinearBlurConfig &prev, @@ -109,6 +114,27 @@ public: LinearBlurWindow *gui; }; +class LinearBlurDefaultSettings : public BC_GenericButton +{ +public: + LinearBlurDefaultSettings(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w); + ~LinearBlurDefaultSettings(); + int handle_event(); + LinearBlurMain *plugin; + LinearBlurWindow *gui; +}; + +class LinearBlurSliderClr : public BC_GenericButton +{ +public: + LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear); + ~LinearBlurSliderClr(); + int handle_event(); + LinearBlurMain *plugin; + LinearBlurWindow *gui; + int clear; +}; + class LinearBlurWindow : public PluginClientWindow { public: @@ -116,12 +142,16 @@ public: ~LinearBlurWindow(); void create_objects(); - void update(); + void update_gui(int clear); LinearBlurSize *angle, *steps, *radius; LinearBlurToggle *r, *g, *b, *a; LinearBlurMain *plugin; LinearBlurReset *reset; + LinearBlurDefaultSettings *default_settings; + LinearBlurSliderClr *radiusClr; + LinearBlurSliderClr *angleClr; + LinearBlurSliderClr *stepsClr; }; diff --git a/cinelerra-5.1/plugins/motion51/motionwindow51.C b/cinelerra-5.1/plugins/motion51/motionwindow51.C index b8aa73c0..96bb6821 100644 --- a/cinelerra-5.1/plugins/motion51/motionwindow51.C +++ b/cinelerra-5.1/plugins/motion51/motionwindow51.C @@ -45,7 +45,7 @@ void Motion51Window::create_objects() { int x = 10, y = 20; int x0 = x, x1 = get_w()/2; - add_subwindow(sample_steps = new Motion51SampleSteps(plugin, x0=x, y, 72)); + add_subwindow(sample_steps = new Motion51SampleSteps(plugin, x0=x, y, 120)); BC_Title *title = new BC_Title(x0+=sample_steps->get_w()+10, y, _("Samples")); add_subwindow(title); sample_steps->create_objects(); diff --git a/cinelerra-5.1/plugins/polar/polar.C b/cinelerra-5.1/plugins/polar/polar.C index cfae601a..16812843 100644 --- a/cinelerra-5.1/plugins/polar/polar.C +++ b/cinelerra-5.1/plugins/polar/polar.C @@ -38,11 +38,15 @@ #define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0) +#define RESET_ALL 0 +#define RESET_DEPTH 1 +#define RESET_ANGLE 2 class PolarEffect; class PolarEngine; class PolarWindow; class PolarReset; +class PolarSliderClr; class PolarConfig @@ -50,7 +54,7 @@ class PolarConfig public: PolarConfig(); - void reset(); + void reset(int clear); void copy_from(PolarConfig &src); int equivalent(PolarConfig &src); void interpolate(PolarConfig &prev, @@ -94,16 +98,29 @@ public: PolarWindow *window; }; +class PolarSliderClr : public BC_GenericButton +{ +public: + PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear); + ~PolarSliderClr(); + int handle_event(); + PolarEffect *plugin; + PolarWindow *window; + int clear; +}; + class PolarWindow : public PluginClientWindow { public: PolarWindow(PolarEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); PolarEffect *plugin; PolarDepth *depth; PolarAngle *angle; PolarReset *reset; + PolarSliderClr *depthClr; + PolarSliderClr *angleClr; }; @@ -162,16 +179,25 @@ REGISTER_PLUGIN(PolarEffect) PolarConfig::PolarConfig() { - reset(); + reset(RESET_ALL); } -void PolarConfig::reset() +void PolarConfig::reset(int clear) { - angle = 1.0; // 0.0; - depth = 1.0; // 0.0; - backwards = 0; - invert = 0; - polar_to_rectangular = 1; + switch(clear) { + case RESET_DEPTH : depth = 1.0; + break; + case RESET_ANGLE : angle = 1.0; + break; + case RESET_ALL : + default: + angle = 1.0; + depth = 1.0; + backwards = 0; + invert = 0; + polar_to_rectangular = 1; + break; + } } void PolarConfig::copy_from(PolarConfig &src) @@ -208,9 +234,9 @@ void PolarConfig::interpolate(PolarConfig &prev, PolarWindow::PolarWindow(PolarEffect *plugin) : PluginClientWindow(plugin, - 270, + 330, 122, - 270, + 330, 122, 0) { @@ -219,12 +245,18 @@ PolarWindow::PolarWindow(PolarEffect *plugin) void PolarWindow::create_objects() { - int x = 10, y = 10; + int x = 10, y = 10, x1 = x + 50; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("Depth:"))); - add_subwindow(depth = new PolarDepth(plugin, x + 50, y)); + add_subwindow(depth = new PolarDepth(plugin, x1, y)); + x2 = x1 + depth->get_w() + 10; + add_subwindow(depthClr = new PolarSliderClr(plugin, this, x2, y, clrBtn_w, RESET_DEPTH)); + y += 40; add_subwindow(new BC_Title(x, y, _("Angle:"))); - add_subwindow(angle = new PolarAngle(plugin, x + 50, y)); + add_subwindow(angle = new PolarAngle(plugin, x1, y)); + add_subwindow(angleClr = new PolarSliderClr(plugin, this, x2, y, clrBtn_w, RESET_ANGLE)); y += 40; add_subwindow(reset = new PolarReset(plugin, this, x, y)); @@ -233,10 +265,19 @@ void PolarWindow::create_objects() } // for Reset button -void PolarWindow::update() +void PolarWindow::update_gui(int clear) { - depth->update(plugin->config.depth); - angle->update(plugin->config.angle); + switch(clear) { + case RESET_DEPTH : depth->update(plugin->config.depth); + break; + case RESET_ANGLE : angle->update(plugin->config.angle); + break; + case RESET_ALL : + default: + depth->update(plugin->config.depth); + angle->update(plugin->config.angle); + break; + } } @@ -298,8 +339,29 @@ PolarReset::~PolarReset() } int PolarReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +PolarSliderClr::PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +PolarSliderClr::~PolarSliderClr() +{ +} +int PolarSliderClr::handle_event() +{ + // clear==1 ==> Depth slider + // clear==2 ==> Angle slider + plugin->config.reset(clear); + window->update_gui(clear); plugin->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/radialblur/radialblur.C b/cinelerra-5.1/plugins/radialblur/radialblur.C index 035ab0af..5137a6f2 100644 --- a/cinelerra-5.1/plugins/radialblur/radialblur.C +++ b/cinelerra-5.1/plugins/radialblur/radialblur.C @@ -30,20 +30,43 @@ REGISTER_PLUGIN(RadialBlurMain) RadialBlurConfig::RadialBlurConfig() { - reset(); + reset(RESET_DEFAULT_SETTINGS); } -void RadialBlurConfig::reset() +void RadialBlurConfig::reset(int clear) { - x = 50; - y = 50; - steps = 10; - angle = 33; - r = 1; - g = 1; - b = 1; - a = 1; + switch(clear) { + case RESET_ALL : + x = 50; + y = 50; + angle = 0; + steps = 1; + r = 1; + g = 1; + b = 1; + a = 1; + break; + case RESET_XSLIDER : x = 50; + break; + case RESET_YSLIDER : y = 50; + break; + case RESET_ANGLE : angle = 0; + break; + case RESET_STEPS : steps = 1; + break; + case RESET_DEFAULT_SETTINGS : + default: + x = 50; + y = 50; + angle = 33; + steps = 10; + r = 1; + g = 1; + b = 1; + a = 1; + break; + } } int RadialBlurConfig::equivalent(RadialBlurConfig &that) @@ -103,9 +126,9 @@ void RadialBlurConfig::interpolate(RadialBlurConfig &prev, RadialBlurWindow::RadialBlurWindow(RadialBlurMain *plugin) : PluginClientWindow(plugin, - 230, + 280, 370, - 230, + 280, 370, 0) { @@ -119,22 +142,33 @@ RadialBlurWindow::~RadialBlurWindow() void RadialBlurWindow::create_objects() { int x = 10, y = 10; + int x1 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; add_subwindow(new BC_Title(x, y, _("X:"))); y += 20; add_subwindow(this->x = new RadialBlurSize(plugin, x, y, &plugin->config.x, 0, 100)); + x1 = x + this->x->get_w() + 10; + add_subwindow(xClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_XSLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("Y:"))); y += 20; add_subwindow(this->y = new RadialBlurSize(plugin, x, y, &plugin->config.y, 0, 100)); + add_subwindow(yClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_YSLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("Angle:"))); y += 20; add_subwindow(angle = new RadialBlurSize(plugin, x, y, &plugin->config.angle, 0, 360)); + add_subwindow(angleClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); + y += 30; add_subwindow(new BC_Title(x, y, _("Steps:"))); y += 20; add_subwindow(steps = new RadialBlurSize(plugin, x, y, &plugin->config.steps, 1, 100)); + add_subwindow(stepsClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + y += 30; add_subwindow(r = new RadialBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); y += 30; @@ -145,22 +179,38 @@ void RadialBlurWindow::create_objects() add_subwindow(a = new RadialBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); y += 40; add_subwindow(reset = new RadialBlurReset(plugin, this, x, y)); + add_subwindow(default_settings = new RadialBlurDefaultSettings(plugin, this, + (280 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); } // for Reset button -void RadialBlurWindow::update() +void RadialBlurWindow::update_gui(int clear) { - this->x->update(plugin->config.x); - this->y->update(plugin->config.y); - angle->update(plugin->config.angle); - steps->update(plugin->config.steps); - r->update(plugin->config.r); - g->update(plugin->config.g); - b->update(plugin->config.b); - a->update(plugin->config.a); + switch(clear) { + case RESET_XSLIDER : this->x->update(plugin->config.x); + break; + case RESET_YSLIDER : this->y->update(plugin->config.y); + break; + case RESET_ANGLE : angle->update(plugin->config.angle); + break; + case RESET_STEPS : steps->update(plugin->config.steps); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + this->x->update(plugin->config.x); + this->y->update(plugin->config.y); + angle->update(plugin->config.angle); + steps->update(plugin->config.steps); + r->update(plugin->config.r); + g->update(plugin->config.g); + b->update(plugin->config.b); + a->update(plugin->config.a); + break; + } } @@ -230,14 +280,52 @@ RadialBlurReset::~RadialBlurReset() } int RadialBlurReset::handle_event() { - plugin->config.reset(); - gui->update(); + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +RadialBlurDefaultSettings::RadialBlurDefaultSettings(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->gui = gui; +} +RadialBlurDefaultSettings::~RadialBlurDefaultSettings() +{ +} +int RadialBlurDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + gui->update_gui(RESET_DEFAULT_SETTINGS); + plugin->send_configure_change(); + return 1; +} + +RadialBlurSliderClr::RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +RadialBlurSliderClr::~RadialBlurSliderClr() +{ +} +int RadialBlurSliderClr::handle_event() +{ + // clear==1 ==> X slider + // clear==2 ==> Y slider + // clear==3 ==> Angle slider + // clear==4 ==> Steps slider + plugin->config.reset(clear); + gui->update_gui(clear); + plugin->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/radialblur/radialblur.h b/cinelerra-5.1/plugins/radialblur/radialblur.h index d16facf8..c111b55e 100644 --- a/cinelerra-5.1/plugins/radialblur/radialblur.h +++ b/cinelerra-5.1/plugins/radialblur/radialblur.h @@ -39,12 +39,19 @@ #include "pluginvclient.h" #include "vframe.h" +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_XSLIDER 1 +#define RESET_YSLIDER 2 +#define RESET_ANGLE 3 +#define RESET_STEPS 4 class RadialBlurMain; class RadialBlurWindow; class RadialBlurEngine; class RadialBlurReset; - +class RadialBlurDefaultSettings; +class RadialBlurSliderClr; @@ -53,7 +60,7 @@ class RadialBlurConfig public: RadialBlurConfig(); - void reset(); + void reset(int clear); int equivalent(RadialBlurConfig &that); void copy_from(RadialBlurConfig &that); void interpolate(RadialBlurConfig &prev, @@ -111,6 +118,27 @@ public: RadialBlurWindow *gui; }; +class RadialBlurDefaultSettings : public BC_GenericButton +{ +public: + RadialBlurDefaultSettings(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w); + ~RadialBlurDefaultSettings(); + int handle_event(); + RadialBlurMain *plugin; + RadialBlurWindow *gui; +}; + +class RadialBlurSliderClr : public BC_GenericButton +{ +public: + RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear); + ~RadialBlurSliderClr(); + int handle_event(); + RadialBlurMain *plugin; + RadialBlurWindow *gui; + int clear; +}; + class RadialBlurWindow : public PluginClientWindow { public: @@ -118,12 +146,17 @@ public: ~RadialBlurWindow(); void create_objects(); - void update(); + void update_gui(int clear); RadialBlurSize *x, *y, *steps, *angle; RadialBlurToggle *r, *g, *b, *a; RadialBlurMain *plugin; RadialBlurReset *reset; + RadialBlurDefaultSettings *default_settings; + RadialBlurSliderClr *xClr; + RadialBlurSliderClr *yClr; + RadialBlurSliderClr *angleClr; + RadialBlurSliderClr *stepsClr; }; diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.C b/cinelerra-5.1/plugins/rgbshift/rgbshift.C index af60c041..dca56c2d 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.C +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.C @@ -32,14 +32,31 @@ REGISTER_PLUGIN(RGBShiftEffect) RGBShiftConfig::RGBShiftConfig() { - reset(); + reset(RESET_ALL); } -void RGBShiftConfig::reset() +void RGBShiftConfig::reset(int clear) { - r_dx = r_dy = 0; - g_dx = g_dy = 0; - b_dx = b_dy = 0; + switch(clear) { + case RESET_R_DX : r_dx = 0; + break; + case RESET_R_DY : r_dy = 0; + break; + case RESET_G_DX : g_dx = 0; + break; + case RESET_G_DY : g_dy = 0; + break; + case RESET_B_DX : b_dx = 0; + break; + case RESET_B_DY : b_dy = 0; + break; + case RESET_ALL : + default: + r_dx = r_dy = 0; + g_dx = g_dy = 0; + b_dx = b_dy = 0; + break; + } } void RGBShiftConfig::copy_from(RGBShiftConfig &src) @@ -105,15 +122,37 @@ RGBShiftReset::~RGBShiftReset() } int RGBShiftReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +RGBShiftSliderClr::RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +RGBShiftSliderClr::~RGBShiftSliderClr() +{ +} +int RGBShiftSliderClr::handle_event() +{ + // clear==1 ==> r_dx slider --- clear==2 ==> r_dy slider + // clear==3 ==> g_dx slider --- clear==4 ==> g_dy slider + // clear==5 ==> b_dx slider --- clear==6 ==> b_dy slider + plugin->config.reset(clear); + window->update_gui(clear); plugin->send_configure_change(); return 1; } RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) - : PluginClientWindow(plugin, 300, 230, 300, 230, 0) + : PluginClientWindow(plugin, 320, 230, 320, 230, 0) { this->plugin = plugin; } @@ -121,23 +160,37 @@ RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) void RGBShiftWindow::create_objects() { int x = 10, y = 10, x1 = 50; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("R_dx:"))); add_subwindow(r_dx = new RGBShiftLevel(plugin, &plugin->config.r_dx, x1, y)); + x2 = x1 + r_dx->get_w() + 10; + add_subwindow(r_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("R_dy:"))); add_subwindow(r_dy = new RGBShiftLevel(plugin, &plugin->config.r_dy, x1, y)); + add_subwindow(r_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("G_dx:"))); add_subwindow(g_dx = new RGBShiftLevel(plugin, &plugin->config.g_dx, x1, y)); + add_subwindow(g_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("G_dy:"))); add_subwindow(g_dy = new RGBShiftLevel(plugin, &plugin->config.g_dy, x1, y)); + add_subwindow(g_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("B_dx:"))); add_subwindow(b_dx = new RGBShiftLevel(plugin, &plugin->config.b_dx, x1, y)); + add_subwindow(b_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("B_dy:"))); add_subwindow(b_dy = new RGBShiftLevel(plugin, &plugin->config.b_dy, x1, y)); + add_subwindow(b_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DY)); y += 40; add_subwindow(reset = new RGBShiftReset(plugin, this, x, y)); @@ -148,14 +201,31 @@ void RGBShiftWindow::create_objects() // for Reset button -void RGBShiftWindow::update() +void RGBShiftWindow::update_gui(int clear) { - r_dx->update(plugin->config.r_dx); - r_dy->update(plugin->config.r_dy); - g_dx->update(plugin->config.g_dx); - g_dy->update(plugin->config.g_dy); - b_dx->update(plugin->config.b_dx); - b_dy->update(plugin->config.b_dy); + switch(clear) { + case RESET_R_DX : r_dx->update(plugin->config.r_dx); + break; + case RESET_R_DY : r_dy->update(plugin->config.r_dy); + break; + case RESET_G_DX : g_dx->update(plugin->config.g_dx); + break; + case RESET_G_DY : g_dy->update(plugin->config.g_dy); + break; + case RESET_B_DX : b_dx->update(plugin->config.b_dx); + break; + case RESET_B_DY : b_dy->update(plugin->config.b_dy); + break; + case RESET_ALL : + default: + r_dx->update(plugin->config.r_dx); + r_dy->update(plugin->config.r_dy); + g_dx->update(plugin->config.g_dx); + g_dy->update(plugin->config.g_dy); + b_dx->update(plugin->config.b_dx); + b_dy->update(plugin->config.b_dy); + break; + } } diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.h b/cinelerra-5.1/plugins/rgbshift/rgbshift.h index 2092dc02..e948c40d 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.h +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.h @@ -36,10 +36,18 @@ #include #include +#define RESET_ALL 0 +#define RESET_R_DX 1 +#define RESET_R_DY 2 +#define RESET_G_DX 3 +#define RESET_G_DY 4 +#define RESET_B_DX 5 +#define RESET_B_DY 6 class RGBShiftEffect; class RGBShiftWindow; class RGBShiftReset; +class RGBShiftSliderClr; class RGBShiftConfig @@ -47,7 +55,7 @@ class RGBShiftConfig public: RGBShiftConfig(); - void reset(); + void reset(int clear); void copy_from(RGBShiftConfig &src); int equivalent(RGBShiftConfig &src); void interpolate(RGBShiftConfig &prev, @@ -78,15 +86,29 @@ public: RGBShiftWindow *window; }; +class RGBShiftSliderClr : public BC_GenericButton +{ +public: + RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear); + ~RGBShiftSliderClr(); + int handle_event(); + RGBShiftEffect *plugin; + RGBShiftWindow *window; + int clear; +}; + class RGBShiftWindow : public PluginClientWindow { public: RGBShiftWindow(RGBShiftEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); RGBShiftLevel *r_dx, *r_dy, *g_dx, *g_dy, *b_dx, *b_dy; RGBShiftEffect *plugin; RGBShiftReset *reset; + RGBShiftSliderClr *r_dxClr, *r_dyClr; + RGBShiftSliderClr *g_dxClr, *g_dyClr; + RGBShiftSliderClr *b_dxClr, *b_dyClr; }; diff --git a/cinelerra-5.1/plugins/sharpen/sharpen.C b/cinelerra-5.1/plugins/sharpen/sharpen.C index e540576c..fc5777f8 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpen.C +++ b/cinelerra-5.1/plugins/sharpen/sharpen.C @@ -40,15 +40,28 @@ REGISTER_PLUGIN(SharpenMain) SharpenConfig::SharpenConfig() { - reset(); + reset(RESET_ALL); } -void SharpenConfig::reset() +void SharpenConfig::reset(int clear) { - horizontal = 0; - interlace = 0; - sharpness = 50; - luminance = 0; + switch(clear) { + case RESET_ALL : + sharpness = 0; + interlace = 0; + horizontal = 0; + luminance = 0; + break; + case RESET_SHARPEN_SLIDER : sharpness = 0; + break; + case RESET_DEFAULT_SETTINGS : + default: + sharpness = 50; + interlace = 0; + horizontal = 0; + luminance = 0; + break; + } } void SharpenConfig::copy_from(SharpenConfig &that) diff --git a/cinelerra-5.1/plugins/sharpen/sharpen.h b/cinelerra-5.1/plugins/sharpen/sharpen.h index b6aefd56..96c0d983 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpen.h +++ b/cinelerra-5.1/plugins/sharpen/sharpen.h @@ -44,7 +44,7 @@ public: void copy_from(SharpenConfig &that); int equivalent(SharpenConfig &that); - void reset(); + void reset(int clear); void interpolate(SharpenConfig &prev, SharpenConfig &next, long prev_frame, diff --git a/cinelerra-5.1/plugins/sharpen/sharpenwindow.C b/cinelerra-5.1/plugins/sharpen/sharpenwindow.C index 310128f8..18ddefd9 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpenwindow.C +++ b/cinelerra-5.1/plugins/sharpen/sharpenwindow.C @@ -33,7 +33,7 @@ SharpenWindow::SharpenWindow(SharpenMain *client) - : PluginClientWindow(client, 230, 195, 230, 195, 0) //195 was 150 + : PluginClientWindow(client, 280, 190, 280, 190, 0) //195 was 150 { this->client = client; } @@ -45,9 +45,15 @@ SharpenWindow::~SharpenWindow() void SharpenWindow::create_objects() { int x = 10, y = 10; + int x1 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; + add_tool(new BC_Title(x, y, _("Sharpness"))); y += 20; add_tool(sharpen_slider = new SharpenSlider(client, &(client->config.sharpness), x, y)); + x1 = x + sharpen_slider->get_w() + 10; + add_subwindow(sharpen_sliderClr = new SharpenSliderClr(client, this, x1, y, clrBtn_w)); + y += 30; add_tool(sharpen_interlace = new SharpenInterlace(client, x, y)); y += 30; @@ -56,16 +62,28 @@ void SharpenWindow::create_objects() add_tool(sharpen_luminance = new SharpenLuminance(client, x, y)); y += 40; add_tool(reset = new SharpenReset(client, this, x, y)); + add_subwindow(default_settings = new SharpenDefaultSettings(client, this, + (280 - 10 - defaultBtn_w), y, defaultBtn_w)); + show_window(); flush(); } -void SharpenWindow::update() +void SharpenWindow::update_gui(int clear) { - sharpen_slider->update(client->config.sharpness); - sharpen_interlace->update(client->config.interlace); - sharpen_horizontal->update(client->config.horizontal); - sharpen_luminance->update(client->config.luminance); + switch(clear) { + case RESET_SHARPEN_SLIDER : + sharpen_slider->update(client->config.sharpness); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + sharpen_slider->update(client->config.sharpness); + sharpen_interlace->update(client->config.interlace); + sharpen_horizontal->update(client->config.horizontal); + sharpen_luminance->update(client->config.luminance); + break; + } } SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y) @@ -154,8 +172,44 @@ SharpenReset::~SharpenReset() } int SharpenReset::handle_event() { - client->config.reset(); - gui->update(); + client->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); + client->send_configure_change(); + return 1; +} + + +SharpenDefaultSettings::SharpenDefaultSettings(SharpenMain *client, SharpenWindow *gui, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->client = client; + this->gui = gui; +} +SharpenDefaultSettings::~SharpenDefaultSettings() +{ +} +int SharpenDefaultSettings::handle_event() +{ + client->config.reset(RESET_DEFAULT_SETTINGS); + gui->update_gui(RESET_DEFAULT_SETTINGS); + client->send_configure_change(); + return 1; +} + + +SharpenSliderClr::SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->client = client; + this->gui = gui; +} +SharpenSliderClr::~SharpenSliderClr() +{ +} +int SharpenSliderClr::handle_event() +{ + client->config.reset(RESET_SHARPEN_SLIDER); + gui->update_gui(RESET_SHARPEN_SLIDER); client->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/sharpen/sharpenwindow.h b/cinelerra-5.1/plugins/sharpen/sharpenwindow.h index 6c5bffb9..b1e684c4 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpenwindow.h +++ b/cinelerra-5.1/plugins/sharpen/sharpenwindow.h @@ -23,23 +23,22 @@ #define SHARPENWINDOW_H #include "guicast.h" - -class SharpenWindow; -class SharpenInterlace; - #include "filexml.h" #include "mutex.h" #include "sharpen.h" +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_SHARPEN_SLIDER 1 - - - - +class SharpenWindow; +class SharpenInterlace; class SharpenSlider; class SharpenHorizontal; class SharpenLuminance; class SharpenReset; +class SharpenDefaultSettings; +class SharpenSliderClr; class SharpenWindow : public PluginClientWindow { @@ -48,7 +47,7 @@ public: ~SharpenWindow(); void create_objects(); - void update(); + void update_gui(int clear); SharpenMain *client; SharpenSlider *sharpen_slider; @@ -56,6 +55,8 @@ public: SharpenHorizontal *sharpen_horizontal; SharpenLuminance *sharpen_luminance; SharpenReset *reset; + SharpenDefaultSettings *default_settings; + SharpenSliderClr *sharpen_sliderClr; }; class SharpenSlider : public BC_ISlider @@ -109,4 +110,24 @@ public: SharpenWindow *gui; }; +class SharpenDefaultSettings : public BC_GenericButton +{ +public: + SharpenDefaultSettings(SharpenMain *client, SharpenWindow *gui, int x, int y, int w); + ~SharpenDefaultSettings(); + int handle_event(); + SharpenMain *client; + SharpenWindow *gui; +}; + +class SharpenSliderClr : public BC_GenericButton +{ +public: + SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w); + ~SharpenSliderClr(); + int handle_event(); + SharpenMain *client; + SharpenWindow *gui; +}; + #endif diff --git a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C index 853fb57f..3c8b15f3 100644 --- a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C +++ b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C @@ -35,13 +35,22 @@ PluginClient* new_plugin(PluginServer *server) ShiftInterlaceConfig::ShiftInterlaceConfig() { - reset(); + reset(RESET_ALL); } -void ShiftInterlaceConfig::reset() +void ShiftInterlaceConfig::reset(int clear) { - odd_offset = 0; - even_offset = 0; + switch(clear) { + case RESET_ODD_OFFSET : odd_offset = 0; + break; + case RESET_EVEN_OFFSET : even_offset = 0; + break; + case RESET_ALL : + default: + odd_offset = 0; + even_offset = 0; + break; + } } @@ -77,9 +86,9 @@ void ShiftInterlaceConfig::interpolate(ShiftInterlaceConfig &prev, ShiftInterlaceWindow::ShiftInterlaceWindow(ShiftInterlaceMain *plugin) : PluginClientWindow(plugin, - 310, + 370, 110, - 310, + 370, 110, 0) { @@ -91,12 +100,18 @@ void ShiftInterlaceWindow::create_objects() { int x = 10, y = 10; int margin = 30; + int x1 = 0; int clrBtn_w = 50; add_subwindow(new BC_Title(x, y, _("Odd offset:"))); add_subwindow(odd_offset = new ShiftInterlaceOdd(plugin, x + 90, y)); + x1 = x + 90 + odd_offset->get_w() + 10; + add_subwindow(odd_offsetClr = new ShiftInterlaceSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ODD_OFFSET)); + y += margin; add_subwindow(new BC_Title(x, y, _("Even offset:"))); add_subwindow(even_offset = new ShiftInterlaceEven(plugin, x + 90, y)); + add_subwindow(even_offsetClr = new ShiftInterlaceSliderClr(plugin, this, x1, y, clrBtn_w, RESET_EVEN_OFFSET)); + y += 40; add_subwindow(reset = new ShiftInterlaceReset(plugin, this, x, y)); show_window(); @@ -104,10 +119,19 @@ void ShiftInterlaceWindow::create_objects() } // for Reset button -void ShiftInterlaceWindow::update() +void ShiftInterlaceWindow::update_gui(int clear) { - odd_offset->update(plugin->config.odd_offset); - even_offset->update(plugin->config.even_offset); + switch(clear) { + case RESET_ODD_OFFSET : odd_offset->update(plugin->config.odd_offset); + break; + case RESET_EVEN_OFFSET : even_offset->update(plugin->config.even_offset); + break; + case RESET_ALL : + default: + odd_offset->update(plugin->config.odd_offset); + even_offset->update(plugin->config.even_offset); + break; + } } @@ -169,13 +193,33 @@ ShiftInterlaceReset::~ShiftInterlaceReset() } int ShiftInterlaceReset::handle_event() { - plugin->config.reset(); - gui->update(); + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +ShiftInterlaceSliderClr::ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +ShiftInterlaceSliderClr::~ShiftInterlaceSliderClr() +{ +} +int ShiftInterlaceSliderClr::handle_event() +{ + // clear==1 ==> Odd slider + // clear==2 ==> Even slider + plugin->config.reset(clear); + gui->update_gui(clear); + plugin->send_configure_change(); + return 1; +} + diff --git a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h index d4618a07..4bba77e2 100644 --- a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h +++ b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h @@ -37,9 +37,9 @@ #include - - - +#define RESET_ALL 0 +#define RESET_ODD_OFFSET 1 +#define RESET_EVEN_OFFSET 2 class ShiftInterlaceWindow; @@ -50,7 +50,7 @@ class ShiftInterlaceConfig public: ShiftInterlaceConfig(); - void reset(); + void reset(int clear); int equivalent(ShiftInterlaceConfig &that); void copy_from(ShiftInterlaceConfig &that); void interpolate(ShiftInterlaceConfig &prev, @@ -91,18 +91,30 @@ public: ShiftInterlaceWindow *gui; }; +class ShiftInterlaceSliderClr : public BC_GenericButton +{ +public: + ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y, int w, int clear); + ~ShiftInterlaceSliderClr(); + int handle_event(); + ShiftInterlaceMain *plugin; + ShiftInterlaceWindow *gui; + int clear; +}; + class ShiftInterlaceWindow : public PluginClientWindow { public: ShiftInterlaceWindow(ShiftInterlaceMain *plugin); void create_objects(); - void update(); + void update_gui(int clear); ShiftInterlaceOdd *odd_offset; ShiftInterlaceEven *even_offset; ShiftInterlaceMain *plugin; ShiftInterlaceReset *reset; + ShiftInterlaceSliderClr *odd_offsetClr, *even_offsetClr; }; diff --git a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C index 77ed39ea..df4d6d59 100644 --- a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C +++ b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C @@ -79,7 +79,7 @@ int SketcherCurvePenItem::handle_event() } SketcherCurvePen::SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen) - : BC_PopupMenu(x,y,72,_(cv_pen[pen])) + : BC_PopupMenu(x,y,100,_(cv_pen[pen])) { this->gui = gui; this->pen = pen; @@ -435,7 +435,7 @@ void SketcherWindow::create_objects() "Shift=\n" "None=\n" "Ctrl=\n" - "Alt=\n" + "Ctrl+Alt=\n" "Ctrl+Shift="))); dy = bmax(dy, notes0->get_h()); add_subwindow(notes1 = new BC_Title(x+100, y, _(" LMB\n" @@ -611,7 +611,7 @@ int SketcherWindow::grab_button_press(XEvent *event) point_list->update(pi); break; } - if( (state & AltMask) ) { // create new curve + if( (state & ControlMask) && (state & AltMask) ) { // create new curve ci = plugin->new_curve(cv->pen, cv->width, curve_color->color); curve_list->update(ci); point_list->update(-1); @@ -666,7 +666,7 @@ int SketcherWindow::grab_cursor_motion() return 1; } if( (state & Button1Mask) ) { - if( (state & ControlMask) ) { // drag selected point + if( (state & ControlMask) && !(state & AltMask) ) { // drag selected point SketcherPoint *pt = pi >= 0 && pi < points.size() ? points[pi] : 0; if( pt ) { point_list->set_point(pi, PT_X, pt->x = output_x); @@ -677,7 +677,7 @@ int SketcherWindow::grab_cursor_motion() } return 1; } - if( (state & AltMask) ) { // drag all curves + if( (state & ControlMask) && (state & AltMask) ) { // drag all curves int dx = round(output_x - last_x); int dy = round(output_y - last_y); for( int i=0; igui = gui; this->type = arc; diff --git a/cinelerra-5.1/plugins/unsharp/unsharp.C b/cinelerra-5.1/plugins/unsharp/unsharp.C index bea4b6cf..a5133c39 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharp.C +++ b/cinelerra-5.1/plugins/unsharp/unsharp.C @@ -39,14 +39,30 @@ REGISTER_PLUGIN(UnsharpMain) UnsharpConfig::UnsharpConfig() { - reset(); + reset(RESET_DEFAULT_SETTINGS); } -void UnsharpConfig::reset() +void UnsharpConfig::reset(int clear) { - radius = 5; - amount = 0.5; - threshold = 0; + switch(clear) { + case RESET_ALL : + radius = 0.1; + amount = 0.0; + threshold = 0; + break; + case RESET_RADIUS : radius = 0.1; + break; + case RESET_AMOUNT : amount = 0.0; + break; + case RESET_THRESHOLD : threshold = 0; + break; + case RESET_DEFAULT_SETTINGS : + default: + radius = 5; + amount = 0.5; + threshold = 0; + break; + } } int UnsharpConfig::equivalent(UnsharpConfig &that) @@ -124,7 +140,7 @@ void UnsharpMain::update_gui() if(load_configuration()) { thread->window->lock_window("UnsharpMain::update_gui"); - ((UnsharpWindow*)thread->window)->update(); + ((UnsharpWindow*)thread->window)->update_gui(RESET_DEFAULT_SETTINGS); thread->window->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/unsharp/unsharp.h b/cinelerra-5.1/plugins/unsharp/unsharp.h index 786dd42d..e6e40ba5 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharp.h +++ b/cinelerra-5.1/plugins/unsharp/unsharp.h @@ -41,7 +41,7 @@ class UnsharpConfig { public: UnsharpConfig(); - void reset(); + void reset(int clear); int equivalent(UnsharpConfig &that); void copy_from(UnsharpConfig &that); diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C index 8839464a..270131dd 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C @@ -46,32 +46,52 @@ UnsharpWindow::~UnsharpWindow() void UnsharpWindow::create_objects() { int x = 10, y = 10, x1 = 90; + int x2 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; BC_Title *title; add_subwindow(title = new BC_Title(x, y + 10, _("Radius:"))); add_subwindow(radius = new UnsharpRadius(plugin, x + x1, y)); + x2 = 285 - 10 - clrBtn_w; + add_subwindow(radiusClr = new UnsharpSliderClr(plugin, this, x2, y + 10, clrBtn_w, RESET_RADIUS)); y += 40; add_subwindow(title = new BC_Title(x, y + 10, _("Amount:"))); add_subwindow(amount = new UnsharpAmount(plugin, x + x1, y)); + add_subwindow(amountClr = new UnsharpSliderClr(plugin, this, x2, y + 10, clrBtn_w, RESET_AMOUNT)); y += 40; add_subwindow(title = new BC_Title(x, y + 10, _("Threshold:"))); add_subwindow(threshold = new UnsharpThreshold(plugin, x + x1, y)); + add_subwindow(thresholdClr = new UnsharpSliderClr(plugin, this, x2, y + 10, clrBtn_w, RESET_THRESHOLD)); y += 50; add_subwindow(reset = new UnsharpReset(plugin, this, x, y)); + add_subwindow(default_settings = new UnsharpDefaultSettings(plugin, this, + (285 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); } -void UnsharpWindow::update() +void UnsharpWindow::update_gui(int clear) { - radius->update(plugin->config.radius); - amount->update(plugin->config.amount); - threshold->update(plugin->config.threshold); + switch(clear) { + case RESET_RADIUS : radius->update(plugin->config.radius); + break; + case RESET_AMOUNT : amount->update(plugin->config.amount); + break; + case RESET_THRESHOLD : threshold->update(plugin->config.threshold); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + radius->update(plugin->config.radius); + amount->update(plugin->config.amount); + threshold->update(plugin->config.threshold); + break; + } } @@ -130,10 +150,46 @@ UnsharpReset::~UnsharpReset() } int UnsharpReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +UnsharpDefaultSettings::UnsharpDefaultSettings(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->window = window; +} +UnsharpDefaultSettings::~UnsharpDefaultSettings() +{ +} +int UnsharpDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + window->update_gui(RESET_DEFAULT_SETTINGS); + plugin->send_configure_change(); + return 1; +} +UnsharpSliderClr::UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +UnsharpSliderClr::~UnsharpSliderClr() +{ +} +int UnsharpSliderClr::handle_event() +{ + // clear==1 ==> Radius slider + // clear==2 ==> Amount slider + // clear==3 ==> Threshold slider + plugin->config.reset(clear); + window->update_gui(clear); + plugin->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h index 3e3c7b70..b04f6239 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h @@ -26,6 +26,13 @@ #include "unsharp.inc" #include "unsharpwindow.inc" +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_RADIUS 1 +#define RESET_AMOUNT 2 +#define RESET_THRESHOLD 3 + + class UnsharpRadius : public BC_FPot { public: @@ -60,6 +67,27 @@ public: UnsharpWindow *window; }; +class UnsharpDefaultSettings : public BC_GenericButton +{ +public: + UnsharpDefaultSettings(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w); + ~UnsharpDefaultSettings(); + int handle_event(); + UnsharpMain *plugin; + UnsharpWindow *window; +}; + +class UnsharpSliderClr : public BC_GenericButton +{ +public: + UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear); + ~UnsharpSliderClr(); + int handle_event(); + UnsharpMain *plugin; + UnsharpWindow *window; + int clear; +}; + class UnsharpWindow : public PluginClientWindow { public: @@ -67,13 +95,17 @@ public: ~UnsharpWindow(); void create_objects(); - void update(); + void update_gui(int clear); UnsharpRadius *radius; UnsharpAmount *amount; UnsharpThreshold *threshold; UnsharpMain *plugin; UnsharpReset *reset; + UnsharpDefaultSettings *default_settings; + UnsharpSliderClr *radiusClr; + UnsharpSliderClr *amountClr; + UnsharpSliderClr *thresholdClr; }; diff --git a/cinelerra-5.1/plugins/wave/wave.C b/cinelerra-5.1/plugins/wave/wave.C index 99e6dc43..8a80c687 100644 --- a/cinelerra-5.1/plugins/wave/wave.C +++ b/cinelerra-5.1/plugins/wave/wave.C @@ -30,17 +30,35 @@ WaveConfig::WaveConfig() { - reset(); + reset(RESET_ALL); } -void WaveConfig::reset() +void WaveConfig::reset(int clear) { - mode = SMEAR; - reflective = 0; - amplitude = 10; - phase = 0; - wavelength = 10; + switch(clear) { + case RESET_ALL : + mode = SMEAR; + reflective = 0; + amplitude = 0; + phase = 0; + wavelength = 0; + break; + case RESET_AMPLITUDE : amplitude = 0; + break; + case RESET_PHASE : phase = 0; + break; + case RESET_WAVELENGTH : wavelength = 0; + break; + case RESET_DEFAULT_SETTINGS : + default: + mode = SMEAR; + reflective = 0; + amplitude = 10; + phase = 0; + wavelength = 10; + break; + } } void WaveConfig::copy_from(WaveConfig &src) @@ -204,20 +222,55 @@ WaveReset::~WaveReset() } int WaveReset::handle_event() { - plugin->config.reset(); - gui->update(); + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +WaveDefaultSettings::WaveDefaultSettings(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->gui = gui; +} +WaveDefaultSettings::~WaveDefaultSettings() +{ +} +int WaveDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + gui->update_gui(RESET_DEFAULT_SETTINGS); + plugin->send_configure_change(); + return 1; +} - +WaveSliderClr::WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->gui = gui; + this->clear = clear; +} +WaveSliderClr::~WaveSliderClr() +{ +} +int WaveSliderClr::handle_event() +{ + // clear==1 ==> Amplitude slider + // clear==2 ==> Phase slider + // clear==3 ==> Steps slider + plugin->config.reset(clear); + gui->update_gui(clear); + plugin->send_configure_change(); + return 1; +} WaveWindow::WaveWindow(WaveEffect *plugin) - : PluginClientWindow(plugin, 335, 140, 335, 140, 0) + : PluginClientWindow(plugin, 385, 140, 385, 140, 0) { this->plugin = plugin; } @@ -229,6 +282,8 @@ WaveWindow::~WaveWindow() void WaveWindow::create_objects() { int x = 10, y = 10, x1 = 115; + int x2 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; // add_subwindow(new BC_Title(x, y, _("Mode:"))); // add_subwindow(smear = new WaveSmear(plugin, this, x1, y)); @@ -239,14 +294,23 @@ void WaveWindow::create_objects() // y += 30; add_subwindow(new BC_Title(x, y, _("Amplitude:"))); add_subwindow(amplitude = new WaveAmplitude(plugin, x1, y)); + x2 = x1 + amplitude->get_w() + 10; + add_subwindow(amplitudeClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_AMPLITUDE)); + y += 30; add_subwindow(new BC_Title(x, y, _("Phase:"))); add_subwindow(phase = new WavePhase(plugin, x1, y)); + add_subwindow(phaseClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_PHASE)); + y += 30; add_subwindow(new BC_Title(x, y, _("Wavelength:"))); add_subwindow(wavelength = new WaveLength(plugin, x1, y)); + add_subwindow(wavelengthClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_WAVELENGTH)); + y += 40; add_subwindow(reset = new WaveReset(plugin, this, x, y)); + add_subwindow(default_settings = new WaveDefaultSettings(plugin, this, + (385 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -259,11 +323,23 @@ void WaveWindow::update_mode() } // for Reset button -void WaveWindow::update() +void WaveWindow::update_gui(int clear) { - amplitude->update(plugin->config.amplitude); - phase->update(plugin->config.phase); - wavelength->update(plugin->config.wavelength); + switch(clear) { + case RESET_AMPLITUDE : amplitude->update(plugin->config.amplitude); + break; + case RESET_PHASE : phase->update(plugin->config.phase); + break; + case RESET_WAVELENGTH : wavelength->update(plugin->config.wavelength); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + amplitude->update(plugin->config.amplitude); + phase->update(plugin->config.phase); + wavelength->update(plugin->config.wavelength); + break; + } } diff --git a/cinelerra-5.1/plugins/wave/wave.h b/cinelerra-5.1/plugins/wave/wave.h index 99d11d34..2c206a2c 100644 --- a/cinelerra-5.1/plugins/wave/wave.h +++ b/cinelerra-5.1/plugins/wave/wave.h @@ -44,18 +44,24 @@ #define SMEAR 0 #define BLACKEN 1 - +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_AMPLITUDE 1 +#define RESET_PHASE 2 +#define RESET_WAVELENGTH 3 class WaveEffect; class WaveWindow; class WaveReset; +class WaveDefaultSettings; +class WaveSliderClr; class WaveConfig { public: WaveConfig(); - void reset(); + void reset(int clear); void copy_from(WaveConfig &src); int equivalent(WaveConfig &src); void interpolate(WaveConfig &prev, @@ -131,7 +137,26 @@ public: WaveWindow *gui; }; +class WaveDefaultSettings : public BC_GenericButton +{ +public: + WaveDefaultSettings(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w); + ~WaveDefaultSettings(); + int handle_event(); + WaveEffect *plugin; + WaveWindow *gui; +}; +class WaveSliderClr : public BC_GenericButton +{ +public: + WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear); + ~WaveSliderClr(); + int handle_event(); + WaveEffect *plugin; + WaveWindow *gui; + int clear; +}; @@ -144,7 +169,7 @@ public: ~WaveWindow(); void create_objects(); void update_mode(); - void update(); + void update_gui(int clear); WaveEffect *plugin; // WaveSmear *smear; @@ -154,6 +179,10 @@ public: WavePhase *phase; WaveLength *wavelength; WaveReset *reset; + WaveDefaultSettings *default_settings; + WaveSliderClr *amplitudeClr; + WaveSliderClr *phaseClr; + WaveSliderClr *wavelengthClr; }; diff --git a/cinelerra-5.1/plugins/whirl/whirl.C b/cinelerra-5.1/plugins/whirl/whirl.C index 01d5ee04..ff8eb44c 100644 --- a/cinelerra-5.1/plugins/whirl/whirl.C +++ b/cinelerra-5.1/plugins/whirl/whirl.C @@ -39,20 +39,24 @@ class WhirlEffect; class WhirlWindow; class WhirlEngine; class WhirlReset; +class WhirlDefaultSettings; +class WhirlSliderClr; #define MAXRADIUS 100 #define MAXPINCH 100 - - - +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_RADIUS 1 +#define RESET_PINCH 2 +#define RESET_ANGLE 3 class WhirlConfig { public: WhirlConfig(); - void reset(); + void reset(int clear); void copy_from(WhirlConfig &src); int equivalent(WhirlConfig &src); @@ -107,18 +111,42 @@ public: WhirlWindow *window; }; +class WhirlDefaultSettings : public BC_GenericButton +{ +public: + WhirlDefaultSettings(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w); + ~WhirlDefaultSettings(); + int handle_event(); + WhirlEffect *plugin; + WhirlWindow *window; +}; + +class WhirlSliderClr : public BC_GenericButton +{ +public: + WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear); + ~WhirlSliderClr(); + int handle_event(); + WhirlEffect *plugin; + WhirlWindow *window; + int clear; +}; + + class WhirlWindow : public PluginClientWindow { public: WhirlWindow(WhirlEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); WhirlEffect *plugin; WhirlRadius *radius; WhirlPinch *pinch; WhirlAngle *angle; WhirlReset *reset; + WhirlDefaultSettings *default_settings; + WhirlSliderClr *radiusClr, *pinchClr, *angleClr; }; @@ -196,14 +224,30 @@ REGISTER_PLUGIN(WhirlEffect) WhirlConfig::WhirlConfig() { - reset(); + reset(RESET_ALL); } -void WhirlConfig::reset() +void WhirlConfig::reset(int clear) { - angle = 180.0; // 0.0; - pinch = 10.0; // 0.0; - radius = 50.0; // 0.0; + switch(clear) { + case RESET_ALL : + radius = 0.0; + pinch = 0.0; + angle = 0.0; + break; + case RESET_RADIUS : radius = 0.0; + break; + case RESET_PINCH : pinch = 0.0; + break; + case RESET_ANGLE : angle = 0.0; + break; + case RESET_DEFAULT_SETTINGS : + default: + radius = 50.0; + pinch = 10.0; + angle = 180.0; + break; + } } void WhirlConfig::copy_from(WhirlConfig &src) @@ -244,12 +288,7 @@ void WhirlConfig::interpolate(WhirlConfig &prev, WhirlWindow::WhirlWindow(WhirlEffect *plugin) - : PluginClientWindow(plugin, - 220, - 195, - 220, - 195, - 0) + : PluginClientWindow(plugin, 280, 195, 280, 195, 0) { this->plugin = plugin; } @@ -259,19 +298,31 @@ WhirlWindow::WhirlWindow(WhirlEffect *plugin) void WhirlWindow::create_objects() { int x = 10, y = 10; + int x1 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; + add_subwindow(new BC_Title(x, y, _("Radius"))); y += 20; add_subwindow(radius = new WhirlRadius(plugin, x, y)); + x1 = x + radius->get_w() + 10; + add_subwindow(radiusClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); + y += 30; add_subwindow(new BC_Title(x, y, _("Pinch"))); y += 20; add_subwindow(pinch = new WhirlPinch(plugin, x, y)); + add_subwindow(pinchClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_PINCH)); + y += 30; add_subwindow(new BC_Title(x, y, _("Angle"))); y += 20; add_subwindow(angle = new WhirlAngle(plugin, x, y)); + add_subwindow(angleClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); + y += 35; add_subwindow(reset = new WhirlReset(plugin, this, x, y)); + add_subwindow(default_settings = new WhirlDefaultSettings(plugin, this, + (280 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -279,11 +330,23 @@ void WhirlWindow::create_objects() // for Reset button -void WhirlWindow::update() +void WhirlWindow::update_gui(int clear) { - radius->update(plugin->config.radius); - pinch->update(plugin->config.pinch); - angle->update(plugin->config.angle); + switch(clear) { + case RESET_RADIUS : radius->update(plugin->config.radius); + break; + case RESET_PINCH : pinch->update(plugin->config.pinch); + break; + case RESET_ANGLE : angle->update(plugin->config.angle); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + radius->update(plugin->config.radius); + pinch->update(plugin->config.pinch); + angle->update(plugin->config.angle); + break; + } } @@ -372,15 +435,49 @@ WhirlReset::~WhirlReset() } int WhirlReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); plugin->send_configure_change(); return 1; } +WhirlDefaultSettings::WhirlDefaultSettings(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->window = window; +} +WhirlDefaultSettings::~WhirlDefaultSettings() +{ +} +int WhirlDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + window->update_gui(RESET_DEFAULT_SETTINGS); + plugin->send_configure_change(); + return 1; +} - - +WhirlSliderClr::WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +WhirlSliderClr::~WhirlSliderClr() +{ +} +int WhirlSliderClr::handle_event() +{ + // clear==1 ==> Radius slider + // clear==2 ==> Pinch slider + // clear==3 ==> Angle slider + plugin->config.reset(clear); + window->update_gui(clear); + plugin->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/yuv/yuv.C b/cinelerra-5.1/plugins/yuv/yuv.C index 75139b9d..845ca48a 100644 --- a/cinelerra-5.1/plugins/yuv/yuv.C +++ b/cinelerra-5.1/plugins/yuv/yuv.C @@ -32,17 +32,22 @@ #include #include +#define RESET_ALL 0 +#define RESET_Y_SLIDER 1 +#define RESET_U_SLIDER 2 +#define RESET_V_SLIDER 3 class YUVEffect; class YUVWindow; class YUVReset; +class YUVSliderClr; class YUVConfig { public: YUVConfig(); - void reset(); + void reset(int clear); void copy_from(YUVConfig &src); int equivalent(YUVConfig &src); @@ -74,15 +79,27 @@ public: YUVWindow *window; }; +class YUVSliderClr : public BC_GenericButton +{ +public: + YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear); + ~YUVSliderClr(); + int handle_event(); + YUVEffect *plugin; + YUVWindow *window; + int clear; +}; + class YUVWindow : public PluginClientWindow { public: YUVWindow(YUVEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); YUVLevel *y, *u, *v; YUVEffect *plugin; YUVReset *reset; + YUVSliderClr *yClr, *uClr, *vClr; }; @@ -116,14 +133,23 @@ REGISTER_PLUGIN(YUVEffect) YUVConfig::YUVConfig() { - reset(); + reset(RESET_ALL); } -void YUVConfig::reset() +void YUVConfig::reset(int clear) { - y = 0; - u = 0; - v = 0; + switch(clear) { + case RESET_Y_SLIDER : y = 0; + break; + case RESET_U_SLIDER : u = 0; + break; + case RESET_V_SLIDER : v = 0; + break; + case RESET_ALL : + default: + y = u = v = 0; + break; + } } void YUVConfig::copy_from(YUVConfig &src) @@ -192,20 +218,37 @@ YUVReset::~YUVReset() } int YUVReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +YUVSliderClr::YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +YUVSliderClr::~YUVSliderClr() +{ +} +int YUVSliderClr::handle_event() +{ + // clear==1 ==> Y slider + // clear==2 ==> U slider + // clear==3 ==> V slider + plugin->config.reset(clear); + window->update_gui(clear); plugin->send_configure_change(); return 1; } YUVWindow::YUVWindow(YUVEffect *plugin) - : PluginClientWindow(plugin, - 260, - 135, - 260, - 135, - 0) + : PluginClientWindow(plugin, 310, 135, 310, 135, 0) { this->plugin = plugin; } @@ -213,14 +256,23 @@ YUVWindow::YUVWindow(YUVEffect *plugin) void YUVWindow::create_objects() { int x = 10, y = 10, x1 = 40; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("Y:"))); add_subwindow(this->y = new YUVLevel(plugin, &plugin->config.y, x1, y)); + x2 = x1 + this->y->get_w() + 10; + add_subwindow(yClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_SLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("U:"))); add_subwindow(u = new YUVLevel(plugin, &plugin->config.u, x1, y)); + add_subwindow(uClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_SLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("V:"))); add_subwindow(v = new YUVLevel(plugin, &plugin->config.v, x1, y)); + add_subwindow(vClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_SLIDER)); + y += 35; add_subwindow(reset = new YUVReset(plugin, this, x, y)); @@ -230,11 +282,22 @@ void YUVWindow::create_objects() // for Reset button -void YUVWindow::update() +void YUVWindow::update_gui(int clear) { - this->y->update(plugin->config.y); - u->update(plugin->config.u); - v->update(plugin->config.v); + switch(clear) { + case RESET_Y_SLIDER : this->y->update(plugin->config.y); + break; + case RESET_U_SLIDER : u->update(plugin->config.u); + break; + case RESET_V_SLIDER : v->update(plugin->config.v); + break; + case RESET_ALL : + default: + this->y->update(plugin->config.y); + u->update(plugin->config.u); + v->update(plugin->config.v); + break; + } } diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.C b/cinelerra-5.1/plugins/yuvshift/yuvshift.C index 3f68a6c8..6f5aad0b 100644 --- a/cinelerra-5.1/plugins/yuvshift/yuvshift.C +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.C @@ -32,14 +32,31 @@ REGISTER_PLUGIN(YUVShiftEffect) YUVShiftConfig::YUVShiftConfig() { - reset(); + reset(RESET_ALL); } -void YUVShiftConfig::reset() +void YUVShiftConfig::reset(int clear) { - y_dx = y_dy = 0; - u_dx = u_dy = 0; - v_dx = v_dy = 0; + switch(clear) { + case RESET_Y_DX : y_dx = 0; + break; + case RESET_Y_DY : y_dy = 0; + break; + case RESET_U_DX : u_dx = 0; + break; + case RESET_U_DY : u_dy = 0; + break; + case RESET_V_DX : v_dx = 0; + break; + case RESET_V_DY : v_dy = 0; + break; + case RESET_ALL : + default: + y_dx = y_dy = 0; + u_dx = u_dy = 0; + v_dx = v_dy = 0; + break; + } } void YUVShiftConfig::copy_from(YUVShiftConfig &src) @@ -105,15 +122,37 @@ YUVShiftReset::~YUVShiftReset() } int YUVShiftReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +YUVShiftSliderClr::YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +YUVShiftSliderClr::~YUVShiftSliderClr() +{ +} +int YUVShiftSliderClr::handle_event() +{ + // clear==1 ==> y_dx slider --- clear==2 ==> y_dy slider + // clear==3 ==> u_dx slider --- clear==4 ==> u_dy slider + // clear==5 ==> v_dx slider --- clear==6 ==> v_dy slider + plugin->config.reset(clear); + window->update_gui(clear); plugin->send_configure_change(); return 1; } YUVShiftWindow::YUVShiftWindow(YUVShiftEffect *plugin) - : PluginClientWindow(plugin, 300, 230, 300, 230, 0) + : PluginClientWindow(plugin, 320, 230, 320, 230, 0) { this->plugin = plugin; } @@ -121,23 +160,37 @@ YUVShiftWindow::YUVShiftWindow(YUVShiftEffect *plugin) void YUVShiftWindow::create_objects() { int x = 10, y = 10, x1 = 50; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("Y_dx:"))); add_subwindow(y_dx = new YUVShiftLevel(plugin, &plugin->config.y_dx, x1, y)); + x2 = x1 + y_dx->get_w() + 10; + add_subwindow(y_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("Y_dy:"))); add_subwindow(y_dy = new YUVShiftLevel(plugin, &plugin->config.y_dy, x1, y)); + add_subwindow(y_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("U_dx:"))); add_subwindow(u_dx = new YUVShiftLevel(plugin, &plugin->config.u_dx, x1, y)); + add_subwindow(u_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("U_dy:"))); add_subwindow(u_dy = new YUVShiftLevel(plugin, &plugin->config.u_dy, x1, y)); + add_subwindow(u_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("V_dx:"))); add_subwindow(v_dx = new YUVShiftLevel(plugin, &plugin->config.v_dx, x1, y)); + add_subwindow(v_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("V_dy:"))); add_subwindow(v_dy = new YUVShiftLevel(plugin, &plugin->config.v_dy, x1, y)); + add_subwindow(v_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_DY)); y += 40; add_subwindow(reset = new YUVShiftReset(plugin, this, x, y)); @@ -148,14 +201,31 @@ void YUVShiftWindow::create_objects() // for Reset button -void YUVShiftWindow::update() +void YUVShiftWindow::update_gui(int clear) { - y_dx->update(plugin->config.y_dx); - y_dy->update(plugin->config.y_dy); - u_dx->update(plugin->config.u_dx); - u_dy->update(plugin->config.u_dy); - v_dx->update(plugin->config.v_dx); - v_dy->update(plugin->config.v_dy); + switch(clear) { + case RESET_Y_DX : y_dx->update(plugin->config.y_dx); + break; + case RESET_Y_DY : y_dy->update(plugin->config.y_dy); + break; + case RESET_U_DX : u_dx->update(plugin->config.u_dx); + break; + case RESET_U_DY : u_dy->update(plugin->config.u_dy); + break; + case RESET_V_DX : v_dx->update(plugin->config.v_dx); + break; + case RESET_V_DY : v_dy->update(plugin->config.v_dy); + break; + case RESET_ALL : + default: + y_dx->update(plugin->config.y_dx); + y_dy->update(plugin->config.y_dy); + u_dx->update(plugin->config.u_dx); + u_dy->update(plugin->config.u_dy); + v_dx->update(plugin->config.v_dx); + v_dy->update(plugin->config.v_dy); + break; + } } diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.h b/cinelerra-5.1/plugins/yuvshift/yuvshift.h index c943f5b7..1c2a2c10 100644 --- a/cinelerra-5.1/plugins/yuvshift/yuvshift.h +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.h @@ -35,10 +35,18 @@ #include #include +#define RESET_ALL 0 +#define RESET_Y_DX 1 +#define RESET_Y_DY 2 +#define RESET_U_DX 3 +#define RESET_U_DY 4 +#define RESET_V_DX 5 +#define RESET_V_DY 6 class YUVShiftEffect; class YUVShiftWindow; class YUVShiftReset; +class YUVShiftSliderClr; class YUVShiftConfig @@ -46,7 +54,7 @@ class YUVShiftConfig public: YUVShiftConfig(); - void reset(); + void reset(int clear); void copy_from(YUVShiftConfig &src); int equivalent(YUVShiftConfig &src); void interpolate(YUVShiftConfig &prev, @@ -77,15 +85,29 @@ public: YUVShiftWindow *window; }; +class YUVShiftSliderClr : public BC_GenericButton +{ +public: + YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear); + ~YUVShiftSliderClr(); + int handle_event(); + YUVShiftEffect *plugin; + YUVShiftWindow *window; + int clear; +}; + class YUVShiftWindow : public PluginClientWindow { public: YUVShiftWindow(YUVShiftEffect *plugin); void create_objects(); - void update(); + void update_gui(int clear); YUVShiftLevel *y_dx, *y_dy, *u_dx, *u_dy, *v_dx, *v_dy; YUVShiftEffect *plugin; YUVShiftReset *reset; + YUVShiftSliderClr *y_dxClr, *y_dyClr; + YUVShiftSliderClr *u_dxClr, *u_dyClr; + YUVShiftSliderClr *v_dxClr, *v_dyClr; }; diff --git a/cinelerra-5.1/plugins/zoomblur/zoomblur.C b/cinelerra-5.1/plugins/zoomblur/zoomblur.C index ad67e540..9637d79e 100644 --- a/cinelerra-5.1/plugins/zoomblur/zoomblur.C +++ b/cinelerra-5.1/plugins/zoomblur/zoomblur.C @@ -30,19 +30,42 @@ REGISTER_PLUGIN(ZoomBlurMain) ZoomBlurConfig::ZoomBlurConfig() { - reset(); -} - -void ZoomBlurConfig::reset() -{ - x = 50; - y = 50; - radius = 10; - steps = 10; - r = 1; - g = 1; - b = 1; - a = 1; + reset(RESET_DEFAULT_SETTINGS); +} + +void ZoomBlurConfig::reset(int clear) +{ + switch(clear) { + case RESET_ALL : + x = 50; + y = 50; + radius = 0; + steps = 1; + r = 1; + g = 1; + b = 1; + a = 1; + break; + case RESET_XSLIDER : x = 50; + break; + case RESET_YSLIDER : y = 50; + break; + case RESET_RADIUS : radius = 0; + break; + case RESET_STEPS : steps = 1; + break; + case RESET_DEFAULT_SETTINGS : + default: + x = 50; + y = 50; + radius = 10; + steps = 10; + r = 1; + g = 1; + b = 1; + a = 1; + break; + } } int ZoomBlurConfig::equivalent(ZoomBlurConfig &that) @@ -101,9 +124,9 @@ void ZoomBlurConfig::interpolate(ZoomBlurConfig &prev, ZoomBlurWindow::ZoomBlurWindow(ZoomBlurMain *plugin) : PluginClientWindow(plugin, - 230, + 280, 370, - 230, + 280, 370, 0) { @@ -117,22 +140,33 @@ ZoomBlurWindow::~ZoomBlurWindow() void ZoomBlurWindow::create_objects() { int x = 10, y = 10; + int x1 = 0; int clrBtn_w = 50; + int defaultBtn_w = 100; add_subwindow(new BC_Title(x, y, _("X:"))); y += 20; add_subwindow(this->x = new ZoomBlurSize(plugin, x, y, &plugin->config.x, 0, 100)); + x1 = x + this->x->get_w() + 10; + add_subwindow(xClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_XSLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("Y:"))); y += 20; add_subwindow(this->y = new ZoomBlurSize(plugin, x, y, &plugin->config.y, 0, 100)); + add_subwindow(yClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_YSLIDER)); + y += 30; add_subwindow(new BC_Title(x, y, _("Radius:"))); y += 20; add_subwindow(radius = new ZoomBlurSize(plugin, x, y, &plugin->config.radius, -100, 100)); + add_subwindow(radiusClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); + y += 30; add_subwindow(new BC_Title(x, y, _("Steps:"))); y += 20; add_subwindow(steps = new ZoomBlurSize(plugin, x, y, &plugin->config.steps, 1, 100)); + add_subwindow(stepsClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + y += 30; add_subwindow(r = new ZoomBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); y += 30; @@ -143,22 +177,38 @@ void ZoomBlurWindow::create_objects() add_subwindow(a = new ZoomBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); y += 40; add_subwindow(reset = new ZoomBlurReset(plugin, this, x, y)); + add_subwindow(default_settings = new ZoomBlurDefaultSettings(plugin, this, + (280 - 10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); } // for Reset button -void ZoomBlurWindow::update() -{ - this->x->update(plugin->config.x); - this->y->update(plugin->config.x); - radius->update(plugin->config.radius); - steps->update(plugin->config.steps); - r->update(plugin->config.r); - g->update(plugin->config.g); - b->update(plugin->config.b); - a->update(plugin->config.a); +void ZoomBlurWindow::update_gui(int clear) +{ + switch(clear) { + case RESET_XSLIDER : this->x->update(plugin->config.x); + break; + case RESET_YSLIDER : this->y->update(plugin->config.y); + break; + case RESET_RADIUS : radius->update(plugin->config.radius); + break; + case RESET_STEPS : steps->update(plugin->config.steps); + break; + case RESET_ALL : + case RESET_DEFAULT_SETTINGS : + default: + this->x->update(plugin->config.x); + this->y->update(plugin->config.x); + radius->update(plugin->config.radius); + steps->update(plugin->config.steps); + r->update(plugin->config.r); + g->update(plugin->config.g); + b->update(plugin->config.b); + a->update(plugin->config.a); + break; + } } @@ -224,13 +274,52 @@ ZoomBlurReset::~ZoomBlurReset() } int ZoomBlurReset::handle_event() { - plugin->config.reset(); - window->update(); + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +ZoomBlurDefaultSettings::ZoomBlurDefaultSettings(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w) + : BC_GenericButton(x, y, w, _("Default")) +{ + this->plugin = plugin; + this->window = window; +} +ZoomBlurDefaultSettings::~ZoomBlurDefaultSettings() +{ +} +int ZoomBlurDefaultSettings::handle_event() +{ + plugin->config.reset(RESET_DEFAULT_SETTINGS); + window->update_gui(RESET_DEFAULT_SETTINGS); plugin->send_configure_change(); return 1; } +ZoomBlurSliderClr::ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear) + : BC_GenericButton(x, y, w, _("⌂")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +ZoomBlurSliderClr::~ZoomBlurSliderClr() +{ +} +int ZoomBlurSliderClr::handle_event() +{ + // clear==1 ==> X slider + // clear==2 ==> Y slider + // clear==3 ==> Radius slider + // clear==4 ==> Steps slider + plugin->config.reset(clear); + window->update_gui(clear); + plugin->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/zoomblur/zoomblur.h b/cinelerra-5.1/plugins/zoomblur/zoomblur.h index 32a00f1c..a39cde3e 100644 --- a/cinelerra-5.1/plugins/zoomblur/zoomblur.h +++ b/cinelerra-5.1/plugins/zoomblur/zoomblur.h @@ -34,13 +34,19 @@ #include "pluginvclient.h" #include "vframe.h" - +#define RESET_DEFAULT_SETTINGS 10 +#define RESET_ALL 0 +#define RESET_XSLIDER 1 +#define RESET_YSLIDER 2 +#define RESET_RADIUS 3 +#define RESET_STEPS 4 class ZoomBlurMain; class ZoomBlurWindow; class ZoomBlurEngine; class ZoomBlurReset; - +class ZoomBlurDefaultSettings; +class ZoomBlurSliderClr; @@ -49,7 +55,7 @@ class ZoomBlurConfig public: ZoomBlurConfig(); - void reset(); + void reset(int clear); int equivalent(ZoomBlurConfig &that); void copy_from(ZoomBlurConfig &that); void interpolate(ZoomBlurConfig &prev, @@ -104,12 +110,14 @@ public: ~ZoomBlurWindow(); void create_objects(); - void update(); + void update_gui(int clear); ZoomBlurSize *x, *y, *radius, *steps; ZoomBlurToggle *r, *g, *b, *a; ZoomBlurMain *plugin; ZoomBlurReset *reset; + ZoomBlurDefaultSettings *default_settings; + ZoomBlurSliderClr *xClr, *yClr, *radiusClr, *stepsClr; }; class ZoomBlurReset : public BC_GenericButton @@ -122,6 +130,27 @@ public: ZoomBlurWindow *window; }; +class ZoomBlurDefaultSettings : public BC_GenericButton +{ +public: + ZoomBlurDefaultSettings(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w); + ~ZoomBlurDefaultSettings(); + int handle_event(); + ZoomBlurMain *plugin; + ZoomBlurWindow *window; +}; + + +class ZoomBlurSliderClr : public BC_GenericButton +{ +public: + ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear); + ~ZoomBlurSliderClr(); + int handle_event(); + ZoomBlurMain *plugin; + ZoomBlurWindow *window; + int clear; +}; diff --git a/cinelerra-5.1/thirdparty/Makefile b/cinelerra-5.1/thirdparty/Makefile index 59974e86..74ce4eaf 100644 --- a/cinelerra-5.1/thirdparty/Makefile +++ b/cinelerra-5.1/thirdparty/Makefile @@ -231,7 +231,7 @@ $(1).cfg_vars+=./waf --version; find .waf* -type f -name "*.py" | \ echo 'exec ./waf configure "$(DS)@"' > ./configure; chmod +x \ ./configure; PKG_CONFIG_PATH=$(LV2_PKGCFG) LD_LIBRARY_PATH=$(LV2_LIBPATH) $(1).cfg_params+=\ - CFLAGS="-I$(call bld_path,lv2) $(foreach f,$(2), $(call inc_path,$(f))) -fPIC "\ + CFLAGS="-I$(call bld_path,lv2) $(foreach f,$(2), $(call inc_path,$(f))) -fPIC -std=c99"\ LDFLAGS="-lm $(foreach f,$(2), $(call ld_path,$(f),usr/local/lib)) " $(1).mak_vars=(echo "all:"; echo " ./waf -v build") > $(call bld_path,$(1),Makefile); $(1).mak_params+=; ( cd $(1)*; ./waf install --destdir=$(call bld_path,$(1)) )