index c0c91adccaaff819bb8c7154398e6dbad992402a..05e4450866eeaafa8317637b882897de97ecfc22 100644 (file)
ddc->del = NR::Point(0,0);
/* attributes */
- ddc->use_timeout = FALSE;
- ddc->timer_id = 0;
ddc->dragging = FALSE;
ddc->mass = 0.3;
ddc->vel_thin = 0.1;
ddc->flatness = 0.9;
+
+ ddc->abs_width = false;
}
static void
sp_event_context_read(ec, "flatness");
sp_event_context_read(ec, "usepressure");
sp_event_context_read(ec, "usetilt");
+ sp_event_context_read(ec, "abs_width");
ddc->is_drawing = false;
@@ -252,6 +253,8 @@ sp_dyna_draw_context_set(SPEventContext *ec, gchar const *key, gchar const *val)
ddc->usepressure = (val && strcmp(val, "0"));
} else if (!strcmp(key, "usetilt")) {
ddc->usetilt = (val && strcmp(val, "0"));
+ } else if (!strcmp(key, "abs_width")) {
+ ddc->abs_width = (val && strcmp(val, "0"));
}
//g_print("DDC: %g %g %g %g\n", ddc->mass, ddc->drag, ddc->angle, ddc->width);
width = 0.02 * dc->width;
}
- NR::Point del_left = 0.05 * (width + tremble_left) * dc->ang;
- NR::Point del_right = 0.05 * (width + tremble_right) * dc->ang;
+ double dezoomify_factor = 0.05 * 1000;
+ if (!dc->abs_width) {
+ dezoomify_factor /= SP_EVENT_CONTEXT(dc)->desktop->current_zoom();
+ }
- dc->point1[dc->npoints] = sp_dyna_draw_get_vpoint(dc, dc->cur + del_left);
- dc->point2[dc->npoints] = sp_dyna_draw_get_vpoint(dc, dc->cur - del_right);
+ NR::Point del_left = dezoomify_factor * (width + tremble_left) * dc->ang;
+ NR::Point del_right = dezoomify_factor * (width + tremble_right) * dc->ang;
- dc->del = 0.5*(del_left + del_right);
-
- dc->npoints++;
-}
-
-static gint
-sp_dyna_draw_timeout_handler(gpointer data)
-{
- SPDynaDrawContext *dc = SP_DYNA_DRAW_CONTEXT(data);
- SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop;
- SPCanvas *canvas = SP_CANVAS(sp_desktop_canvas(desktop));
+ NR::Point abs_middle = sp_dyna_draw_get_vpoint(dc, dc->cur);
- dc->dragging = TRUE;
+ dc->point1[dc->npoints] = abs_middle + del_left;
+ dc->point2[dc->npoints] = abs_middle - del_right;
- int x, y;
- gtk_widget_get_pointer(GTK_WIDGET(canvas), &x, &y);
- NR::Point p = sp_canvas_window_to_world(canvas, NR::Point(x, y));
- p = desktop->w2d(p);
- if (! sp_dyna_draw_apply(dc, p)) {
- return TRUE;
- }
-
- if ( dc->cur != dc->last ) {
- sp_dyna_draw_brush(dc);
- g_assert( dc->npoints > 0 );
- fit_and_split(dc, FALSE);
- }
+ dc->del = 0.5*(del_left + del_right);
- return TRUE;
+ dc->npoints++;
}
void
dc->npoints = 0;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
- ( dc->use_timeout
- ? ( GDK_KEY_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_PRESS_MASK )
- : ( GDK_KEY_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK ) ),
+ ( GDK_KEY_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK ),
NULL,
event->button.time);
- if ( dc->use_timeout && !dc->timer_id ) {
- dc->timer_id = gtk_timeout_add(SAMPLE_TIMEOUT, sp_dyna_draw_timeout_handler, dc);
- }
ret = TRUE;
dc->is_drawing = true;
}
break;
case GDK_MOTION_NOTIFY:
- if ( dc->is_drawing && !dc->use_timeout && ( event->motion.state & GDK_BUTTON1_MASK ) ) {
+ if ( dc->is_drawing && ( event->motion.state & GDK_BUTTON1_MASK ) ) {
dc->dragging = TRUE;
NR::Point const motion_w(event->motion.x,
case GDK_BUTTON_RELEASE:
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time);
dc->is_drawing = false;
- if ( event->button.button == 1
- && dc->use_timeout
- && dc->timer_id != 0 )
- {
- gtk_timeout_remove(dc->timer_id);
- dc->timer_id = 0;
- }
if ( dc->dragging && event->button.button == 1 ) {
dc->dragging = FALSE;
dc->width += 0.01;
if (dc->width > 1.0)
dc->width = 1.0;
- sp_ddc_update_toolbox (desktop, "altx-calligraphy", dc->width); // the same spinbutton is for alt+x
+ sp_ddc_update_toolbox (desktop, "altx-calligraphy", dc->width * 100); // the same spinbutton is for alt+x
ret = TRUE;
}
break;
dc->width -= 0.01;
if (dc->width < 0.01)
dc->width = 0.01;
- sp_ddc_update_toolbox (desktop, "altx-calligraphy", dc->width);
+ sp_ddc_update_toolbox (desktop, "altx-calligraphy", dc->width * 100);
ret = TRUE;
}
break;