summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5c0236)
raw | patch | inline | side by side (parent: f5c0236)
author | rwst <rwst@users.sourceforge.net> | |
Wed, 15 Feb 2006 19:04:29 +0000 (19:04 +0000) | ||
committer | rwst <rwst@users.sourceforge.net> | |
Wed, 15 Feb 2006 19:04:29 +0000 (19:04 +0000) |
86 files changed:
diff --git a/src/color.cpp b/src/color.cpp
index c968d334fff0002593586131fd3a33d69f26e471..77fca3b4b338140b09cad3e8696f8fe16dc07acd 100644 (file)
--- a/src/color.cpp
+++ b/src/color.cpp
static SPColorSpace const CMYK = {"CMYK"};
/**
- * Returns one of three values depending on if color is valid and if it
+ * Returns one of three values depending on if color is valid and if it
* has a valid color space. Likely redundant as soon as this is C++.
*/
SPColorSpaceClass
}
/**
- * Returns TRUE if no RGB value differs epsilon or more in both colors,
- * with CMYK aditionally comparing opacity, or if c0 or c1 is NULL.
+ * Returns TRUE if no RGB value differs epsilon or more in both colors,
+ * with CMYK aditionally comparing opacity, or if c0 or c1 is NULL.
* \note Do we want the latter?
*/
gboolean
/**
* Converts 32bit value to RGB floats and sets color.
- * \pre color != NULL
+ * \pre color != NULL
*/
void
sp_color_set_rgb_rgba32(SPColor *color, guint32 value)
hsl[0] = 0;
hsl[1] = 0;
} else {
- if (hsl[2] <= 0.5)
+ if (hsl[2] <= 0.5)
hsl[1] = delta / (max + min);
- else
+ else
hsl[1] = delta / (2 - max - min);
if (r == max) hsl[0] = (g - b) / delta;
index f3296aebfd0a3459bfcf3ff90f30d5fbdede2bfc..a004076629bb5fbb77fbebe67a0f9e1283867fb2 100644 (file)
* for both endpoints, even if only one is moving.
* o Cleanup to remove unecessary borrowed DrawContext code.
* o Allow user-placeable connection points.
- * o Deal sanely with connectors with both endpoints attached to the
+ * o Deal sanely with connectors with both endpoints attached to the
* same connection point, and drawing of connectors attaching
* overlaping shapes (currently tries to adjust connector to be
* outside both bounding boxes).
* attached to each other.
* e.g., detach connector when it is moved or transformed in
* one of the other contexts.
- * o Cope with shapes whose ids change when they have attached
+ * o Cope with shapes whose ids change when they have attached
* connectors.
* o gobble_motion_events(GDK_BUTTON1_MASK)?;
*
ec->yp = 0;
cc->red_color = 0xff00007f;
-
+
cc->newconn = NULL;
cc->newConnRef = NULL;
-
+
cc->sel_changed_connection = sigc::connection();
-
+
cc->active_shape = NULL;
cc->active_shape_repr = NULL;
cc->active_shape_layer_repr = NULL;
cc->active_conn_repr = NULL;
cc->active_handle = NULL;
-
+
cc->clickeditem = NULL;
cc->clickedhandle = NULL;
-
+
cc->connpthandle = NULL;
for (int i = 0; i < 2; ++i) {
cc->endpt_handle[i] = NULL;
cc->sel_changed_connection = cc->selection->connectChanged(
sigc::bind(sigc::ptr_fun(&cc_selection_changed),
(gpointer) cc));
-
+
/* Create red bpath */
cc->red_bpath = sp_canvas_bpath_new(SP_DT_SKETCH(ec->desktop), NULL);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cc->red_bpath), cc->red_color,
// Notice the initial selection.
cc_selection_changed(cc->selection, (gpointer) cc);
-
+
if (prefs_get_int_attribute("tools.connector", "selcue", 0) != 0) {
ec->enableSelectionCue();
}
sp_connector_context_finish(SPEventContext *ec)
{
SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(ec);
-
+
spcc_connector_finish(cc);
if (((SPEventContextClass *) parent_class)->finish) {
((SPEventContextClass *) parent_class)->finish(ec);
}
-
+
if (cc->selection) {
cc->selection = NULL;
}
sp_repr_remove_listener_by_data(cc->active_shape_repr, cc);
Inkscape::GC::release(cc->active_shape_repr);
cc->active_shape_repr = NULL;
-
+
sp_repr_remove_listener_by_data(cc->active_shape_layer_repr, cc);
Inkscape::GC::release(cc->active_shape_layer_repr);
cc->active_shape_layer_repr = NULL;
{
// TODO: this will need to change when there are more connection
// points available for each shape.
-
+
SPKnot *centerpt = cc->connpthandle;
if (cc->active_handle && (cc->active_handle == centerpt))
{
@@ -493,7 +493,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
if (Inkscape::have_viable_layer(desktop, cc->_message_context) == false) {
return TRUE;
}
-
+
NR::Point const event_w(bevent.x,
bevent.y);
connector_drag_origin_w = event_w;
@@ -508,35 +508,35 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
if ( cc->npoints == 0 ) {
/* Set start anchor */
NR::Point p;
-
+
cc_clear_active_conn(cc);
SP_EVENT_CONTEXT_DESKTOP(cc)->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new connector"));
/* Create green anchor */
p = event_dt;
-
+
// Test whether we clicked on a connection point
cc->sid = conn_pt_handle_test(cc, p);
-
+
if (!cc->sid) {
// This is the first point, so just snap it to the grid
// as there's no other points to go off.
SnapManager const m(cc->desktop->namedview);
p = m.freeSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT,
p, NULL).getPoint();
- }
+ }
spcc_connector_set_initial_point(cc, p);
-
+
}
cc->state = SP_CONNECTOR_CONTEXT_DRAGGING;
ret = TRUE;
break;
- }
+ }
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
// This is the second click of a connector creation.
-
+
spcc_connector_set_subsequent_point(cc, p);
spcc_connector_finish_segment(cc, p);
// Test whether we clicked on a connection point
@@ -600,7 +600,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
// This is movement during a connector creation.
-
+
if ( cc->npoints > 0 ) {
cc->selection->clear();
spcc_connector_set_subsequent_point(cc, p);
@@ -703,7 +703,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
}
cc->clickeditem->setHidden(false);
sp_conn_adjust_path(SP_PATH(cc->clickeditem));
- cc->clickeditem->updateRepr();
+ cc->clickeditem->updateRepr();
sp_document_done(doc);
cc_set_active_conn(cc, cc->clickeditem);
sp_document_ensure_up_to_date(doc);
/* Red */
sp_curve_reset(cc->red_curve);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL);
-
+
sp_curve_reset(cc->green_curve);
cc->npoints = 0;
}
spcc_concat_colors_and_flush(cc);
cc->npoints = 0;
-
+
if (cc->newConnRef) {
cc->newConnRef->removeFromGraph();
delete cc->newConnRef;
knot->fill [SP_KNOT_STATE_NORMAL], NULL);
gtk_object_set (GTK_OBJECT (knot->item), "stroke_color",
knot->stroke [SP_KNOT_STATE_NORMAL], NULL);
-
+
cc->active_handle = NULL;
if (knot->tip) {
}
-static gboolean
+static gboolean
endpt_handler(SPKnot *knot, GdkEvent *event, SPConnectorContext *cc)
{
g_assert( SP_IS_CONNECTOR_CONTEXT(cc) );
cc->clickedhandle = cc->active_handle;
cc_clear_active_conn(cc);
cc->state = SP_CONNECTOR_CONTEXT_REROUTING;
-
+
// Disconnect from attached shape
unsigned ind = (cc->active_handle == cc->endpt_handle[0]) ? 0 : 1;
sp_conn_end_detach(cc->clickeditem, ind);
-
+
NR::Point origin;
if (cc->clickedhandle == cc->endpt_handle[0]) {
origin = cc->endpt_handle[1]->pos;
static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
{
g_assert(item != NULL );
-
+
cc->active_shape = item;
// Remove existing active shape listeners
if (cc->active_shape_repr) {
sp_repr_remove_listener_by_data(cc->active_shape_repr, cc);
Inkscape::GC::release(cc->active_shape_repr);
-
+
sp_repr_remove_listener_by_data(cc->active_shape_layer_repr, cc);
Inkscape::GC::release(cc->active_shape_layer_repr);
}
-
+
// Listen in case the active shape changes
- cc->active_shape_repr = SP_OBJECT_REPR(item);
+ cc->active_shape_repr = SP_OBJECT_REPR(item);
if (cc->active_shape_repr) {
Inkscape::GC::anchor(cc->active_shape_repr);
sp_repr_add_listener(cc->active_shape_repr, &shape_repr_events, cc);
-
+
cc->active_shape_layer_repr = cc->active_shape_repr->parent();
Inkscape::GC::anchor(cc->active_shape_layer_repr);
sp_repr_add_listener(cc->active_shape_layer_repr, &layer_repr_events, cc);
}
-
+
// Set center connection point.
if ( cc->connpthandle == NULL ) {
SPKnot * knot = (SPKnot*)g_object_new (SP_TYPE_KNOT, 0);
"anchor", GTK_ANCHOR_CENTER,
"tip", _("<b>Connection point</b>: click or drag to create a new connector"),
NULL);
-
+
cc->connpthandle = knot;
}
-
+
NR::Rect bbox = sp_item_bbox_desktop(cc->active_shape);
NR::Point center = bbox.midpoint();
sp_knot_set_position(cc->connpthandle, ¢er, 0);
sp_knot_show(cc->connpthandle);
-
+
}
SPCurve *curve = SP_SHAPE(SP_PATH(item))->curve;
NR::Matrix i2d = sp_item_i2d_affine(item);
-
+
if (cc->active_conn == item)
{
// Just adjust handle positions.
NR::Point startpt = sp_curve_first_point(curve) * i2d;
sp_knot_set_position(cc->endpt_handle[0], &startpt, 0);
-
+
NR::Point endpt = sp_curve_last_point(curve) * i2d;
sp_knot_set_position(cc->endpt_handle[1], &endpt, 0);
-
+
return;
}
-
+
cc->active_conn = item;
// Remove existing active conn listeners
Inkscape::GC::release(cc->active_conn_repr);
cc->active_conn_repr = NULL;
}
-
+
// Listen in case the active conn changes
- cc->active_conn_repr = SP_OBJECT_REPR(item);
+ cc->active_conn_repr = SP_OBJECT_REPR(item);
if (cc->active_conn_repr) {
Inkscape::GC::anchor(cc->active_conn_repr);
sp_repr_add_listener(cc->active_conn_repr, &shape_repr_events, cc);
cc->endpt_handle[i] = knot;
}
-
+
// Remove any existing handlers
if (cc->endpt_handler_id[i]) {
g_signal_handlers_disconnect_by_func(
cc->endpt_handler_id[i] = 0;
}
- // Setup handlers for connector endpoints, this is
+ // Setup handlers for connector endpoints, this is
// is as 'after' so that cc_generic_knot_handler is
// triggered first for any endpoint.
cc->endpt_handler_id[i] = g_signal_connect_after(
G_OBJECT(cc->endpt_handle[i]->item), "event",
G_CALLBACK(endpt_handler), cc);
}
-
+
NR::Point startpt = sp_curve_first_point(curve) * i2d;
sp_knot_set_position(cc->endpt_handle[0], &startpt, 0);
-
+
NR::Point endpt = sp_curve_last_point(curve) * i2d;
sp_knot_set_position(cc->endpt_handle[1], &endpt, 0);
-
+
sp_knot_show(cc->endpt_handle[0]);
sp_knot_show(cc->endpt_handle[1]);
}
return false;
}
-
+
void cc_selection_set_avoid(bool const set_avoid)
{
SPDesktop *desktop = inkscape_active_desktop();
SPItem *item = (SPItem *) l->data;
char const *value = (set_avoid) ? "true" : NULL;
-
+
if (cc_item_is_shape(item)) {
sp_object_setAttribute(item, "inkscape:connector-avoid",
value, false);
item->avoidRef->handleSettingChange();
changes++;
}
-
+
l = l->next;
}
sp_document_done(document);
}
-
+
static void
cc_selection_changed(Inkscape::Selection *selection, gpointer data)
//SPEventContext *ec = SP_EVENT_CONTEXT(cc);
SPItem *item = selection->singleItem();
-
+
if (cc->active_conn == item)
{
// Nothing to change.
cc_clear_active_conn(cc);
return;
}
-
+
if (cc_item_is_connector(item)) {
cc_set_active_conn(cc, item);
}
{
g_assert(data);
SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(data);
-
+
// Look for changes than result in onscreen movement.
if (!strcmp(name, "d") || !strcmp(name, "x") || !strcmp(name, "y") ||
!strcmp(name, "width") || !strcmp(name, "height") ||
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index 42100d49a1a140c5fa390e1ad12f7c89ab7bea71..6c36e780fdcae26a54590d849619e939e7f47be7 100644 (file)
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
bool Inkscape::have_viable_layer(SPDesktop *desktop, MessageContext *message)
{
SPItem const *layer = SP_ITEM(desktop->currentLayer());
-
+
if ( !layer || desktop->itemIsHidden(layer) ) {
message->flash(Inkscape::ERROR_MESSAGE,
_("<b>Current layer is hidden</b>. Unhide it to be able to draw on it."));
return false;
}
-
+
if ( !layer || layer->isLocked() ) {
message->flash(Inkscape::ERROR_MESSAGE,
_("<b>Current layer is locked</b>. Unlock it to be able to draw on it."));
bool Inkscape::have_viable_layer(SPDesktop *desktop, MessageStack *message)
{
SPItem const *layer = SP_ITEM(desktop->currentLayer());
-
+
if ( !layer || desktop->itemIsHidden(layer) ) {
message->flash(Inkscape::WARNING_MESSAGE,
_("<b>Current layer is hidden</b>. Unhide it to be able to draw on it."));
return false;
}
-
+
if ( !layer || layer->isLocked() ) {
message->flash(Inkscape::WARNING_MESSAGE,
_("<b>Current layer is locked</b>. Unlock it to be able to draw on it."));
/* p[1] is the dragged point with the integer-ratio constraint */
p[1] = center + delta;
-
+
if (shift) {
/* Shift is down, so our origin is the centre point rather than the corner
/* p[0] is the opposite corner of our box */
p[0] = center - delta;
-
+
Inkscape::SnappedPoint s[2];
/* Try to snap p[0] (the opposite corner) along the constraint vector */
@@ -122,20 +122,20 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
p[0] = 2 * center - s[1].getPoint();
p[1] = s[1].getPoint();
}
-
+
} else {
/* Our origin is the opposite corner. Snap the drag point along the constraint vector */
p[0] = center;
p[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[1], p[1] - p[0], item).getPoint();
}
-
+
} else if (shift) {
/* Shift is down, so our origin is the centre point rather than the corner point;
** this means that corner-point movements are bound to each other.
*/
-
+
p[1] = pt;
p[0] = 2 * center - p[1];
p[0] = 2 * center - s[1].getPoint();
p[1] = s[1].getPoint();
}
-
+
} else {
-
+
/* There's no constraint on the corner point, so just snap it to anything */
p[0] = center;
p[1] = m.freeSnap(Inkscape::Snapper::SNAP_POINT, pt, item).getPoint();
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 226b9d997a7f4ef22bd574a0a0cfbe84f3ef5653..fad40ca7e56c1e17208476e238b1c3a75b54c71e 100644 (file)
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -138,7 +138,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
default:
break;
}
-
+
return FALSE;
}
static bool dragging = false;
static bool moved = false;
gint ret = FALSE;
-
+
SPGuide *guide = SP_GUIDE(data);
SPDesktop *desktop = static_cast<SPDesktop*>(gtk_object_get_data(GTK_OBJECT(item->canvas), "SPDesktop"));
}
case GDK_ENTER_NOTIFY:
{
-
+
sp_guideline_set_color(SP_GUIDELINE(item), guide->hicolor);
GString *position_string = SP_PX_TO_METRIC_STRING(guide->position, desktop->namedview->getDefaultMetric());
default:
break;
}
-
+
return ret;
}
static void guide_dialog_response(GtkDialog *dialog, gint response, gpointer data)
{
GtkWidget *widget = GTK_WIDGET(dialog);
-
+
switch (response) {
case GTK_RESPONSE_OK:
guide_dialog_ok(widget, data);
NULL);
sp_transientize(d);
gtk_widget_hide(d);
-
+
GtkWidget *b1 = gtk_hbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), b1, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(b1), 4);
gtk_widget_show(b1);
-
+
GtkWidget *b2 = gtk_vbox_new(FALSE, 4);
gtk_box_pack_end(GTK_BOX(b1), b2, TRUE, TRUE, 0);
gtk_widget_show(b2);
-
+
//labels
GtkWidget *b3 = gtk_hbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(b2), b3, TRUE, TRUE, 0);
gtk_widget_show(b3);
-
+
l1 = gtk_label_new("foo1");
gtk_box_pack_start(GTK_BOX(b3), l1, TRUE, TRUE, 0);
gtk_misc_set_alignment(GTK_MISC(l1), 1.0, 0.5);
gtk_widget_show(l1);
-
+
l2 = gtk_label_new("foo2");
gtk_box_pack_start(GTK_BOX(b3), l2, TRUE, TRUE, 0);
gtk_misc_set_alignment(GTK_MISC(l2), 0.0, 0.5);
gtk_widget_show(l2);
-
+
GtkWidget *b4 = gtk_hbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(b2), b4, FALSE, FALSE, 0);
gtk_widget_show(b4);
GtkWidget *but = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(but), GTK_RELIEF_NONE);
gtk_box_pack_start(GTK_BOX(b4), but, FALSE, TRUE, 0);
- gtk_signal_connect_while_alive(GTK_OBJECT(but), "clicked", GTK_SIGNAL_FUNC(guide_dialog_mode_changed),
+ gtk_signal_connect_while_alive(GTK_OBJECT(but), "clicked", GTK_SIGNAL_FUNC(guide_dialog_mode_changed),
NULL , GTK_OBJECT(but));
gtk_widget_show(but);
m = gtk_label_new(_(" absolute to "));
mode = true;
gtk_container_add(GTK_CONTAINER(but), m);
gtk_widget_show(m);
-
+
// unitmenu
/* fixme: We should allow percents here too, as percents of the canvas size */
u = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
sp_unit_selector_set_unit(SP_UNIT_SELECTOR(u), desktop->namedview->doc_units);
-
+
// spinbutton
GtkObject *a = gtk_adjustment_new(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(u), GTK_ADJUSTMENT(a));
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(e), TRUE);
gtk_box_pack_start(GTK_BOX(b4), e, TRUE, TRUE, 0);
gtk_signal_connect_object(GTK_OBJECT(e), "activate",
- GTK_SIGNAL_FUNC(gtk_window_activate_default),
+ GTK_SIGNAL_FUNC(gtk_window_activate_default),
GTK_OBJECT(d));
/* gnome_dialog_editable_enters(GNOME_DIALOG(d), GTK_EDITABLE(e)); */
-
+
gtk_widget_show(u);
gtk_box_pack_start(GTK_BOX(b4), u, FALSE, FALSE, 0);
-
-
+
+
// dialog
gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_OK);
gtk_signal_connect(GTK_OBJECT(d), "response", GTK_SIGNAL_FUNC(guide_dialog_response), &g);
gtk_signal_connect(GTK_OBJECT(d), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_WIDGET(d));
}
-
+
// initialize dialog
g = guide;
oldpos = guide->position;
gtk_label_set(GTK_LABEL(l1), label);
g_free(label);
}
-
+
SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(u));
gdouble const val = sp_pixels_get_units(oldpos, unit);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), val);
gtk_widget_grab_focus(e);
gtk_editable_select_region(GTK_EDITABLE(e), 0, 20);
gtk_window_set_position(GTK_WINDOW(d), GTK_WIN_POS_MOUSE);
-
+
gtk_widget_show(d);
}
index 75584c6eef6ec2296e58588379e87b229ac26420..e2d36bb529befb9240f9b7c0b3b0e4080245f604 100644 (file)
--- a/src/desktop-handles.cpp
+++ b/src/desktop-handles.cpp
return desktop->controls;
}
-Inkscape::MessageStack *
+Inkscape::MessageStack *
sp_desktop_message_stack (SPDesktop const * desktop)
{
g_return_val_if_fail (desktop != NULL, NULL);
return desktop->messageStack();
}
-SPNamedView *
+SPNamedView *
sp_desktop_namedview (SPDesktop const * desktop)
{
g_return_val_if_fail (desktop != NULL, NULL);
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 540fd1637e5fe014ab1528eb87e66c4f07eea1bd..8a3074e2e3a2aecd7eb680192fd7152e07958018 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
// 2. Generally we allow setting style on clones, but when it's inside flowRegion, do not touch
// it, be it clone or not; it's just styleless shape (because that's how Inkscape does
- // flowtext).
+ // flowtext).
if (!(skip_lines
&& ((SP_IS_TSPAN(o) && SP_TSPAN(o)->role == SP_TSPAN_ROLE_LINE)
@@ -164,8 +164,8 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write
bool intercepted = desktop->_set_style_signal.emit(css);
/** \todo
- * FIXME: in set_style, compensate pattern and gradient fills, stroke width,
- * rect corners, font size for the object's own transform so that pasting
+ * FIXME: in set_style, compensate pattern and gradient fills, stroke width,
+ * rect corners, font size for the object's own transform so that pasting
* fills does not depend on preserve/optimize.
*/
}
/**
- * Returns the font size (in SVG pixels) of the text tool style (if text
+ * Returns the font size (in SVG pixels) of the text tool style (if text
* tool uses its own style) or desktop style (otherwise).
*/
double
@@ -374,7 +374,7 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
if (!SP_IS_PATTERN(server))
return QUERY_STYLE_MULTIPLE_DIFFERENT; // different kind of server
-
+
SPPattern *pat = pattern_getroot (SP_PATTERN (server));
SPPattern *pat_res = pattern_getroot (SP_PATTERN (server_res));
if (pat_res != pat)
@@ -437,7 +437,7 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
if (num > 1) {
if (same_color)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_AVERAGED;
} else {
return QUERY_STYLE_SINGLE;
} else {
if (same_opacity)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_AVERAGED;
}
}
if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
continue;
- }
+ }
n_stroked ++;
} else {
if (same_sw)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_AVERAGED;
}
}
if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
continue;
- }
+ }
n_stroked ++;
} else {
if (same_ml)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_AVERAGED;
}
}
if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
continue;
- }
+ }
n_stroked ++;
} else {
if (same_cap)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_DIFFERENT;
}
}
if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
continue;
- }
+ }
n_stroked ++;
} else {
if (same_join)
return QUERY_STYLE_MULTIPLE_SAME;
- else
+ else
return QUERY_STYLE_MULTIPLE_DIFFERENT;
}
}
letterspacing_normal = false;
}
- double linespacing_current;
+ double linespacing_current;
if (style->line_height.normal) {
linespacing_current = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL;
if (!different && (linespacing_prev == 0 || linespacing_prev == linespacing_current))
texts ++;
- if (set &&
+ if (set &&
font_style_to_pos(*style_res).signature() != font_style_to_pos(*style).signature() ) {
different = true; // different styles
}
texts ++;
- if (style_res->text->font_family.value && style->text->font_family.value &&
+ if (style_res->text->font_family.value && style->text->font_family.value &&
strcmp (style_res->text->font_family.value, style->text->font_family.value)) {
different = true; // different fonts
}
{
int ret = desktop->_query_style_signal.emit(style, property);
- if (ret != QUERY_STYLE_NOTHING)
+ if (ret != QUERY_STYLE_NOTHING)
return ret; // subselection returned a style, pass it on
// otherwise, do querying and averaging over selection
sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query)
{
int result_family = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
- int result_fstyle = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
- int result_fnumbers = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ int result_fstyle = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
+ int result_fnumbers = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_fill = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FILL);
int result_stroke = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKE);
int result_strokewidth = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 9a2274bea9ca7dae900157fca75a49e07a17515d..5db7e5d2413a54c9d8a463fb05af4ab431388ec8 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
selection = Inkscape::GC::release (new Inkscape::Selection (this));
}
-void
+void
SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
{
namedview = nv;
canvas = aCanvas;
-
+
SPDocument *document = SP_OBJECT_DOCUMENT (namedview);
/* Kill flicker */
sp_document_ensure_up_to_date (document);
NR::Rect const d(NR::Point(0.0, 0.0),
NR::Point(sp_document_width(document), sp_document_height(document)));
-
+
SP_CTRLRECT(page)->setRectangle(d);
SP_CTRLRECT(page_border)->setRectangle(d);
if ( namedview->pageshadow != 0 && namedview->showpageshadow ) {
SP_CTRLRECT(page_border)->setShadow(namedview->pageshadow, 0x3f3f3fff);
}
-
+
/* Connect event for page resize */
_doc2dt[5] = sp_document_height (document);
NRArenaItem *ai = sp_item_invoke_show (SP_ITEM (sp_document_root (document)),
- SP_CANVAS_ARENA (drawing)->arena,
- dkey,
+ SP_CANVAS_ARENA (drawing)->arena,
+ dkey,
SP_ITEM_SHOW_DISPLAY);
if (ai) {
nr_arena_item_add_child (SP_CANVAS_ARENA (drawing)->root, ai, NULL);
/* Ugly hack */
_namedview_modified (namedview, SP_OBJECT_MODIFIED_FLAG, this);
- /* Construct SessionManager
- *
- * SessionManager construction needs to be done after document connection
+ /* Construct SessionManager
+ *
+ * SessionManager construction needs to be done after document connection
*/
#ifdef WITH_INKBOARD
_whiteboard_session_manager = new Inkscape::Whiteboard::SessionManager(this);
/**
* Returns current root (=bottom) layer.
*/
-SPObject *SPDesktop::currentRoot() const
+SPObject *SPDesktop::currentRoot() const
{
return _layer_hierarchy ? _layer_hierarchy->top() : NULL;
}
/**
* True if desktop viewport fully contains \a item's bbox.
*/
-bool SPDesktop::isWithinViewport (SPItem *item) const
+bool SPDesktop::isWithinViewport (SPItem *item) const
{
NR::Rect const viewport = get_display_area();
NR::Rect const bbox = sp_item_bbox_desktop(item);
}
/**
- * \brief Returns the mouse point in document coordinates; if mouse is
+ * \brief Returns the mouse point in document coordinates; if mouse is
* outside the canvas, returns the center of canvas viewpoint
*/
NR::Point
@@ -726,10 +726,10 @@ SPDesktop::zoom_absolute_keep_point (double cx, double cy, double px, double py,
double const width2 = viewbox.dimensions()[NR::X] / zoom;
double const height2 = viewbox.dimensions()[NR::Y] / zoom;
- set_display_area(cx - px * width2,
- cy - py * height2,
- cx + (1 - px) * width2,
- cy + (1 - py) * height2,
+ set_display_area(cx - px * width2,
+ cy - py * height2,
+ cx + (1 - px) * width2,
+ cy + (1 - py) * height2,
0.0);
}
{
NR::Rect d(NR::Point(0, 0),
NR::Point(sp_document_width(doc()), sp_document_height(doc())));
-
+
if (d.dimensions()[NR::X] < 1.0 || d.dimensions()[NR::Y] < 1.0) {
return;
}
NR::Rect d(NR::Point(0, a.midpoint()[NR::Y]),
NR::Point(sp_document_width(doc()), a.midpoint()[NR::Y]));
-
+
set_display_area(d, 10);
}
if (d.dimensions()[NR::X] < 0.1 || d.dimensions()[NR::Y] < 0.1) {
return;
}
-
+
set_display_area(d, 10);
}
/**
* Scroll canvas by specific coordinate amount.
*/
-void
+void
SPDesktop::scroll_world (double dx, double dy)
{
- g_assert(_widget);
+ g_assert(_widget);
NR::Rect const viewbox = canvas->getViewbox();
{
_widget->setFullscreen();
}
-
-void
+
+void
SPDesktop::getWindowGeometry (gint &x, gint &y, gint &w, gint &h)
{
_widget->getGeometry (x, y, w, h);
}
-void
+void
SPDesktop::setWindowPosition (NR::Point p)
{
_widget->setPosition (p);
_widget->setToolboxFocusTo (label);
}
-void
+void
SPDesktop::setToolboxAdjustmentValue (gchar const* id, double val)
{
_widget->setToolboxAdjustmentValue (id, val);
return _widget->isToolboxButtonActive (id);
}
-void
-SPDesktop::emitToolSubselectionChanged(gpointer data)
+void
+SPDesktop::emitToolSubselectionChanged(gpointer data)
{
_tool_subselection_changed.emit(data);
inkscape_subselection_changed (this);
//----------------------------------------------------------------------
// Callback implementations. The virtual ones are connected by the view.
-void
+void
SPDesktop::onPositionSet (double x, double y)
{
_widget->viewSetPosition (NR::Point(x,y));
void
SPDesktop::onResized (double x, double y)
{
- // Nothing called here
+ // Nothing called here
}
/**
g_signal_connect (G_OBJECT (namedview), "modified", G_CALLBACK (_namedview_modified), this);
number = namedview->getViewCount();
- ai = sp_item_invoke_show (SP_ITEM (sp_document_root (doc)),
+ ai = sp_item_invoke_show (SP_ITEM (sp_document_root (doc)),
SP_CANVAS_ARENA (drawing)->arena,
- dkey,
+ dkey,
SP_ITEM_SHOW_DISPLAY);
if (ai) {
nr_arena_item_add_child (SP_CANVAS_ARENA (drawing)->root, ai, NULL);
}
void
-SPDesktop::_onSelectionModified
+SPDesktop::_onSelectionModified
(Inkscape::Selection *selection, guint flags, SPDesktop *dt)
{
if (!dt->_widget) return;
dt->_widget->updateScrollbars (expansion(dt->_d2w));
}
-static void
+static void
_onSelectionChanged
(Inkscape::Selection *selection, SPDesktop *desktop)
{
- /** \todo
+ /** \todo
* only change the layer for single selections, or what?
* This seems reasonable -- for multiple selections there can be many
* different layers involved.
@@ -1180,21 +1180,21 @@ _arena_handler (SPCanvasArena *arena, NRArenaItem *ai, GdkEvent *event, SPDeskto
}
}
-static void
+static void
_layer_activated(SPObject *layer, SPDesktop *desktop) {
g_return_if_fail(SP_IS_GROUP(layer));
SP_GROUP(layer)->setLayerDisplayMode(desktop->dkey, SPGroup::LAYER);
}
/// Callback
-static void
+static void
_layer_deactivated(SPObject *layer, SPDesktop *desktop) {
g_return_if_fail(SP_IS_GROUP(layer));
SP_GROUP(layer)->setLayerDisplayMode(desktop->dkey, SPGroup::GROUP);
}
/// Callback
-static void
+static void
_layer_hierarchy_changed(SPObject *top, SPObject *bottom,
SPDesktop *desktop)
{
}
if (SP_RGBA32_A_U(nv->pagecolor) < 128 ||
- (SP_RGBA32_R_U(nv->pagecolor) +
- SP_RGBA32_G_U(nv->pagecolor) +
- SP_RGBA32_B_U(nv->pagecolor)) >= 384) {
+ (SP_RGBA32_R_U(nv->pagecolor) +
+ SP_RGBA32_G_U(nv->pagecolor) +
+ SP_RGBA32_B_U(nv->pagecolor)) >= 384) {
// the background color is light or transparent, use black outline
SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = 0xff;
} else { // use white outline
SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = 0xffffffff;
- }
+ }
}
}
diff --git a/src/dir-util.cpp b/src/dir-util.cpp
index b83eec00283d92641250186448f2772f363a79a0..b2a7c97f6fcd630a005bc77c8b2a8fdb8feab3b7 100644 (file)
--- a/src/dir-util.cpp
+++ b/src/dir-util.cpp
\comment
based on functions by Shigio Yamaguchi.
- FIXME:TODO: force it to also do path normalization of the entire resulting path,
- i.e. get rid of any .. and . in any place, even if 'path' is already absolute
+ FIXME:TODO: force it to also do path normalization of the entire resulting path,
+ i.e. get rid of any .. and . in any place, even if 'path' is already absolute
(now it returns it unchanged in this case)
*/
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index 226d38127a56c0fb661d5a90785288ae8e75162b..f37a3fcafb9450b14de2bac28075782bbfe048b6 100644 (file)
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
/*
* Undo & redo
*/
-/**
+/**
* Set undo sensitivity.
*
- * \note
+ * \note
* Since undo sensitivity needs to be nested, setting undo sensitivity
- * should be done like this:
+ * should be done like this:
*\verbatim
gboolean saved = sp_document_get_undo_sensitive(document);
sp_document_set_undo_sensitive(document, FALSE);
doc->priv->sensitive = TRUE;
- if (ret)
+ if (ret)
inkscape_external_change();
return ret;
doc->priv->sensitive = TRUE;
- if (ret)
+ if (ret)
inkscape_external_change();
return ret;
diff --git a/src/document.cpp b/src/document.cpp
index b53a7b7fad6f9fb1d54354ba028e77e9f0fc77f7..c5fa71f2be0c1c0f6f3220655e3976fc3b301c0f 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
/** \class SPDocument
* SPDocument serves as the container of both model trees (agnostic XML
* and typed object tree), and implements all of the document-level
- * functionality used by the program. Many document level operations, like
+ * functionality used by the program. Many document level operations, like
* load, save, print, export and so on, use SPDocument as their basic datatype.
*
* SPDocument implements undo and redo stacks and an id-based object
{
actionkey = NULL;
}
-
+
static SPDocument *
sp_document_create(Inkscape::XML::Document *rdoc,
gchar const *uri,
}
/**
- * Fetches document from URI, or creates new, if NULL; public document
+ * Fetches document from URI, or creates new, if NULL; public document
* appears in document list.
*/
SPDocument *
diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp
index 2a3279075b4403af4f51859fff9bb600b0a0d511..f2af728cf7eec7c6c7b6b8108c18dca060629bfe 100644 (file)
--- a/src/draw-anchor.cpp
+++ b/src/draw-anchor.cpp
-/** \file
+/** \file
* Anchors implementation.
*/
#define A_SNAP 4.0
/**
- * Test if point is near anchor, if so fill anchor on canvas and return
+ * Test if point is near anchor, if so fill anchor on canvas and return
* pointer to it or NULL.
*/
SPDrawAnchor *
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index ed1d6a7a4820f3248c00ad63a28616460822c331..0cb408293decefe06134213148c046793cbaa997 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -367,10 +367,10 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, N
}
v = t;
}
-
+
if (fabs(bdot) > 0) {
p = o + bdot * best;
-
+
/* Snap it along best vector */
SnapManager const m(SP_EVENT_CONTEXT_DESKTOP(ec)->namedview);
p = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT,
index e37f1660bca922ea18e0c7e59818c83a7ccd3932..b998b1b15f779c7531766aef65874f54c6a84280 100644 (file)
--- a/src/dropper-context.cpp
+++ b/src/dropper-context.cpp
SPEventContextClass *ec_class = (SPEventContextClass *) klass;
parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass);
-
+
ec_class->setup = sp_dropper_context_setup;
ec_class->finish = sp_dropper_context_finish;
ec_class->root_handler = sp_dropper_context_root_handler;
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(dc->area), 0x00000000,(SPWindRule)0);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->area), 0x0000007f, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_item_hide(dc->area);
-
+
if (prefs_get_int_attribute("tools.dropper", "selcue", 0) != 0) {
ec->enableSelectionCue();
}
-
+
if (prefs_get_int_attribute("tools.dropper", "gradientdrag", 0) != 0) {
ec->enableGrDrag();
}
static void sp_dropper_context_finish(SPEventContext *ec)
{
SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
-
+
ec->enableGrDrag(false);
-
+
if (dc->area) {
gtk_object_destroy(GTK_OBJECT(dc->area));
dc->area = NULL;
SP_DROPPER_PICK_VISIBLE);
gchar c[64];
- g_snprintf(c, 64, "%06x%02x", c32 >> 8,
+ g_snprintf(c, 64, "%06x%02x", c32 >> 8,
pick == SP_DROPPER_PICK_ACTUAL? SP_COLOR_F_TO_U(dc->alpha) : 255);
Glib::ustring text;
text += c;
- if (!text.empty())
+ if (!text.empty())
{
- Glib::RefPtr<Gtk::Clipboard> refClipboard =
+ Glib::RefPtr<Gtk::Clipboard> refClipboard =
Gtk::Clipboard::get();
refClipboard->set_text(text);
}
*/
void sp_dropper_c32_color_copy(guint32 c32)
{
- int const pick = prefs_get_int_attribute("tools.dropper", "pick",
+ int const pick = prefs_get_int_attribute("tools.dropper", "pick",
SP_DROPPER_PICK_VISIBLE);
gchar c[64];
- g_snprintf(c, 64, "%06x%02x", c32 >> 8,
+ g_snprintf(c, 64, "%06x%02x", c32 >> 8,
pick == SP_DROPPER_PICK_ACTUAL? SP_RGBA32_A_U(c32) : 255);
Glib::ustring text;
void sp_dropper_c32_color_copy_hex(guint32 c32)
{
/*
- int pick = prefs_get_int_attribute ("tools.dropper", "pick",
+ int pick = prefs_get_int_attribute ("tools.dropper", "pick",
SP_DROPPER_PICK_VISIBLE);
-
+
if ( pick == SP_DROPPER_PICK_ACTUAL )
; // process c32 so that it computes against page
// else just can cut off that last 2 hex digits....
-
+
*/
gchar c[48];
@@ -237,33 +237,33 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
break;
} else {
// otherwise, constantly calculate color no matter is any button pressed or not
-
+
double rw = 0.0;
double W(0), R(0), G(0), B(0), A(0);
-
- if (dc->dragging) {
+
+ if (dc->dragging) {
// calculate average
-
+
// radius
rw = std::min(NR::L2(NR::Point(event->button.x, event->button.y) - dc->centre), 400.0);
-
+
if (rw == 0) { // happens sometimes, little idea why...
break;
}
-
+
NR::Point const cd = ec->desktop->w2d(dc->centre);
NR::Matrix const w2dt = ec->desktop->w2d();
const double scale = rw * NR_MATRIX_DF_EXPANSION(&w2dt);
NR::Matrix const sm( NR::scale(scale, scale) * NR::translate(cd) );
sp_canvas_item_affine_absolute(dc->area, sm);
sp_canvas_item_show(dc->area);
-
+
/* Get buffer */
const int x0 = (int) floor(dc->centre[NR::X] - rw);
const int y0 = (int) floor(dc->centre[NR::Y] - rw);
const int x1 = (int) ceil(dc->centre[NR::X] + rw);
const int y1 = (int) ceil(dc->centre[NR::Y] + rw);
-
+
if ((x1 > x0) && (y1 > y0)) {
NRPixBlock pb;
nr_pixblock_setup_fast(&pb, NR_PIXBLOCK_MODE_R8G8B8A8P, x0, y0, x1, y1, TRUE);
@@ -284,7 +284,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
}
}
nr_pixblock_release(&pb);
-
+
R = (R + 0.001) / (255.0 * W);
G = (G + 0.001) / (255.0 * W);
B = (B + 0.001) / (255.0 * W);
@@ -304,13 +304,13 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
nr_pixblock_setup_fast(&pb, NR_PIXBLOCK_MODE_R8G8B8A8P, x, y, x+1, y+1, TRUE);
sp_canvas_arena_render_pixblock(SP_CANVAS_ARENA(SP_DT_DRAWING(ec->desktop)), &pb);
const unsigned char *s = NR_PIXBLOCK_PX(&pb);
-
+
R = s[0] / 255.0;
G = s[1] / 255.0;
B = s[2] / 255.0;
A = s[3] / 255.0;
}
-
+
if (pick == SP_DROPPER_PICK_VISIBLE) {
// compose with page color
guint32 bg = SP_DT_NAMEDVIEW(ec->desktop)->pagecolor;
@@ -326,7 +326,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
B /= A;
}
}
-
+
if (fabs(A) < 1e-4) {
A = 0; // suppress exponentials, CSS does not allow that
}
@@ -336,10 +336,10 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
dc->G = G;
dc->B = B;
dc->alpha = A;
-
+
// status message
guint32 c32 = SP_RGBA32_F_COMPOSE(R, G, B, A);
-
+
gchar c[64];
sp_svg_write_color(c, 64, c32);
@@ -356,28 +356,28 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
(pick == SP_DROPPER_PICK_VISIBLE)? "" : alpha,
where, message
);
-
+
g_free(where);
g_free(alpha);
-
+
ret = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
- if (event->button.button == 1)
+ if (event->button.button == 1)
{
sp_canvas_item_hide(dc->area);
dc->dragging = FALSE;
-
+
// do the actual color setting
- sp_desktop_set_color(ec->desktop,
+ sp_desktop_set_color(ec->desktop,
(event->button.state & GDK_MOD1_MASK)?
ColorRGBA(1 - dc->R, 1 - dc->G, 1 - dc->B, dc->alpha) : ColorRGBA(dc->R, dc->G, dc->B, dc->alpha),
false, !(event->button.state & GDK_SHIFT_MASK));
-
+
// REJON: set aux. toolbar input to hex color!
-
-
+
+
if (!(SP_DT_SELECTION(ec->desktop)->isEmpty())) {
sp_document_done(SP_DT_DOCUMENT(ec->desktop));
}
@@ -387,10 +387,10 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key)) {
- case GDK_Up:
- case GDK_Down:
- case GDK_KP_Up:
- case GDK_KP_Down:
+ case GDK_Up:
+ case GDK_Down:
+ case GDK_KP_Up:
+ case GDK_KP_Down:
// prevent the zoom field from activation
if (!MOD__CTRL_ONLY) {
ret = TRUE;
@@ -405,13 +405,13 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
default:
break;
}
-
+
if (!ret) {
if (((SPEventContextClass *) parent_class)->root_handler) {
ret = ((SPEventContextClass *) parent_class)->root_handler(ec, event);
}
}
-
+
return ret;
}
index 8b90ce034c3484e916be536adc7c308fa83177d6..7fd7bfe7223661dfbafc157e794b6307d1df184a 100644 (file)
event_context->cursor_shape = cursor_calligraphy_xpm;
event_context->hot_x = 4;
event_context->hot_y = 4;
-
+
ddc->accumulated = NULL;
ddc->segments = NULL;
ddc->currentcurve = NULL;
if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
return TRUE;
}
-
+
NR::Point const button_w(event->button.x,
event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
? ( GDK_KEY_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_PRESS_MASK )
- : ( GDK_KEY_PRESS_MASK |
+ : ( GDK_KEY_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK ) ),
case GDK_KP_Up:
if (!MOD__CTRL_ONLY) {
dc->angle += 5.0;
- if (dc->angle > 90.0)
+ if (dc->angle > 90.0)
dc->angle = 90.0;
sp_ddc_update_toolbox (desktop, "calligraphy-angle", dc->angle);
ret = TRUE;
case GDK_KP_Down:
if (!MOD__CTRL_ONLY) {
dc->angle -= 5.0;
- if (dc->angle < -90.0)
+ if (dc->angle < -90.0)
dc->angle = -90.0;
sp_ddc_update_toolbox (desktop, "calligraphy-angle", dc->angle);
ret = TRUE;
case GDK_KP_Right:
if (!MOD__CTRL_ONLY) {
dc->width += 0.01;
- if (dc->width > 1.0)
+ 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
ret = TRUE;
case GDK_KP_Left:
if (!MOD__CTRL_ONLY) {
dc->width -= 0.01;
- if (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);
ret = TRUE;
}
break;
diff --git a/src/event-context.cpp b/src/event-context.cpp
index 54b683bf4094536ae6c62d7f3ea44bc236c0ff21..da430a2ed163d711f43eaa4caad3b428926aa968 100644 (file)
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
if (ec->cursor)
gdk_cursor_unref (ec->cursor);
ec->cursor = gdk_cursor_new_from_pixmap(bitmap, mask,
- &w->style->black,
+ &w->style->black,
&w->style->white,
ec->hot_x, ec->hot_y);
g_object_unref (bitmap);
event_next = gdk_event_get();
// while the next event is also a key notify with the same keyval and mask,
while (event_next && event_next->type == GDK_KEY_PRESS
- && event_next->key.keyval == keyval
+ && event_next->key.keyval == keyval
&& (event_next->key.state & mask)) {
// kill it
gdk_event_free(event_next);
* Toggles current tool between active tool and selector tool.
* Subroutine of sp_event_context_private_root_handler().
*/
-static void
+static void
sp_toggle_selector(SPDesktop *dt)
{
if (!dt->event_context) return;
}
// This is a hack that is necessary because when middle-clicking too fast,
-// button_press events come for all clicks but there's button_release only
-// for the first one. So after a release, we must prohibit the next grab for
-// some time, or the grab will be stuck. Perhaps this is caused by some
-// wrong handling of events among contexts and not by a GDK bug;
+// button_press events come for all clicks but there's button_release only
+// for the first one. So after a release, we must prohibit the next grab for
+// some time, or the grab will be stuck. Perhaps this is caused by some
+// wrong handling of events among contexts and not by a GDK bug;
// if someone can fix this properly this would be great.
static gint dontgrab = 0;
-static bool
-grab_allow_again()
+static bool
+grab_allow_again()
{
- dontgrab--;
+ dontgrab--;
if (dontgrab < 0) dontgrab = 0;
return FALSE; // so that it is only called once
}
@@ -336,7 +336,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_2BUTTON_PRESS:
if (panning) {
panning = 0;
- sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
ret = TRUE;
} else {
@@ -353,11 +353,11 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
switch (event->button.button) {
case 2:
- if (dontgrab)
- // double-click, still not permitted to grab;
+ if (dontgrab)
+ // double-click, still not permitted to grab;
// increase the counter to guard against triple click
{
- dontgrab ++;
+ dontgrab ++;
gtk_timeout_add(250, (GtkFunction) grab_allow_again, NULL);
break;
}
@@ -375,7 +375,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
ret = TRUE;
break;
case 3:
- if (event->button.state & GDK_SHIFT_MASK
+ if (event->button.state & GDK_SHIFT_MASK
|| event->button.state & GDK_CONTROL_MASK) {
button_w = NR::Point(event->button.x,
event->button.y);
@@ -394,12 +394,12 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
break;
case GDK_MOTION_NOTIFY:
if (panning) {
- if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK))
+ if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK))
|| (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) {
/* Gdk seems to lose button release for us sometimes :-( */
panning = 0;
dontgrab = 0;
- sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
ret = TRUE;
} else {
@@ -408,17 +408,17 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
&& ( abs( (gint) event->motion.y - yp ) < tolerance ))
{
// do not drag if we're within tolerance from origin
- break;
+ break;
}
- // Once the user has moved farther than tolerance from
- // the original location (indicating they intend to move
- // the object, not click), then always process the motion
+ // Once the user has moved farther than tolerance from
+ // the original location (indicating they intend to move
+ // the object, not click), then always process the motion
// notify coordinates as given (no snapping back to origin)
- within_tolerance = false;
+ within_tolerance = false;
- // gobble subsequent motion events to prevent "sticking"
+ // gobble subsequent motion events to prevent "sticking"
// when scrolling is slow
- gobble_motion_events(panning == 2 ?
+ gobble_motion_events(panning == 2 ?
GDK_BUTTON2_MASK : GDK_BUTTON3_MASK);
NR::Point const motion_w(event->motion.x,
@@ -443,10 +443,10 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
Inkscape::Rubberband::get()->move(motion_dt);
}
- // Once the user has moved farther than tolerance from the original location
- // (indicating they intend to move the object, not click), then always process the
+ // Once the user has moved farther than tolerance from the original location
+ // (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
- within_tolerance = false;
+ within_tolerance = false;
}
break;
case GDK_BUTTON_RELEASE:
@@ -462,7 +462,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
}
if (panning == event->button.button) {
panning = 0;
- sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
ret = TRUE;
} else if (zoom_rb == event->button.button) {
@@ -473,7 +473,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
}
Inkscape::Rubberband::get()->stop();
}
- xp = yp = 0;
+ xp = yp = 0;
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key)) {
@@ -481,11 +481,11 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_F1:
/* Grab it away from Gtk */
shortcut = get_group0_keyval(&event->key);
- if (event->key.state & GDK_SHIFT_MASK)
+ if (event->key.state & GDK_SHIFT_MASK)
shortcut |= SP_SHORTCUT_SHIFT_MASK;
- if (event->key.state & GDK_CONTROL_MASK)
+ if (event->key.state & GDK_CONTROL_MASK)
shortcut |= SP_SHORTCUT_CONTROL_MASK;
- if (event->key.state & GDK_MOD1_MASK)
+ if (event->key.state & GDK_MOD1_MASK)
shortcut |= SP_SHORTCUT_ALT_MASK;
ret = sp_shortcut_invoke(shortcut, desktop);
break;
@@ -497,11 +497,11 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
} else {
/* Grab it away from Gtk */
shortcut = get_group0_keyval(&event->key);
- if (event->key.state & GDK_SHIFT_MASK)
+ if (event->key.state & GDK_SHIFT_MASK)
shortcut |= SP_SHORTCUT_SHIFT_MASK;
- if (event->key.state & GDK_CONTROL_MASK)
+ if (event->key.state & GDK_CONTROL_MASK)
shortcut |= SP_SHORTCUT_CONTROL_MASK;
- if (event->key.state & GDK_MOD1_MASK)
+ if (event->key.state & GDK_MOD1_MASK)
shortcut |= SP_SHORTCUT_ALT_MASK;
ret = sp_shortcut_invoke(shortcut, desktop);
}
@@ -527,7 +527,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_KP_4:
if (MOD__CTRL_ONLY) {
int i = (int) floor(key_scroll * accelerate_scroll(event, acceleration));
- gobble_key_events(get_group0_keyval(&event->key),
+ gobble_key_events(get_group0_keyval(&event->key),
GDK_CONTROL_MASK);
event_context->desktop->scroll_world(i, 0);
ret = TRUE;
@@ -538,7 +538,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_KP_8:
if (MOD__CTRL_ONLY) {
int i = (int) floor(key_scroll * accelerate_scroll(event, acceleration));
- gobble_key_events(get_group0_keyval(&event->key),
+ gobble_key_events(get_group0_keyval(&event->key),
GDK_CONTROL_MASK);
event_context->desktop->scroll_world(0, i);
ret = TRUE;
@@ -549,7 +549,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_KP_6:
if (MOD__CTRL_ONLY) {
int i = (int) floor(key_scroll * accelerate_scroll(event, acceleration));
- gobble_key_events(get_group0_keyval(&event->key),
+ gobble_key_events(get_group0_keyval(&event->key),
GDK_CONTROL_MASK);
event_context->desktop->scroll_world(-i, 0);
ret = TRUE;
@@ -560,7 +560,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case GDK_KP_2:
if (MOD__CTRL_ONLY) {
int i = (int) floor(key_scroll * accelerate_scroll(event, acceleration));
- gobble_key_events(get_group0_keyval(&event->key),
+ gobble_key_events(get_group0_keyval(&event->key),
GDK_CONTROL_MASK);
event_context->desktop->scroll_world(0, -i);
ret = TRUE;
@@ -646,7 +646,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
}
/**
- * Handles item specific events. Gets called from Gdk.
+ * Handles item specific events. Gets called from Gdk.
*
* Only reacts to right mouse button at the moment.
* \todo Fixme: do context sensitive popup menu on items.
@@ -658,7 +658,7 @@ sp_event_context_private_item_handler(SPEventContext *ec, SPItem *item, GdkEvent
switch (event->type) {
case GDK_BUTTON_PRESS:
- if ((event->button.button == 3)
+ if ((event->button.button == 3)
&& !(event->button.state & GDK_SHIFT_MASK || event->button.state & GDK_CONTROL_MASK)) {
sp_event_root_menu_popup(ec->desktop, item, event);
ret = TRUE;
* Show tool context specific modifier tip.
*/
void
-sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
- GdkEvent *event, gchar const *ctrl_tip, gchar const *shift_tip,
+sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
+ GdkEvent *event, gchar const *ctrl_tip, gchar const *shift_tip,
gchar const *alt_tip)
{
guint keyval = get_group0_keyval(&event->key);
-
- bool ctrl = ctrl_tip && (MOD__CTRL
- || (keyval == GDK_Control_L)
+
+ bool ctrl = ctrl_tip && (MOD__CTRL
+ || (keyval == GDK_Control_L)
|| (keyval == GDK_Control_R));
- bool shift = shift_tip
+ bool shift = shift_tip
&& (MOD__SHIFT || (keyval == GDK_Shift_L) || (keyval == GDK_Shift_R));
- bool alt = alt_tip
- && (MOD__ALT
- || (keyval == GDK_Alt_L)
- || (keyval == GDK_Alt_R)
- || (keyval == GDK_Meta_L)
+ bool alt = alt_tip
+ && (MOD__ALT
+ || (keyval == GDK_Alt_L)
+ || (keyval == GDK_Alt_R)
+ || (keyval == GDK_Meta_L)
|| (keyval == GDK_Meta_R));
gchar *tip = g_strdup_printf("%s%s%s%s%s",
}
/**
- * Return the keyval corresponding to the key event in group 0, i.e.,
- * in the main (English) layout.
+ * Return the keyval corresponding to the key event in group 0, i.e.,
+ * in the main (English) layout.
*
- * Use this instead of simply event->keyval, so that your keyboard shortcuts
+ * Use this instead of simply event->keyval, so that your keyboard shortcuts
* work regardless of layouts (e.g., in Cyrillic).
*/
guint
guint keyval = 0;
gdk_keymap_translate_keyboard_state(
gdk_keymap_get_for_display(gdk_display_get_default()),
- event->hardware_keycode,
- (GdkModifierType) event->state,
+ event->hardware_keycode,
+ (GdkModifierType) event->state,
0 /*event->key.group*/,
&keyval, NULL, NULL, NULL);
return keyval;
/**
* Returns item at point p in desktop.
*
- * If state includes alt key mask, cyclically selects under; honors
+ * If state includes alt key mask, cyclically selects under; honors
* into_groups.
*/
SPItem *
-sp_event_context_find_item (SPDesktop *desktop, NR::Point const p,
+sp_event_context_find_item (SPDesktop *desktop, NR::Point const p,
bool select_under, bool into_groups)
{
SPItem *item;
if (select_under) {
- SPItem *selected_at_point =
+ SPItem *selected_at_point =
desktop->item_from_list_at_point_bottom (desktop->selection->itemList(), p);
item = desktop->item_at_point(p, into_groups, selected_at_point);
if (item == NULL) { // we may have reached bottom, flip over to the top
item = desktop->item_at_point(p, into_groups, NULL);
}
- } else
+ } else
item = desktop->item_at_point(p, into_groups, NULL);
return item;
@@ -992,13 +992,13 @@ sp_event_context_over_item (SPDesktop *desktop, SPItem *item, NR::Point const p)
/**
* Called when SPEventContext subclass node attribute changed.
*/
-void
-ec_shape_event_attr_changed(Inkscape::XML::Node *shape_repr, gchar const *name,
+void
+ec_shape_event_attr_changed(Inkscape::XML::Node *shape_repr, gchar const *name,
gchar const *old_value, gchar const *new_value,
bool const is_interactive, gpointer const data)
{
- if (!name
- || !strcmp(name, "style")
+ if (!name
+ || !strcmp(name, "style")
|| SP_ATTRIBUTE_IS_CSS(sp_attribute_lookup(name))) {
// no need to regenrate knotholder if only style changed
return;
diff --git a/src/file.cpp b/src/file.cpp
index acc6e101a8222aee149055ae6b4c255c65192f3e..d42abbff686681864b005d6c80bdabc954a18d36 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
char *default_template = g_build_filename(dirname, _("default.svg"), NULL);
if (Inkscape::IO::file_test(default_template, G_FILE_TEST_IS_REGULAR)) {
return sp_file_new(default_template);
- }
+ }
}
g_free(dirname);
sources.pop_front();
@@ -180,7 +180,7 @@ sp_file_open(gchar const *uri, Inkscape::Extension::Extension *key, bool add_to_
if (doc) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPDocument *existing = desktop ? SP_DT_DOCUMENT(desktop) : NULL;
-
+
if (existing && existing->virgin && replace_empty) {
// If the current desktop is empty, open the document there
desktop->change_document(doc);
@@ -194,7 +194,7 @@ sp_file_open(gchar const *uri, Inkscape::Extension::Extension *key, bool add_to_
desktop = Inkscape::NSApplication::Editor::createDesktop (doc);
}
}
-
+
doc->virgin = FALSE;
// everyone who cares now has a reference, get rid of ours
sp_document_unref(doc);
{
#ifdef INK_DUMP_FILENAME_CONV
- g_message(" FileName: %s",(const char *)list->data);
+ g_message(" FileName: %s",(const char *)list->data);
#endif
fileName=(gchar *)g_strdup((gchar *)list->data);
g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" );
}
-#ifdef INK_DUMP_FILENAME_CONV
+#ifdef INK_DUMP_FILENAME_CONV
g_message("Opening File %s\n",fileName);
#endif
{
g_message("Cannot Open Directory %s\n",fileName);
}
-
+
list=list->next;
}
diff --git a/src/fixes.cpp b/src/fixes.cpp
index 72498c4481681da85b136652213015203b06f2d6..4ed1b6eb146f90f4d07bd9ce95381e0badf95f10 100644 (file)
--- a/src/fixes.cpp
+++ b/src/fixes.cpp
* $Id$
*
* 2004 Kees Cook
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
decimal_point_len = strlen (decimal_point);
g_assert (decimal_point_len != 0);
-
+
decimal_point_pos = NULL;
- if (decimal_point[0] != '.' ||
+ if (decimal_point[0] != '.' ||
decimal_point[1] != 0)
{
p = nptr;
/* Skip leading space */
while (g_ascii_isspace (*p))
p++;
-
+
/* Skip leading optional sign */
if (*p == '+' || *p == '-')
p++;
-
- if (p[0] == '0' &&
+
+ if (p[0] == '0' &&
(p[1] == 'x' || p[1] == 'X'))
{
p += 2;
/* HEX - find the (optional) decimal point */
-
+
while (g_ascii_isxdigit (*p))
p++;
-
+
if (*p == '.')
{
decimal_point_pos = p++;
-
+
while (g_ascii_isxdigit (*p))
p++;
-
+
if (*p == 'p' || *p == 'P')
p++;
if (*p == '+' || *p == '-')
{
while (g_ascii_isdigit (*p))
p++;
-
+
if (*p == '.')
{
decimal_point_pos = p++;
-
+
while (g_ascii_isdigit (*p))
p++;
-
+
if (*p == 'e' || *p == 'E')
p++;
if (*p == '+' || *p == '-')
/* Set errno to zero, so that we can distinguish zero results
and underflows */
errno = 0;
-
+
if (decimal_point_pos)
{
char *copy, *c;
/* We need to convert the '.' to the locale specific decimal point */
copy = (char*)g_malloc (end - nptr + 1 + decimal_point_len);
-
+
c = copy;
memcpy (c, nptr, decimal_point_pos - nptr);
c += decimal_point_pos - nptr;
else
fail_pos = (char *)nptr + (fail_pos - copy);
}
-
+
g_free (copy);
-
+
}
else if (decimal_point[0] != '.' ||
decimal_point[1] != 0)
{
char *copy;
-
+
copy = (char*)g_malloc (end - (char *)nptr + 1);
memcpy (copy, nptr, end - nptr);
*(copy + (end - (char *)nptr)) = 0;
-
+
val = strtod (copy, &fail_pos);
-
+
if (fail_pos)
{
fail_pos = (char *)nptr + (fail_pos - copy);
}
-
+
g_free (copy);
}
else
if (endptr)
*endptr = fail_pos;
-
+
return val;
}
}
diff --git a/src/geom.cpp b/src/geom.cpp
index 2749d6d7d34fee19dc04d88f8c0a485a4f796468..bc161bf9fc74b10fa70547fe0a4d26e4b148481c 100644 (file)
--- a/src/geom.cpp
+++ b/src/geom.cpp
* convert lines to form
* ax + by = c
* dx + ey = f
- *
+ *
* (
* e.g. a = (x2 - x1), b = (y2 - y1), c = (x2 - x1)*x1 + (y2 - y1)*y1
* )
- *
+ *
* In our case we use:
* a = n0.x d = n1.x
* b = n0.y e = n1.y
* c = d0 f = d1
- *
+ *
* so:
- *
+ *
* adx + bdy = cd
* adx + aey = af
- *
+ *
* bdy - aey = cd - af
* (bd - ae)y = cd - af
- *
+ *
* y = (cd - af)/(bd - ae)
- *
+ *
* repeat for x and you get:
- *
+ *
* x = (fb - ce)/(bd - ae) \endverbatim
- *
+ *
* If the denominator (bd-ae) is 0 then the lines are parallel, if the
- * numerators are then 0 then the lines coincide.
+ * numerators are then 0 then the lines coincide.
*
- * \todo Why not use existing but outcommented code below
+ * \todo Why not use existing but outcommented code below
* (HAVE_NEW_INTERSECTOR_CODE)?
*/
IntersectorKind intersector_line_intersection(NR::Point const &n0, double const d0,
return PARALLEL;
}
}
-
+
double Y = n0[NR::X] * d1 -
n1[NR::X] * d0;
-
+
result = NR::Point(X, Y) / denominator;
-
+
return INTERSECTS;
}
index aa77ea0ade4bfd053cd22dff4ba37500e4b07555..b4a1eca92571c2d78bd765c7f0f98924140dae70 100644 (file)
/**
* Convert an item's gradient to userspace _without_ preserving coords, setting them to defaults
- * instead. No forking or reapplying is done because this is only called for newly created privates.
+ * instead. No forking or reapplying is done because this is only called for newly created privates.
* @return The new gradient.
*/
SPGradient *
sp_repr_set_svg_double(repr, "r", width/2);
// we want it to be elliptic, not circular
- NR::Matrix squeeze = NR::Matrix (NR::translate (-center)) *
- NR::Matrix (NR::scale(1, height/width)) *
+ NR::Matrix squeeze = NR::Matrix (NR::translate (-center)) *
+ NR::Matrix (NR::scale(1, height/width)) *
NR::Matrix (NR::translate (center));
gr->gradientTransform = squeeze;
}
}
}
-
+
return gradient;
}
SPStop*
sp_prev_stop(SPStop *stop, SPGradient *gradient)
{
- if (sp_object_first_child(SP_OBJECT(gradient)) == SP_OBJECT(stop))
+ if (sp_object_first_child(SP_OBJECT(gradient)) == SP_OBJECT(stop))
return NULL;
SPObject *found = NULL;
for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
if (scale) {
lg->x2.computed += (lg->x1.computed - p[NR::X]);
lg->y2.computed += (lg->y1.computed - p[NR::Y]);
- }
+ }
lg->x1.computed = p[NR::X];
lg->y1.computed = p[NR::Y];
if (write_repr) {
if (scale) {
lg->x1.computed += (lg->x2.computed - p[NR::X]);
lg->y1.computed += (lg->y2.computed - p[NR::Y]);
- }
+ }
lg->x2.computed = p[NR::X];
lg->y2.computed = p[NR::Y];
if (write_repr) {
@@ -782,13 +782,13 @@ sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_w, bool
double move_stretch = NR::L2(p_w - c_w) / NR::L2(r1_w - c_w);
NR::Matrix move = NR::Matrix (NR::translate (-c_w)) *
- NR::Matrix (NR::rotate(-r1_angle)) *
+ NR::Matrix (NR::rotate(-r1_angle)) *
NR::Matrix (NR::scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (NR::rotate(r1_angle)) *
- NR::Matrix (NR::rotate(move_angle)) *
+ NR::Matrix (NR::rotate(r1_angle)) *
+ NR::Matrix (NR::rotate(move_angle)) *
NR::Matrix (NR::translate (c_w));
- new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
+ new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
break;
@@ -801,13 +801,13 @@ sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_w, bool
double move_stretch = NR::L2(p_w - c_w) / NR::L2(r2_w - c_w);
NR::Matrix move = NR::Matrix (NR::translate (-c_w)) *
- NR::Matrix (NR::rotate(-r2_angle)) *
+ NR::Matrix (NR::rotate(-r2_angle)) *
NR::Matrix (NR::scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (NR::rotate(r2_angle)) *
- NR::Matrix (NR::rotate(move_angle)) *
+ NR::Matrix (NR::rotate(r2_angle)) *
+ NR::Matrix (NR::rotate(move_angle)) *
NR::Matrix (NR::translate (c_w));
- new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
+ new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
break;
}
if (transform_set) {
- gradient->gradientTransform = new_transform;
+ gradient->gradientTransform = new_transform;
gradient->gradientTransform_set = TRUE;
if (write_repr) {
gchar s[256];
return NULL;
}
-SPGradientSpread
+SPGradientSpread
sp_item_gradient_get_spread (SPItem *item, bool fill_or_stroke)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
/**
-Returns the position of point point_num of the gradient applied to item (either fill_or_stroke),
+Returns the position of point point_num of the gradient applied to item (either fill_or_stroke),
in desktop coordinates.
*/
@@ -940,7 +940,7 @@ sp_item_set_gradient(SPItem *item, SPGradient *gr, SPGradientType type, bool is_
//g_print("hrefcount %d count %d\n", SP_OBJECT_HREFCOUNT(ig), count_gradient_hrefs(SP_OBJECT(item), ig));
- if (SP_OBJECT_HREFCOUNT(current) == 1 ||
+ if (SP_OBJECT_HREFCOUNT(current) == 1 ||
SP_OBJECT_HREFCOUNT(current) == count_gradient_hrefs(SP_OBJECT(item), current)) {
// current is private and it's either used once, or all its uses are by children of item;
index 84bed562d98cdfe777327fcb2fdc34ff7b39d5a8..1168181fc793b8b9b40e4030fc8bb800702d0b09 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -130,7 +130,7 @@ static gint sp_gradient_context_root_handler(SPEventContext *event_context, GdkE
SPDesktop *desktop = event_context->desktop;
Inkscape::Selection *selection = SP_DT_SELECTION (desktop);
-
+
SPGradientContext *rc = SP_GRADIENT_CONTEXT(event_context);
event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
@@ -200,7 +200,7 @@ static gint sp_gradient_context_root_handler(SPEventContext *event_context, GdkE
NR::Point const motion_w(event->motion.x,
event->motion.y);
NR::Point const motion_dt = event_context->desktop->w2d(motion_w);
-
+
sp_gradient_drag(*rc, motion_dt, event->motion.state, event->motion.time);
ret = TRUE;
@@ -441,8 +441,8 @@ static void sp_gradient_drag(SPGradientContext &rc, NR::Point const pt, guint st
ec->_grdrag->local_change = true;
// give the grab out-of-bounds values of xp/yp because we're already dragging
// and therefore are already out of tolerance
- ec->_grdrag->grabKnot (SP_ITEM(selection->itemList()->data),
- type == SP_GRADIENT_TYPE_LINEAR? POINT_LG_P2 : POINT_RG_R1,
+ ec->_grdrag->grabKnot (SP_ITEM(selection->itemList()->data),
+ type == SP_GRADIENT_TYPE_LINEAR? POINT_LG_P2 : POINT_RG_R1,
fill_or_stroke, 99999, 99999, etime);
}
// We did an undoable action, but sp_document_done will be called by the knot when released
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index ffc1b7fc638596b2ed06907f914de073b8030336..7e23b5750ec2e98e995733fc9ee3727ac9e7fd9e 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
N_("Radial gradient <b>focus</b>") // POINT_RG_FOCUS
};
-static void
+static void
gr_drag_sel_changed(Inkscape::Selection *selection, gpointer data)
{
GrDrag *drag = (GrDrag *) data;
if (css->attribute("fill-opacity")) // TODO: multiply
sp_repr_css_set_property (stop, "stop-opacity", css->attribute("fill-opacity"));
- if ((css->attribute("fill") && !strcmp(css->attribute("fill"), "none")) ||
+ if ((css->attribute("fill") && !strcmp(css->attribute("fill"), "none")) ||
(css->attribute("stroke") && !strcmp(css->attribute("stroke"), "none")))
sp_repr_css_set_property (stop, "stop-opacity", "0"); // if set to none, don't change color, set opacity to 0
this->sel_changed_connection = this->selection->connectChanged(
sigc::bind (
- sigc::ptr_fun(&gr_drag_sel_changed),
+ sigc::ptr_fun(&gr_drag_sel_changed),
(gpointer)this )
);
}
}
-GrDrag::~GrDrag()
+GrDrag::~GrDrag()
{
this->sel_changed_connection.disconnect();
this->sel_modified_connection.disconnect();
get_snap_vector (NR::Point p, NR::Point o, double snap, double initial)
{
double r = NR::L2 (p - o);
- if (r < 1e-3)
+ if (r < 1e-3)
return NULL;
double angle = NR::atan2 (p - o);
// snap angle to snaps increments, starting from initial:
@@ -364,7 +364,7 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi
GrDraggable *draggable = (GrDraggable *) i->data;
// copy draggable to d_new:
GrDraggable *da_new = new GrDraggable (draggable->item, draggable->point_num, draggable->fill_or_stroke);
- d_new->addDraggable (da_new);
+ d_new->addDraggable (da_new);
}
// unlink and delete this dragger
@@ -384,7 +384,7 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi
}
}
- if (!((state & GDK_SHIFT_MASK) || ((state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK)))) {
+ if (!((state & GDK_SHIFT_MASK) || ((state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK)))) {
// See if we need to snap to any of the levels
for (guint i = 0; i < dragger->parent->hor_levels.size(); i++) {
if (fabs(p[NR::Y] - dragger->parent->hor_levels[i]) < snap_dist) {
@@ -417,7 +417,7 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi
GrDragger *d_new = (GrDragger *) di->data;
if (d_new == dragger)
continue;
- if (d_new->isA (draggable->item,
+ if (d_new->isA (draggable->item,
draggable->point_num == POINT_LG_P1? POINT_LG_P2 : POINT_LG_P1,
draggable->fill_or_stroke)) {
// found the other end of the linear gradient;
@@ -436,7 +436,7 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi
GrDragger *d_new = (GrDragger *) di->data;
if (d_new == dragger)
continue;
- if (d_new->isA (draggable->item,
+ if (d_new->isA (draggable->item,
POINT_RG_CENTER,
draggable->fill_or_stroke)) {
// found the center of the radial gradient;
sp_item_gradient_edit_stop (draggable->item, draggable->point_num, draggable->fill_or_stroke);
}
-/**
+/**
Act upon all draggables of the dragger, setting them to the dragger's point
*/
void
@@ -556,7 +556,7 @@ GrDragger::fireDraggables (bool write_repr, bool scale_radial, bool merging_focu
// change gradient, optionally writing to repr; prevent focus from moving if it's snapped
// to the center, unless it's the first update upon merge when we must snap it to the point
- if (merging_focus ||
+ if (merging_focus ||
!(draggable->point_num == POINT_RG_FOCUS && this->isA(draggable->item, POINT_RG_CENTER, draggable->fill_or_stroke)))
sp_item_gradient_set_coords (draggable->item, draggable->point_num, this->point, draggable->fill_or_stroke, write_repr, scale_radial);
}
if (g_slist_length (this->draggables) == 1) {
GrDraggable *draggable = (GrDraggable *) this->draggables->data;
char *item_desc = sp_item_description(draggable->item);
- this->knot->tip = g_strdup_printf (_("%s for: %s%s; drag with <b>Ctrl</b> to snap angle, with <b>Ctrl+Alt</b> to preserve angle, with <b>Ctrl+Shift</b> to scale around center"),
+ this->knot->tip = g_strdup_printf (_("%s for: %s%s; drag with <b>Ctrl</b> to snap angle, with <b>Ctrl+Alt</b> to preserve angle, with <b>Ctrl+Shift</b> to scale around center"),
_(gr_knot_descr[draggable->point_num]),
item_desc,
draggable->fill_or_stroke == false ? _(" (stroke)") : "");
} else if (g_slist_length (draggables) == 2 && isA (POINT_RG_CENTER) && isA (POINT_RG_FOCUS)) {
this->knot->tip = g_strdup_printf (_("Radial gradient <b>center</b> and <b>focus</b>; drag with <b>Shift</b> to separate focus"));
} else {
- this->knot->tip = g_strdup_printf (_("Gradient point shared by <b>%d</b> gradients; drag with <b>Shift</b> to separate"),
+ this->knot->tip = g_strdup_printf (_("Gradient point shared by <b>%d</b> gradients; drag with <b>Shift</b> to separate"),
g_slist_length (this->draggables));
}
}
-GrDragger::GrDragger (GrDrag *parent, NR::Point p, GrDraggable *draggable)
+GrDragger::GrDragger (GrDrag *parent, NR::Point p, GrDraggable *draggable)
{
this->draggables = NULL;
@@ -823,7 +823,7 @@ GrDragger::moveOtherToDraggable (SPItem *item, guint point_num, bool fill_or_str
GrDragger *d = this->parent->getDraggerFor (item, point_num, fill_or_stroke);
if (d && d != this) {
d->moveThisToDraggable (item, point_num, fill_or_stroke, write_repr);
- }
+ }
}
@@ -831,7 +831,7 @@ GrDragger::moveOtherToDraggable (SPItem *item, guint point_num, bool fill_or_str
Set selected dragger
*/
void
-GrDrag::setSelected (GrDragger *dragger)
+GrDrag::setSelected (GrDragger *dragger)
{
if (this->selected) {
this->selected->knot->fill [SP_KNOT_STATE_NORMAL] = GR_KNOT_COLOR_NORMAL;
Create a line from p1 to p2 and add it to the lines list
*/
void
-GrDrag::addLine (NR::Point p1, NR::Point p2, guint32 rgba)
+GrDrag::addLine (NR::Point p1, NR::Point p2, guint32 rgba)
{
SPCanvasItem *line = sp_canvas_item_new(SP_DT_CONTROLS(this->desktop),
SP_TYPE_CTRLLINE, NULL);
If there already exists a dragger within MERGE_DIST of p, add the draggable to it; otherwise create
new dragger and add it to draggers list
*/
-void
+void
GrDrag::addDragger (GrDraggable *draggable)
{
NR::Point p = sp_item_gradient_get_coords (draggable->item, draggable->point_num, draggable->fill_or_stroke);
/**
Add draggers for the radial gradient rg on item
*/
-void
+void
GrDrag::addDraggersRadial (SPRadialGradient *rg, SPItem *item, bool fill_or_stroke)
{
addDragger (new GrDraggable (item, POINT_RG_CENTER, fill_or_stroke));
@@ -899,7 +899,7 @@ GrDrag::addDraggersRadial (SPRadialGradient *rg, SPItem *item, bool fill_or_stro
/**
Add draggers for the linear gradient lg on item
*/
-void
+void
GrDrag::addDraggersLinear (SPLinearGradient *lg, SPItem *item, bool fill_or_stroke)
{
addDragger (new GrDraggable (item, POINT_LG_P1, fill_or_stroke));
SPItem *item = SP_ITEM(i->data);
SPStyle *style = SP_OBJECT_STYLE (item);
- if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) {
+ if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) {
SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item);
if (SP_IS_LINEARGRADIENT (server)) {
addDraggersLinear (SP_LINEARGRADIENT (server), item, true);
}
}
- if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) {
+ if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) {
SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item);
if (SP_IS_LINEARGRADIENT (server)) {
addDraggersLinear (SP_LINEARGRADIENT (server), item, false);
SPStyle *style = SP_OBJECT_STYLE (item);
- if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) {
+ if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) {
SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item);
if (SP_IS_LINEARGRADIENT (server)) {
this->addLine (sp_item_gradient_get_coords (item, POINT_LG_P1, true), sp_item_gradient_get_coords (item, POINT_LG_P2, true), GR_LINE_COLOR_FILL);
}
}
- if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) {
+ if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) {
SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item);
if (SP_IS_LINEARGRADIENT (server)) {
this->addLine (sp_item_gradient_get_coords (item, POINT_LG_P1, false), sp_item_gradient_get_coords (item, POINT_LG_P2, false), GR_LINE_COLOR_STROKE);
diff --git a/src/grid-snapper.cpp b/src/grid-snapper.cpp
index 61bfa30d49195b4129f3204cd29e2b9a28d2ddef..f1d4e4bf6ffe5ce3a4d3662ea5cab55614f10abd 100644 (file)
--- a/src/grid-snapper.cpp
+++ b/src/grid-snapper.cpp
* Frank Felfe <innerspace@iname.com>
* Carl Hetherington <inkscape@carlh.net>
*
- * Copyright (C) 1999-2002 Authors
+ * Copyright (C) 1999-2002 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
{
LineList s;
- SPCGrid *griditem = NULL;
+ SPCGrid *griditem = NULL;
for (GSList *l = _named_view->gridviews; l != NULL; l = l->next) {
// FIXME : this is a hack since there is only one view for now
// but when we'll handle multiple views, snapping should
}
g_assert(griditem != NULL);
-
+
for (unsigned int i = 0; i < 2; ++i) {
/* This is to make sure we snap to only visible grid lines */
NR::Coord const rounded = round_to_nearest_multiple_plus(p[i],
_named_view->gridspacing[i] * scale,
_named_view->gridorigin[i]);
-
+
s.push_back(std::make_pair(NR::Dim2(i), rounded));
}
diff --git a/src/guide-snapper.cpp b/src/guide-snapper.cpp
index e247c0451ae843dfd1c7039d738fbcca7ffe96d1..fbf1af0af1bd61c38e64177b90bfcd32cd1759ea 100644 (file)
--- a/src/guide-snapper.cpp
+++ b/src/guide-snapper.cpp
* Frank Felfe <innerspace@iname.com>
* Carl Hetherington <inkscape@carlh.net>
*
- * Copyright (C) 1999-2002 Authors
+ * Copyright (C) 1999-2002 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point const &p) const
{
LineList s;
-
+
for (GSList const *l = _named_view->guides; l != NULL; l = l->next) {
SPGuide const *g = SP_GUIDE(l->data);
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 9c0d93173b8ae4cc084259df75dcb7585147a453..71c5d422fcb4217868ff36a7b6341b3933becf01 100644 (file)
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
static void inkscape_activate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop);
static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop);
-static bool inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, const gchar *skeleton,
+static bool inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, const gchar *skeleton,
unsigned int skel_size,
const gchar *e_mkdir,
const gchar *e_notdir,
/**
* Retrieves the GType for the Inkscape Application object.
- */
+ */
GType
inkscape_get_type (void)
{
{
inkscape = (Inkscape::Application *)g_object_new (SP_TYPE_INKSCAPE, NULL);
/* fixme: load application defaults */
-
+
segv_handler = signal (SIGSEGV, inkscape_segv_handler);
signal (SIGFPE, inkscape_segv_handler);
signal (SIGILL, inkscape_segv_handler);
-#ifndef WIN32
+#ifndef WIN32
signal (SIGBUS, inkscape_segv_handler);
-#endif
+#endif
signal (SIGABRT, inkscape_segv_handler);
inkscape->use_gui = use_gui;
/**
* Preference management
* We use '.' as separator
- *
+ *
* Returns TRUE if the config file was successfully loaded, FALSE if not.
*/
bool
-inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton,
- unsigned int skel_size, const gchar *e_notreg, const gchar *e_notxml,
+inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton,
+ unsigned int skel_size, const gchar *e_notreg, const gchar *e_notxml,
const gchar *e_notsp, const gchar *warn)
{
gchar *fn = profile_path(filename);
if (!Inkscape::IO::file_test(fn, G_FILE_TEST_EXISTS)) {
bool result;
/* No such file */
- result = inkscape_init_config (config, filename, skeleton,
+ result = inkscape_init_config (config, filename, skeleton,
skel_size,
_("Cannot create directory %s.\n%s"),
_("%s is not a valid directory.\n%s"),
_("Cannot create file %s.\n%s"),
- _("Cannot write file %s.\n%s"),
+ _("Cannot write file %s.\n%s"),
_("Although Inkscape will run, it will use default settings,\n"
"and any changes made in preferences will not be saved."));
g_free (fn);
@@ -672,7 +672,7 @@ inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, co
/**
* Menus management
- *
+ *
*/
bool
inkscape_load_menus (Inkscape::Application *inkscape)
gchar *fn = profile_path(MENUS_FILE);
bool retval = false;
if (Inkscape::IO::file_test(fn, G_FILE_TEST_EXISTS)) {
- retval = inkscape_load_config (MENUS_FILE,
- inkscape->menus,
- menus_skeleton,
+ retval = inkscape_load_config (MENUS_FILE,
+ inkscape->menus,
+ menus_skeleton,
MENUS_SKELETON_SIZE,
_("%s is not a regular file.\n%s"),
_("%s not a valid XML file, or\n"
} else {
len = strlen (s);
}
-
+
Inkscape::XML::Node* child;
for (child = repr->firstChild(); child != NULL; child = child->next()) {
gchar const *id = child->attribute("id");
inkscape_add_desktop (SPDesktop * desktop)
{
g_return_if_fail (desktop != NULL);
-
+
if (Inkscape::NSApplication::Application::getNewGui())
{
Inkscape::NSApplication::Editor::addDesktop (desktop);
#####################*/
static bool
-inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, const gchar *skeleton,
+inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, const gchar *skeleton,
unsigned int skel_size,
- const gchar *e_mkdir,
- const gchar *e_notdir,
- const gchar *e_ccf,
- const gchar *e_cwf,
+ const gchar *e_mkdir,
+ const gchar *e_notdir,
+ const gchar *e_ccf,
+ const gchar *e_cwf,
const gchar *warn)
{
gchar *dn = profile_path(NULL);
inkscape_exit (Inkscape::Application *inkscape)
{
g_assert (INKSCAPE);
-
+
//emit shutdown signal so that dialogs could remember layout
g_signal_emit (G_OBJECT (INKSCAPE), inkscape_signals[SHUTDOWN_SIGNAL], 0);
diff --git a/src/inkview.cpp b/src/inkview.cpp
index fffa0acdf77f68741850368dfa348952c2e8c346..8be261dcdfc3273213cb352c1bbbfe49b1fe2e19 100644 (file)
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
- *
+ *
* Inkscape authors:
* Johan Ceuppens
- *
+ *
* Copyright (C) 2004 Inkscape authors
- *
+ *
* Released under GNU GPL, read the file 'COPYING' for more information
*/
diff --git a/src/interface.cpp b/src/interface.cpp
index 69ed8818b20af067c2e4cf0ded0c787c97639c80..4a7c12f7688fae9b19e9db60134f92c53323ee24 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
g_return_if_fail(SP_IS_VIEW_WIDGET(vw));
w = sp_window_new("", TRUE);
-
+
if (editable) {
g_object_set_data(G_OBJECT(vw), "window", w);
- reinterpret_cast<SPDesktopWidget*>(vw)->window =
+ reinterpret_cast<SPDesktopWidget*>(vw)->window =
static_cast<GtkWindow*>((void*)w);
}
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
// Add it to the current layer
-
+
// Greg's edits to add intelligent positioning of svg drops
SPObject *new_obj = NULL;
new_obj = desktop->currentLayer()->appendChildRepr(newgroup);
diff --git a/src/knot.cpp b/src/knot.cpp
index 12fa710663fd41a1a4c56bbe1cd57622f5186856..15fde68ff287cd43e8ab003989e7f28bcb7808c1 100644 (file)
--- a/src/knot.cpp
+++ b/src/knot.cpp
enum {
PROP_0,
-
+
PROP_SIZE,
PROP_ANCHOR,
PROP_SHAPE,
PROP_CURSOR, PROP_CURSOR_MOUSEOVER, PROP_CURSOR_DRAGGING,
PROP_PIXBUF,
PROP_TIP,
-
+
PROP_LAST
};
GObjectClass *object_class = (GObjectClass *) klass;
parent_class = (GObjectClass*) g_type_class_peek_parent(klass);
-
+
object_class->dispose = sp_knot_dispose;
object_class->set_property = sp_knot_set_property;
object_class->get_property = sp_knot_get_property;
/* Huh :) */
-
+
g_object_class_install_property(object_class,
PROP_SIZE,
g_param_spec_uint("size", "Size", "",
SP_KNOT_SHAPE_IMAGE,
SP_KNOT_SHAPE_SQUARE,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_MODE,
g_param_spec_int("mode", "Mode", "",
SP_KNOT_MODE_XOR,
SP_KNOT_MODE_XOR,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_FILL,
g_param_spec_uint("fill", "Fill", "",
0xffffffff,
0xff000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_FILL_MOUSEOVER,
g_param_spec_uint("fill_mouseover", "Fill mouse over", "",
0xffffffff,
0xff000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_FILL_DRAGGING,
g_param_spec_uint("fill_dragging", "Fill dragging", "",
0xffffffff,
0xff000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_STROKE,
g_param_spec_uint("stroke", "Stroke", "",
0xffffffff,
0x01000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_STROKE_MOUSEOVER,
g_param_spec_uint("stroke_mouseover", "Stroke mouseover", "",
0xffffffff,
0x01000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_STROKE_DRAGGING,
g_param_spec_uint("stroke_dragging", "Stroke dragging", "",
0xffffffff,
0x01000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_IMAGE,
g_param_spec_pointer("image", "Image", "",
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_IMAGE_MOUSEOVER,
g_param_spec_pointer("image_mouseover", "Image mouseover", "",
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_IMAGE_DRAGGING,
g_param_spec_pointer("image_dragging", "Image dragging", "",
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_CURSOR,
g_param_spec_boxed("cursor", "Cursor", "",
GDK_TYPE_CURSOR,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_CURSOR_MOUSEOVER,
g_param_spec_boxed("cursor_mouseover", "Cursor mouseover", "",
GDK_TYPE_CURSOR,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_CURSOR_DRAGGING,
g_param_spec_boxed("cursor_dragging", "Cursor dragging", "",
GDK_TYPE_CURSOR,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_PIXBUF,
g_param_spec_pointer("pixbuf", "Pixbuf", "",
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(object_class,
PROP_TIP,
g_param_spec_pointer("tip", "Tip", "",
(GParamFlags) G_PARAM_READWRITE));
-
+
knot_signals[EVENT] = g_signal_new("event",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
sp_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT);
-
+
knot_signals[CLICKED] = g_signal_new("clicked",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
sp_marshal_NONE__UINT,
G_TYPE_NONE, 1,
G_TYPE_UINT);
-
+
knot_signals[DOUBLECLICKED] = g_signal_new("doubleclicked",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
sp_marshal_NONE__UINT,
G_TYPE_NONE, 1,
G_TYPE_UINT);
-
+
knot_signals[GRABBED] = g_signal_new("grabbed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
sp_marshal_NONE__UINT,
G_TYPE_NONE, 1,
G_TYPE_UINT);
-
+
knot_signals[UNGRABBED] = g_signal_new("ungrabbed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
sp_marshal_NONE__UINT,
G_TYPE_NONE, 1,
G_TYPE_UINT);
-
+
knot_signals[MOVED] = g_signal_new("moved",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
sp_marshal_NONE__POINTER_UINT,
G_TYPE_NONE, 2,
G_TYPE_POINTER, G_TYPE_UINT);
-
+
knot_signals[REQUEST] = g_signal_new("request",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
sp_marshal_BOOLEAN__POINTER_UINT,
G_TYPE_BOOLEAN, 2,
G_TYPE_POINTER, G_TYPE_UINT);
-
+
knot_signals[DISTANCE] = g_signal_new("distance",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
knot->desktop = NULL;
knot->item = NULL;
knot->flags = 0;
-
+
knot->size = 8;
knot->pos = NR::Point(0, 0);
knot->grabbed_rel_pos = NR::Point(0, 0);
knot->shape = SP_KNOT_SHAPE_SQUARE;
knot->mode = SP_KNOT_MODE_XOR;
knot->tip = NULL;
-
+
knot->fill[SP_KNOT_STATE_NORMAL] = 0xffffff00;
knot->fill[SP_KNOT_STATE_MOUSEOVER] = 0xff0000ff;
knot->fill[SP_KNOT_STATE_DRAGGING] = 0x0000ffff;
@@ -422,7 +422,7 @@ static void sp_knot_set_property(GObject *object, guint prop_id, const GValue *v
knot->fill[SP_KNOT_STATE_DRAGGING] = g_value_get_uint(value);
break;
case PROP_FILL_MOUSEOVER:
- knot->fill[SP_KNOT_STATE_MOUSEOVER] =
+ knot->fill[SP_KNOT_STATE_MOUSEOVER] =
knot->fill[SP_KNOT_STATE_DRAGGING] = g_value_get_uint(value);
break;
case PROP_FILL_DRAGGING:
@@ -434,7 +434,7 @@ static void sp_knot_set_property(GObject *object, guint prop_id, const GValue *v
knot->stroke[SP_KNOT_STATE_DRAGGING] = g_value_get_uint(value);
break;
case PROP_STROKE_MOUSEOVER:
- knot->stroke[SP_KNOT_STATE_MOUSEOVER] =
+ knot->stroke[SP_KNOT_STATE_MOUSEOVER] =
knot->stroke[SP_KNOT_STATE_DRAGGING] = g_value_get_uint(value);
break;
case PROP_STROKE_DRAGGING:
@@ -493,7 +493,7 @@ static void sp_knot_set_property(GObject *object, guint prop_id, const GValue *v
g_assert_not_reached();
break;
}
-
+
sp_knot_update_ctrl(knot);
}
void sp_knot_start_dragging(SPKnot *knot, NR::Point p, gint x, gint y, guint32 etime)
{
// save drag origin
- xp = x;
+ xp = x;
yp = y;
within_tolerance = true;
case GDK_MOTION_NOTIFY:
if (grabbed) {
consumed = TRUE;
-
+
if ( within_tolerance
&& ( abs( (gint) event->motion.x - xp ) < tolerance )
&& ( abs( (gint) event->motion.y - yp ) < tolerance ) ) {
break; // do not drag if we're within tolerance from origin
}
-
- // Once the user has moved farther than tolerance from the original location
- // (indicating they intend to move the object, not click), then always process the
+
+ // Once the user has moved farther than tolerance from the original location
+ // (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
- within_tolerance = false;
-
+ within_tolerance = false;
+
if (!moved) {
g_signal_emit(G_OBJECT (knot),
knot_signals[GRABBED], 0,
grabbed = FALSE;
moved = FALSE;
-
+
consumed = TRUE;
break;
case GDK_KEY_PRESS: // keybindings for knot
- switch (get_group0_keyval(&event->key)) {
+ switch (get_group0_keyval(&event->key)) {
case GDK_Escape:
sp_knot_set_flag(knot, SP_KNOT_GRABBED, FALSE);
if (!nograb) {
knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled."));
transform_escaped = true;
consumed = TRUE;
- }
+ }
grabbed = FALSE;
moved = FALSE;
break;
{
g_return_if_fail(knot != NULL);
g_return_if_fail(SP_IS_KNOT (knot));
-
+
sp_knot_set_flag(knot, SP_KNOT_VISIBLE, TRUE);
}
p,
state,
&distance);
-
+
return distance;
}
g_return_if_fail(SP_IS_KNOT(knot));
knot->pos = *p;
-
+
if (knot->item) {
SP_CTRL(knot->item)->moveto (*p);
}
- sp_knot_set_flag(knot, SP_KNOT_MOUSEOVER, FALSE);
+ sp_knot_set_flag(knot, SP_KNOT_MOUSEOVER, FALSE);
}
/**
{
g_assert(knot != NULL);
g_assert(SP_IS_KNOT (knot));
-
+
return knot->pos;
}
{
g_assert(knot != NULL);
g_assert(SP_IS_KNOT(knot));
-
+
if (set) {
knot->flags |= flag;
} else {
knot->flags &= ~flag;
}
-
+
switch (flag) {
case SP_KNOT_VISIBLE:
if (set) {
if (!knot->item) {
return;
}
-
+
gtk_object_set(GTK_OBJECT(knot->item), "shape", knot->shape, NULL);
gtk_object_set(GTK_OBJECT(knot->item), "mode", knot->mode, NULL);
gtk_object_set(GTK_OBJECT(knot->item), "size", (gdouble) knot->size, NULL);
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 70a234260f34bb5f87bfb8217d2182eb4a7570cc..0ea3ed98ab49ab9c1c377aa7236c81dbc37ee8a6 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
g_free(e);
kh->entity = g_slist_remove(kh->entity, e);
}
-
+
g_free(kh);
}
}
static void knotholder_update_knots(SPKnotHolder *knot_holder, SPItem *item)
{
NR::Matrix const i2d(sp_item_i2d_affine(item));
-
+
for (GSList *el = knot_holder->entity; el; el = el->next) {
SPKnotHolderEntity *e = (SPKnotHolderEntity *) el->data;
GObject *kob = G_OBJECT(e->knot);
-
+
NR::Point dp( e->knot_get(item) * i2d );
g_signal_handler_block(kob, e->handler_id);
sp_knot_set_position(e->knot, &dp, SP_KNOT_STATE_NORMAL);
knotholder_update_knots(knot_holder, item);
// for drag, this is done by ungrabbed_handler, but for click we must do it here
- sp_document_done(SP_OBJECT_DOCUMENT(knot_holder->item));
+ sp_document_done(SP_OBJECT_DOCUMENT(knot_holder->item));
}
static void knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, gpointer data)
@@ -188,8 +188,8 @@ static void knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, gp
SPKnotHolder *knot_holder = (SPKnotHolder *) data;
SPItem *item = SP_ITEM (knot_holder->item);
// this was a local change and the knotholder does not need to be recreated:
- knot_holder->local_change = TRUE;
-
+ knot_holder->local_change = TRUE;
+
for (GSList *el = knot_holder->entity; el; el = el->next) {
SPKnotHolderEntity *e = (SPKnotHolderEntity *) el->data;
if (e->knot == knot) {
diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp
index fadcd0f1e319338e02c97b72640396b1343f853a..c143336cc26a273f622b884f3a2f5b6742774d41 100644 (file)
--- a/src/layer-fns.cpp
+++ b/src/layer-fns.cpp
namespace Inkscape {
-/**
+/**
* Creates a new layer. Advances to the next layer id indicated
- * by the string "layerNN", then creates a new group object of
+ * by the string "layerNN", then creates a new group object of
* that id with attribute inkscape:groupmode='layer', and finally
* appends the new group object to \a root after object \a layer.
*
} else {
return last_elder_layer(root, SP_OBJECT_PARENT(layer));
}
- }
+ }
return NULL;
}
diff --git a/src/message-stack.cpp b/src/message-stack.cpp
index 23ff1435f715b38982fab10e7827e9b4f41a079b..ae65e3421ed7490bd727b983c9ffbfc89968c861 100644 (file)
--- a/src/message-stack.cpp
+++ b/src/message-stack.cpp
@@ -104,11 +104,11 @@ MessageId MessageStack::_push(MessageType type, guint lifetime, gchar const *mes
m->message = g_strdup(message);
if (lifetime) {
- m->timeout_id = g_timeout_add(lifetime, &MessageStack::_timeout, m);
+ m->timeout_id = g_timeout_add(lifetime, &MessageStack::_timeout, m);
} else {
m->timeout_id = 0;
}
-
+
m->next = _messages;
_messages = m;
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 747fa65b3eb86155a32f7eeaf245e380ff3db604..53130f5f8ba995414e0d3ab7d6a90a022bd1e9d6 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
if (ec->shape_knot_holder)
repr = ec->shape_knot_holder->repr;
else
- repr = SP_OBJECT_REPR(item);
+ repr = SP_OBJECT_REPR(item);
if (repr) {
Inkscape::GC::anchor(repr);
sp_repr_add_listener(repr, &nodepath_repr_events, ec);
@@ -256,7 +256,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
if (ec->shape_knot_holder)
repr = ec->shape_knot_holder->repr;
else
- repr = SP_OBJECT_REPR(item);
+ repr = SP_OBJECT_REPR(item);
if (repr) {
Inkscape::GC::anchor(repr);
sp_repr_add_listener(repr, &nodepath_repr_events, ec);
@@ -369,8 +369,8 @@ sp_node_context_show_modifier_tip(SPEventContext *event_context, GdkEvent *event
_("<b>Alt</b>: lock handle length; <b>Ctrl+Alt</b>: move along handles"));
}
-bool
-sp_node_context_is_over_stroke (SPNodeContext *nc, SPItem *item, NR::Point event_p, bool remember)
+bool
+sp_node_context_is_over_stroke (SPNodeContext *nc, SPItem *item, NR::Point event_p, bool remember)
{
SPDesktop *desktop = SP_EVENT_CONTEXT (nc)->desktop;
@@ -385,11 +385,11 @@ sp_node_context_is_over_stroke (SPNodeContext *nc, SPItem *item, NR::Point event
delta = desktop->d2w(delta);
- double stroke_tolerance =
- (SP_OBJECT_STYLE (item)->stroke.type != SP_PAINT_TYPE_NONE?
- desktop->current_zoom() *
- SP_OBJECT_STYLE (item)->stroke_width.computed *
- sp_item_i2d_affine (item).expansion() * 0.5
+ double stroke_tolerance =
+ (SP_OBJECT_STYLE (item)->stroke.type != SP_PAINT_TYPE_NONE?
+ desktop->current_zoom() *
+ SP_OBJECT_STYLE (item)->stroke_width.computed *
+ sp_item_i2d_affine (item).expansion() * 0.5
: 0.0)
+ (double) SP_EVENT_CONTEXT(nc)->tolerance;
@@ -424,11 +424,11 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
if (!nc->drag) {
// find out clicked item, disregarding groups, honoring Alt
- SPItem *item_clicked = sp_event_context_find_item (desktop,
+ SPItem *item_clicked = sp_event_context_find_item (desktop,
NR::Point(event->button.x, event->button.y),
(event->button.state & GDK_MOD1_MASK) && !(event->button.state & GDK_CONTROL_MASK), TRUE);
// find out if we're over the selected item, disregarding groups
- SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
+ SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
NR::Point(event->button.x, event->button.y));
bool over_stroke = false;
if (item_over && nc->nodepath) {
@@ -453,7 +453,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
sp_nodepath_select_segment_near_point(item_over, nc->curvepoint_doc, false);
}
}
- break;
+ break;
case GDK_2BUTTON_PRESS:
//add a node
sp_nodepath_add_node_near_point(item_over, nc->curvepoint_doc);
@@ -461,7 +461,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
break;
default:
break;
- }
+ }
} else if (event->button.state & GDK_SHIFT_MASK) {
selection->toggle(item_clicked);
} else {
@@ -483,7 +483,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
if (!nc->drag) {
// find out if we're over the selected item, disregarding groups
- SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
+ SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
NR::Point(event->button.x, event->button.y));
if (nc->nodepath && selection->single() && item_over) {
event->motion.y - nc->curvepoint_event[NR::Y]);
NR::Point const delta_dt(desktop->w2d(delta_w));
sp_nodepath_curve_drag (nc->grab_node, nc->grab_t, delta_dt, undo_label);
- nc->curvepoint_event[NR::X] = (gint) event->motion.x;
+ nc->curvepoint_event[NR::X] = (gint) event->motion.x;
nc->curvepoint_event[NR::Y] = (gint) event->motion.y;
gobble_motion_events(GDK_BUTTON1_MASK);
} else {
break;
}
- SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
+ SPItem *item_over = sp_event_context_over_item (desktop, selection->singleItem(),
NR::Point(event->motion.x, event->motion.y));
bool over_stroke = false;
if (item_over && nc->nodepath) {
if (event->button.button == 1) {
NR::Maybe<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
-
+
if (nc->hit && !event_context->within_tolerance) { //drag curve
if (undo_label == undo_label_1)
undo_label = undo_label_2;
- else
+ else
undo_label = undo_label_1;
} else if (b != NR::Nothing() && !event_context->within_tolerance) { // drag to select
if (nc->nodepath) {
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 3a76e785061009bd06573ab69d87bc17251e51b0..6b470da26ca66a1cba4fde6bdf3c2531ccff391e 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
/// evil evil evil. FIXME: conflict of two different Path classes!
/// There is a conflict in the namespace between two classes named Path.
/// #include "sp-flowtext.h"
-/// #include "sp-flowregion.h"
+/// #include "sp-flowregion.h"
#define SP_TYPE_FLOWREGION (sp_flowregion_get_type ())
#define SP_IS_FLOWREGION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_FLOWREGION))
@@ -131,7 +131,7 @@ static NRPathcode sp_node_path_code_from_side(Inkscape::NodePath::Node *node,Ink
static Inkscape::NodePath::Node *active_node = NULL;
/**
- * \brief Creates new nodepath from item
+ * \brief Creates new nodepath from item
*/
Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPItem *item)
{
np->nodeContext = NULL; //Let the context that makes this set it
// we need to update item's transform from the repr here,
- // because they may be out of sync when we respond
+ // because they may be out of sync when we respond
// to a change in repr by regenerating nodepath --bb
sp_object_read_attr(SP_OBJECT(item), "transform");
/**
* Clean up a nodepath after editing.
- *
+ *
* Currently we are deleting trivial subpaths.
*/
static void sp_nodepath_cleanup(Inkscape::NodePath::Path *nodepath)
/**
- * \brief Returns true if the argument nodepath and the d attribute in
- * its repr do not match.
+ * \brief Returns true if the argument nodepath and the d attribute in
+ * its repr do not match.
+ *
+ * This may happen if repr was changed in, e.g., XML editor or by undo.
*
- * This may happen if repr was changed in, e.g., XML editor or by undo.
- *
* \todo
* UGLY HACK, think how we can eliminate it.
*/
@@ -307,7 +307,7 @@ gboolean nodepath_repr_d_changed(Inkscape::NodePath::Path *np, char const *newd)
gboolean ret;
if (attr_d && svgpath)
ret = strcmp(attr_d, svgpath);
- else
+ else
ret = TRUE;
g_free(svgpath);
@@ -317,8 +317,8 @@ gboolean nodepath_repr_d_changed(Inkscape::NodePath::Path *np, char const *newd)
}
/**
- * \brief Returns true if the argument nodepath and the sodipodi:nodetypes
- * attribute in its repr do not match.
+ * \brief Returns true if the argument nodepath and the sodipodi:nodetypes
+ * attribute in its repr do not match.
*
* This may happen if repr was changed in, e.g., the XML editor or by undo.
*/
@@ -681,7 +681,7 @@ static void sp_nodepath_line_midpoint(Inkscape::NodePath::Node *new_path,Inkscap
}
/**
- * Adds new node on direct line between two nodes, activates handles of all
+ * Adds new node on direct line between two nodes, activates handles of all
* three nodes.
*/
static Inkscape::NodePath::Node *sp_nodepath_line_add_node(Inkscape::NodePath::Node *end, gdouble t)
@@ -847,7 +847,7 @@ static Inkscape::NodePath::Node *sp_nodepath_set_node_type(Inkscape::NodePath::N
}
/**
- * Same as sp_nodepath_set_node_type(), but also converts, if necessary,
+ * Same as sp_nodepath_set_node_type(), but also converts, if necessary,
* adjacent segments from lines to curves.
*/
void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::NodePath::NodeType type)
@@ -859,7 +859,7 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod
NR::Point delta;
if (node->n.other != NULL)
delta = node->n.other->pos - node->p.other->pos;
- else
+ else
delta = node->pos - node->p.other->pos;
node->p.pos = node->pos - delta / 4;
sp_node_ensure_ctrls(node);
@@ -871,7 +871,7 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod
NR::Point delta;
if (node->p.other != NULL)
delta = node->p.other->pos - node->n.other->pos;
- else
+ else
delta = node->pos - node->n.other->pos;
node->n.pos = node->pos - delta / 4;
sp_node_ensure_ctrls(node);
@@ -1227,7 +1227,7 @@ sp_nodepath_select_segment_near_point(SPItem * item, NR::Point p, bool toggle)
gboolean force = FALSE;
if (!(e->selected && (!e->p.other || e->p.other->selected))) {
force = TRUE;
- }
+ }
sp_nodepath_node_select(e, (gboolean) toggle, force);
if (e->p.other)
sp_nodepath_node_select(e->p.other, TRUE, force);
//find segment to split
Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(position.piece);
-
+
//don't know why but t seems to flip for lines
if (sp_node_path_code_from_side(e, sp_node_get_side(e, -1)) == NR_LINETO) {
position.t = 1.0 - position.t;
* cf. app/vectors/gimpbezierstroke.c, gimp_bezier_stroke_point_move_relative()
*/
void
-sp_nodepath_curve_drag(Inkscape::NodePath::Node * e, double t, NR::Point delta, char * key)
+sp_nodepath_curve_drag(Inkscape::NodePath::Node * e, double t, NR::Point delta, char * key)
{
/* feel good is an arbitrary parameter that distributes the delta between handles
* if t of the drag point is less than 1/6 distance form the endpoint only
@@ -1291,7 +1291,7 @@ sp_nodepath_curve_drag(Inkscape::NodePath::Node * e, double t, NR::Point delta,
feel_good = (1 - pow((6 * (1-t) - 1) / 2.0, 3)) / 2 + 0.5;
else
feel_good = 1;
-
+
//if we're dragging a line convert it to a curve
if (sp_node_path_code_from_side(e, sp_node_get_side(e, -1))==NR_LINETO) {
sp_nodepath_set_line_type(e, NR_CURVETO);
}
}
-/**
- * If nothing selected, does the same as sp_nodepath_select_all();
- * otherwise selects/inverts all nodes in all subpaths that have selected nodes
- * (i.e., similar to "select all in layer", with the "selected" subpaths
+/**
+ * If nothing selected, does the same as sp_nodepath_select_all();
+ * otherwise selects/inverts all nodes in all subpaths that have selected nodes
+ * (i.e., similar to "select all in layer", with the "selected" subpaths
* being treated as "layers" in the path).
*/
void
@@ -1940,7 +1940,7 @@ sp_nodepath_select_all_from_subpath(Inkscape::NodePath::Path *nodepath, bool inv
}
/**
- * \brief Select the node after the last selected; if none is selected,
+ * \brief Select the node after the last selected; if none is selected,
* select the first within path.
*/
void sp_nodepath_select_next(Inkscape::NodePath::Path *nodepath)
}
/**
- * \brief Select the node before the first selected; if none is selected,
+ * \brief Select the node before the first selected; if none is selected,
* select the last within path
*/
void sp_nodepath_select_prev(Inkscape::NodePath::Path *nodepath)
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) data;
// If either (Shift and some handle retracted), or (we're already dragging out a handle)
- if (((state & GDK_SHIFT_MASK) && ((n->n.other && n->n.pos == n->pos) || (n->p.other && n->p.pos == n->pos))) || n->dragging_out) {
+ if (((state & GDK_SHIFT_MASK) && ((n->n.other && n->n.pos == n->pos) || (n->p.other && n->p.pos == n->pos))) || n->dragging_out) {
NR::Point mouse = (*p);
@@ -2950,7 +2950,7 @@ void sp_nodepath_selected_nodes_rotate(Inkscape::NodePath::Path *nodepath, gdoub
Inkscape::NodePath::Node *n0 = (Inkscape::NodePath::Node *) nodepath->selected->data;
NR::Rect box (n0->pos, n0->pos); // originally includes the first selected node
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
box.expandTo (n->pos); // contain all selected nodes
}
@@ -2965,12 +2965,12 @@ void sp_nodepath_selected_nodes_rotate(Inkscape::NodePath::Path *nodepath, gdoub
rot = angle;
}
- NR::Matrix t =
- NR::Matrix (NR::translate(-box.midpoint())) *
- NR::Matrix (NR::rotate(rot)) *
+ NR::Matrix t =
+ NR::Matrix (NR::translate(-box.midpoint())) *
+ NR::Matrix (NR::rotate(rot)) *
NR::Matrix (NR::translate(box.midpoint()));
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
n->pos *= t;
n->n.pos *= t;
@@ -3002,14 +3002,14 @@ static void node_scale_one (Inkscape::NodePath::Node *n, gdouble grow, int which
} else if (!n->p.other) {
me = &(n->n);
other = &(n->p);
- if (n->n.other)
+ if (n->n.other)
n->n.other->code = NR_CURVETO;
} else {
if (which > 0) { // right handle
if (xn > xp) {
me = &(n->n);
other = &(n->p);
- if (n->n.other)
+ if (n->n.other)
n->n.other->code = NR_CURVETO;
} else {
me = &(n->p);
@@ -3020,7 +3020,7 @@ static void node_scale_one (Inkscape::NodePath::Node *n, gdouble grow, int which
if (xn <= xp) {
me = &(n->n);
other = &(n->p);
- if (n->n.other)
+ if (n->n.other)
n->n.other->code = NR_CURVETO;
} else {
me = &(n->p);
@@ -3032,7 +3032,7 @@ static void node_scale_one (Inkscape::NodePath::Node *n, gdouble grow, int which
other = &(n->p);
both = true;
n->code = NR_CURVETO;
- if (n->n.other)
+ if (n->n.other)
n->n.other->code = NR_CURVETO;
}
}
@@ -3083,19 +3083,19 @@ void sp_nodepath_selected_nodes_scale(Inkscape::NodePath::Path *nodepath, gdoubl
Inkscape::NodePath::Node *n0 = (Inkscape::NodePath::Node *) nodepath->selected->data;
NR::Rect box (n0->pos, n0->pos); // originally includes the first selected node
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
box.expandTo (n->pos); // contain all selected nodes
}
double scale = (box.maxExtent() + grow)/box.maxExtent();
- NR::Matrix t =
- NR::Matrix (NR::translate(-box.midpoint())) *
- NR::Matrix (NR::scale(scale, scale)) *
+ NR::Matrix t =
+ NR::Matrix (NR::translate(-box.midpoint())) *
+ NR::Matrix (NR::scale(scale, scale)) *
NR::Matrix (NR::translate(box.midpoint()));
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
n->pos *= t;
n->n.pos *= t;
Inkscape::NodePath::Node *n0 = (Inkscape::NodePath::Node *) nodepath->selected->data;
NR::Rect box (n0->pos, n0->pos); // originally includes the first selected node
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
box.expandTo (n->pos); // contain all selected nodes
}
- NR::Matrix t =
- NR::Matrix (NR::translate(-box.midpoint())) *
- NR::Matrix ((axis == NR::X)? NR::scale(-1, 1) : NR::scale(1, -1)) *
+ NR::Matrix t =
+ NR::Matrix (NR::translate(-box.midpoint())) *
+ NR::Matrix ((axis == NR::X)? NR::scale(-1, 1) : NR::scale(1, -1)) *
NR::Matrix (NR::translate(box.midpoint()));
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
n->pos *= t;
n->n.pos *= t;
@@ -3253,7 +3253,7 @@ static void sp_nodepath_subpath_open(Inkscape::NodePath::SubPath *sp,Inkscape::N
* Returns area in triangle given by points; may be negative.
*/
inline double
-triangle_area (NR::Point p1, NR::Point p2, NR::Point p3)
+triangle_area (NR::Point p1, NR::Point p2, NR::Point p3)
{
return (p1[NR::X]*p2[NR::Y] + p1[NR::Y]*p3[NR::X] + p2[NR::X]*p3[NR::Y] - p2[NR::Y]*p3[NR::X] - p1[NR::Y]*p2[NR::X] - p1[NR::X]*p3[NR::Y]);
}
@@ -3514,11 +3514,11 @@ static NRPathcode sp_node_path_code_from_side(Inkscape::NodePath::Node *node,Ink
/**
* Call sp_nodepath_line_add_node() at t on the segment denoted by piece
*/
-Inkscape::NodePath::Node *
+Inkscape::NodePath::Node *
sp_nodepath_get_node_by_index(int index)
{
Inkscape::NodePath::Node *e = NULL;
-
+
Inkscape::NodePath::Path *nodepath = sp_nodepath_current();
if (!nodepath) {
return e;
//find segment
for (GList *l = nodepath->subpaths; l ; l=l->next) {
-
+
Inkscape::NodePath::SubPath *sp = (Inkscape::NodePath::SubPath *)l->data;
int n = g_list_length(sp->nodes);
if (sp->closed) {
n++;
- }
-
+ }
+
//if the piece belongs to this subpath grab it
//otherwise move onto the next subpath
if (index < n) {
}
}
}
-
+
return e;
}
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 3db0f0a21837122d2a181877110297054a19c70e..d96585509ca7882b059e4f0c883b21702ce0c062 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -227,12 +227,12 @@ static void sp_rect_rx_set(SPItem *item, NR::Point const &p, NR::Point const &or
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
rect->rx.computed = rect->ry.computed = CLAMP(rect->x.computed + rect->width.computed - p[NR::X], 0.0, temp);
rect->rx._set = rect->ry._set = true;
-
+
} else {
rect->rx.computed = CLAMP(rect->x.computed + rect->width.computed - p[NR::X], 0.0, rect->width.computed / 2.0);
rect->rx._set = true;
}
-
+
((SPObject*)rect)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
@@ -248,7 +248,7 @@ static void sp_rect_ry_set(SPItem *item, NR::Point const &p, NR::Point const &or
{
SPRect *rect = SP_RECT(item);
- if (state & GDK_CONTROL_MASK) {
+ if (state & GDK_CONTROL_MASK) {
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
rect->rx.computed = rect->ry.computed = CLAMP(p[NR::Y] - rect->y.computed, 0.0, temp);
rect->ry._set = rect->rx._set = true;
index 30f13e49a2b87a59474f2633efbeb7e7aeddfb6e..658bcb511ea251b5ead33f5b91e6b9f98c5d1b83 100644 (file)
--- a/src/object-hierarchy.cpp
+++ b/src/object-hierarchy.cpp
}
/**
- * Add hierarchy from junior's parent to senior to this
+ * Add hierarchy from junior's parent to senior to this
* hierarchy's top.
*/
void ObjectHierarchy::_addTop(SPObject *senior, SPObject *junior) {
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 6552cea969379d561c9fc3b7401af6056e6124ac..153abe4affe58a0d8027f8d1a495fdbfc171c537 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
* Authors:
* Carl Hetherington <inkscape@carlh.net>
*
- * Copyright (C) 2005 Authors
+ * Copyright (C) 2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
Inkscape::ObjectSnapper::ObjectSnapper(SPNamedView const *nv, NR::Coord const d)
: Snapper(nv, d), _snap_to_nodes(true), _snap_to_paths(true)
{
-
+
}
while (i != it.end() && *i != o) {
i++;
}
-
+
if (i == it.end()) {
/* See if the item is within range */
NR::Rect const b = NR::expand(sp_item_bbox_desktop(SP_ITEM(o)), -getDistance());
}
}
}
-
+
_findCandidates(c, o, it, p);
}
}
int j = 0;
NR::Matrix const i2doc = sp_item_i2doc_affine(*i);
-
+
while (sh->curve->bpath[j].code != NR_END) {
/* Get this node in desktop coordinates */
if (dist < getDistance() && dist < s.getDistance()) {
s = SnappedPoint(n, dist);
}
-
+
j++;
}
}
/* Convert the nearest point back to desktop coordinates */
NR::Point const o_it = get_point_on_Path(*i, o.assume().piece, o.assume().t);
NR::Point const o_dt = desktop->doc2dt(o_it * i2doc);
-
+
NR::Coord const dist = NR::L2(o_dt - p);
if (dist < getDistance() && dist < s.getDistance()) {
s = SnappedPoint(o_dt, dist);
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 6a5d876d66aab9058668f96b8bd12dd479e4bebc..ff346edf932bd4b5cceec15821244555f4b8b6ae 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
SPItem *item = (SPItem *) items->data;
- if (!SP_IS_PATH (item))
+ if (!SP_IS_PATH (item))
continue;
SPPath *path = SP_PATH (item);
SPCurve *curve = sp_shape_get_curve (SP_SHAPE (path));
- if (curve == NULL)
+ if (curve == NULL)
continue;
did = true;
// add the new repr to the parent
parent->appendChild(repr);
- // move to the saved position
+ // move to the saved position
repr->setPosition(pos > 0 ? pos : 0);
// if it's the first one, restore id
} else {
SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection."));
return;
- }
+ }
}
/* This function is an entry point from GUI */
@@ -280,7 +280,7 @@ sp_selected_path_to_curves0 (gboolean interactive, guint32 text_grouping_policy)
repr->setAttribute("id", id);
// add the new repr to the parent
parent->appendChild(repr);
- // move to the saved position
+ // move to the saved position
repr->setPosition(pos > 0 ? pos : 0);
selection->add(repr);
/* Transformation */
repr->setAttribute("transform", SP_OBJECT_REPR (item)->attribute("transform"));
/* Style */
- gchar *style_str = sp_style_write_difference (SP_OBJECT_STYLE (item),
+ gchar *style_str = sp_style_write_difference (SP_OBJECT_STYLE (item),
SP_OBJECT_STYLE (SP_OBJECT_PARENT (item)));
repr->setAttribute("style", style_str);
g_free (style_str);
sp_document_done (SP_DT_DOCUMENT (desktop));
} else {
SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
- }
+ }
}
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 95593f25b2e8ca6f3eee4f8780d30818467ecfc7..6344cff2877f3dd56c561350dee0a922ff12364b 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
-/** \file
- * Pen event context implementation.
+/** \file
+ * Pen event context implementation.
*/
/*
event_context->cursor_shape = cursor_pen_xpm;
event_context->hot_x = 4;
event_context->hot_y = 4;
-
+
pc->npoints = 0;
pc->mode = SP_PEN_CONTEXT_MODE_CLICK;
pc->state = SP_PEN_CONTEXT_POINT;
}
}
-/**
+/**
* Snaps new node relative to the previous node.
*/
static void
@@ -248,7 +248,7 @@ spdc_endpoint_snap(SPPenContext const *const pc, NR::Point &p, guint const state
spdc_endpoint_snap_free(pc, p, state);
}
-/**
+/**
* Snaps new node's handle relative to the new node.
*/
static void
@@ -321,7 +321,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
return TRUE;
}
-
+
NR::Point const event_w(bevent.x, bevent.y);
pen_drag_origin_w = event_w;
pen_within_tolerance = true;
@@ -352,12 +352,12 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
/* This is allowed, if we just cancelled curve */
case SP_PEN_CONTEXT_POINT:
if (pc->npoints == 0) {
-
+
/* Set start anchor */
pc->sa = anchor;
NR::Point p;
if (anchor) {
-
+
/* Adjust point to anchor if needed */
p = anchor->dp;
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
@@ -369,7 +369,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
// anchor, which is handled by the sibling branch above)
Inkscape::Selection * const selection = SP_DT_SELECTION(desktop);
if (!(bevent.state & GDK_SHIFT_MASK)) {
-
+
selection->clear();
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path"));
@@ -385,12 +385,12 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
}
spdc_pen_set_initial_point(pc, p);
} else {
-
+
/* Set end anchor */
pc->ea = anchor;
NR::Point p;
if (anchor) {
-
+
p = anchor->dp;
// we hit an anchor, will finish the curve (either with or without closing)
// in release handler
@@ -399,18 +399,18 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
if (pc->green_anchor && pc->green_anchor->active) {
// we clicked on the current curve start, so close it even if
// we drag a handle away from it
- dc->green_closed = TRUE;
+ dc->green_closed = TRUE;
}
ret = TRUE;
break;
-
+
} else {
-
+
p = event_dt;
spdc_endpoint_snap(pc, p, bevent.state); /* Snap node only if not hitting anchor. */
spdc_pen_set_subsequent_point(pc, p, true);
}
-
+
}
pc->state = SP_PEN_CONTEXT_CONTROL;
ret = TRUE;
@@ -434,7 +434,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
ret = TRUE;
}
}
-
+
return ret;
}
if (pc->green_bpaths->data)
gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
- }
+ }
/* Get last segment */
NArtBpath const *const p = SP_CURVE_BPATH(pc->green_curve);
gint const e = SP_CURVE_LENGTH(pc->green_curve);
@@ -1031,7 +1031,7 @@ spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const p, guint const s
if (!sp_curve_empty(pc->red_curve)) {
sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);
SPCurve *curve = sp_curve_copy(pc->red_curve);
- /// \todo fixme:
+ /// \todo fixme:
SPCanvasItem *cshape = sp_canvas_bpath_new(SP_DT_SKETCH(pc->desktop), curve);
sp_curve_unref(curve);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index a75b4c561e085887ee320616377b7ba436ba93fe..0b69006132bd2eae728d17235d59b3c9fee10767 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
-/** \file
+/** \file
* Pencil event context implementation.
*/
event_context->cursor_shape = cursor_pencil_xpm;
event_context->hot_x = 4;
event_context->hot_y = 4;
-
+
pc->npoints = 0;
pc->state = SP_PENCIL_CONTEXT_IDLE;
pc->req_tangent = NR::Point(0, 0);
@@ -207,7 +207,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
}
NR::Point const button_w(bevent.x, bevent.y);
-
+
/* Find desktop coordinates */
NR::Point p = pc->desktop->w2d(button_w);
@@ -295,8 +295,8 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
/* Create green anchor */
pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, pc->p[0]);
}
- /** \todo
- * fixme: I am not sure whether we want to snap to anchors
+ /** \todo
+ * fixme: I am not sure whether we want to snap to anchors
* in middle of freehand (Lauris)
*/
if (anchor) {
/**
* Finalize addline.
- *
- * \todo
+ *
+ * \todo
* fixme: I'd like remove red reset from concat colors (lauris).
* Still not sure, how it will make most sense.
*/
sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);
SPCurve *curve = sp_curve_copy(pc->red_curve);
- /// \todo fixme:
+ /// \todo fixme:
SPCanvasItem *cshape = sp_canvas_bpath_new(SP_DT_SKETCH(pc->desktop), curve);
sp_curve_unref(curve);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 5d3981b5804b8354f5bf6dc6ae6591dc563712d1..fedfa85680007bdf4e25f0a6a469c39cf3cfb311 100644 (file)
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
Preferences::load()
{
/// \todo this still uses old Gtk+ code which should be somewhere else
- if (inkscape_load_config (PREFERENCES_FILE,
+ if (inkscape_load_config (PREFERENCES_FILE,
_preferences,
- preferences_skeleton,
+ preferences_skeleton,
PREFERENCES_SKELETON_SIZE,
_("%s is not a regular file.\n%s"),
_("%s not a valid XML file, or\n"
{
if (!_preferences || ! _save_preferences)
return;
-
+
gchar *fn = profile_path (PREFERENCES_FILE);
(void) sp_repr_save_file (_preferences, fn);
g_free (fn);
diff --git a/src/prefix.cpp b/src/prefix.cpp
index 3c9ec6caea49e4d88d656065d53988dcfa71e759..4999e152432025a7ff978e8b9ecffcf322cea07d 100644 (file)
--- a/src/prefix.cpp
+++ b/src/prefix.cpp
* Written by: Mike Hearn <mike@theoretic.com>
* Hongli Lai <h.lai@chello.nl>
* http://autopackage.org/
- *
+ *
* This source code is public domain. You can relicense this code
* under whatever license you want.
*
#include <stdlib.h>
#include <stdio.h>
-#include <limits.h>
+#include <limits.h>
#include <string.h>
#include "prefix.h"
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index be56047f04d108df57587d9d5ca64f0252a2b2c5..1d62667956b84d8499a3db1a3ab6b7a19443ce4c 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -302,9 +302,9 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
SnapManager const m(desktop->namedview);
rc->center = m.freeSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT,
button_dt, rc->item).getPoint();
-
+
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
- ( GDK_KEY_PRESS_MASK |
+ ( GDK_KEY_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
}
NR::Rect const r = Inkscape::snap_rectangular_box(desktop, rc.item, pt, rc.center, state);
-
+
sp_rect_position_set(SP_RECT(rc.item), r.min()[NR::X], r.min()[NR::Y], r.dimensions()[NR::X], r.dimensions()[NR::Y]);
if ( rc.rx != 0.0 ) {
sp_rect_set_rx (SP_RECT(rc.item), TRUE, rc.rx);
if ( rc.ry != 0.0 ) {
if (rc.rx == 0.0)
sp_rect_set_ry (SP_RECT(rc.item), TRUE, CLAMP(rc.ry, 0, MIN(r.dimensions()[NR::X], r.dimensions()[NR::Y])/2));
- else
+ else
sp_rect_set_ry (SP_RECT(rc.item), TRUE, CLAMP(rc.ry, 0, r.dimensions()[NR::Y]));
}
diff --git a/src/rubberband.cpp b/src/rubberband.cpp
index d44662c5bba665b872e03dc545163b213c3028f6..dd16a62d841fd5b18cdfbd3703b3ea2fadd3f274 100644 (file)
--- a/src/rubberband.cpp
+++ b/src/rubberband.cpp
Inkscape::Rubberband::Rubberband()
: _desktop(NULL), _canvas(NULL)
{
-
+
}
void Inkscape::Rubberband::start(SPDesktop *d, NR::Point const &p)
diff --git a/src/selcue.cpp b/src/selcue.cpp
index 845561d1876a3388215eff4de41d492c25c80ffb..426422fc9eb624a5dbdc20744494cb3d7feb9516 100644 (file)
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
NULL);
sp_canvas_item_show(box);
SP_CTRL(box)->moveto(NR::Point(b.min()[NR::X], b.max()[NR::Y]));
-
+
sp_canvas_item_move_to_z(box, 0); // just low enough to not get in the way of other draggable knots
} else if (mode == BBOX) {
SP_TYPE_CTRLRECT,
NULL
);
-
+
SP_CTRLRECT(box)->setRectangle(b);
SP_CTRLRECT(box)->setColor(0x000000a0, 0, 0);
SP_CTRLRECT(box)->setDashed(true);
-
+
sp_canvas_item_move_to_z(box, 0);
}
-
+
if (box) {
_item_bboxes.push_back(box);
}
"stroked", 1,
"stroke_color", 0x000000ff,
NULL);
-
+
sp_canvas_item_show(baseline_point);
SP_CTRL(baseline_point)->moveto(a);
sp_canvas_item_move_to_z(baseline_point, 0);
}
}
-
+
if (baseline_point) {
_text_baselines.push_back(baseline_point);
}
diff --git a/src/select-context.cpp b/src/select-context.cpp
index d5288117ca057b231fae1a3d322b95dbcdb6e29e..e9ad992a44a4e4f7c5f5de2d33ecde6a66afb726 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
rb_escaped = 1;
SP_EVENT_CONTEXT(sc)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selection canceled."));
return true;
- }
+ }
}
return false;
}
@@ -319,7 +319,7 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
sc->moved = FALSE;
// remember the clicked item in sc->item:
- sc->item = sp_event_context_find_item (desktop,
+ sc->item = sp_event_context_find_item (desktop,
NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, FALSE);
sp_object_ref(sc->item, NULL);
item_at_point = desktop->item_at_point(NR::Point(event->button.x, event->button.y), FALSE);
if (!item_at_point) // if no item at this point, try at the click point (bug 1012200)
item_at_point = desktop->item_at_point(NR::Point(xp, yp), FALSE);
- if (item_at_point || sc->moved || sc->button_press_alt) {
+ if (item_at_point || sc->moved || sc->button_press_alt) {
// drag only if starting from an item, or if something is already grabbed, or if alt-dragging
if (!sc->moved) {
item_in_group = desktop->item_at_point(NR::Point(event->button.x, event->button.y), TRUE);
@@ -564,12 +564,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (sc->button_press_ctrl) {
// go into groups, honoring Alt
- item = sp_event_context_find_item (desktop,
+ item = sp_event_context_find_item (desktop,
NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, TRUE);
sc->button_press_ctrl = FALSE;
} else {
// don't go into groups, honoring Alt
- item = sp_event_context_find_item (desktop,
+ item = sp_event_context_find_item (desktop,
NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, FALSE);
}
sc->button_press_ctrl = FALSE;
- item = sp_event_context_find_item (desktop,
+ item = sp_event_context_find_item (desktop,
NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, TRUE);
if (item) {
index 1587b27192938caabc2995bdf1ac5484e5b2ce4d..36f3b1b3f1b4d8e635f19bb450b3ac88f100f438 100644 (file)
void sp_selection_paste(bool in_place)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
+
if (desktop == NULL) {
return;
}
@@ -1182,7 +1182,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
SPItem *item = SP_ITEM(l->data);
NR::Point old_center(0,0);
- if (set_i2d && item->isCenterSet())
+ if (set_i2d && item->isCenterSet())
old_center = item->getCenter();
#if 0 /* Re-enable this once persistent guides have a graphical indication.
@@ -1232,7 +1232,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
// calculate the matrix we need to apply to the clone to cancel its induced transform from its original
NR::Matrix t = matrix_to_desktop (matrix_from_desktop (affine, item), item);
- NR::Matrix t_inv = matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item);
+ NR::Matrix t_inv = matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item);
NR::Matrix result = t_inv * item->transform * t;
if ((prefs_parallel || prefs_unmoved) && affine.is_translation()) {
NR::Rect const bbox(selection->bounds());
if (bbox.isEmpty()) {
- return;
+ return;
}
NR::translate const p2o(-bbox.min());
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
- NR::Matrix t = NR::scale (1/res, -1/res) * NR::translate (bbox.x0, bbox.y1) * eek.inverse();
+ NR::Matrix t = NR::scale (1/res, -1/res) * NR::translate (bbox.x0, bbox.y1) * eek.inverse();
// Do the export
sp_export_png_file(document, filepath,
gchar c[256];
if (sp_svg_transform_write(c, 256, t)) {
repr->setAttribute("transform", c);
- }
+ }
// add the new repr to the parent
parent->appendChild(repr);
- // move to the saved position
+ // move to the saved position
repr->setPosition(pos > 0 ? pos + 1 : 1);
// Set selection to the new image
index 9d484b2938d3ddf958f0650291a966af1bec8652..3f72afae0f78691c4ddefa4700f50a72a23aabc7 100644 (file)
@@ -63,19 +63,19 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
if (!items->next) { // one item
char *item_desc = sp_item_description(item);
if (SP_IS_USE(item) || (SP_IS_OFFSET(item) && SP_OFFSET (item)->sourceHref)) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
item_desc, layer_phrase,
_("Use <b>Shift+D</b> to look up original"), when_selected);
} else if (SP_IS_TEXT_TEXTPATH(item)) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
item_desc, layer_phrase,
_("Use <b>Shift+D</b> to look up path"), when_selected);
} else if (SP_IS_FLOWTEXT(item) && !SP_FLOWTEXT(item)->has_internal_frame()) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
item_desc, layer_phrase,
_("Use <b>Shift+D</b> to look up frame"), when_selected);
} else {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
item_desc, layer_phrase, when_selected);
}
g_free(item_desc);
@@ -89,12 +89,12 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
object_count);
if (selection->numberOfLayers() == 1) {
- _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."),
+ _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."),
object_count_str, layer_phrase, when_selected);
} else {
- _context.setF(Inkscape::NORMAL_MESSAGE,
+ _context.setF(Inkscape::NORMAL_MESSAGE,
ngettext("%s in <b>%i</b> layer. %s.",
- "%s in <b>%i</b> layers. %s.",
+ "%s in <b>%i</b> layers. %s.",
selection->numberOfLayers()),
object_count_str, selection->numberOfLayers(), when_selected);
}
diff --git a/src/selection.cpp b/src/selection.cpp
index aa77ef89430a09c60c730bd1989a6015d8d9b153..c40b7b546346da91531deac04cb8bc8a53e437e9 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p));
}
-
- std::vector<NR::Point>::iterator i;
+
+ std::vector<NR::Point>::iterator i;
NR::ConvexHull cvh(*(p.begin()));
for (i = p.begin(); i != p.end(); i++) {
// these are the points we get back
- cvh.add(*i);
+ cvh.add(*i);
}
-
- NR::Rect rHull = cvh.bounds();
- std::vector<NR::Point> pHull(4);
- pHull[0] = rHull.corner(0);
- pHull[1] = rHull.corner(1);
- pHull[2] = rHull.corner(2);
- pHull[3] = rHull.corner(3);
+
+ NR::Rect rHull = cvh.bounds();
+ std::vector<NR::Point> pHull(4);
+ pHull[0] = rHull.corner(0);
+ pHull[1] = rHull.corner(1);
+ pHull[2] = rHull.corner(2);
+ pHull[3] = rHull.corner(3);
return pHull;
}
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 520a6faff73dbdbc8416bd34aeca63dcc2ca3f9b..1d4557b903fa60e7bad1e0b7780ce3ba0a9a5cb7 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
"stroke_color", 0x000000a0,
"pixbuf", handles[12],
NULL);
-
+
_grip = sp_canvas_item_new(SP_DT_CONTROLS(desktop),
SP_TYPE_CTRL,
"anchor", GTK_ANCHOR_CENTER,
"stroke_color", 0xffffffff,
"pixbuf", handles[12],
NULL);
-
+
sp_canvas_item_hide(_grip);
sp_canvas_item_hide(_norm);
// If dragging showed content live, sp_selection_apply_affine cannot change the centers
// appropriately - it does not know the original positions of the centers (all objects already have
// the new bboxes). So we need to reset the centers from our saved array.
- if (_show != SHOW_OUTLINE && !_current.is_translation()) {
+ if (_show != SHOW_OUTLINE && !_current.is_translation()) {
for (unsigned i = 0; i < _items_centers.size(); i++) {
SPItem *currentItem = _items_centers[i].first;
if (currentItem->isCenterSet()) { // only if it's already set
if (items) {
SPItem *first = reinterpret_cast<SPItem*>(g_slist_last(items)->data); // from the first item in selection
if (first->isCenterSet()) { // only if set explicitly
- _center = first->getCenter();
+ _center = first->getCenter();
} else {
_center = _box.midpoint();
}
@@ -678,7 +678,7 @@ gboolean Inkscape::SelTrans::handleRequest(SPKnot *knot, NR::Point *position, gu
knot->desktop->set_coordinate_status(*position);
knot->desktop->setPosition(*position);
-
+
if (state & GDK_MOD1_MASK) {
*position = _point + ( *position - _point ) / 10;
}
@@ -888,7 +888,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
for (GSList const *i = _selection->itemList(); i != NULL; i = i->next) {
it.push_back(reinterpret_cast<SPItem*>(i->data));
}
-
+
if ( state & GDK_CONTROL_MASK ) {
s[perp] = fabs(s[axis]);
@@ -1122,7 +1122,7 @@ void sp_sel_trans_rotate(Inkscape::SelTrans *seltrans, SPSelTransHandle const &,
{
seltrans->rotate(pt, state);
}
-
+
void Inkscape::SelTrans::stretch(SPSelTransHandle const &handle, NR::Point &pt, guint state)
{
using NR::X;
@@ -1167,7 +1167,7 @@ void Inkscape::SelTrans::stretch(SPSelTransHandle const &handle, NR::Point &pt,
NR::Point new_bbox_max = _box.max() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin));
int transform_stroke = prefs_get_int_attribute ("options.transform", "stroke", 1);
- NR::Matrix scaler = get_scale_transform_with_stroke (_box, _strokewidth, transform_stroke,
+ NR::Matrix scaler = get_scale_transform_with_stroke (_box, _strokewidth, transform_stroke,
new_bbox_min[NR::X], new_bbox_min[NR::Y], new_bbox_max[NR::X], new_bbox_max[NR::Y]);
transform(scaler, NR::Point(0, 0)); // we have already accounted for origin, so pass 0,0
NR::Point new_bbox_max = _box.max() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin));
int transform_stroke = prefs_get_int_attribute ("options.transform", "stroke", 1);
- NR::Matrix scaler = get_scale_transform_with_stroke (_box, _strokewidth, transform_stroke,
+ NR::Matrix scaler = get_scale_transform_with_stroke (_box, _strokewidth, transform_stroke,
new_bbox_min[NR::X], new_bbox_min[NR::Y], new_bbox_max[NR::X], new_bbox_max[NR::Y]);
transform(scaler, NR::Point(0, 0)); // we have already accounted for origin, so pass 0,0
@@ -1258,7 +1258,7 @@ void sp_sel_trans_center(Inkscape::SelTrans *seltrans, SPSelTransHandle const &,
void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state)
{
SnapManager const m(_desktop->namedview);
-
+
/* The amount that we've moved by during this drag */
NR::Point dxy = xy - _point;
/* This will be our list of possible translations */
std::list<std::pair<NR::Point, bool> > s;
-
+
if (control) {
-
+
/* Snap to things, and also constrain to horizontal or vertical movement */
for (unsigned int dim = 0; dim < 2; dim++) {
_snap_points,
component_vectors[dim], it, dxy));
}
-
+
} else {
/* Snap to things with no constraint */
}
}
}
-
+
if (control) {
/* Ensure that the horizontal and vertical constraint has been applied */
if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) {
dxy[NR::X] = 0;
}
}
-
+
NR::Matrix const move((NR::translate(dxy)));
NR::Point const norm(0, 0);
transform(move, norm);
index e91f435e21f464093e14b60c240e7fc471087ba3..56b31ceb6b56f821c14514f066e5004bd68f6dd3 100644 (file)
-extern char const shortcuts_default_xml[]=
+extern char const shortcuts_default_xml[]=
"<?xml version=\"1.0\"?>\n"
"<keybindings name=\"Inkscape default\">\n"
" <primary keyval=\"n\" modifiers=\"control\" verb=\"FileNew\" />\n"
diff --git a/src/snap.cpp b/src/snap.cpp
index b14549db3a25a29602d9f5f4a7048a616a9cb654..111ef619f473ea7c7a3e35611d177e1d143cbf87 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
std::list<SPItem const *> const &it) const
{
Inkscape::SnappedPoint r(p, NR_HUGE);
-
+
SPNamedView::SnapperList snappers = namedview->getSnappers();
for (SPNamedView::SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) {
Inkscape::SnappedPoint const s = (*i)->freeSnap(t, p, it);
std::list<SPItem const *> const &it) const
{
Inkscape::SnappedPoint r(p, NR_HUGE);
-
+
SPNamedView::SnapperList snappers = namedview->getSnappers();
for (SPNamedView::SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) {
Inkscape::SnappedPoint const s = (*i)->constrainedSnap(t, p, c, it);
@@ -195,7 +195,7 @@ NR::Coord namedview_dim_snap(SPNamedView const *nv, Inkscape::Snapper::PointType
}
-NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointType t,
NR::Point &req, NR::Point const &d,
SPItem const *it)
{
@@ -213,7 +213,7 @@ NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointT
*
* \pre d \81â\89\81 (0, 0).
*/
-NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointType t,
NR::Point &req, NR::Point const &d,
std::list<SPItem const *> const &it)
{
@@ -239,14 +239,14 @@ NR::Coord namedview_vector_snap(SPNamedView const *nv, Inkscape::Snapper::PointT
* functions for lists of points
*
* All functions take a list of NR::Point and parameter indicating the proposed transformation.
- * They return the updated transformation parameter.
+ * They return the updated transformation parameter.
*/
/**
* Snap list of points in one dimension.
* \return Coordinate difference.
*/
-std::pair<NR::Coord, bool> namedview_dim_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+std::pair<NR::Coord, bool> namedview_dim_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t,
const std::vector<NR::Point> &p,
NR::Coord const dx, NR::Dim2 const dim,
std::list<SPItem const *> const &it
@@ -256,7 +256,7 @@ std::pair<NR::Coord, bool> namedview_dim_snap_list(SPNamedView const *nv, Inksca
NR::Coord xdist = dx;
SnapManager const m(nv);
-
+
if (m.willSnapSomething()) {
for (std::vector<NR::Point>::const_iterator i = p.begin(); i != p.end(); i++) {
NR::Point q = *i;
@@ -276,8 +276,8 @@ std::pair<NR::Coord, bool> namedview_dim_snap_list(SPNamedView const *nv, Inksca
/**
* Snap list of points in two dimensions.
*/
-std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t,
- const std::vector<NR::Point> &p, NR::Point const &norm,
+std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+ const std::vector<NR::Point> &p, NR::Point const &norm,
NR::scale const &s, std::list<SPItem const *> const &it)
{
using NR::X;
@@ -288,7 +288,7 @@ std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inksca
if (m.willSnapSomething() == false) {
return std::make_pair(s[X], false);
}
-
+
NR::Coord dist = NR_HUGE;
double ratio = fabs(s[X]);
for (std::vector<NR::Point>::const_iterator i = p.begin(); i != p.end(); i++) {
@@ -307,7 +307,7 @@ std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inksca
}
}
}
-
+
return std::make_pair(ratio, dist < NR_HUGE);
}
@@ -318,8 +318,8 @@ std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inksca
*
* \return Pair containing snapped scale and a flag which is true if a snap was made.
*/
-std::pair<double, bool> namedview_dim_snap_list_scale(SPNamedView const *nv, Inkscape::Snapper::PointType t,
- const std::vector<NR::Point> &p, NR::Point const &norm,
+std::pair<double, bool> namedview_dim_snap_list_scale(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+ const std::vector<NR::Point> &p, NR::Point const &norm,
double const sx, NR::Dim2 dim,
std::list<const SPItem *> const &it)
{
@@ -339,13 +339,13 @@ std::pair<double, bool> namedview_dim_snap_list_scale(SPNamedView const *nv, Ink
/* Scaled version of the point we are looking at */
check[dim] = (sx * (q - norm) + norm)[dim];
-
+
if (fabs (q[dim] - norm[dim]) > MIN_DIST_NORM) {
/* Snap this point */
const NR::Coord d = namedview_dim_snap (nv, t, check, dim, it);
/* Work out the resulting scale factor */
double snapped_scale = (check[dim] - norm[dim]) / (q[dim] - norm[dim]);
-
+
if (dist == NR_HUGE || fabs(snapped_scale - sx) < fabs(scale - sx)) {
/* This is either the first point, or the snapped scale
** is the closest yet to the original.
@@ -362,12 +362,12 @@ std::pair<double, bool> namedview_dim_snap_list_scale(SPNamedView const *nv, Ink
/**
* Try to snap points after they have been skewed.
*/
-double namedview_dim_snap_list_skew(SPNamedView const *nv, Inkscape::Snapper::PointType t,
- const std::vector<NR::Point> &p, NR::Point const &norm,
+double namedview_dim_snap_list_skew(SPNamedView const *nv, Inkscape::Snapper::PointType t,
+ const std::vector<NR::Point> &p, NR::Point const &norm,
double const sx, NR::Dim2 const dim)
{
SnapManager const m(nv);
-
+
if (m.willSnapSomething() == false) {
return sx;
}
@@ -376,7 +376,7 @@ double namedview_dim_snap_list_skew(SPNamedView const *nv, Inkscape::Snapper::Po
gdouble dist = NR_HUGE;
gdouble skew = sx;
-
+
for (std::vector<NR::Point>::const_iterator i = p.begin(); i != p.end(); i++) {
NR::Point q = *i;
NR::Point check = q;
diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp
index 3aebb086a1e6e9001b48b6220c81d9a8791fa0ee..5d0d242dde08b2f5ce716e51b478aacf1e5a7260 100644 (file)
--- a/src/snapped-point.cpp
+++ b/src/snapped-point.cpp
Inkscape::SnappedPoint::SnappedPoint(NR::Point p, NR::Coord d)
: _distance(d), _point(p)
{
-
+
}
-Inkscape::SnappedPoint::~SnappedPoint()
+Inkscape::SnappedPoint::~SnappedPoint()
{
/// TODO : empty the _hightlight_groups vector and destroy the
/// HighlightGroup items it holds
diff --git a/src/snapper.cpp b/src/snapper.cpp
index 27531b50b9f371b37c0772da44261a84622a69c6..fd05809c13af5d54c10525e7a7ed96e48f1dd9b8 100644 (file)
--- a/src/snapper.cpp
+++ b/src/snapper.cpp
{
g_assert(_named_view != NULL);
g_assert(SP_IS_NAMEDVIEW(_named_view));
-
+
setSnapTo(BBOX_POINT, true);
}
index 85d9ccce22bce79e97227003b211820c5fcec779..c4425add69e85c283e794dee4bec0312e7530545 100644 (file)
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
delete _connRef;
_connRef = NULL;
}
-
+
_invalid_path_connection.disconnect();
_transformed_connection.disconnect();
}
}
-static void
+static void
avoid_conn_move(NR::Matrix const *mp, SPItem *moved_item)
{
// Detach from objects if attached.
if (key == SP_ATTR_CONNECTOR_TYPE) {
if (value && (strcmp(value, "polyline") == 0)) {
_connType = SP_CONNECTOR_POLYLINE;
-
+
Avoid::Router *router = _path->document->router;
GQuark itemID = g_quark_from_string(SP_OBJECT(_path)->id);
_connRef = new Avoid::ConnRef(router, itemID);
}
else {
_connType = SP_CONNECTOR_NOAVOID;
-
+
if (_connRef) {
_connRef->removeFromGraph();
delete _connRef;
return;
}
-
+
unsigned const handle_ix = key - SP_ATTR_CONNECTION_START;
g_assert( handle_ix <= 1 );
this->_connEnd[handle_ix]->setAttacherHref(value);
SPCurve *curve = _path->curve;
SPItem *h2attItem[2];
getAttachedItems(h2attItem);
-
+
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
NR::Rect const bbox = h2attItem[h]->invokeBbox(sp_item_i2doc_affine(h2attItem[h]));
endPts[h] = bbox.midpoint();
}
- else
+ else
{
if (h == 0) {
endPts[h] = sp_curve_first_point(curve);
// then all connectors (that require it) will be rerouted. Otherwise,
// one connector could get rerouted several times as a result of
// dragging a couple of shapes.
-
+
SPPath *path = SP_PATH(ptr);
path->connEndPair._invalid_path_signal.emit(path);
}
}
return false;
}
-
+
void
SPConnEndPair::makePathInvalid(void)
{
Avoid::Point src = { endPt[0][NR::X], endPt[0][NR::Y] };
Avoid::Point dst = { endPt[1][NR::X], endPt[1][NR::Y] };
-
+
_connRef->updateEndPoint(Avoid::VertID::src, src);
_connRef->updateEndPoint(Avoid::VertID::tar, dst);
Avoid::PolyLine route = _connRef->route();
_connRef->calcRouteDist();
-
+
sp_curve_reset(curve);
sp_curve_moveto(curve, endPt[0]);
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index af8692358ea2877de0ce25b763c74ba699639e00..536addf4e6b860ccbff0afe6fa585fd02a547ae4 100644 (file)
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
// that have internal representations that are updated later
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(path->document);
-
+
// Get the new route around obstacles.
path->connEndPair.reroutePath();
NR::Rect otherpt_rect = NR::Rect(other_endpt, other_endpt);
NR::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect };
h2bbox_icoordsys[ind] = h2attItem[ind]->invokeBbox(NR::identity());
-
+
h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
-
+
h2endPt_icoordsys[!ind] = other_endpt;
// For the attached object, change the corresponding point to be
h2endPt_icoordsys[ind] = calc_bbox_conn_pt(h2bbox_icoordsys[ind],
( last_seg_pt / h2i2anc ));
h2endPt_pcoordsys[ind] = h2endPt_icoordsys[ind] * h2i2anc / path2anc;
-
+
// Leave the other where it is.
h2endPt_pcoordsys[!ind] = other_endpt;
-
+
change_endpts(path->curve, h2endPt_pcoordsys);
}
if (updatePathRepr) {
void
SPConnEnd::setAttacherHref(gchar const *value)
-{
+{
if ( value && href && ( strcmp(value, href) == 0 ) ) {
/* No change, do nothing. */
} else {
diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp
index f59c63487083ac986e74e49b61ed4acb39d6e691..339990771c3e05d189c2358b17e6a26dd3e9fa03 100644 (file)
--- a/src/sp-cursor.cpp
+++ b/src/sp-cursor.cpp
if (strcmp(p, "None") == 0) {
transparent_color = ccode;
}
-
+
if (strcmp(p, "#000000") == 0) {
black_color = ccode;
}
for (int y = 0; y < 32; y++) {
for (int x = 0; x < 32; ) {
-
+
char value = 0;
char maskv = 0;
}
}
}
-
+
pixmap_buffer[(y * 4 + x/8)-1] = value;
mask_buffer[(y * 4 + x/8)-1] = maskv;
}
{
GdkColor const fg = { 0, 0, 0, 0 };
GdkColor const bg = { 0, 65535, 65535, 65535 };
-
+
GdkBitmap *bitmap = NULL;
GdkBitmap *mask = NULL;
diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp
index ad6cfc578e8358e0b67d8f3f0f0eb8e8f0abdb0d..95823ee62f4442db0412ab8e3ff6d36f0af68a82 100644 (file)
--- a/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
GType sp_defs_get_type(void)
{
static GType defs_type = 0;
-
+
if (!defs_type) {
GTypeInfo defs_info = {
sizeof(SPDefsClass),
};
defs_type = g_type_register_static(SP_TYPE_OBJECT, "SPDefs", &defs_info, (GTypeFlags) 0);
}
-
+
return defs_type;
}
{
parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
SPObjectClass *sp_object_class = (SPObjectClass *) dc;
-
+
sp_object_class->release = sp_defs_release;
sp_object_class->update = sp_defs_update;
sp_object_class->modified = sp_defs_modified;
static void sp_defs_init(SPDefs *defs)
{
-
+
}
static void sp_defs_release(SPObject *object)
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
-
+
l = g_slist_reverse(l);
-
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
-
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
-
+
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
-
+
l = g_slist_reverse(l);
-
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
-
+
if (!repr) {
repr = sp_repr_new("svg:defs");
}
-
+
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags);
if (crepr) l = g_slist_prepend(l, crepr);
}
-
+
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
-
+
} else {
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
child->updateRepr(flags);
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 5c01483c8f36ed762eb3bbba59eeeb13f02e8740..95695768e8f5025c9738696006c79347db1e5e0d 100644 (file)
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -234,19 +234,19 @@ sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegion");
-
+
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags);
if (crepr) l = g_slist_prepend(l, crepr);
}
-
+
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
-
+
} else {
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
child->updateRepr(flags);
@@ -448,19 +448,19 @@ sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint f
{
if (flags & SP_OBJECT_WRITE_BUILD) {
if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegionExclude");
-
+
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags);
if (crepr) l = g_slist_prepend(l, crepr);
}
-
+
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
-
+
} else {
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
child->updateRepr(flags);
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index f54e60dab578434ba9160f32a9f2d75e044c494e..4c46a699c9df9937e2e0b22d5a146ef2047401f7 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
Inkscape::XML::Node *c_repr = NULL;
if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) {
c_repr = child->updateRepr(NULL, flags);
- }
+ }
if ( c_repr ) l = g_slist_prepend(l, c_repr);
}
while ( l ) {
int const nChars = layout.iteratorToCharIndex(layout.end());
if (SP_FLOWTEXT(item)->has_internal_frame())
return g_strdup_printf(_("<b>Flowed text</b> (%d characters)"), nChars);
- else
+ else
return g_strdup_printf(_("<b>Linked flowed text</b> (%d characters)"), nChars);
}
@@ -412,7 +412,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape,
}
if (with_indent)
layout.appendText(SP_STRING(child)->string, root->style, child, &pi);
- else
+ else
layout.appendText(SP_STRING(child)->string, root->style, child);
} else if (SP_IS_FLOWREGION(child)) {
std::vector<Shape*> const &computed = SP_FLOWREGION(child)->computed;
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index db2360225c6c4b033e0115b7bd46602bfdaeb09e..c2b0b32a3cb881169f6562a13d5ef59e649f38ea 100644 (file)
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
#define SP_MACROS_SILENT
#include "macros.h"
-/// Has to be power of 2
+/// Has to be power of 2
#define NCOLORS NR_GRADIENT_VECTOR_LENGTH
static void sp_stop_class_init(SPStopClass *klass);
* We need presentation attributes etc.
* \par
* remove the hackish "style reading" from here: see comments in
- * sp_object_get_style_property about the bugs in our current
- * approach. However, note that SPStyle doesn't currently have
+ * sp_object_get_style_property about the bugs in our current
+ * approach. However, note that SPStyle doesn't currently have
* stop-color and stop-opacity properties.
*/
{
if (streq(p, "currentColor")) {
stop->currentColor = true;
} else {
- guint32 const color = sp_svg_read_color(p, 0);
+ guint32 const color = sp_svg_read_color(p, 0);
sp_color_set_rgb_rgba32(&stop->specified_color, color);
}
}
}
/**
- * Writes the gradient's internal vector (whether from its own stops, or
+ * Writes the gradient's internal vector (whether from its own stops, or
* inherited from refs) into the gradient repr as svg:stop elements.
*/
void
/**
* Renders gradient vector to buffer as line.
- *
+ *
* RGB buffer background should be set up beforehand.
*
* @param len,width,height,rowstride Buffer parameters (1 or 2 dimensional).
/**
* Render rectangular RGB area from gradient vector.
- */
+ */
void
sp_gradient_render_vector_block_rgb(SPGradient *gradient, guchar *buf,
gint const width, gint const height, gint const rowstride,
@@ -1402,7 +1402,7 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags
/**
* Create linear gradient context.
- *
+ *
* Basically we have to deal with transformations
*
* 1) color2norm - maps point in (0,NCOLORS) vector to (0,1) vector
@@ -1410,10 +1410,10 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags
* 2) gradientTransform
* 3) bbox2user
* 4) ctm == userspace to pixel grid
- *
+ *
* See also (*) in sp-pattern about why we may need parent_transform.
- *
- * \todo (point 1 above) fixme: I do not know how to deal with start > 0
+ *
+ * \todo (point 1 above) fixme: I do not know how to deal with start > 0
* and end < 1.
*/
static SPPainter *
lgp->lg = lg;
/** \todo
- * Technically speaking, we map NCOLORS on line [start,end] onto line
- * [0,1]. I almost think we should fill color array start and end in
- * that case. The alternative would be to leave these just empty garbage
- * or something similar. Originally I had 1023.9999 here - not sure
+ * Technically speaking, we map NCOLORS on line [start,end] onto line
+ * [0,1]. I almost think we should fill color array start and end in
+ * that case. The alternative would be to leave these just empty garbage
+ * or something similar. Originally I had 1023.9999 here - not sure
* whether we have really to cut out ceil int (Lauris).
*/
NR::Matrix color2norm(NR::identity());
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
/** \todo
- * fixme: We may try to normalize here too, look at
+ * fixme: We may try to normalize here too, look at
* linearGradient (Lauris)
*/
} else {
/** \todo
* Problem: What to do, if we have mixed lengths and percentages?
- * Currently we do ignore percentages at all, but that is not
+ * Currently we do ignore percentages at all, but that is not
* good (lauris)
*/
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 98ca6609294a6f441fbcb0823c38e7021dcd43f9..ccaf8164949532ca82b2df536344df214928c384 100644 (file)
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
GType sp_guide_get_type(void)
{
static GType guide_type = 0;
-
+
if (!guide_type) {
GTypeInfo guide_info = {
sizeof(SPGuideClass),
};
guide_type = g_type_register_static(SP_TYPE_OBJECT, "SPGuide", &guide_info, (GTypeFlags) 0);
}
-
+
return guide_type;
}
{
GObjectClass *gobject_class = (GObjectClass *) gc;
SPObjectClass *sp_object_class = (SPObjectClass *) gc;
-
+
parent_class = (SPObjectClass*) g_type_class_ref(SP_TYPE_OBJECT);
-
+
gobject_class->set_property = sp_guide_set_property;
gobject_class->get_property = sp_guide_get_property;
-
+
sp_object_class->build = sp_guide_build;
sp_object_class->release = sp_guide_release;
sp_object_class->set = sp_guide_set;
0xffffffff,
0xff000000,
(GParamFlags) G_PARAM_READWRITE));
-
+
g_object_class_install_property(gobject_class,
PROP_HICOLOR,
g_param_spec_uint("hicolor", "HiColor", "HiColor",
@@ -144,7 +144,7 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML
if (((SPObjectClass *) (parent_class))->build) {
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
-
+
sp_object_read_attr(object, "orientation");
sp_object_read_attr(object, "position");
}
@@ -152,12 +152,12 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML
static void sp_guide_release(SPObject *object)
{
SPGuide *guide = (SPGuide *) object;
-
+
while (guide->views) {
gtk_object_destroy(GTK_OBJECT(guide->views->data));
guide->views = g_slist_remove(guide->views, guide->views->data);
}
-
+
if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release(object);
}
( guide->normal == component_vectors[NR::Y] ) );
SPCanvasItem *item = sp_guideline_new(group, guide->position, vertical_line_p);
sp_guideline_set_color(SP_GUIDELINE(item), guide->color);
-
+
g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), guide);
guide->views = g_slist_prepend(guide->views, item);
g_assert(SP_IS_GUIDE(guide));
g_assert(canvas != NULL);
g_assert(SP_IS_CANVAS(canvas));
-
+
for (GSList *l = guide->views; l != NULL; l = l->next) {
if (canvas == SP_CANVAS_ITEM(l->data)->canvas) {
gtk_object_destroy(GTK_OBJECT(l->data));
return;
}
}
-
+
g_assert_not_reached();
}
g_assert(SP_IS_GUIDE(guide));
g_assert(canvas != NULL);
g_assert(SP_IS_CANVAS(canvas));
-
+
for (GSList *l = guide->views; l != NULL; l = l->next) {
if (canvas == SP_CANVAS_ITEM(l->data)->canvas) {
sp_guideline_set_sensitive(SP_GUIDELINE(l->data), sensitive);
return;
}
}
-
+
g_assert_not_reached();
}
@@ -263,7 +263,7 @@ void sp_guide_moveto(SPGuide const &guide, gdouble const position, bool const co
sp_repr_set_svg_double(SP_OBJECT(&guide)->repr,
"position", position);
}
-
+
for (vector<SPGuideAttachment>::const_iterator i(guide.attached_items.begin()),
iEnd(guide.attached_items.end());
i != iEnd; ++i)
{
using NR::X;
using NR::Y;
-
+
if ( guide->normal == component_vectors[X] ) {
return g_strdup(_("vertical guideline"));
} else if ( guide->normal == component_vectors[Y] ) {
void sp_guide_remove(SPGuide *guide)
{
g_assert(SP_IS_GUIDE(guide));
-
+
for (vector<SPGuideAttachment>::const_iterator i(guide->attached_items.begin()),
iEnd(guide->attached_items.end());
i != iEnd; ++i)
remove_last(att.item->constraints, SPGuideConstraint(guide, att.snappoint_ix));
}
guide->attached_items.clear();
-
+
sp_repr_unparent(SP_OBJECT(guide)->repr);
}
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 19b9b19a79c0fe587f7988a5a574ac23c0421035..631eb6a9c36f8544637be22497926f09e569c2ac 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
SPImage *image = SP_IMAGE(item);
char *href_desc;
if (image->href) {
- href_desc = (strncmp(image->href, "data:", 5) == 0)
+ href_desc = (strncmp(image->href, "data:", 5) == 0)
? g_strdup(_("embedded"))
: xml_quote_strdup(image->href);
} else {
g_warning("Attempting to call strncmp() with a null pointer.");
href_desc = g_strdup(_("(null_pointer)")); // we call g_free() on href_desc
- }
+ }
char *ret = ( image->pixbuf == NULL
? g_strdup_printf(_("<b>Image with bad reference</b>: %s"), href_desc)
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index a2be6daf427e8f05d9b81a00435f5ce9cfc41def..b4b69e1e488db966d4183af78709242897dff0d2 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
}
Inkscape::GC::release(repr);
- if (children && SP_IS_ITEM (nitem))
+ if (children && SP_IS_ITEM (nitem))
*children = g_slist_prepend (*children, nitem);
items = g_slist_remove (items, items->data);
index c8479221502de9ac02240588063c7ee0750c52f8..163a9f5f81cfd181b2cd85e5089757fa6c318ec2 100644 (file)
-/** \file
+/** \file
* Implementation of sp_item_notify_moveto().
*/
@@ -51,13 +51,13 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin
{
sp_item_write_transform(&item, SP_OBJECT_REPR(&item), item.transform);
}
-
+
sp_item_rm_unsatisfied_cns(item);
#if 0 /* nyi */
move_cn_to_front(mv_g, snappoint_ix, item.constraints);
- /** \note If the guideline is connected to multiple snappoints of
- * this item, then keeping those cns in order requires that the
- * guide send notifications in order of increasing importance.
+ /** \note If the guideline is connected to multiple snappoints of
+ * this item, then keeping those cns in order requires that the
+ * guide send notifications in order of increasing importance.
*/
#endif
}
index 817bc1b44e6f7cef4c1784ce0c75c77a44948f5f..beefc7640d98659fe292272062f24778d369b390 100644 (file)
return NR::translate(-m[0], -m[1]);
}
-void
+void
sp_item_rotate_rel(SPItem *item, NR::rotate const &rotation)
{
NR::translate const s(sp_item_bbox_desktop(item).midpoint());
sp_item_set_i2d_affine(item,
sp_item_i2d_affine(item) * inverse(s) * scale * s);
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
-}
+}
void
sp_item_skew_rel (SPItem *item, double skewX, double skewY)
sp_item_set_i2d_affine(item,
sp_item_i2d_affine(item) * inverse(s) * skew * s);
sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
-}
+}
void sp_item_move_rel(SPItem *item, NR::translate const &tr)
{
the goal is met exactly and the stroke scaling is obeyed.
*/
-NR::Matrix
+NR::Matrix
get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1)
{
NR::Rect bbox (bbox_param);
gdouble h1 = y1 - y0;
gdouble r0 = strokewidth;
- if (bbox.isEmpty() || bbox.extent(NR::X) < 1e-06 || bbox.extent(NR::Y) < 1e-06 ||
+ if (bbox.isEmpty() || bbox.extent(NR::X) < 1e-06 || bbox.extent(NR::Y) < 1e-06 ||
fabs(w0 - r0) < 1e-6 || fabs(h0 - r0) < 1e-6 ||
- (!transform_stroke && (fabs(w1 - r0) < 1e-6 || fabs(h1 - r0) < 1e-6))
+ (!transform_stroke && (fabs(w1 - r0) < 1e-6 || fabs(h1 - r0) < 1e-6))
) {
NR::Matrix move = NR::Matrix(NR::translate(x0 - bbox.min()[NR::X], y0 - bbox.min()[NR::Y]));
return (move); // sorry, cannot scale from or to empty boxes, so only translate
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index ab241a0cde9f32b7c0f4fe997992fadd74918548..db7f9fffd32644424d8568187dd32ce9036ca7a5 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? NULL : "true" ));
if (item->transform_center_x != 0)
sp_repr_set_svg_double (repr, "inkscape:transform-center-x", item->transform_center_x);
- else
+ else
repr->setAttribute ("inkscape:transform-center-x", NULL);
if (item->transform_center_y != 0)
sp_repr_set_svg_double (repr, "inkscape:transform-center-y", item->transform_center_y);
- else
- repr->setAttribute ("inkscape:transform-center-y", NULL);
+ else
+ repr->setAttribute ("inkscape:transform-center-y", NULL);
}
if (((SPObjectClass *) (parent_class))->write) {
diff --git a/src/sp-marker.cpp b/src/sp-marker.cpp
index 0c4c9215b7605fdf8125a0d7f0a7561aaecc01cd..0b4d954bf5280d10893417bd91f6c1a9d8622f80 100644 (file)
--- a/src/sp-marker.cpp
+++ b/src/sp-marker.cpp
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_MARKERWIDTH:
- marker->markerWidth.readOrUnset(value, SVGLength::NONE, 3.0, 3.0);
+ marker->markerWidth.readOrUnset(value, SVGLength::NONE, 3.0, 3.0);
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_MARKERHEIGHT:
- marker->markerHeight.readOrUnset(value, SVGLength::NONE, 3.0, 3.0);
+ marker->markerHeight.readOrUnset(value, SVGLength::NONE, 3.0, 3.0);
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_ORIENT:
/* fixme: Remove link if zero-sized (Lauris) */
/**
-* First of all, removes any SPMarkerViews that a marker has with a specific key.
+* First of all, removes any SPMarkerViews that a marker has with a specific key.
* Set up the NRArenaItem array's size in the specified SPMarker's SPMarkerView.
* \param marker Marker to create views in.
* \param key Key to give each SPMarkerView.
}
if (!v->items[pos]) {
/* Parent class ::show method */
- v->items[pos] = ((SPItemClass *) parent_class)->show ((SPItem *) marker,
+ v->items[pos] = ((SPItemClass *) parent_class)->show ((SPItem *) marker,
parent->arena, key,
SP_ITEM_REFERENCE_FLAGS);
if (v->items[pos]) {
diff --git a/src/sp-metrics.cpp b/src/sp-metrics.cpp
index 27d65422fc397b4f6dca08a30ed07e6bfb665e19..5f05c9fad6b8ac9db3bb46541f776a9a4122792d 100644 (file)
--- a/src/sp-metrics.cpp
+++ b/src/sp-metrics.cpp
/*
* SPMetric handling and stuff
- * I hope this will be usefull :-)
+ * I hope this will be usefull :-)
*/
gdouble
{
gdouble const len = sp_absolute_metric_to_metric(length, metric_src, metric_dst);
GString *str = g_string_new("");
- g_string_printf(str, "%0.02f", len);
+ g_string_printf(str, "%0.02f", len);
/* We need a fixed number of fractional digits, because otherwise the live statusbar display of
* lengths will be too jerky */
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 32e713792a67521578027f825cb1a1bba3c92ce0..f1d957d84acd87578da4bda8e413db3131a81c94 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
{
GObjectClass * gobject_class;
SPObjectClass * sp_object_class;
-
+
gobject_class = (GObjectClass *) klass;
sp_object_class = (SPObjectClass *) klass;
-
+
parent_class = (SPObjectGroupClass*) g_type_class_ref(SP_TYPE_OBJECTGROUP);
-
+
sp_object_class->build = sp_namedview_build;
sp_object_class->release = sp_namedview_release;
sp_object_class->set = sp_namedview_set;
nv->showguides = TRUE;
nv->showborder = TRUE;
nv->showpageshadow = TRUE;
-
+
nv->guides = NULL;
nv->viewcount = 0;
-
+
nv->default_layer_id = 0;
-
+
nv->connector_spacing = defaultConnSpacing;
-
+
new (&nv->grid_snapper) Inkscape::GridSnapper(nv, 0);
new (&nv->guide_snapper) Inkscape::GuideSnapper(nv, 0);
new (&nv->object_snapper) Inkscape::ObjectSnapper(nv, 0);
@@ -129,11 +129,11 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
{
SPNamedView *nv = (SPNamedView *) object;
SPObjectGroup *og = (SPObjectGroup *) object;
-
+
if (((SPObjectClass *) (parent_class))->build) {
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
-
+
sp_object_read_attr(object, "inkscape:document-units");
sp_object_read_attr(object, "viewonly");
sp_object_read_attr(object, "showgrid");
@@ -180,9 +180,9 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
sp_object_read_attr(object, "inkscape:object-nodes");
sp_object_read_attr(object, "inkscape:current-layer");
sp_object_read_attr(object, "inkscape:connector-spacing");
-
+
/* Construct guideline list */
-
+
for (SPObject *o = sp_object_first_child(SP_OBJECT(og)) ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
if (SP_IS_GUIDE(o)) {
SPGuide * g = SP_GUIDE(o);
@@ -195,21 +195,21 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
static void sp_namedview_release(SPObject *object)
{
SPNamedView *namedview = (SPNamedView *) object;
-
+
if (namedview->guides) {
g_slist_free(namedview->guides);
namedview->guides = NULL;
}
-
+
while (namedview->gridviews) {
gtk_object_unref(GTK_OBJECT(namedview->gridviews->data));
namedview->gridviews = g_slist_remove(namedview->gridviews, namedview->gridviews->data);
}
-
+
namedview->grid_snapper.~GridSnapper();
namedview->guide_snapper.~GuideSnapper();
namedview->object_snapper.~ObjectSnapper();
-
+
if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release(object);
}
@@ -520,7 +520,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
* doc_units.
*/
SPUnit const *new_unit = &sp_unit_get_by_id(SP_UNIT_PX);
-
+
if (value) {
SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value);
if ( req_unit == NULL ) {
@@ -553,15 +553,15 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
SPNamedView *nv = (SPNamedView *) object;
-
+
if (((SPObjectClass *) (parent_class))->child_added) {
(* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);
}
-
+
const gchar *id = child->attribute("id");
SPObject *no = object->document->getObjectById(id);
g_assert(SP_IS_OBJECT(no));
-
+
if (SP_IS_GUIDE(no)) {
SPGuide *g = (SPGuide *) no;
nv->guides = g_slist_prepend(nv->guides, g);
@@ -569,9 +569,9 @@ static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *chil
if (nv->editable) {
for (GSList *l = nv->views; l != NULL; l = l->next) {
sp_guide_show(g, static_cast<SPDesktop*>(l->data)->guides, (GCallback) sp_dt_guide_event);
- if (static_cast<SPDesktop*>(l->data)->guides_active)
- sp_guide_sensitize(g,
- SP_DT_CANVAS(static_cast<SPDesktop*> (l->data)),
+ if (static_cast<SPDesktop*>(l->data)->guides_active)
+ sp_guide_sensitize(g,
+ SP_DT_CANVAS(static_cast<SPDesktop*> (l->data)),
TRUE);
if (nv->showguides) {
for (GSList *v = SP_GUIDE(g)->views; v != NULL; v = v->next) {
@@ -590,7 +590,7 @@ static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *chil
static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *child)
{
SPNamedView *nv = (SPNamedView *) object;
-
+
GSList **ref = &nv->guides;
for ( GSList *iter = nv->guides ; iter ; iter = iter->next ) {
if ( SP_OBJECT_REPR((SPObject *)iter->data) == child ) {
@@ -601,7 +601,7 @@ static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *chi
}
ref = &iter->next;
}
-
+
if (((SPObjectClass *) (parent_class))->remove_child) {
(* ((SPObjectClass *) (parent_class))->remove_child)(object, child);
}
@@ -618,7 +618,7 @@ static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::
repr = SP_OBJECT_REPR(object)->duplicate();
}
}
-
+
return repr;
}
}
}
}
-
+
views = g_slist_prepend(views, desktop);
-
+
SPCanvasItem *item = sp_canvas_item_new(SP_DT_GRID(desktop), SP_TYPE_CGRID, NULL);
// since we're keeping a copy, we need to bump up the ref count
gtk_object_ref(GTK_OBJECT(item));
{
SPNamedView *nv = desktop->namedview;
gint save_geometry = prefs_get_int_attribute("options.savewindowgeometry", "value", 0);
-
+
// restore window size and position
if (save_geometry) {
if (nv->window_width != -1 && nv->window_height != -1)
if (nv->window_x != -1 && nv->window_y != -1)
desktop->setWindowPosition(NR::Point(nv->window_x, nv->window_y));
}
-
+
// restore zoom and view
if (nv->zoom != 0 && nv->zoom != HUGE_VAL && !isNaN(nv->zoom)
- && nv->cx != HUGE_VAL && !isNaN(nv->cx)
+ && nv->cx != HUGE_VAL && !isNaN(nv->cx)
&& nv->cy != HUGE_VAL && !isNaN(nv->cy)) {
desktop->zoom_absolute(nv->cx, nv->cy, nv->zoom);
} else if (SP_DT_DOCUMENT(desktop)) { // document without saved zoom, zoom to its page
desktop->zoom_page();
}
-
+
// cancel any history of zooms up to this point
if (desktop->zooms_past) {
g_list_free(desktop->zooms_past);
desktop->zooms_past = NULL;
}
-
+
SPObject *layer = NULL;
SPDocument *document = desktop->doc();
if ( nv->default_layer_id != 0 ) {
gint save_geometry = prefs_get_int_attribute("options.savewindowgeometry", "value", 0);
Inkscape::XML::Node *view = SP_OBJECT_REPR(desktop->namedview);
NR::Rect const r = desktop->get_display_area();
-
+
// saving window geometry is not undoable
gboolean saved = sp_document_get_undo_sensitive(SP_DT_DOCUMENT(desktop));
sp_document_set_undo_sensitive(SP_DT_DOCUMENT(desktop), FALSE);
-
+
sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom());
sp_repr_set_svg_double(view, "inkscape:cx", r.midpoint()[NR::X]);
sp_repr_set_svg_double(view, "inkscape:cy", r.midpoint()[NR::Y]);
-
+
if (save_geometry) {
gint w, h, x, y;
desktop->getWindowGeometry(x, y, w, h);
sp_repr_set_int(view, "inkscape:window-x", x);
sp_repr_set_int(view, "inkscape:window-y", y);
}
-
+
view->setAttribute("inkscape:current-layer", SP_OBJECT_ID(desktop->currentLayer()));
-
+
// restore undoability
sp_document_set_undo_sensitive(SP_DT_DOCUMENT(desktop), saved);
}
{
g_assert(desktop != NULL);
g_assert(g_slist_find(views, desktop));
-
+
for (GSList *l = guides; l != NULL; l = l->next) {
sp_guide_hide(SP_GUIDE(l->data), SP_DT_CANVAS(desktop));
}
-
+
views = g_slist_remove(views, desktop);
GSList *l;
}
g_assert(l);
-
+
sp_canvas_item_hide(SP_CANVAS_ITEM(l->data));
gtk_object_unref(GTK_OBJECT(l->data));
gridviews = g_slist_remove(gridviews, l->data);
{
g_assert(desktop != NULL);
g_assert(g_slist_find(views, desktop));
-
+
SPDesktop *dt = static_cast<SPDesktop*>(desktop);
-
+
for (GSList *l = guides; l != NULL; l = l->next) {
sp_guide_sensitize(SP_GUIDE(l->data), SP_DT_CANVAS(dt), active);
}
} else {
v = !v;
}
-
+
gboolean saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, FALSE);
-
+
sp_repr_set_boolean(repr, "showguides", v);
-
+
doc->rroot->setAttribute("sodipodi:modified", "true");
sp_document_set_undo_sensitive(doc, saved);
}
unsigned int v;
sp_repr_get_boolean(repr, "showgrid", &v);
v = !v;
-
+
gboolean saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, FALSE);
-
+
sp_repr_set_boolean(repr, "showgrid", v);
-
+
doc->rroot->setAttribute("sodipodi:modified", "true");
sp_document_set_undo_sensitive(doc, saved);
}
} else {
sp_canvas_item_hide(item);
}
-
+
sp_canvas_item_set((GtkObject *) item,
"color", nv->gridcolor,
"originx", nv->gridorigin[NR::X],
return TRUE;
}
}
-
+
return FALSE;
}
@@ -893,13 +893,13 @@ static gboolean sp_nv_read_length(const gchar *str, guint base, gdouble *val, co
while (isspace(*u)) {
u += 1;
}
-
+
if (!*u) {
/* No unit specified - keep default */
*val = v;
return TRUE;
}
-
+
if (base & SP_UNIT_DEVICE) {
if (u[0] && u[1] && !isalnum(u[2]) && !strncmp(u, "px", 2)) {
*unit = &sp_unit_get_by_id(SP_UNIT_PX);
@@ -907,7 +907,7 @@ static gboolean sp_nv_read_length(const gchar *str, guint base, gdouble *val, co
return TRUE;
}
}
-
+
if (base & SP_UNIT_ABSOLUTE) {
if (!strncmp(u, "pt", 2)) {
*unit = &sp_unit_get_by_id(SP_UNIT_PT);
@@ -925,7 +925,7 @@ static gboolean sp_nv_read_length(const gchar *str, guint base, gdouble *val, co
*val = v;
return TRUE;
}
-
+
return FALSE;
}
return FALSE;
}
v = CLAMP(v, 0.0, 1.0);
-
+
*color = (*color & 0xffffff00) | (guint32) floor(v * 255.9999);
-
+
return TRUE;
}
SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id)
{
g_return_val_if_fail(document != NULL, NULL);
-
+
SPObject *nv = sp_item_group_get_child_by_name((SPGroup *) document->root, NULL, "sodipodi:namedview");
g_assert(nv != NULL);
-
+
if (id == NULL) {
return (SPNamedView *) nv;
}
-
+
while (nv && strcmp(nv->id, id)) {
nv = sp_item_group_get_child_by_name((SPGroup *) document->root, nv, "sodipodi:namedview");
}
-
+
return (SPNamedView *) nv;
}
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index f97007b5140afeea94db994886676cdeb766777b..4a1a2e09ed84a6a28825af91485be617cbaec2a9 100644 (file)
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
*/
/** \class SPObject
- *
+ *
* SPObject is an abstract base class of all of the document nodes at the
* SVG document level. Each SPObject subclass implements a certain SVG
* element node type, or is an abstract base class for different node
*
* Hrefcount is used for weak references, for example, to
* determine whether any graphical element references a certain gradient
- * node.
+ * node.
* \param owner Ignored.
* \return object, NULL is error
* \pre object points to real object
/**
* Decrease weak refcount.
*
- * Hrefcount is used for weak references, for example, to determine whether
+ * Hrefcount is used for weak references, for example, to determine whether
* any graphical element references a certain gradient node.
* \param owner Ignored.
* \return always NULL
/**
* Adds increment to _total_hrefcount of object and its parents.
*/
-void
+void
SPObject::_updateTotalHRefCount(int increment) {
SPObject *topmost_collectable = NULL;
for ( SPObject *iter = this ; iter ; iter = SP_OBJECT_PARENT(iter) ) {
/**
* True if object is non-NULL and this is some in/direct parent of object.
*/
-bool
+bool
SPObject::isAncestorOf(SPObject const *object) const {
g_return_val_if_fail(object != NULL, false);
object = SP_OBJECT_PARENT(object);
/**
* Compares height of objects in tree.
- *
- * Works for different-parent objects, so long as they have a common ancestor.
+ *
+ * Works for different-parent objects, so long as they have a common ancestor.
* \return \verbatim
* 0 positions are equivalent
* 1 first object's position is greater than the second
}
/** Sets the label property for the object */
-void
+void
SPObject::setLabel(gchar const *label) {
SP_OBJECT_REPR(this)->setAttribute("inkscape:label", label, false);
}
/** Queues the object for orphan collection */
-void
+void
SPObject::requestOrphanCollection() {
g_return_if_fail(document != NULL);
document->queueForOrphanCollection(this);
/** \todo
- * This is a temporary hack added to make fill&stroke rebuild its
- * gradient list when the defs are vacuumed. gradient-vector.cpp
- * listens to the modified signal on defs, and now we give it that
+ * This is a temporary hack added to make fill&stroke rebuild its
+ * gradient list when the defs are vacuumed. gradient-vector.cpp
+ * listens to the modified signal on defs, and now we give it that
* signal. Mental says that this should be made automatic by
- * merging SPObjectGroup with SPObject; SPObjectGroup would issue
- * this signal automatically. Or maybe just derive SPDefs from
+ * merging SPObjectGroup with SPObject; SPObjectGroup would issue
+ * this signal automatically. Or maybe just derive SPDefs from
* SPObjectGroup?
*/
-
+
this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
}
/** Sends the delete signal to all children of this object recursively */
-void
+void
SPObject::_sendDeleteSignalRecursive() {
for (SPObject *child = sp_object_first_child(this); child; child = SP_OBJECT_NEXT(child)) {
child->_delete_signal.emit(child);
/**
* Deletes the object reference, unparenting it from its parent.
- *
+ *
* If the \a propagate parameter is set to true, it emits a delete
* signal. If the \a propagate_descendants parameter is true, it
* recursively sends the delete signal to children.
*/
-void
+void
SPObject::deleteObject(bool propagate, bool propagate_descendants)
{
sp_object_ref(this, NULL);
/**
* In list of object's siblings, move object behind prev.
*/
-void
+void
sp_object_reorder(SPObject *object, SPObject *prev) {
g_return_if_fail(object != NULL);
g_return_if_fail(SP_IS_OBJECT(object));
/**
* Remove object from parent's children, release and unref it.
*/
-void
+void
sp_object_detach(SPObject *parent, SPObject *object) {
g_return_if_fail(parent != NULL);
g_return_if_fail(SP_IS_OBJECT(parent));
* Callback for child_added event.
* Invoked whenever the given mutation event happens in the XML tree.
*/
-static void
+static void
sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
GType type = sp_repr_type_lookup(child);
}
/**
- * Remove object's child whose node equals repr, release and
+ * Remove object's child whose node equals repr, release and
* unref it.
*
* Invoked whenever the given mutation event happens in the XML
- * tree, BEFORE removal from the XML tree happens, so grouping
+ * tree, BEFORE removal from the XML tree happens, so grouping
* objects can safely release the child data.
*/
-static void
+static void
sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child)
{
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
}
/**
- * Move object corresponding to child after sibling object corresponding
+ * Move object corresponding to child after sibling object corresponding
* to new_ref.
* Invoked whenever the given mutation event happens in the XML tree.
* \param old_ref Ignored
@@ -775,7 +775,7 @@ static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child
/**
* Virtual build callback.
- *
+ *
* This has to be invoked immediately after creation of an SPObject. The
* frontend method ensures that the new object is properly attached to
* the document and repr; implementation then will parse all of the attributes,
@@ -932,7 +932,7 @@ sp_object_repr_child_removed(Inkscape::XML::Node *repr, Inkscape::XML::Node *chi
/**
* Callback for order_changed node event.
- *
+ *
* \todo fixme:
*/
static void
/* Modification */
-/**
- * Add \a flags to \a object's as dirtiness flags, and
+/**
+ * Add \a flags to \a object's as dirtiness flags, and
* recursively add CHILD_MODIFIED flag to
* parent and ancestors (as far up as necessary).
*/
// Merge style if we have good reasons to think that parent style is changed */
/** \todo
- * I am not sure whether we should check only propagated
- * flag. We are currently assuming that style parsing is
+ * I am not sure whether we should check only propagated
+ * flag. We are currently assuming that style parsing is
* done immediately. I think this is correct (Lauris).
*/
if ((flags & SP_OBJECT_STYLE_MODIFIED_FLAG) && (flags & SP_OBJECT_PARENT_MODIFIED_FLAG)) {
* Returns an object style property.
*
* \todo
- * fixme: Use proper CSS parsing. The current version is buggy
- * in a number of situations where key is a substring of the
+ * fixme: Use proper CSS parsing. The current version is buggy
+ * in a number of situations where key is a substring of the
* style string other than as a property name (including
- * where key is a substring of a property name), and is also
- * buggy in its handling of inheritance for properties that
+ * where key is a substring of a property name), and is also
+ * buggy in its handling of inheritance for properties that
* aren't inherited by default. It also doesn't allow for
- * the case where the property is specified but with an invalid
- * value (in which case I believe the CSS2 error-handling
+ * the case where the property is specified but with an invalid
+ * value (in which case I believe the CSS2 error-handling
* behaviour applies, viz. behave as if the property hadn't
- * been specified). Also, the current code doesn't use CRSelEng
- * stuff to take a value from stylesheets. Also, we aren't
- * setting any hooks to force an update for changes in any of
- * the inputs (i.e., in any of the elements that this function
+ * been specified). Also, the current code doesn't use CRSelEng
+ * stuff to take a value from stylesheets. Also, we aren't
+ * setting any hooks to force an update for changes in any of
+ * the inputs (i.e., in any of the elements that this function
* queries).
*
* \par
- * Given that the default value for a property depends on what
- * property it is (e.g., whether to inherit or not), and given
- * the above comment about ignoring invalid values, and that the
- * repr parent isn't necessarily the right element to inherit
- * from (e.g., maybe we need to inherit from the referencing
- * <use> element instead), we should probably make the caller
+ * Given that the default value for a property depends on what
+ * property it is (e.g., whether to inherit or not), and given
+ * the above comment about ignoring invalid values, and that the
+ * repr parent isn't necessarily the right element to inherit
+ * from (e.g., maybe we need to inherit from the referencing
+ * <use> element instead), we should probably make the caller
* responsible for ascending the repr tree as necessary.
*/
gchar const *
sp_object_get_style_property(SPObject const *object, gchar const *key, gchar const *def)
-{
+{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(key != NULL, NULL);
@@ -1490,7 +1490,7 @@ sp_object_get_style_property(SPObject const *object, gchar const *key, gchar con
/**
* Lifts SVG version of all root objects to version.
*/
-void
+void
SPObject::_requireSVGVersion(Inkscape::Version version) {
for ( SPObject::ParentIterator iter=this ; iter ; ++iter ) {
SPObject *object=iter;
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index a9730653c247e4ac11f3118113197c9bc2aea9c9..fc9115f24adadbacc7f3af3c1475df4cc962beb4 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
/** \note
* SPOffset is a derivative of SPShape, much like the SPSpiral or SPRect.
- * The goal is to have a source shape (= originalPath), an offset (= radius)
- * and compute the offset of the source by the radius. To get it to work,
- * one needs to know what the source is and what the radius is, and how it's
- * stored in the xml representation. The object itself is a "path" element,
- * to get lots of shape functionality for free. The source is the easy part:
- * it's stored in a "inkscape:original" attribute in the path. In case of
+ * The goal is to have a source shape (= originalPath), an offset (= radius)
+ * and compute the offset of the source by the radius. To get it to work,
+ * one needs to know what the source is and what the radius is, and how it's
+ * stored in the xml representation. The object itself is a "path" element,
+ * to get lots of shape functionality for free. The source is the easy part:
+ * it's stored in a "inkscape:original" attribute in the path. In case of
* "linked" offset, as they've been dubbed, there is an additional
- * "inkscape:href" that contains the id of an element of the svg.
- * When built, the object will attach a listener vector to that object and
- * rebuild the "inkscape:original" whenever the href'd object changes. This
- * is of course grossly inefficient, and also does not react to changes
- * to the href'd during context stuff (like changing the shape of a star by
- * dragging control points) unless the path of that object is changed during
- * the context (seems to be the case for SPEllipse). The computation of the
- * offset is done in sp_offset_set_shape(), a function that is called whenever
+ * "inkscape:href" that contains the id of an element of the svg.
+ * When built, the object will attach a listener vector to that object and
+ * rebuild the "inkscape:original" whenever the href'd object changes. This
+ * is of course grossly inefficient, and also does not react to changes
+ * to the href'd during context stuff (like changing the shape of a star by
+ * dragging control points) unless the path of that object is changed during
+ * the context (seems to be the case for SPEllipse). The computation of the
+ * offset is done in sp_offset_set_shape(), a function that is called whenever
* a change occurs to the offset (change of source or change of radius).
- * just like the sp-star and other, this path derivative can make control
- * points, or more precisely one control point, that's enough to define the
+ * just like the sp-star and other, this path derivative can make control
+ * points, or more precisely one control point, that's enough to define the
* radius (look in object-edit).
*/
@@ -209,19 +209,19 @@ sp_offset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
{
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
-
+
if (object->repr->attribute("inkscape:radius")) {
sp_object_read_attr (object, "inkscape:radius");
} else {
gchar const *oldA = object->repr->attribute("sodipodi:radius");
object->repr->setAttribute("inkscape:radius",oldA);
object->repr->setAttribute("sodipodi:radius",NULL);
-
+
sp_object_read_attr (object, "inkscape:radius");
}
if (object->repr->attribute("inkscape:original")) {
sp_object_read_attr (object, "inkscape:original");
- } else {
+ } else {
gchar const *oldA = object->repr->attribute("sodipodi:original");
object->repr->setAttribute("inkscape:original",oldA);
object->repr->setAttribute("sodipodi:original",NULL);
}
/**
- * Set callback: the function that is called whenever a change is made to
+ * Set callback: the function that is called whenever a change is made to
* the description of the object.
*/
static void
}
/**
- * Converts an NArtBpath (like the one stored in a SPCurve) into a
+ * Converts an NArtBpath (like the one stored in a SPCurve) into a
* livarot Path. Duplicate of splivarot.
*/
Path *
{
if (bpath == NULL)
return NULL;
-
+
Path *dest = new Path;
dest->SetBackData (false);
{
Path *originaux[1];
Path *res = new Path;
res->SetBackData (false);
-
+
// and now: offset
float o_width;
if (offset->rad >= 0)
// version par makeoffset
Shape *theShape = new Shape;
Shape *theRes = new Shape;
-
-
+
+
// and now: offset
float o_width;
if (offset->rad >= 0)
{
o_width = -offset->rad;
}
-
+
// one has to have a measure of the details
if (o_width >= 1.0)
{
// utilitaires pour les poignees
// used to get the distance to the shape: distance to polygon give the fabs(radius), we still need
// the sign. for edges, it's easy to determine which side the point is on, for points of the polygon
-// it's trickier: we need to identify which angle the point is in; to that effect, we take each
+// it's trickier: we need to identify which angle the point is in; to that effect, we take each
// successive clockwise angle (A,C) and check if the vector B given by the point is in the angle or
// outside.
-// another method would be to use the Winding() function to test whether the point is inside or outside
+// another method would be to use the Winding() function to test whether the point is inside or outside
// the polygon (it would be wiser to do so, in fact, but i like being stupid)
-/**
+/**
*
* \todo
* FIXME: This can be done using linear operations, more stably and
* faster. method: transform A and C into B's space, A should be
* negative and B should be positive in the orthogonal component. I
- * think this is equivalent to
- * dot(A, rot90(B))*dot(C, rot90(B)) == -1.
- * -- njh
+ * think this is equivalent to
+ * dot(A, rot90(B))*dot(C, rot90(B)) == -1.
+ * -- njh
*/
bool
vectors_are_clockwise (NR::Point A, NR::Point B, NR::Point C)
return false;
}
-/**
- * Distance to the original path; that function is called from object-edit
+/**
+ * Distance to the original path; that function is called from object-edit
* to set the radius when the control knot moves.
*
- * The sign of the result is the radius we're going to offset the shape with,
- * so result > 0 ==outset and result < 0 ==inset. thus result<0 means
+ * The sign of the result is the radius we're going to offset the shape with,
+ * so result > 0 ==outset and result < 0 ==inset. thus result<0 means
* 'px inside source'.
*/
double
double dist = 1.0;
Shape *theShape = new Shape;
Shape *theRes = new Shape;
-
- /** \todo
- * Awfully damn stupid method: uncross the source path EACH TIME you
- * need to compute the distance. The good way to do this would be to
+
+ /** \todo
+ * Awfully damn stupid method: uncross the source path EACH TIME you
+ * need to compute the distance. The good way to do this would be to
* store the uncrossed source path somewhere, and delete it when the
- * context is finished. Hopefully this part is much faster than actually
- * computing the offset (which happen just after), so the time spent in
- * this function should end up being negligible with respect to the
+ * context is finished. Hopefully this part is much faster than actually
+ * computing the offset (which happen just after), so the time spent in
+ * this function should end up being negligible with respect to the
* delay of one context.
*/
// move
return dist;
}
-/**
- * Computes a point on the offset; used to set a "seed" position for
+/**
+ * Computes a point on the offset; used to set a "seed" position for
* the control knot.
*
* \return the topmost point on the offset.
sp_shape_set_shape ((SPShape *) offset);
}
-static void
+static void
refresh_offset_source(SPOffset* offset)
{
if ( offset == NULL ) return;
{
theRes->ConvertToShape (theShape, fill_nonZero);
}
-
+
Path *originaux[1];
originaux[0] = orig;
Path *res = new Path;
theRes->ConvertToForme (res, 1, originaux);
-
+
delete theShape;
delete theRes;
-
+
char *res_d = res->svg_dump_path ();
delete res;
delete orig;
-
+
SP_OBJECT (offset)->repr->setAttribute("inkscape:original", res_d);
-
+
free (res_d);
}
}
index 24727628ca09aaf91e5d7ec5c5e6c5047a5053ed..90263d17cba9dd507add4774db03b61f0b44bbc0 100644 (file)
--- a/src/sp-paint-server.cpp
+++ b/src/sp-paint-server.cpp
g_return_if_fail(painter != NULL);
SPPaintServerClass *psc = (SPPaintServerClass *) G_OBJECT_GET_CLASS(ps);
-
+
SPPainter *r = NULL;
for (SPPainter *p = ps->painters; p != NULL; p = p->next) {
if (p == painter) {
}
r = p;
}
-
+
g_assert_not_reached();
}
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index beea89b02ced8f5c62ace242fde0f9d03ef8ab5f..85a8ad649634f533bb5c8a6332fa9940e74f77c1 100644 (file)
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -332,7 +332,7 @@ sp_pattern_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::
}
/* TODO: do we need a ::remove_child handler? */
-
+
/* fixme: We need ::order_changed handler too (Lauris) */
GSList *
@@ -458,7 +458,7 @@ sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *pr
SPCSSAttr *css = sp_repr_css_attr_new ();
sp_repr_css_set_property (css, property, href);
sp_repr_css_change_recursive (SP_OBJECT_REPR (item), css, "style");
- }
+ }
return pattern;
}
@@ -512,7 +512,7 @@ pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix t
SPItem *copy = SP_ITEM(pat_object->appendChildRepr(node));
NR::Matrix dup_transform;
- if (!sp_svg_transform_read (node->attribute("transform"), &dup_transform))
+ if (!sp_svg_transform_read (node->attribute("transform"), &dup_transform))
dup_transform = NR::identity();
dup_transform *= move;
@@ -524,7 +524,7 @@ pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix t
}
SPPattern *
-pattern_getroot (SPPattern *pat)
+pattern_getroot (SPPattern *pat)
{
for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (sp_object_first_child(SP_OBJECT(pat_i))) { // find the first one with children
@@ -708,7 +708,7 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR:
pcs2px = pattern_patternTransform(pat) * full_transform;
}
- pcs2px = NR::translate (pattern_x (pat), pattern_y (pat)) * pcs2px;
+ pcs2px = NR::translate (pattern_x (pat), pattern_y (pat)) * pcs2px;
pcs2px.copyto (&pp->pcs2px);
}
area.x1 = area.x0 + pb->area.x1 - pb->area.x0;
area.y1 = area.y0 + pb->area.y1 - pb->area.y0;
- // We do not update here anymore
+ // We do not update here anymore
- // Set up buffer
- // fixme: (Lauris)
+ // Set up buffer
+ // fixme: (Lauris)
nr_pixblock_setup_extern (&ppb, pb->mode, area.x0, area.y0, area.x1, area.y1, NR_PIXBLOCK_PX (pb), pb->rs, FALSE, FALSE);
nr_arena_item_invoke_render (pp->root, &area, &ppb, 0);
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 1bb77ccc78f8615e31780947a66db35dad056396..3773efa8333c010e011e75e7653457c20db5f89e 100644 (file)
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
Inkscape::SVGOStringStream os;
os << root->viewBox.x0 << " " << root->viewBox.y0 << " " << root->viewBox.x1 - root->viewBox.x0 << " " << root->viewBox.y1 - root->viewBox.y0;
repr->setAttribute("viewBox", os.str().c_str());
- }
+ }
if (((SPObjectClass *) (parent_class))->write)
((SPObjectClass *) (parent_class))->write(object, repr, flags);
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index aced4ec53148202bd51086c710d006bb95147d36..d7b703d1adbc70269657cf795f5a61ba6ce7a5fc 100644 (file)
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
spiral = SP_SPIRAL (object);
shape = SP_SHAPE (object);
- /// \todo fixme: we should really collect updates
+ /// \todo fixme: we should really collect updates
switch (key) {
case SP_ATTR_SODIPODI_CX:
if (!sp_svg_length_read_computed_absolute (value, &spiral->cx)) {
break;
case SP_ATTR_SODIPODI_EXPANSION:
if (value) {
- /** \todo
- * FIXME: check that value looks like a (finite)
- * number. Create a routine that uses strtod, and
+ /** \todo
+ * FIXME: check that value looks like a (finite)
+ * number. Create a routine that uses strtod, and
* accepts a default value (if strtod finds an error).
- * N.B. atof/sscanf/strtod consider "nan" and "inf"
+ * N.B. atof/sscanf/strtod consider "nan" and "inf"
* to be valid numbers.
*/
spiral->exp = g_ascii_strtod (value, NULL);
if (value) {
spiral->arg = g_ascii_strtod (value, NULL);
/** \todo
- * FIXME: We still need some bounds on arg, for
- * numerical reasons. E.g., we don't want inf or NaN,
- * nor near-infinite numbers. I'm inclined to take
- * modulo 2*pi. If so, then change the knot editors,
- * which use atan2 - revo*2*pi, which typically
+ * FIXME: We still need some bounds on arg, for
+ * numerical reasons. E.g., we don't want inf or NaN,
+ * nor near-infinite numbers. I'm inclined to take
+ * modulo 2*pi. If so, then change the knot editors,
+ * which use atan2 - revo*2*pi, which typically
* results in very negative arg.
*/
} else {
spiral->t0 = CLAMP (spiral->t0, 0.0, 0.999);
/** \todo
* Have shared constants for the allowable bounds for
- * attributes. There was a bug here where we used -1.0
- * as the minimum (which leads to NaN via, e.g.,
- * pow(-1.0, 0.5); see sp_spiral_get_xy for
+ * attributes. There was a bug here where we used -1.0
+ * as the minimum (which leads to NaN via, e.g.,
+ * pow(-1.0, 0.5); see sp_spiral_get_xy for
* requirements.
*/
} else {
}
-/**
+/**
* Fit beziers together to spiral and draw it.
*
* \pre dstep \> 0.
&& (d < 1.0)) {
i--;
d += dstep;
- /** We mustn't increase dstep for subsequent values of
- * i: for large spiral.exp values, rate of growth
- * increases very rapidly.
+ /** We mustn't increase dstep for subsequent values of
+ * i: for large spiral.exp values, rate of growth
+ * increases very rapidly.
*/
- /** \todo
- * Get the function itself to decide what value of d
- * to use next: ensure that we move at least 0.25 *
- * stroke width, for example. The derivative (as used
- * for get_tangent before normalization) would be
- * useful for estimating the appropriate d value. Or
- * perhaps just start with a small dstep and scale by
- * some small number until we move >= 0.25 *
- * stroke_width. Must revert to the original dstep
- * value for next iteration to avoid the problem
+ /** \todo
+ * Get the function itself to decide what value of d
+ * to use next: ensure that we move at least 0.25 *
+ * stroke width, for example. The derivative (as used
+ * for get_tangent before normalization) would be
+ * useful for estimating the appropriate d value. Or
+ * perhaps just start with a small dstep and scale by
+ * some small number until we move >= 0.25 *
+ * stroke_width. Must revert to the original dstep
+ * value for next iteration to avoid the problem
* mentioned above.
*/
}
g_return_if_fail (SP_IS_SPIRAL (spiral));
/** \todo
- * Consider applying CLAMP or adding in-bounds assertions for
+ * Consider applying CLAMP or adding in-bounds assertions for
* some of these parameters.
*/
spiral->cx = cx;
}
}
-/**
+/**
* Return one of the points on the spiral.
*
* \param t specifies how far along the spiral.
- * \pre \a t in [0.0, 2.03]. (It doesn't make sense for t to be much more
- * than 1.0, though some callers go slightly beyond 1.0 for curve-fitting
+ * \pre \a t in [0.0, 2.03]. (It doesn't make sense for t to be much more
+ * than 1.0, though some callers go slightly beyond 1.0 for curve-fitting
* purposes.)
*/
NR::Point sp_spiral_get_xy (SPSpiral const *spiral, gdouble t)
}
-/**
+/**
* Returns the derivative of sp_spiral_get_xy with respect to t,
* scaled to a unit vector.
*
NR::Point unrotated(spiral->exp, t_scaled);
double const s_len = L2 (unrotated);
g_assert (s_len != 0);
- /** \todo
- * Check that this isn't being too hopeful of the hypot
- * function. E.g. test with numbers around 2**-1070
- * (denormalized numbers), preferably on a few different
- * platforms. However, njh says that the usual implementation
+ /** \todo
+ * Check that this isn't being too hopeful of the hypot
+ * function. E.g. test with numbers around 2**-1070
+ * (denormalized numbers), preferably on a few different
+ * platforms. However, njh says that the usual implementation
* does handle both very big and very small numbers.
*/
unrotated /= s_len;
so ret is already of unit length other than numerical
error in the above matrix multiplication. */
- /** \todo
- * I haven't checked how important it is for ret to be very
+ /** \todo
+ * I haven't checked how important it is for ret to be very
* near unit length; we could get rid of the below.
*/
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index dfa34be9525c88cecae2c9bddcac3d42afdb0837..eea11791ff291279c9c30ddfd1db782f34dacfc7 100644 (file)
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
static void
sp_star_update (SPObject *object, SPCtx *ctx, guint flags)
{
- if (flags & (SP_OBJECT_MODIFIED_FLAG |
- SP_OBJECT_STYLE_MODIFIED_FLAG |
+ if (flags & (SP_OBJECT_MODIFIED_FLAG |
+ SP_OBJECT_STYLE_MODIFIED_FLAG |
SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
sp_shape_set_shape ((SPShape *) object);
}
static guint32
point_unique_int (NR::Point o)
{
- return ((guint32)
- 65536 *
- (((int) floor (o[NR::X] * 64)) % 1024 + ((int) floor (o[NR::X] * 1024)) % 64)
+ return ((guint32)
+ 65536 *
+ (((int) floor (o[NR::X] * 64)) % 1024 + ((int) floor (o[NR::X] * 1024)) % 64)
+
(((int) floor (o[NR::Y] * 64)) % 1024 + ((int) floor (o[NR::Y] * 1024)) % 64)
);
@@ -358,7 +358,7 @@ sp_star_get_curvepoint (SPStar *star, SPStarPoint point, gint index, bool previ)
// point to which we direct the bissector of the curve handles;
// it's far enough outside the star on the perpendicular to prev-next through mid
- NR::Point biss = mid + 100000 * rot90_rel (mid, next);
+ NR::Point biss = mid + 100000 * rot90_rel (mid, next);
// lengths of vectors to prev and next
gdouble prev_len = NR::L2 (prev - o);
if (not_rounded) {
sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT2, 0, true));
} else {
- sp_curve_curveto (c,
+ sp_curve_curveto (c,
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, NEXT),
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, 0, PREV),
sp_star_get_xy (star, SP_STAR_POINT_KNOT2, 0, true));
sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
} else {
if (star->flatsided == false) {
- sp_curve_curveto (c,
+ sp_curve_curveto (c,
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, i - 1, NEXT),
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, PREV),
sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
} else {
- sp_curve_curveto (c,
+ sp_curve_curveto (c,
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i - 1, NEXT),
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, PREV),
sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
} else {
if (star->flatsided == false) {
- sp_curve_curveto (c,
+ sp_curve_curveto (c,
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, sides - 1, NEXT),
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, PREV),
sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
} else {
- sp_curve_curveto (c,
+ sp_curve_curveto (c,
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, sides - 1, NEXT),
sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, PREV),
sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index f07783dbefe7db75ce65c4ac636f4d57d616c39d..3b5780721dda18940d5f295947f3eee01b4b6dd1 100644 (file)
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
tp->sourcePath->sourceDirty=false;
// finalisons
- if ( tp->sourcePath->originalPath ) {
+ if ( tp->sourcePath->originalPath ) {
if (tp->originalPath) {
delete tp->originalPath;
}
// make a copy of each textpath child
Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate();
// remove the old repr from under textpath
- SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data);
+ SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data);
// put its copy into under textPath
SP_OBJECT_REPR(text)->addChild(copy, NULL); // fixme: copy id
}
tp->deleteObject();
g_slist_free(tp_reprs);
- // set x/y on text
+ // set x/y on text
/* fixme: Yuck, is this really the right test? */
if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) {
sp_repr_set_svg_double(SP_OBJECT_REPR(text), "x", xy[NR::X]);
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index c1640d427538e5f5eef2f83176dffea060a96bf4..15bf513dcc4b36fd7ff597aa082b25f0f4ff8ac3 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
SnapManager const m(desktop->namedview);
sc->center = m.freeSnap(Inkscape::Snapper::SNAP_POINT, sc->center, sc->item).getPoint();
-
+
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
( GDK_KEY_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
diff --git a/src/star-context.cpp b/src/star-context.cpp
index bee392863d6764d732bb29b09dab06b82a7909d5..f796f77a944d32b224f6935d52101264e78c49b4 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
sc->rounded = (val) ? g_ascii_strtod (val, NULL) : 0.0;
} else if (!strcmp (key, "randomized")) {
sc->randomized = (val) ? g_ascii_strtod (val, NULL) : 0.0;
- }
+ }
}
static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent *event)
@@ -272,11 +272,11 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
switch (event->type) {
case GDK_BUTTON_PRESS:
if (event->button.button == 1) {
-
+
dragging = TRUE;
sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
-
+
SnapManager const m(desktop->namedview);
sc->center = m.freeSnap(Inkscape::Snapper::SNAP_POINT, sc->center, sc->item).getPoint();
NR::Point const d = p1 - p0;
NR::Coord const r1 = NR::L2(d);
double arg1 = atan2(d);
-
+
if (state & GDK_CONTROL_MASK) {
/* Snap angle */
arg1 = sp_round(arg1, M_PI / snaps);
_("<b>Polygon</b>: radius %s, angle %5g°; with <b>Ctrl</b> to snap angle")
: _("<b>Star</b>: radius %s, angle %5g°; with <b>Ctrl</b> to snap angle") ),
rads->str, sp_round((arg1) * 180 / M_PI, 0.0001));
-
+
g_string_free(rads, FALSE);
}
diff --git a/src/streams-gzip.cpp b/src/streams-gzip.cpp
index c2cda1c2b7b5ebc814cea5c07cd70bf3470a6321..4233be7c05e60dfa723faf8082f707ad2be22585 100644 (file)
--- a/src/streams-gzip.cpp
+++ b/src/streams-gzip.cpp
static int const GZIP_HEADER_CRC = 0x02; //there is a CRC in the header
static int const GZIP_EXTRA_FIELD = 0x04; //there is an 'extra' field
static int const GZIP_ORIGINAL_NAME = 0x08; //the original is stored
-static int const GZIP_HAS_COMMENT = 0x10; //There is a comment in the header
-static unsigned int const GZIP_HEADER_FLAGS = (GZIP_IS_ASCII
- |GZIP_HEADER_CRC
+static int const GZIP_HAS_COMMENT = 0x10; //There is a comment in the header
+static unsigned int const GZIP_HEADER_FLAGS = (GZIP_IS_ASCII
+ |GZIP_HEADER_CRC
|GZIP_EXTRA_FIELD
|GZIP_ORIGINAL_NAME
|GZIP_HAS_COMMENT);
{
unsigned int flags;
guint8 data[4];
-
+
try {
_urihandle->read(data, 4);
check_signature(data);
index 0990d05897dd09acb1cb8e3678fd8451efb4dd79..9c6e861f80aeca9dd8fde44ee184461762430177 100644 (file)
--- a/src/streams-handles.cpp
+++ b/src/streams-handles.cpp
}
FILE *FileHandle::sys_open(URI const& uri, char const* mode)
-{
+{
gchar *filename = uri.toNativeFilename();
if ((fp = std::fopen(filename, mode)) == 0) {
error("fwrite");
throw WriteException();
}
-
- return nbytes;
+
+ return nbytes;
}
int FileHandle::seek(long offset, int whence)
diff --git a/src/streams-jar.cpp b/src/streams-jar.cpp
index ffaccc2e4a1726bad93186634fe8bdfa3d522f44..712524cf0b130b2fe0d05f31c99e28a6f82877d8 100644 (file)
--- a/src/streams-jar.cpp
+++ b/src/streams-jar.cpp
flags = unpack_2bytes(data, LOC_EXTRA);
method = unpack_2bytes(data, LOC_COMP);
-#ifdef DEBUG_STREAMS
+#ifdef DEBUG_STREAMS
std::printf("Compressed size is %u\n", compressed_size);
std::printf("Filename length is %hu\n", filename_length);
std::printf("Extra field length is %hu\n", eflen);
std::printf("Flags are %#hx\n", flags);
std::printf("Compression method is %#hx\n", method);
#endif
-
+
//guint32 crc = check_crc(data, flags);
gchar filename[filename_length+1];
_urihandle->read(filename, filename_length);
@@ -75,12 +75,12 @@ void JarBuffer::reset()//resets zlib and buffer (also skips archived directories
int JarBuffer::consume_and_inflate()
{
int nbytes;
-
+
reset();
- nbytes = compressed_left > BUFSIZE_STREAM ? BUFSIZE_STREAM
+ nbytes = compressed_left > BUFSIZE_STREAM ? BUFSIZE_STREAM
: compressed_left;
-
+
if (is_compressed())
return consume_compressed(nbytes);
else
guint8 efbuf[eflen];
_urihandle->read(efbuf, eflen);
return 1;
- }
+ }
return ret;
}
guint8 data[nbytes];
if (consume(data, nbytes) == EOF)
return EOF;
-
+
copy_to_get(data, nbytes);
compressed_left -= nbytes;
return gba;
}
-guint32 JarBuffer::unpack_4bytes(guint8 *data, const int offset)
+guint32 JarBuffer::unpack_4bytes(guint8 *data, const int offset)
{
- return ((guint32)data[offset]
+ return ((guint32)data[offset]
+ (((guint32)data[offset + 1]) << 8)
- + (((guint32)data[offset + 2]) << 16)
+ + (((guint32)data[offset + 2]) << 16)
+ (((guint32)data[offset + 3]) << 24));
}
diff --git a/src/streams-zlib.cpp b/src/streams-zlib.cpp
index 73106db17109215088e993a18ca42d91ad5fd1be..cbe6a75fe0c44d114b68a72307f426f0528a4530 100644 (file)
--- a/src/streams-zlib.cpp
+++ b/src/streams-zlib.cpp
* ZlibBuffer
*/
-ZlibBuffer::ZlibBuffer(URIHandle& urih)
+ZlibBuffer::ZlibBuffer(URIHandle& urih)
: _urihandle(&urih), _putsize(BUFSIZE_STREAM), _getsize(BUFSIZE_STREAM)
-{
+{
init_inflation();
}
int ZlibBuffer::reallocate_buffers(int new_getsize, int new_putsize)
{
char *new_buffer = new char[new_getsize + new_putsize];
-
+
std::memcpy(new_buffer, eback(), _getsize);
std::memcpy(new_buffer, eback() + _getsize, _putsize);
-
- setg(new_buffer, new_buffer + (gptr() - eback()),
+
+ setg(new_buffer, new_buffer + (gptr() - eback()),
new_buffer + new_getsize);
new_buffer += new_getsize;
setp(new_buffer, new_buffer + new_putsize);
-
+
_getsize = new_getsize;
_putsize = new_putsize;
{
if (eback() == 0 && allocate_buffers() == 0)
return EOF;
-
+
if (consume_and_inflate() == EOF)
return EOF;
-
+
return *(unsigned char *)gptr();
}
if (pbase() == 0 && allocate_buffers() == 0)
return EOF;
- if (pptr() >= epptr() &&
+ if (pptr() >= epptr() &&
flush_output() == EOF)
return EOF;
putchar(c);
-
- if (pptr() >= epptr() &&
+
+ if (pptr() >= epptr() &&
flush_output() == EOF)
return EOF;
int ZlibBuffer::do_consume(guint8 *buf, int nbytes)
{
nbytes = _urihandle->read(buf, nbytes);
-
+
if (nbytes == EOF)
return EOF;
else if (nbytes == 0)
guint8 buf[nbytes];
if (consume(buf, nbytes) == EOF)
return EOF;
-
+
GByteArray *gba = inflate(buf, nbytes);
copy_to_get(gba->data, gba->len);
-
+
g_byte_array_free(gba, TRUE);
return 1;
}
void ZlibBuffer::init_inflation() throw(ZlibBufferException)
{
memset(&_zs, 0, sizeof(z_stream));
-
+
_zs.zalloc = Z_NULL;
_zs.zfree = Z_NULL;
_zs.opaque = Z_NULL;
-
+
if(inflateInit2(&_zs, -15) != Z_OK) {
throw ZlibBufferException();
}
void ZlibBuffer::reset_inflation() throw(ZlibBufferException)
{
- if (inflateReset(&_zs) != Z_OK)
+ if (inflateReset(&_zs) != Z_OK)
throw ZlibBufferException();
}
{
GByteArray *gba = g_byte_array_new();
guint8 out_buffer[BUFSIZE_STREAM];
-
+
_zs.avail_in = 0;
guint32 crc = crc32(0, Z_NULL, 0);
-
+
if (!_zs.avail_in) {
_zs.avail_in = nbytes;
_zs.next_in = (Bytef *)data;
int ZlibBuffer::do_copy_to_get(guint8 *data, int nbytes)
{
- if (nbytes + gptr() - eback() > _getsize)
+ if (nbytes + gptr() - eback() > _getsize)
reallocate_buffers(nbytes + gptr() - eback() + BUFSIZE_STREAM,
_putsize);
-
+
std::memcpy(gptr(), data, nbytes);
setg(eback(), gptr(), gptr() + nbytes);
return 1;
diff --git a/src/style.cpp b/src/style.cpp
index e0a1dcc7d2bdaad8a62f85d9c88e61c3baae2c5c..ee67469ade716ac45dc3e9710748d83d23b53aa3 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
/**
* Read style properties from object's repr.
- *
+ *
* 1. Reset existing object style
* 2. Load current effective object style
* 3. Load i attributes from immediate parent (which has to be up-to-date)
/**
- *
+ *
*/
static void
sp_style_privatize_text(SPStyle *style)
/**
* Merge property into style.
- *
+ *
* Should be called in order of highest to lowest precedence.
* E.g. for a single style string, call from the last declaration to the first,
* as CSS says that later declarations override earlier ones.
SPS_READ_IENUM_IF_UNSET(&style->display, val, enum_display, true);
break;
case SP_PROP_OVERFLOW:
- /** \todo
- * FIXME: not supported properly yet, we just read and write it,
+ /** \todo
+ * FIXME: not supported properly yet, we just read and write it,
* but act as if it is always "display".
*/
SPS_READ_IENUM_IF_UNSET(&style->overflow, val, enum_overflow, true);
static void
sp_style_merge_style_from_decl(SPStyle *const style, CRDeclaration const *const decl)
{
- /** \todo Ensure that property is lcased, as per
+ /** \todo Ensure that property is lcased, as per
* http://www.w3.org/TR/REC-CSS2/syndata.html#q4.
* Should probably be done in libcroco.
*/
unsigned const prop_idx = sp_attribute_lookup(decl->property->stryng->str);
if (prop_idx != SP_ATTR_INVALID) {
- /** \todo
- * effic: Test whether the property is already set before trying to
- * convert to string. Alternatively, set from CRTerm directly rather
+ /** \todo
+ * effic: Test whether the property is already set before trying to
+ * convert to string. Alternatively, set from CRTerm directly rather
* than converting to string.
*/
guchar *const str_value_unsigned = cr_term_to_string(decl->value);
* Check whether we need to register any pseudo-class handlers.
* libcroco has its own default handlers for first-child and lang.
*
- * We probably want handlers for link and arguably visited (though
- * inkscape can't visit links at the time of writing). hover etc.
+ * We probably want handlers for link and arguably visited (though
+ * inkscape can't visit links at the time of writing). hover etc.
* more useful in inkview than the editor inkscape.
*
- * http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS says that
- * the following should be honoured, at least by inkview:
+ * http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS says that
+ * the following should be honoured, at least by inkview:
* :hover, :active, :focus, :visited, :link.
*/
sp_style_merge_from_style_string(SPStyle *const style, gchar const *const p)
{
/*
- * Reference: http://www.w3.org/TR/SVG11/styling.html#StyleAttribute:
- * ``When CSS styling is used, CSS inline style is specified by including
- * semicolon-separated property declarations of the form "name : value"
+ * Reference: http://www.w3.org/TR/SVG11/styling.html#StyleAttribute:
+ * ``When CSS styling is used, CSS inline style is specified by including
+ * semicolon-separated property declarations of the form "name : value"
* within the style attribute''.
*
- * That's fairly ambiguous. Is a `value' allowed to contain semicolons?
- * Why does it say "including", what else is allowed in the style
+ * That's fairly ambiguous. Is a `value' allowed to contain semicolons?
+ * Why does it say "including", what else is allowed in the style
* attribute value?
*/
@@ -1163,7 +1163,7 @@ sp_style_merge_font_size_from_parent(SPIFontSize &child, SPIFontSize const &pare
child.computed = parent.computed;
} else if (child.type == SP_FONT_SIZE_LITERAL) {
/** \todo
- * fixme: SVG and CSS do not specify clearly, whether we should use
+ * fixme: SVG and CSS do not specify clearly, whether we should use
* user or screen coordinates (Lauris)
*/
if (child.value < SP_CSS_FONT_SIZE_SMALLER) {
g_return_if_fail(style != NULL);
/** \todo
- * fixme: Check for existing callers that might pass null parent.
- * This should probably be g_return_if_fail, or else we should make a
- * best attempt to set computed values correctly without having a parent
+ * fixme: Check for existing callers that might pass null parent.
+ * This should probably be g_return_if_fail, or else we should make a
+ * best attempt to set computed values correctly without having a parent
* (i.e., by assuming parent has initial values).
*/
if (!parent)
style->font_weight.computed = parent->font_weight.computed;
} else if (style->font_weight.value == SP_CSS_FONT_WEIGHT_NORMAL) {
/** \todo
- * fixme: This is unconditional, i.e., happens even if parent not
+ * fixme: This is unconditional, i.e., happens even if parent not
* present.
*/
style->font_weight.computed = SP_CSS_FONT_WEIGHT_400;
if (!style->stroke_dasharray_set && parent->stroke_dasharray_set) {
/** \todo
- * This code looks wrong. Why does the logic differ from the
+ * This code looks wrong. Why does the logic differ from the
* above properties? Similarly dashoffset below.
*/
style->stroke_dash.n_dash = parent->stroke_dash.n_dash;
SPIPaint &child, SPIPaint const &parent)
{
/** \todo
- * I haven't given this much attention. See comments below about
+ * I haven't given this much attention. See comments below about
* currentColor, colorProfile, and relative URIs.
*/
if (!child.set || child.inherit || child.currentcolor) {
@@ -1476,10 +1476,10 @@ sp_style_merge_rel_enum_prop_from_dying_parent(SPIEnum &child, SPIEnum const &pa
{
child.set = false;
/*
- * Note that this can result in a change in computed value in the
- * rare case that the parent's setting was a no-op (i.e. if the
- * parent's parent's computed value was already ultra-condensed or
- * ultra-expanded). However, I'd guess that the change is for the
+ * Note that this can result in a change in computed value in the
+ * rare case that the parent's setting was a no-op (i.e. if the
+ * parent's parent's computed value was already ultra-condensed or
+ * ultra-expanded). However, I'd guess that the change is for the
* better: I'd guess that if the properties were specified
* relatively, then the intent is to counteract parent's effect.
* I.e. I believe this is the best code even in that case.
@@ -1487,17 +1487,17 @@ sp_style_merge_rel_enum_prop_from_dying_parent(SPIEnum &child, SPIEnum const &pa
} else if (child.value == parent.value) {
/* Leave as is. */
/** \todo
- * It's unclear what to do if style and parent specify the same
- * relative directive (narrower or wider). We can either convert
- * to absolute specification or coalesce to a single relative
+ * It's unclear what to do if style and parent specify the same
+ * relative directive (narrower or wider). We can either convert
+ * to absolute specification or coalesce to a single relative
* request (of half the strength of the original pair).
*
- * Converting to a single level of relative specification is a
- * better choice if the newly-unlinked clone is itself cloned to
- * other contexts (inheriting different font stretchiness): it
+ * Converting to a single level of relative specification is a
+ * better choice if the newly-unlinked clone is itself cloned to
+ * other contexts (inheriting different font stretchiness): it
* would preserve the effect that it will be narrower than
- * the inherited context in each case. The disadvantage is that
- * it will ~certainly affect the computed value of the
+ * the inherited context in each case. The disadvantage is that
+ * it will ~certainly affect the computed value of the
* newly-unlinked clone.
*/
} else {
@@ -1530,7 +1530,7 @@ sp_style_merge_length_prop_from_dying_parent(LengthT &child, LengthT const &pare
case SP_CSS_UNIT_EX:
child.value *= parent_child_em_ratio;
/** \todo
- * fixme: Have separate ex ratio parameter.
+ * fixme: Have separate ex ratio parameter.
* Get x height from libnrtype or pango.
*/
if (!isFinite(child.value)) {
@@ -1605,7 +1605,7 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
/* We do font-size first, to ensure that em size is up-to-date. */
/** \todo
- * fixme: We'll need to have more font-related things up the top once
+ * fixme: We'll need to have more font-related things up the top once
* we're getting x-height from pango or libnrtype.
*/
@@ -1699,8 +1699,8 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
sp_style_merge_prop_from_dying_parent<SPIFloat>(style->stroke_miterlimit, parent->stroke_miterlimit);
/** \todo
- * We currently treat text-decoration as if it were a simple inherited
- * property (fixme). This code may need changing once we do the
+ * We currently treat text-decoration as if it were a simple inherited
+ * property (fixme). This code may need changing once we do the
* special fill/stroke inheritance mentioned by the spec.
*/
sp_style_merge_prop_from_dying_parent<SPITextDecoration>(style->text_decoration,
@@ -1757,9 +1757,9 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
/* Properties that involve a URI but are easy in other respects. */
{
/** \todo
- * Could cause problems if original object was in another document
- * and it used a relative URL. (At the time of writing, we don't
- * allow hrefs to other documents, so this isn't a problem yet.)
+ * Could cause problems if original object was in another document
+ * and it used a relative URL. (At the time of writing, we don't
+ * allow hrefs to other documents, so this isn't a problem yet.)
* Paint properties also allow URIs.
*/
//nyi: cursor, // may involve change in effect, but we can't do much better
@@ -1860,8 +1860,8 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
}
/** \todo
- * fixme: Check that we correctly handle all properties that don't
- * inherit by default (as shown in
+ * fixme: Check that we correctly handle all properties that don't
+ * inherit by default (as shown in
* http://www.w3.org/TR/SVG11/propidx.html for most SVG 1.1 properties).
*/
}
@@ -1869,9 +1869,9 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
/* SPIPaint properties (including color). */
{
/** \todo
- * Think about the issues involved if specified as currentColor or
- * if specified relative to colorProfile, and if the currentColor or
- * colorProfile differs between parent \& child. See also comments
+ * Think about the issues involved if specified as currentColor or
+ * if specified relative to colorProfile, and if the currentColor or
+ * colorProfile differs between parent \& child. See also comments
* elsewhere in this function about URIs.
*/
SPIPaint SPStyle::*const fields[] = {
@@ -1954,11 +1954,11 @@ sp_style_paint_server_modified(SPPaintServer *server, guint flags, SPStyle *styl
{
if (style->object) {
/** \todo
- * fixme: I do not know, whether it is optimal - we are
+ * fixme: I do not know, whether it is optimal - we are
* forcing reread of everything (Lauris)
*/
/** \todo
- * fixme: We have to use object_modified flag, because parent
+ * fixme: We have to use object_modified flag, because parent
* flag is only available downstreams.
*/
style->object->requestModified(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
@@ -2024,10 +2024,10 @@ sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent)
/**
- * Dumps the style to a CSS string, with either SP_STYLE_FLAG_IFSET or
- * SP_STYLE_FLAG_ALWAYS flags. Used with Always for copying an object's
- * complete cascaded style to style_clipboard. When you need a CSS string
- * for an object in the document tree, you normally call
+ * Dumps the style to a CSS string, with either SP_STYLE_FLAG_IFSET or
+ * SP_STYLE_FLAG_ALWAYS flags. Used with Always for copying an object's
+ * complete cascaded style to style_clipboard. When you need a CSS string
+ * for an object in the document tree, you normally call
* sp_style_write_difference instead to take into account the object's parent.
*
* \pre style != NULL.
/**
* Dumps style to CSS string, see sp_style_write_string()
- *
+ *
* \pre from != NULL.
* \pre to != NULL.
* \post ret != NULL.
p += sp_style_write_ienum(p, c + BMAX - p, "text-anchor", enum_text_anchor, &from->text_anchor, &to->text_anchor, SP_STYLE_FLAG_IFDIFF);
- /// \todo fixme: Per type methods need default flag too
+ /// \todo fixme: Per type methods need default flag too
if (from->opacity.set && from->opacity.value != SP_SCALE24_MAX) {
p += sp_style_write_iscale24(p, c + BMAX - p, "opacity", &from->opacity, &to->opacity, SP_STYLE_FLAG_IFSET);
}
/**
- *
+ *
*/
static void
sp_style_read_dash(SPStyle *style, gchar const *str)
/** \todo fixme: Move this to standard place (Lauris) */
value = g_ascii_strtod(str, &e);
if ((gchar const *) e != str) {
- /** \todo
- * Allow the number of px per inch to vary (document preferences,
- * X server or whatever). E.g. don't fill in computed here, do
+ /** \todo
+ * Allow the number of px per inch to vary (document preferences,
+ * X server or whatever). E.g. don't fill in computed here, do
* it at the same time as percentage units are done.
*/
if (!*e) {
@@ -2818,7 +2818,7 @@ sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
/**
- * Set SPIPaint object from string.
+ * Set SPIPaint object from string.
*/
static void
sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document)
/**
- *
+ *
*/
static bool
sp_length_differ(SPILength const *const a, SPILength const *const b)
if (p == NULL)
return false;
/** \todo
- * FIXME: I'm not sure if this applies to SVG as well, but CSS2 says any URIs
+ * FIXME: I'm not sure if this applies to SVG as well, but CSS2 says any URIs
* in property values must start with 'url('.
*/
return (g_ascii_strncasecmp(p, "url(", 4) == 0);
}
/**
- * Unset any properties that contain URI values.
+ * Unset any properties that contain URI values.
*
- * Used for storing style that will be reused across documents when carrying
+ * Used for storing style that will be reused across documents when carrying
* the referenced defs is impractical.
*/
SPCSSAttr *
/**
* Remove quotes from SPIString object value.
- *
- * \todo FIXME: now used for font family, but perhaps this should apply to
- * ALL strings (check CSS spec), in which case this should be part of
+ *
+ * \todo FIXME: now used for font family, but perhaps this should apply to
+ * ALL strings (check CSS spec), in which case this should be part of
* read_istring.
*/
void
/// \todo unescape all \-escaped chars
int l = strlen(val->value);
- if ((val->value[0] == '"' && val->value[l - 1] == '"') ||
+ if ((val->value[0] == '"' && val->value[l - 1] == '"') ||
(val->value[0] == '\'' && val->value[l - 1] == '\'')) {
memcpy (val->value, val->value+1, l - 2);
val->value[l - 2] = '\0';
diff --git a/src/svg-view.cpp b/src/svg-view.cpp
index 5da24df98b18a69f6c2c75a39c38758a67be4396..22d9dd120e81d0cd4e477add44a77bf36066ac95 100644 (file)
--- a/src/svg-view.cpp
+++ b/src/svg-view.cpp
SPSVGView::~SPSVGView()
{
- if (doc() && _drawing)
+ if (doc() && _drawing)
{
sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey);
_drawing = NULL;
* Rescales SPSVGView and keeps aspect ratio.
*/
void
-SPSVGView::setRescale
+SPSVGView::setRescale
(bool rescale, bool keepaspect, gdouble width, gdouble height)
{
g_return_if_fail (!rescale || (width >= 0.0));
@@ -147,7 +147,7 @@ arena_handler (SPCanvasArena *arena, NRArenaItem *ai, GdkEvent *event, SPSVGView
break;
case GDK_BUTTON_RELEASE:
if (event->button.button == 1) {
- if (active && (event->button.x == x) &&
+ if (active && (event->button.x == x) &&
(event->button.y == y)) {
spev.type = SP_EVENT_ACTIVATE;
if ( spitem != 0 )
if (document) {
NRArenaItem *ai = sp_item_invoke_show (
- SP_ITEM (sp_document_root (document)),
+ SP_ITEM (sp_document_root (document)),
SP_CANVAS_ARENA (_drawing)->arena,
- _dkey,
+ _dkey,
SP_ITEM_SHOW_DISPLAY);
-
+
if (ai) {
nr_arena_item_add_child (SP_CANVAS_ARENA (_drawing)->root, ai, NULL);
nr_arena_item_unref (ai);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index a181f4f6fb22d70f63128da9fe536da50ce68dd3..d59ba6bdf0b464a855420e93d6deac3edcc5fb8b 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
tc->grabbed = NULL;
}
-
+
Inkscape::Rubberband::get()->stop();
-
+
if (ec->shape_knot_holder) {
sp_knot_holder_destroy(ec->shape_knot_holder);
ec->shape_knot_holder = NULL;
@@ -413,14 +413,14 @@ sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
if (new_end < tc->text_sel_start) {
if (!layout->isStartOfWord(new_end))
new_end.prevStartOfWord();
- } else
+ } else
if (!layout->isEndOfWord(new_end))
new_end.nextEndOfWord();
} else if (tc->dragging == 3) {
// triple-click dragging: go by line
if (new_end < tc->text_sel_start)
new_end.thisStartOfLine();
- else
+ else
new_end.thisEndOfLine();
}
// update display
return TRUE;
}
break;
- case GDK_MOTION_NOTIFY:
+ case GDK_MOTION_NOTIFY:
if (tc->over_text) {
tc->over_text = 0;
// update cursor and statusbar: we are not over a text object now
}
break;
- case GDK_BUTTON_RELEASE:
+ case GDK_BUTTON_RELEASE:
if (event->button.button == 1) {
if (tc->grabbed) {
if (tc->text) {
if (MOD__CTRL)
cursor_movement_operator = &Inkscape::Text::Layout::iterator::thisStartOfShape;
- else
+ else
cursor_movement_operator = &Inkscape::Text::Layout::iterator::thisStartOfLine;
break;
}
if (tc->text) {
if (MOD__CTRL)
cursor_movement_operator = &Inkscape::Text::Layout::iterator::nextStartOfShape;
- else
+ else
cursor_movement_operator = &Inkscape::Text::Layout::iterator::thisEndOfLine;
break;
}
sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -10);
} else {
sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -1);
- }
+ }
} else {
sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -90);
}
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
return TRUE;
- }
+ }
}
break;
case GDK_bracketright:
sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 10);
} else {
sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 1);
- }
+ }
} else {
sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 90);
}
tc->grabbed = NULL;
}
Inkscape::Rubberband::get()->stop();
- }
+ }
}
}
break;
diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index f7bae09e925b8541147fd64100763049018d4fc1..62395581f400003b269957e8da74589f68b4431e 100644 (file)
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
GType sp_zoom_context_get_type(void)
{
static GType type = 0;
-
+
if (!type) {
GTypeInfo info = {
sizeof(SPZoomContextClass),
};
type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPZoomContext", &info, (GTypeFlags) 0);
}
-
+
return type;
}
static void sp_zoom_context_class_init(SPZoomContextClass *klass)
{
SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
-
+
parent_class = (SPEventContextClass*) g_type_class_peek_parent(klass);
-
+
event_context_class->setup = sp_zoom_context_setup;
event_context_class->finish = sp_zoom_context_finish;
static void sp_zoom_context_init (SPZoomContext *zoom_context)
{
SPEventContext *event_context = SP_EVENT_CONTEXT(zoom_context);
-
+
event_context->cursor_shape = cursor_zoom_xpm;
event_context->hot_x = 6;
event_context->hot_y = 6;
@@ -110,7 +110,7 @@ static gint sp_zoom_context_item_handler(SPEventContext *event_context, SPItem *
if (((SPEventContextClass *) parent_class)->item_handler) {
ret = ((SPEventContextClass *) parent_class)->item_handler (event_context, item, event);
}
-
+
return ret;
}
@@ -119,17 +119,17 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
SPDesktop *desktop = event_context->desktop;
tolerance = prefs_get_int_attribute_limited ("options.dragtolerance", "value", 0, 0, 100);
double const zoom_inc = prefs_get_double_attribute_limited("options.zoomincrement", "value", M_SQRT2, 1.01, 10);
-
+
gint ret = FALSE;
-
+
switch (event->type) {
case GDK_BUTTON_PRESS:
if (event->button.button == 1) {
// save drag origin
- xp = (gint) event->button.x;
+ xp = (gint) event->button.x;
yp = (gint) event->button.y;
within_tolerance = true;
-
+
NR::Point const button_w(event->button.x, event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
Inkscape::Rubberband::get()->start(desktop, button_dt);
@@ -139,27 +139,27 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
ret = TRUE;
}
break;
-
+
case GDK_MOTION_NOTIFY:
if (event->motion.state & GDK_BUTTON1_MASK) {
ret = TRUE;
-
+
if ( within_tolerance
&& ( abs( (gint) event->motion.x - xp ) < tolerance )
&& ( abs( (gint) event->motion.y - yp ) < tolerance ) ) {
break; // do not drag if we're within tolerance from origin
}
- // Once the user has moved farther than tolerance from the original location
- // (indicating they intend to move the object, not click), then always process the
+ // Once the user has moved farther than tolerance from the original location
+ // (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
- within_tolerance = false;
-
+ within_tolerance = false;
+
NR::Point const motion_w(event->motion.x, event->motion.y);
NR::Point const motion_dt(desktop->w2d(motion_w));
Inkscape::Rubberband::get()->move(motion_dt);
}
break;
-
+
case GDK_BUTTON_RELEASE:
if ( event->button.button == 1 ) {
NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
@@ -176,22 +176,22 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
ret = TRUE;
}
Inkscape::Rubberband::get()->stop();
- xp = yp = 0;
+ xp = yp = 0;
escaped = false;
break;
-
+
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
case GDK_Escape:
Inkscape::Rubberband::get()->stop();
- xp = yp = 0;
+ xp = yp = 0;
escaped = true;
ret = TRUE;
break;
- case GDK_Up:
- case GDK_Down:
- case GDK_KP_Up:
- case GDK_KP_Down:
+ case GDK_Up:
+ case GDK_Down:
+ case GDK_KP_Up:
+ case GDK_KP_Down:
// prevent the zoom field from activation
if (!MOD__CTRL_ONLY)
ret = TRUE;