From: Good Guy Date: Fri, 28 Jun 2019 16:31:13 +0000 (-0600) Subject: mask ctrpt correction, on_track select fix, alt-wheel ptr focus, mask help chkbox X-Git-Tag: 2019-08~28 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=9af81a9c7d1206521ffb3d21973a692dceded3cd;p=goodguy%2Fcinelerra.git mask ctrpt correction, on_track select fix, alt-wheel ptr focus, mask help chkbox --- diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 27a06511..2cfb5da5 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -1782,6 +1782,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, cx += point->x; cy += point->y; } cx /= n; cy /= n; + if( !mask_gui->focused ) + mask_gui->set_focused(0, cx, cy); output_to_canvas(mwindow->edl, 0, cx, cy); float r = bmax(cvs_win->get_w(), cvs_win->get_h()); float d = 0.007*r; @@ -1791,8 +1793,6 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, cvs_win->draw_line(cx,cy-d, cx, cy+d); cvs_win->set_line_width(0); cvs_win->set_color(WHITE); - if( !mask_gui->focused ) - mask_gui->set_focused(0, cx, cy); } //printf("CWindowCanvas::do_mask 1\n"); } @@ -2087,12 +2087,13 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, rotate = 1; case CWINDOW_MASK_SCALE: { if( !mask_gui || !mask_points.size() ) break; + float cx = gui->x_origin, cy = gui->y_origin; if( mask_gui->focused ) { - gui->x_origin = atof(mask_gui->focus_x->get_text()); - gui->y_origin = atof(mask_gui->focus_y->get_text()); + cx = atof(mask_gui->focus_x->get_text()); + cy = atof(mask_gui->focus_y->get_text()); } - else { - float cx = 0, cy = 0; + else if( !gui->alt_down() ) { + cx = cy = 0; int n = mask_points.size(); for( int i=0; iset_focused(0, cx, cy); } + gui->x_origin = cx; + gui->y_origin = cy; int button_no = get_buttonpress(); double scale = button_no == WHEEL_UP ? 1.02 : 0.98; double theta = button_no == WHEEL_UP ? M_PI/360. : -M_PI/360.; diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index 80122c52..8470f354 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -1499,18 +1499,25 @@ CWindowMaskOnTrack::~CWindowMaskOnTrack() int CWindowMaskOnTrack::handle_event() { - int k = get_number(); + CWindowMaskItem *track_item = 0; + int k = get_number(), track_id = -1; //printf("selected %d = %s\n", k, k<0 ? "()" : track_items[k]->get_text()); - CWindowMaskItem *track_item = k >= 0 ? (CWindowMaskItem *)track_items[k] : 0; - Track *track = track_item ? mwindow->edl->tracks->get_track_by_id(track_item->id) : 0; - int track_id = track_item && track && track->record ? track_item->id : -1; + if( k >= 0 ) { + track_item = (CWindowMaskItem *)track_items[k]; + Track *track = track_item ? mwindow->edl->tracks->get_track_by_id(track_item->id) : 0; + if( track && track->record ) track_id = track->get_id(); + } + else + track_id = mwindow->cwindow->mask_track_id; set_back_color(track_id >= 0 ? gui->get_resources()->text_background : gui->get_resources()->text_background_disarmed); - gui->mask_on_track->update(track_item ? track_item->get_text() : ""); + if( mwindow->cwindow->mask_track_id != track_id ) + gui->mask_on_track->update(track_item ? track_item->get_text() : ""); mwindow->cwindow->mask_track_id = track_id; mwindow->edl->local_session->solo_track_id = -1; gui->mask_solo_track->update(0); + gui->update(); gui->update_preview(1); return 1; } @@ -1573,6 +1580,7 @@ int CWindowMaskTrackTumbler::do_event(int dir) mwindow->cwindow->mask_track_id = track_item ? track_item->id : -1; mwindow->edl->local_session->solo_track_id = -1; gui->mask_solo_track->update(0); + gui->update(); gui->update_preview(1); return 1; } @@ -1978,6 +1986,27 @@ int CWindowMaskFocus::handle_event() return 1; } +CWindowMaskHelp::CWindowMaskHelp(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y) + : BC_CheckBox(x, y, 0, _("Help")) +{ + this->mwindow = mwindow; + this->gui = gui; + set_tooltip(_("Show help text")); +} + +CWindowMaskHelp::~CWindowMaskHelp() +{ +} + +int CWindowMaskHelp::handle_event() +{ + gui->helped = get_value(); + gui->resize_window(gui->get_w(), + gui->helped ? gui->help_h : gui->help_y); + gui->update(); + return 1; +} + CWindowMaskDrawMarkers::CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y) : BC_CheckBox(x, y, gui->markers, _("Markers")) { @@ -2390,7 +2419,7 @@ int CWindowMaskGangFeather::handle_event() CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread) : CWindowToolGUI(mwindow, thread, - _(PROGRAM_NAME ": Mask"), 420, 680) + _(PROGRAM_NAME ": Mask"), 430, 680) { this->mwindow = mwindow; this->thread = thread; @@ -2533,20 +2562,23 @@ void CWindowMaskGUI::create_objects() add_subwindow(this->apply_before_plugins = new CWindowMaskBeforePlugins(this, 10, y)); y += this->apply_before_plugins->get_h(); add_subwindow(this->disable_opengl_masking = new CWindowDisableOpenGLMasking(this, 10, y)); - y += this->disable_opengl_masking->get_h() + margin; - add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); - y += bar->get_h() + margin; - - y += margin; - add_subwindow(title = new BC_Title(x, y, _( + add_subwindow(help = new CWindowMaskHelp(mwindow, this, del_x, y)); + y += this->disable_opengl_masking->get_h() + 2*margin; + help_y = y; + add_subwindow(new BC_Bar(x, y, get_w()-2*x)); + y += bar->get_h() + 2*margin; + add_subwindow(new BC_Title(x, y, _( "Shift+LMB: move an end point\n" "Ctrl+LMB: move a control point\n" "Alt+LMB: to drag translate the mask\n" "Shift+Key Delete to delete the point\n" - "Wheel Up/Dn: rotate around pointer\n" - "Shift+Wheel Up/Dn: scale around pointer\n" + "Wheel Up/Dn: rotate around focal point\n" + "Shift+Wheel Up/Dn: scale around focal point\n" + "Alt/Shift+Wheel: rotate/scale around pointer\n" "Shift+MMB: Toggle focus center at pointer"))); + help_h = get_h(); update(); + resize_window(get_w(), help_y); unlock_window(); } diff --git a/cinelerra-5.1/cinelerra/cwindowtool.h b/cinelerra-5.1/cinelerra/cwindowtool.h index b8b431c9..ced331bc 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.h +++ b/cinelerra-5.1/cinelerra/cwindowtool.h @@ -334,6 +334,17 @@ public: CWindowMaskGUI *gui; }; +class CWindowMaskHelp : public BC_CheckBox +{ +public: + CWindowMaskHelp(MWindow *mwindow, CWindowMaskGUI *gui, + int x, int y); + ~CWindowMaskHelp(); + int handle_event(); + MWindow *mwindow; + CWindowMaskGUI *gui; +}; + class CWindowMaskDrawMarkers : public BC_CheckBox { public: @@ -459,6 +470,8 @@ public: CWindowCoord *x, *y; CWindowMaskFocus *focus; int focused; + CWindowMaskHelp *help; + int helped, help_y, help_h; CWindowMaskDrawMarkers *draw_markers; int markers; CWindowMaskDrawBoundary *draw_boundary;