- switch( event->type ) {
- case ButtonPress: {
- int button_no = event->xbutton.button;
- switch( button_no ) {
- case LEFT_BUTTON: {
- if( (state & ShiftMask) ) { // create new point/string
- ++new_points;
- pi = plugin->new_point(cv, PTY_LINE, output_x, output_y, pi+1);
- point_list->update(pi);
- break;
- }
- SketcherPoint *pt = 0; // select point
- double dist = cv->nearest_point(pi, output_x,output_y);
- if( dist >= 0 ) {
- pt = points[pi];
- float px = (pt->x - track_w / 2) * projector_z + projector_x;
- float py = (pt->y - track_h / 2) * projector_z + projector_y;
- float pix = DISTANCE(px, py, cursor_x,cursor_y);
- if( (state & ControlMask) && pix >= HANDLE_W ) { pi = -1; pt = 0; }
- }
- point_list->set_selected(pi);
- break; }
- case RIGHT_BUTTON: {
- if( (state & ShiftMask) ) { // create new curve point
- ++new_points;
- pi = plugin->new_point(cv, PTY_CURVE,
- output_x, output_y, pi+1);
- point_list->update(pi);
- break;
- }
- if( (state & AltMask) ) { // create new curve
- ci = plugin->new_curve(cv->pen, cv->radius, cv->color);
- curve_list->update(ci);
- point_list->update(-1);
- break;
- }
- SketcherPoint *pt = 0;
- double dist = config.nearest_point(ci, pi, output_x,output_y);
- if( dist >= 0 ) {
- pt = curves[ci]->points[pi];
- float px = (pt->x - track_w / 2) * projector_z + projector_x;
- float py = (pt->y - track_h / 2) * projector_z + projector_y;
- float pix = DISTANCE(px, py, cursor_x,cursor_y);
- if( (state & ControlMask) && pix >= HANDLE_W ) { ci = pi = -1; pt = 0; }
- }
- if( pt ) {
- curve_list->update(ci);
- point_list->update(pi);
+ case LEFT_BUTTON: {
+ if( (state & ShiftMask) ) { // create new point/string
+ ++new_points;
+ pi = plugin->new_point(cv,
+ !(state & ControlMask) ? ARC_LINE : ARC_FILL,
+ track_x, track_y, pi+1);
+ point_list->update(pi);
+ break;
+ }
+ SketcherPoint *pt = 0; // select point
+ double dist = cv->nearest_point(pi, track_x,track_y);
+ if( dist >= 0 ) {
+ pt = points[pi];
+ float cx, cy;
+ plugin->track_to_output(pt->x, pt->y, cx, cy);
+ canvas->output_to_canvas(mwindow->edl, 0, cx, cy);
+ cx += canvas->view_x; cy += canvas->view_y;
+ dist = DISTANCE(cx,cy, cursor_x,cursor_y);
+ if( (state & ControlMask) && dist >= HANDLE_W ) {
+ pi = -1; pt = 0;