}
edit_panel->update();
+ unlock_window();
tool_panel->start_tool(value);
+ lock_window("CWindowGUI::set_operation");
canvas->refresh(0);
}
cx /= n; cy /= n;
if( !mask_gui->focused )
mask_gui->set_focused(0, cx, cy);
+ cx = (cx - half_track_w) * projector_z + projector_x;
+ cy = (cy - half_track_h) * projector_z + projector_y;
output_to_canvas(mwindow->edl, 0, cx, cy);
float r = bmax(cvs_win->get_w(), cvs_win->get_h());
float d = 0.007*r;
MaskPoints &points = sub_mask->points;
for( int i=0; i<points.size(); ++i ) {
MaskPoint *point = points[i];
- if( mode == 0 || mode == 2) point->x += dx;
- if( mode == 1 || mode == 2) point->y += dy;
+ if( mode == MASK_SCALE_X || mode == MASK_SCALE_XY ) point->x += dx;
+ if( mode == MASK_SCALE_Y || mode == MASK_SCALE_XY ) point->y += dy;
}
}
gui->x_origin = mask_cursor_x;
double ds = accel/64., dt = accel*M_PI/360.;
double scale = button_no == WHEEL_UP ? 1.+ds : 1.-ds;
int mode = mask_gui->scale_mode;
- double xscale = !rotate && (mode == 0 || mode == 2 ) ? scale : 1.;
- double yscale = !rotate && (mode == 1 || mode == 2 ) ? scale : 1.;
+ double xscale = !rotate && (mode == MASK_SCALE_X ||
+ mode == MASK_SCALE_XY ) ? scale : 1.;
+ double yscale = !rotate && (mode == MASK_SCALE_Y ||
+ mode == MASK_SCALE_XY ) ? scale : 1.;
double theta = button_no == WHEEL_UP ? dt : -dt;
if( rotate ? theta==0 : scale==1 ) break;
float st = sin(theta), ct = cos(theta);
int CWindowMaskScaleXY::handle_event()
{
gui->scale_mode = id;
- gui->mask_scale_x->update(id == 0);
- gui->mask_scale_y->update(id == 1);
- gui->mask_scale_xy->update(id == 2);
+ gui->mask_scale_x->update(id == MASK_SCALE_X);
+ gui->mask_scale_y->update(id == MASK_SCALE_Y);
+ gui->mask_scale_xy->update(id == MASK_SCALE_XY);
return 1;
}
return 1;
}
+CWindowMaskGangPoint::CWindowMaskGangPoint(MWindow *mwindow,
+ CWindowMaskGUI *gui, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->get_image_set("gangpatch_data"), 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Gang points"));
+}
+
+CWindowMaskGangPoint::~CWindowMaskGangPoint()
+{
+}
+
+int CWindowMaskGangPoint::handle_event()
+{
+ return 1;
+}
+
CWindowMaskSmoothButton::CWindowMaskSmoothButton(MWindow *mwindow, CWindowMaskGUI *gui,
const char *tip, int type, int on, int x, int y, const char *images)
add_subwindow(mask_normal = new CWindowMaskNormal(mwindow, this, t[1], y, 80));
add_subwindow(mask_scale_x = new CWindowMaskScaleXY(mwindow, this,
- t[5], y, theme->get_image_set("mask_scale_x"), 0, 0, _("xlate/scale x")));
+ t[5], y, theme->get_image_set("mask_scale_x"), 0, MASK_SCALE_X, _("xlate/scale x")));
add_subwindow(mask_scale_y = new CWindowMaskScaleXY(mwindow, this,
- t[6], y, theme->get_image_set("mask_scale_y"), 0, 1, _("xlate/scale y")));
+ t[6], y, theme->get_image_set("mask_scale_y"), 0, MASK_SCALE_Y, _("xlate/scale y")));
add_subwindow(mask_scale_xy = new CWindowMaskScaleXY(mwindow, this,
- t[7], y, theme->get_image_set("mask_scale_xy"), 1, 2, _("xlate/scale xy")));
+ t[7], y, theme->get_image_set("mask_scale_xy"), 1, MASK_SCALE_XY, _("xlate/scale xy")));
y += mask_center->get_h() + 2*margin;
add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Fade & Feather")));
y += title_bar->get_h() + 2*margin;
add_subwindow(mask_pnt_smooth = new CWindowMaskSmoothButton(mwindow, this,
_("smooth point"), 0, 1, t[4], y, "mask_pnt_smooth_images"));
add_subwindow(del_point = new CWindowMaskDelPoint(mwindow, this, del_x, y));
+ add_subwindow(gang_point = new CWindowMaskGangPoint(mwindow, this, clr_x, y));
y += active_point->get_h() + margin;
add_subwindow(title = new BC_Title(x, y, "X:"));
this->x = new CWindowCoord(this, t[0], y, (float)0.0);
void CWindowMaskGUI::handle_event()
{
+ if( event_caller != this->x &&
+ event_caller != this->y ) return;
Track *track;
MaskAuto *keyframe;
MaskAutos *autos;
mwindow->undo->update_undo_before(_("mask point"), this);
- if(point)
- {
+ if( point ) {
+ float px = atof(x->get_text());
+ float py = atof(y->get_text());
+ float dx = px - point->x, dy = py - point->y;
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Get affected point in temp keyframe
mask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
- if(mwindow->cwindow->gui->affected_point < mask->points.total &&
- mwindow->cwindow->gui->affected_point >= 0)
- {
- point = mask->points.values[mwindow->cwindow->gui->affected_point];
+#endif
+
+ MaskPoints &points = mask->points;
+ int gang = gang_point->get_value();
+ int k = mwindow->cwindow->gui->affected_point;
+ int n = gang ? points.size() : k+1;
+ for( int i=gang? 0 : k; i<n; ++i ) {
+ if( i < 0 || i >= points.size() ) continue;
+ MaskPoint *point = points[i];
+ point->x += dx; point->y += dy;
}
- if(point)
- {
- point->x = atof(x->get_text());
- point->y = atof(y->get_text());
+#ifdef USE_KEYFRAME_SPANNING
// Commit to spanned keyframes
- autos->update_parameter(&temp_keyframe);
- }
-#else
- point->x = atof(x->get_text());
- point->y = atof(y->get_text());
+ autos->update_parameter(&temp_keyframe);
#endif
}