本文整理汇总了C++中SPDesktop::dt2doc方法的典型用法代码示例。如果您正苦于以下问题:C++ SPDesktop::dt2doc方法的具体用法?C++ SPDesktop::dt2doc怎么用?C++ SPDesktop::dt2doc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPDesktop
的用法示例。
在下文中一共展示了SPDesktop::dt2doc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sp_spray_context_root_handler
gint sp_spray_context_root_handler(SPEventContext *event_context, GdkEvent *event)
{
SPSprayContext *tc = SP_SPRAY_CONTEXT(event_context);
SPDesktop *desktop = event_context->desktop;
gint ret = FALSE;
switch (event->type) {
case GDK_ENTER_NOTIFY:
sp_canvas_item_show(tc->dilate_area);
break;
case GDK_LEAVE_NOTIFY:
sp_canvas_item_hide(tc->dilate_area);
break;
case GDK_BUTTON_PRESS:
if (event->button.button == 1 && !event_context->space_panning) {
if (Inkscape::have_viable_layer(desktop, tc->_message_context) == false) {
return TRUE;
}
Geom::Point const motion_w(event->button.x, event->button.y);
Geom::Point const motion_dt(desktop->w2d(motion_w));
tc->last_push = desktop->dt2doc(motion_dt);
sp_spray_extinput(tc, event);
desktop->canvas->forceFullRedrawAfterInterruptions(3);
tc->is_drawing = true;
tc->is_dilating = true;
tc->has_dilated = false;
if(tc->is_dilating && event->button.button == 1 && !event_context->space_panning) {
sp_spray_dilate(tc, motion_w, desktop->dt2doc(motion_dt), Geom::Point(0,0), MOD__SHIFT);
}
tc->has_dilated = true;
ret = TRUE;
}
break;
case GDK_MOTION_NOTIFY: {
Geom::Point const motion_w(event->motion.x,
event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
Geom::Point motion_doc(desktop->dt2doc(motion_dt));
sp_spray_extinput(tc, event);
// draw the dilating cursor
double radius = get_dilate_radius(tc);
Geom::Affine const sm (Geom::Scale(radius/(1-tc->ratio), radius/(1+tc->ratio)) );
sp_canvas_item_affine_absolute(tc->dilate_area, (sm*Geom::Rotate(tc->tilt))*Geom::Translate(desktop->w2d(motion_w)));
sp_canvas_item_show(tc->dilate_area);
guint num = 0;
if (!desktop->selection->isEmpty()) {
num = g_slist_length((GSList *) desktop->selection->itemList());
}
if (num == 0) {
tc->_message_context->flash(Inkscape::ERROR_MESSAGE, _("<b>Nothing selected!</b> Select objects to spray."));
}
// dilating:
if (tc->is_drawing && ( event->motion.state & GDK_BUTTON1_MASK )) {
sp_spray_dilate(tc, motion_w, motion_doc, motion_doc - tc->last_push, event->button.state & GDK_SHIFT_MASK? true : false);
//tc->last_push = motion_doc;
tc->has_dilated = true;
// it's slow, so prevent clogging up with events
gobble_motion_events(GDK_BUTTON1_MASK);
return TRUE;
}
}
break;
/*Spray with the scroll*/
case GDK_SCROLL: {
if (event->scroll.state & GDK_BUTTON1_MASK) {
double temp ;
temp = tc->population;
tc->population = 1.0;
desktop->setToolboxAdjustmentValue("population", tc->population * 100);
Geom::Point const scroll_w(event->button.x, event->button.y);
Geom::Point const scroll_dt = desktop->point();;
Geom::Point motion_doc(desktop->dt2doc(scroll_dt));
switch (event->scroll.direction) {
case GDK_SCROLL_DOWN:
case GDK_SCROLL_UP: {
if (Inkscape::have_viable_layer(desktop, tc->_message_context) == false) {
return TRUE;
}
tc->last_push = desktop->dt2doc(scroll_dt);
sp_spray_extinput(tc, event);
desktop->canvas->forceFullRedrawAfterInterruptions(3);
tc->is_drawing = true;
tc->is_dilating = true;
tc->has_dilated = false;
if(tc->is_dilating && !event_context->space_panning) {
sp_spray_dilate(tc, scroll_w, desktop->dt2doc(scroll_dt), Geom::Point(0,0), false);
}
tc->has_dilated = true;
tc->population = temp;
//.........这里部分代码省略.........