mask ctrpt correction, on_track select fix, alt-wheel ptr focus, mask help chkbox
authorGood Guy <good1.2guy@gmail.com>
Fri, 28 Jun 2019 16:31:13 +0000 (10:31 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 28 Jun 2019 16:31:13 +0000 (10:31 -0600)
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/cwindowtool.h

index 27a065117a8590e490f5d9c7a61638fc752df715..2cfb5da53ffaa2f22a0ccee17721180b2733820e 100644 (file)
@@ -1782,6 +1782,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                                cx += point->x;  cy += point->y;
                        }
                        cx /= n;  cy /= n;
                                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;
                        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);
                        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");
        }
                }
 //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;
                                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 ) {
                                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; i<n; ++i ) {
                                                MaskPoint *point = mask_points.values[i];
                                        int n = mask_points.size();
                                        for( int i=0; i<n; ++i ) {
                                                MaskPoint *point = mask_points.values[i];
@@ -2101,6 +2102,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                                        cx /= n;  cy /= n;
                                        mask_gui->set_focused(0, cx, cy);
                                }
                                        cx /= n;  cy /= n;
                                        mask_gui->set_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.;
                                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.;
index 80122c529a5e392c1db085c2b8e1fa71a7ea5e93..8470f35487533b10bf5ee694a090a00d1b855068 100644 (file)
@@ -1499,18 +1499,25 @@ CWindowMaskOnTrack::~CWindowMaskOnTrack()
 
 int CWindowMaskOnTrack::handle_event()
 {
 
 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());
 //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);
        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);
        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;
 }
        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);
        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;
 }
        gui->update_preview(1);
        return 1;
 }
@@ -1978,6 +1986,27 @@ int CWindowMaskFocus::handle_event()
        return 1;
 }
 
        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"))
 {
 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,
 
 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;
 {
        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));
        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"
                "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")));
                "Shift+MMB: Toggle focus center at pointer")));
+       help_h = get_h();
        update();
        update();
+       resize_window(get_w(), help_y);
        unlock_window();
 }
 
        unlock_window();
 }
 
index b8b431c9f4430a84b11c090b0fd7868791f37da3..ced331bc376897462a9dbd324f753f7606f64125 100644 (file)
@@ -334,6 +334,17 @@ public:
        CWindowMaskGUI *gui;
 };
 
        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:
 class CWindowMaskDrawMarkers : public BC_CheckBox
 {
 public:
@@ -459,6 +470,8 @@ public:
        CWindowCoord *x, *y;
        CWindowMaskFocus *focus;
        int focused;
        CWindowCoord *x, *y;
        CWindowMaskFocus *focus;
        int focused;
+       CWindowMaskHelp *help;
+       int helped, help_y, help_h;
        CWindowMaskDrawMarkers *draw_markers;
        int markers;
        CWindowMaskDrawBoundary *draw_boundary;
        CWindowMaskDrawMarkers *draw_markers;
        int markers;
        CWindowMaskDrawBoundary *draw_boundary;