From f951374eef04129c6a0d213e7ab4d9ed2095ca69 Mon Sep 17 00:00:00 2001 From: rwst Date: Wed, 15 Feb 2006 19:04:29 +0000 Subject: [PATCH] bulk trailing spaces removal. consistency through MD5 of binary --- src/color.cpp | 12 +-- src/connector-context.cpp | 112 +++++++++++++-------------- src/context-fns.cpp | 22 +++--- src/desktop-events.cpp | 42 +++++----- src/desktop-handles.cpp | 4 +- src/desktop-style.cpp | 42 +++++----- src/desktop.cpp | 82 ++++++++++---------- src/dir-util.cpp | 4 +- src/document-undo.cpp | 10 +-- src/document.cpp | 6 +- src/draw-anchor.cpp | 4 +- src/draw-context.cpp | 4 +- src/dropper-context.cpp | 82 ++++++++++---------- src/dyna-draw-context.cpp | 16 ++-- src/event-context.cpp | 130 +++++++++++++++---------------- src/file.cpp | 12 +-- src/fixes.cpp | 48 ++++++------ src/geom.cpp | 28 +++---- src/gradient-chemistry.cpp | 38 ++++----- src/gradient-context.cpp | 8 +- src/gradient-drag.cpp | 48 ++++++------ src/grid-snapper.cpp | 8 +- src/guide-snapper.cpp | 4 +- src/inkscape.cpp | 44 +++++------ src/inkview.cpp | 6 +- src/interface.cpp | 6 +- src/knot.cpp | 100 ++++++++++++------------ src/knotholder.cpp | 12 +-- src/layer-fns.cpp | 6 +- src/message-stack.cpp | 4 +- src/node-context.cpp | 36 ++++----- src/nodepath.cpp | 104 ++++++++++++------------- src/object-edit.cpp | 6 +- src/object-hierarchy.cpp | 2 +- src/object-snapper.cpp | 14 ++-- src/path-chemistry.cpp | 14 ++-- src/pen-context.cpp | 36 ++++----- src/pencil-context.cpp | 16 ++-- src/preferences.cpp | 6 +- src/prefix.cpp | 4 +- src/rect-context.cpp | 8 +- src/rubberband.cpp | 2 +- src/selcue.cpp | 12 +-- src/select-context.cpp | 12 +-- src/selection-chemistry.cpp | 14 ++-- src/selection-describer.cpp | 14 ++-- src/selection.cpp | 20 ++--- src/seltrans.cpp | 30 ++++---- src/shortcuts-default-xml.cpp | 2 +- src/snap.cpp | 38 ++++----- src/snapped-point.cpp | 4 +- src/snapper.cpp | 2 +- src/sp-conn-end-pair.cpp | 22 +++--- src/sp-conn-end.cpp | 12 +-- src/sp-cursor.cpp | 8 +- src/sp-defs.cpp | 28 +++---- src/sp-flowregion.cpp | 12 +-- src/sp-flowtext.cpp | 6 +- src/sp-gradient.cpp | 34 ++++----- src/sp-guide.cpp | 36 ++++----- src/sp-image.cpp | 4 +- src/sp-item-group.cpp | 2 +- src/sp-item-notify-moveto.cpp | 10 +-- src/sp-item-transform.cpp | 12 +-- src/sp-item.cpp | 6 +- src/sp-marker.cpp | 8 +- src/sp-metrics.cpp | 4 +- src/sp-namedview.cpp | 120 ++++++++++++++--------------- src/sp-object.cpp | 98 ++++++++++++------------ src/sp-offset.cpp | 102 ++++++++++++------------- src/sp-paint-server.cpp | 4 +- src/sp-pattern.cpp | 16 ++-- src/sp-root.cpp | 2 +- src/sp-spiral.cpp | 78 +++++++++---------- src/sp-star.cpp | 22 +++--- src/sp-tspan.cpp | 6 +- src/spiral-context.cpp | 2 +- src/star-context.cpp | 10 +-- src/streams-gzip.cpp | 8 +- src/streams-handles.cpp | 6 +- src/streams-jar.cpp | 20 ++--- src/streams-zlib.cpp | 42 +++++----- src/style.cpp | 140 +++++++++++++++++----------------- src/svg-view.cpp | 12 +-- src/text-context.cpp | 24 +++--- src/zoom-context.cpp | 48 ++++++------ 86 files changed, 1152 insertions(+), 1152 deletions(-) diff --git a/src/color.cpp b/src/color.cpp index c968d334f..77fca3b4b 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -25,7 +25,7 @@ static SPColorSpace const RGB = {"RGB"}; 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 @@ -85,8 +85,8 @@ sp_color_is_equal (SPColor const *c0, SPColor const *c1) } /** - * 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 @@ -128,7 +128,7 @@ sp_color_set_rgb_float(SPColor *color, float r, float g, float b) /** * 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) @@ -349,9 +349,9 @@ sp_color_rgb_to_hsl_floatv (float *hsl, float r, float g, float b) 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; diff --git a/src/connector-context.cpp b/src/connector-context.cpp index f3296aebf..a00407662 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -25,7 +25,7 @@ * 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). @@ -34,7 +34,7 @@ * 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)?; * @@ -183,12 +183,12 @@ sp_connector_context_init(SPConnectorContext *cc) 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; @@ -197,10 +197,10 @@ sp_connector_context_init(SPConnectorContext *cc) 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; @@ -260,7 +260,7 @@ sp_connector_context_setup(SPEventContext *ec) 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, @@ -275,7 +275,7 @@ sp_connector_context_setup(SPEventContext *ec) // Notice the initial selection. cc_selection_changed(cc->selection, (gpointer) cc); - + if (prefs_get_int_attribute("tools.connector", "selcue", 0) != 0) { ec->enableSelectionCue(); } @@ -290,13 +290,13 @@ static void 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; } @@ -327,7 +327,7 @@ cc_clear_active_shape(SPConnectorContext *cc) 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; @@ -370,7 +370,7 @@ conn_pt_handle_test(SPConnectorContext *cc, NR::Point& p) { // 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); @@ -758,7 +758,7 @@ spcc_reset_colors(SPConnectorContext *cc) /* 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; } @@ -941,7 +941,7 @@ spcc_connector_finish(SPConnectorContext *const cc) spcc_concat_colors_and_flush(cc); cc->npoints = 0; - + if (cc->newConnRef) { cc->newConnRef->removeFromGraph(); delete cc->newConnRef; @@ -983,7 +983,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot) 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) { @@ -1000,7 +1000,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot) } -static gboolean +static gboolean endpt_handler(SPKnot *knot, GdkEvent *event, SPConnectorContext *cc) { g_assert( SP_IS_CONNECTOR_CONTEXT(cc) ); @@ -1016,11 +1016,11 @@ endpt_handler(SPKnot *knot, GdkEvent *event, SPConnectorContext *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; @@ -1054,30 +1054,30 @@ endpt_handler(SPKnot *knot, GdkEvent *event, SPConnectorContext *cc) 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); @@ -1106,17 +1106,17 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item) "anchor", GTK_ANCHOR_CENTER, "tip", _("Connection point: 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); - + } @@ -1127,19 +1127,19 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) 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 @@ -1148,9 +1148,9 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) 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); @@ -1189,7 +1189,7 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) cc->endpt_handle[i] = knot; } - + // Remove any existing handlers if (cc->endpt_handler_id[i]) { g_signal_handlers_disconnect_by_func( @@ -1198,20 +1198,20 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) 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]); } @@ -1241,7 +1241,7 @@ bool cc_item_is_connector(SPItem *item) return false; } - + void cc_selection_set_avoid(bool const set_avoid) { SPDesktop *desktop = inkscape_active_desktop(); @@ -1261,14 +1261,14 @@ void cc_selection_set_avoid(bool const set_avoid) 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; } @@ -1280,7 +1280,7 @@ void cc_selection_set_avoid(bool const set_avoid) sp_document_done(document); } - + static void cc_selection_changed(Inkscape::Selection *selection, gpointer data) @@ -1289,7 +1289,7 @@ 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. @@ -1300,7 +1300,7 @@ cc_selection_changed(Inkscape::Selection *selection, gpointer data) cc_clear_active_conn(cc); return; } - + if (cc_item_is_connector(item)) { cc_set_active_conn(cc, item); } @@ -1328,7 +1328,7 @@ shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name, { 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 42100d49a..6c36e780f 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -22,13 +22,13 @@ 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, _("Current layer is hidden. Unhide it to be able to draw on it.")); return false; } - + if ( !layer || layer->isLocked() ) { message->flash(Inkscape::ERROR_MESSAGE, _("Current layer is locked. Unlock it to be able to draw on it.")); @@ -51,13 +51,13 @@ bool Inkscape::have_viable_layer(SPDesktop *desktop, MessageContext *message) 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, _("Current layer is hidden. Unhide it to be able to draw on it.")); return false; } - + if ( !layer || layer->isLocked() ) { message->flash(Inkscape::WARNING_MESSAGE, _("Current layer is locked. Unlock it to be able to draw on it.")); @@ -94,7 +94,7 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, /* 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 @@ -103,7 +103,7 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, /* 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]; @@ -151,9 +151,9 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, 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 226b9d997..fad40ca7e 100644 --- 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; } @@ -159,7 +159,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) static bool dragging = false; static bool moved = false; gint ret = FALSE; - + SPGuide *guide = SP_GUIDE(data); SPDesktop *desktop = static_cast(gtk_object_get_data(GTK_OBJECT(item->canvas), "SPDesktop")); @@ -221,7 +221,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) } 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()); @@ -240,7 +240,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) default: break; } - + return ret; } @@ -311,7 +311,7 @@ static void guide_dialog_delete(GtkWidget *widget, SPGuide **guide) 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); @@ -349,31 +349,31 @@ static void sp_dt_simple_guide_dialog(SPGuide *guide, SPDesktop *desktop) 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); @@ -381,19 +381,19 @@ static void sp_dt_simple_guide_dialog(SPGuide *guide, SPDesktop *desktop) 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)); @@ -402,20 +402,20 @@ static void sp_dt_simple_guide_dialog(SPGuide *guide, SPDesktop *desktop) 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; @@ -426,7 +426,7 @@ static void sp_dt_simple_guide_dialog(SPGuide *guide, SPDesktop *desktop) 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); @@ -434,7 +434,7 @@ static void sp_dt_simple_guide_dialog(SPGuide *guide, SPDesktop *desktop) 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); } diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 75584c6ee..e2d36bb52 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -103,7 +103,7 @@ sp_desktop_controls (SPDesktop const * desktop) return desktop->controls; } -Inkscape::MessageStack * +Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop) { g_return_val_if_fail (desktop != NULL, NULL); @@ -111,7 +111,7 @@ sp_desktop_message_stack (SPDesktop const * desktop) 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 540fd1637..8a3074e2e 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -82,7 +82,7 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) // 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. */ @@ -241,7 +241,7 @@ sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char } /** - * 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; @@ -493,7 +493,7 @@ objects_query_opacity (GSList *objects, SPStyle *style_res) } else { if (same_opacity) return QUERY_STYLE_MULTIPLE_SAME; - else + else return QUERY_STYLE_MULTIPLE_AVERAGED; } } @@ -524,7 +524,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) if ( style->stroke.type == SP_PAINT_TYPE_NONE ) { continue; - } + } n_stroked ++; @@ -551,7 +551,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) } else { if (same_sw) return QUERY_STYLE_MULTIPLE_SAME; - else + else return QUERY_STYLE_MULTIPLE_AVERAGED; } } @@ -581,7 +581,7 @@ objects_query_miterlimit (GSList *objects, SPStyle *style_res) if ( style->stroke.type == SP_PAINT_TYPE_NONE ) { continue; - } + } n_stroked ++; @@ -605,7 +605,7 @@ objects_query_miterlimit (GSList *objects, SPStyle *style_res) } else { if (same_ml) return QUERY_STYLE_MULTIPLE_SAME; - else + else return QUERY_STYLE_MULTIPLE_AVERAGED; } } @@ -634,7 +634,7 @@ objects_query_strokecap (GSList *objects, SPStyle *style_res) if ( style->stroke.type == SP_PAINT_TYPE_NONE ) { continue; - } + } n_stroked ++; @@ -655,7 +655,7 @@ objects_query_strokecap (GSList *objects, SPStyle *style_res) } else { if (same_cap) return QUERY_STYLE_MULTIPLE_SAME; - else + else return QUERY_STYLE_MULTIPLE_DIFFERENT; } } @@ -684,7 +684,7 @@ objects_query_strokejoin (GSList *objects, SPStyle *style_res) if ( style->stroke.type == SP_PAINT_TYPE_NONE ) { continue; - } + } n_stroked ++; @@ -705,7 +705,7 @@ objects_query_strokejoin (GSList *objects, SPStyle *style_res) } else { if (same_join) return QUERY_STYLE_MULTIPLE_SAME; - else + else return QUERY_STYLE_MULTIPLE_DIFFERENT; } } @@ -754,7 +754,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) 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)) @@ -838,7 +838,7 @@ objects_query_fontstyle (GSList *objects, SPStyle *style_res) texts ++; - if (set && + if (set && font_style_to_pos(*style_res).signature() != font_style_to_pos(*style).signature() ) { different = true; // different styles } @@ -892,7 +892,7 @@ objects_query_fontfamily (GSList *objects, SPStyle *style_res) 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 } @@ -965,7 +965,7 @@ sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property) { 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 @@ -980,8 +980,8 @@ bool 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 9a2274bea..5db7e5d24 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -134,7 +134,7 @@ SPDesktop::SPDesktop() selection = Inkscape::GC::release (new Inkscape::Selection (this)); } -void +void SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) { @@ -144,7 +144,7 @@ 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); @@ -206,7 +206,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) 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); @@ -219,7 +219,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) 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); @@ -229,8 +229,8 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) 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); @@ -243,9 +243,9 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) /* 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); @@ -356,7 +356,7 @@ void SPDesktop::setDisplayModeOutline() /** * Returns current root (=bottom) layer. */ -SPObject *SPDesktop::currentRoot() const +SPObject *SPDesktop::currentRoot() const { return _layer_hierarchy ? _layer_hierarchy->top() : NULL; } @@ -405,7 +405,7 @@ bool SPDesktop::isLayer(SPObject *object) const { /** * 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); @@ -538,7 +538,7 @@ SPDesktop::group_at_point (NR::Point const p) const } /** - * \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); } @@ -788,7 +788,7 @@ SPDesktop::zoom_page() { 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; } @@ -810,7 +810,7 @@ SPDesktop::zoom_page_width() 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); } @@ -825,7 +825,7 @@ SPDesktop::zoom_selection() if (d.dimensions()[NR::X] < 0.1 || d.dimensions()[NR::Y] < 0.1) { return; } - + set_display_area(d, 10); } @@ -863,10 +863,10 @@ SPDesktop::zoom_drawing() /** * 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(); @@ -926,14 +926,14 @@ SPDesktop::fullscreen() { _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); @@ -999,7 +999,7 @@ SPDesktop::setToolboxFocusTo (gchar const *label) _widget->setToolboxFocusTo (label); } -void +void SPDesktop::setToolboxAdjustmentValue (gchar const* id, double val) { _widget->setToolboxAdjustmentValue (id, val); @@ -1011,8 +1011,8 @@ SPDesktop::isToolboxButtonActive (gchar const *id) return _widget->isToolboxButtonActive (id); } -void -SPDesktop::emitToolSubselectionChanged(gpointer data) +void +SPDesktop::emitToolSubselectionChanged(gpointer data) { _tool_subselection_changed.emit(data); inkscape_subselection_changed (this); @@ -1021,7 +1021,7 @@ SPDesktop::emitToolSubselectionChanged(gpointer data) //---------------------------------------------------------------------- // Callback implementations. The virtual ones are connected by the view. -void +void SPDesktop::onPositionSet (double x, double y) { _widget->viewSetPosition (NR::Point(x,y)); @@ -1030,7 +1030,7 @@ SPDesktop::onPositionSet (double x, double y) void SPDesktop::onResized (double x, double y) { - // Nothing called here + // Nothing called here } /** @@ -1075,9 +1075,9 @@ SPDesktop::setDocument (SPDocument *doc) 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); @@ -1139,18 +1139,18 @@ SPDesktop::_onDeactivate (SPDesktop* dt) } 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) { @@ -1291,14 +1291,14 @@ _namedview_modified (SPNamedView *nv, guint flags, 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 b83eec002..b2a7c97f6 100644 --- a/src/dir-util.cpp +++ b/src/dir-util.cpp @@ -86,8 +86,8 @@ static char const *const current = dots + 1; \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 226d38127..f37a3fcaf 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -67,12 +67,12 @@ /* * 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); @@ -231,7 +231,7 @@ sp_document_undo (SPDocument *doc) doc->priv->sensitive = TRUE; - if (ret) + if (ret) inkscape_external_change(); return ret; @@ -275,7 +275,7 @@ sp_document_redo (SPDocument *doc) doc->priv->sensitive = TRUE; - if (ret) + if (ret) inkscape_external_change(); return ret; diff --git a/src/document.cpp b/src/document.cpp index b53a7b7fa..c5fa71f2b 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -18,7 +18,7 @@ /** \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 @@ -201,7 +201,7 @@ void SPDocument::reset_key (void *dummy) { actionkey = NULL; } - + static SPDocument * sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, @@ -316,7 +316,7 @@ sp_document_create(Inkscape::XML::Document *rdoc, } /** - * 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 2a3279075..f2af728cf 100644 --- a/src/draw-anchor.cpp +++ b/src/draw-anchor.cpp @@ -1,4 +1,4 @@ -/** \file +/** \file * Anchors implementation. */ @@ -63,7 +63,7 @@ sp_draw_anchor_destroy(SPDrawAnchor *anchor) #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 ed1d6a7a4..0cb408293 100644 --- 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, diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp index e37f1660b..b998b1b15 100644 --- a/src/dropper-context.cpp +++ b/src/dropper-context.cpp @@ -89,7 +89,7 @@ static void sp_dropper_context_class_init(SPDropperContextClass *klass) 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; @@ -117,11 +117,11 @@ static void sp_dropper_context_setup(SPEventContext *ec) 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(); } @@ -130,9 +130,9 @@ static void sp_dropper_context_setup(SPEventContext *ec) 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; @@ -153,14 +153,14 @@ void sp_dropper_context_copy(SPEventContext *ec) 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 refClipboard = + Glib::RefPtr refClipboard = Gtk::Clipboard::get(); refClipboard->set_text(text); } @@ -171,11 +171,11 @@ void sp_dropper_context_copy(SPEventContext *ec) */ 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; @@ -194,13 +194,13 @@ void sp_dropper_c32_color_copy(guint32 c32) 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; } diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 8b90ce034..7fd7bfe72 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -136,7 +136,7 @@ sp_dyna_draw_context_init(SPDynaDrawContext *ddc) 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; @@ -490,7 +490,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, 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)); @@ -510,7 +510,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, ? ( 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 ) ), @@ -596,7 +596,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, 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; @@ -606,7 +606,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, 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; @@ -616,7 +616,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, 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; @@ -626,9 +626,9 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, 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 54b683bf4..da430a2ed 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -181,7 +181,7 @@ sp_event_context_update_cursor(SPEventContext *ec) 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); @@ -213,7 +213,7 @@ gint gobble_key_events(guint keyval, gint mask) 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); @@ -255,7 +255,7 @@ gint gobble_motion_events(gint mask) * 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; @@ -294,16 +294,16 @@ static gdouble accelerate_scroll(GdkEvent *event, gdouble acceleration) } // 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; @@ -896,22 +896,22 @@ sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event) * 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", @@ -929,10 +929,10 @@ sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, } /** - * 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 @@ -941,8 +941,8 @@ get_group0_keyval(GdkEventKey *event) 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; @@ -951,23 +951,23 @@ get_group0_keyval(GdkEventKey *event) /** * 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 acc6e101a..d42abbff6 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -130,7 +130,7 @@ sp_file_new_default() 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); @@ -404,7 +404,7 @@ sp_file_open_dialog(gpointer object, gpointer data) { #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); @@ -432,7 +432,7 @@ sp_file_open_dialog(gpointer object, gpointer 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 @@ -443,7 +443,7 @@ sp_file_open_dialog(gpointer object, gpointer data) { g_message("Cannot Open Directory %s\n",fileName); } - + list=list->next; } diff --git a/src/fixes.cpp b/src/fixes.cpp index 72498c448..4ed1b6eb1 100644 --- a/src/fixes.cpp +++ b/src/fixes.cpp @@ -5,17 +5,17 @@ * $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. @@ -63,36 +63,36 @@ fixed_g_ascii_strtod (const gchar *nptr, 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 == '-') @@ -105,14 +105,14 @@ fixed_g_ascii_strtod (const gchar *nptr, { 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 == '-') @@ -128,14 +128,14 @@ fixed_g_ascii_strtod (const gchar *nptr, /* 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; @@ -154,26 +154,26 @@ fixed_g_ascii_strtod (const gchar *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 @@ -183,7 +183,7 @@ fixed_g_ascii_strtod (const gchar *nptr, if (endptr) *endptr = fail_pos; - + return val; } } diff --git a/src/geom.cpp b/src/geom.cpp index 2749d6d7d..bc161bf9f 100644 --- a/src/geom.cpp +++ b/src/geom.cpp @@ -23,34 +23,34 @@ * 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, @@ -69,12 +69,12 @@ IntersectorKind intersector_line_intersection(NR::Point const &n0, double const return PARALLEL; } } - + double Y = n0[NR::X] * d1 - n1[NR::X] * d0; - + result = NR::Point(X, Y) / denominator; - + return INTERSECTS; } diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index aa77ea0ad..b4a1eca92 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -245,7 +245,7 @@ sp_gradient_fork_vector_if_necessary (SPGradient *gr) /** * 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 * @@ -271,8 +271,8 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item) 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; @@ -449,7 +449,7 @@ sp_item_gradient (SPItem *item, bool fill_or_stroke) } } } - + return gradient; } @@ -467,7 +467,7 @@ sp_first_stop(SPGradient *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) ) { @@ -702,7 +702,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_w, bool 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) { @@ -720,7 +720,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_w, bool 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; @@ -815,7 +815,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_w, bool } if (transform_set) { - gradient->gradientTransform = new_transform; + gradient->gradientTransform = new_transform; gradient->gradientTransform_set = TRUE; if (write_repr) { gchar s[256]; @@ -841,7 +841,7 @@ sp_item_gradient_get_vector (SPItem *item, bool fill_or_stroke) return NULL; } -SPGradientSpread +SPGradientSpread sp_item_gradient_get_spread (SPItem *item, bool fill_or_stroke) { SPGradient *gradient = sp_item_gradient (item, fill_or_stroke); @@ -853,7 +853,7 @@ sp_item_gradient_get_spread (SPItem *item, bool 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; diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 84bed562d..1168181fc 100644 --- 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 ffc1b7fc6..7e23b5750 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -62,7 +62,7 @@ const gchar *gr_knot_descr [] = { N_("Radial gradient focus") // POINT_RG_FOCUS }; -static void +static void gr_drag_sel_changed(Inkscape::Selection *selection, gpointer data) { GrDrag *drag = (GrDrag *) data; @@ -195,7 +195,7 @@ gr_drag_style_set (const SPCSSAttr *css, gpointer 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 @@ -236,7 +236,7 @@ GrDrag::GrDrag(SPDesktop *desktop) { 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 ) ); @@ -267,7 +267,7 @@ GrDrag::GrDrag(SPDesktop *desktop) { } } -GrDrag::~GrDrag() +GrDrag::~GrDrag() { this->sel_changed_connection.disconnect(); this->sel_modified_connection.disconnect(); @@ -317,7 +317,7 @@ NR::Point * 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; @@ -542,7 +542,7 @@ gr_knot_doubleclicked_handler (SPKnot *knot, guint state, gpointer data) 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); } @@ -648,7 +648,7 @@ GrDragger::updateTip () 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 Ctrl to snap angle, with Ctrl+Alt to preserve angle, with Ctrl+Shift to scale around center"), + this->knot->tip = g_strdup_printf (_("%s for: %s%s; drag with Ctrl to snap angle, with Ctrl+Alt to preserve angle, with Ctrl+Shift to scale around center"), _(gr_knot_descr[draggable->point_num]), item_desc, draggable->fill_or_stroke == false ? _(" (stroke)") : ""); @@ -656,7 +656,7 @@ GrDragger::updateTip () } else if (g_slist_length (draggables) == 2 && isA (POINT_RG_CENTER) && isA (POINT_RG_FOCUS)) { this->knot->tip = g_strdup_printf (_("Radial gradient center and focus; drag with Shift to separate focus")); } else { - this->knot->tip = g_strdup_printf (_("Gradient point shared by %d gradients; drag with Shift to separate"), + this->knot->tip = g_strdup_printf (_("Gradient point shared by %d gradients; drag with Shift to separate"), g_slist_length (this->draggables)); } } @@ -747,7 +747,7 @@ GrDragger::updateDependencies (bool write_repr) -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; @@ -850,7 +850,7 @@ GrDrag::setSelected (GrDragger *dragger) 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); @@ -865,7 +865,7 @@ GrDrag::addLine (NR::Point p1, NR::Point p2, guint32 rgba) 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); @@ -887,7 +887,7 @@ GrDrag::addDragger (GrDraggable *draggable) /** 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)); @@ -940,7 +940,7 @@ GrDrag::updateDraggers () 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); @@ -949,7 +949,7 @@ GrDrag::updateDraggers () } } - 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); @@ -984,7 +984,7 @@ GrDrag::updateLines () 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); @@ -995,7 +995,7 @@ GrDrag::updateLines () } } - 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 61bfa30d4..f1d4e4bf6 100644 --- a/src/grid-snapper.cpp +++ b/src/grid-snapper.cpp @@ -7,7 +7,7 @@ * Frank Felfe * Carl Hetherington * - * Copyright (C) 1999-2002 Authors + * Copyright (C) 1999-2002 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -39,7 +39,7 @@ Inkscape::LineSnapper::LineList Inkscape::GridSnapper::_getSnapLines(NR::Point c { 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 @@ -50,7 +50,7 @@ Inkscape::LineSnapper::LineList Inkscape::GridSnapper::_getSnapLines(NR::Point c } g_assert(griditem != NULL); - + for (unsigned int i = 0; i < 2; ++i) { /* This is to make sure we snap to only visible grid lines */ @@ -59,7 +59,7 @@ Inkscape::LineSnapper::LineList Inkscape::GridSnapper::_getSnapLines(NR::Point c 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 e247c0451..fbf1af0af 100644 --- a/src/guide-snapper.cpp +++ b/src/guide-snapper.cpp @@ -7,7 +7,7 @@ * Frank Felfe * Carl Hetherington * - * Copyright (C) 1999-2002 Authors + * Copyright (C) 1999-2002 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -25,7 +25,7 @@ Inkscape::GuideSnapper::GuideSnapper(SPNamedView const *nv, NR::Coord const d) : 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 9c0d93173..71c5d422f 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -98,7 +98,7 @@ static void inkscape_dispose (GObject *object); 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, @@ -152,7 +152,7 @@ static void (* segv_handler) (int) = NULL; /** * Retrieves the GType for the Inkscape Application object. - */ + */ GType inkscape_get_type (void) { @@ -544,13 +544,13 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) { 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; @@ -596,24 +596,24 @@ gboolean inkscape_app_use_gui( Inkscape::Application const * app ) /** * 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) @@ -680,9 +680,9 @@ 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" @@ -724,7 +724,7 @@ inkscape_get_repr (Inkscape::Application *inkscape, const gchar *key) } else { len = strlen (s); } - + Inkscape::XML::Node* child; for (child = repr->firstChild(); child != NULL; child = child->next()) { gchar const *id = child->attribute("id"); @@ -825,7 +825,7 @@ void inkscape_add_desktop (SPDesktop * desktop) { g_return_if_fail (desktop != NULL); - + if (Inkscape::NSApplication::Application::getNewGui()) { Inkscape::NSApplication::Editor::addDesktop (desktop); @@ -1183,12 +1183,12 @@ inkscape_active_event_context (void) #####################*/ 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); @@ -1290,7 +1290,7 @@ void 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 fffa0acdf..8be261dcd 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -17,12 +17,12 @@ * * 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 69ed8818b..4a7c12f76 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -114,10 +114,10 @@ sp_create_window(SPViewWidget *vw, gboolean editable) 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(vw)->window = + reinterpret_cast(vw)->window = static_cast((void*)w); } @@ -993,7 +993,7 @@ sp_ui_drag_data_received(GtkWidget *widget, 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 12fa71066..15fde68ff 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -47,7 +47,7 @@ static bool transform_escaped = false; // true iff resize or rotate was cancelle enum { PROP_0, - + PROP_SIZE, PROP_ANCHOR, PROP_SHAPE, @@ -58,7 +58,7 @@ enum { PROP_CURSOR, PROP_CURSOR_MOUSEOVER, PROP_CURSOR_DRAGGING, PROP_PIXBUF, PROP_TIP, - + PROP_LAST }; @@ -120,13 +120,13 @@ static void sp_knot_class_init(SPKnotClass *klass) 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", "", @@ -147,7 +147,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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", "", @@ -155,7 +155,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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", "", @@ -163,7 +163,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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", "", @@ -171,7 +171,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 0xffffffff, 0xff000000, (GParamFlags) G_PARAM_READWRITE)); - + g_object_class_install_property(object_class, PROP_FILL_DRAGGING, g_param_spec_uint("fill_dragging", "Fill dragging", "", @@ -179,7 +179,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 0xffffffff, 0xff000000, (GParamFlags) G_PARAM_READWRITE)); - + g_object_class_install_property(object_class, PROP_STROKE, g_param_spec_uint("stroke", "Stroke", "", @@ -187,7 +187,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 0xffffffff, 0x01000000, (GParamFlags) G_PARAM_READWRITE)); - + g_object_class_install_property(object_class, PROP_STROKE_MOUSEOVER, g_param_spec_uint("stroke_mouseover", "Stroke mouseover", "", @@ -195,7 +195,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 0xffffffff, 0x01000000, (GParamFlags) G_PARAM_READWRITE)); - + g_object_class_install_property(object_class, PROP_STROKE_DRAGGING, g_param_spec_uint("stroke_dragging", "Stroke dragging", "", @@ -203,50 +203,50 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -255,7 +255,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -264,7 +264,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -273,7 +273,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -282,7 +282,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -291,7 +291,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -300,7 +300,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -309,7 +309,7 @@ static void sp_knot_class_init(SPKnotClass *klass) 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, @@ -331,7 +331,7 @@ static void sp_knot_init(SPKnot *knot) 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); @@ -339,7 +339,7 @@ static void sp_knot_init(SPKnot *knot) 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); } @@ -509,7 +509,7 @@ static void sp_knot_get_property(GObject *, guint, GValue *, GParamSpec *) 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; @@ -593,18 +593,18 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot) 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, @@ -643,11 +643,11 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot) 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) { @@ -664,7 +664,7 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot) knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled.")); transform_escaped = true; consumed = TRUE; - } + } grabbed = FALSE; moved = FALSE; break; @@ -720,7 +720,7 @@ void sp_knot_show(SPKnot *knot) { g_return_if_fail(knot != NULL); g_return_if_fail(SP_IS_KNOT (knot)); - + sp_knot_set_flag(knot, SP_KNOT_VISIBLE, TRUE); } @@ -773,7 +773,7 @@ gdouble sp_knot_distance(SPKnot * knot, NR::Point *p, guint state) p, state, &distance); - + return distance; } @@ -807,12 +807,12 @@ void sp_knot_moveto(SPKnot *knot, NR::Point *p) 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); } /** @@ -822,7 +822,7 @@ NR::Point sp_knot_position(SPKnot const *knot) { g_assert(knot != NULL); g_assert(SP_IS_KNOT (knot)); - + return knot->pos; } @@ -833,13 +833,13 @@ static void sp_knot_set_flag(SPKnot *knot, guint flag, bool set) { 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) { @@ -868,7 +868,7 @@ static void sp_knot_update_ctrl(SPKnot *knot) 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 70a234260..0ea3ed98a 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -73,7 +73,7 @@ void sp_knot_holder_destroy(SPKnotHolder *kh) g_free(e); kh->entity = g_slist_remove(kh->entity, e); } - + g_free(kh); } } @@ -146,11 +146,11 @@ void sp_knot_holder_add_full( 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); @@ -180,7 +180,7 @@ static void knot_clicked_handler(SPKnot *knot, guint state, gpointer data) 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 fadcd0f1e..c143336cc 100644 --- a/src/layer-fns.cpp +++ b/src/layer-fns.cpp @@ -20,9 +20,9 @@ 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. * @@ -167,7 +167,7 @@ SPObject *previous_layer(SPObject *root, SPObject *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 23ff1435f..ae65e3421 100644 --- 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 747fa65b3..53130f5f8 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -191,7 +191,7 @@ sp_node_context_setup(SPEventContext *ec) 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 _("Alt: lock handle length; Ctrl+Alt: 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) { @@ -566,7 +566,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) 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 { @@ -582,7 +582,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) 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) { @@ -609,11 +609,11 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (event->button.button == 1) { NR::Maybe 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 3a76e7850..6b470da26 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -47,7 +47,7 @@ class NR::Matrix; /// 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) { @@ -182,7 +182,7 @@ 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"); @@ -257,7 +257,7 @@ static gint sp_nodepath_get_node_count(Inkscape::NodePath::Path *np) /** * Clean up a nodepath after editing. - * + * * Currently we are deleting trivial subpaths. */ static void sp_nodepath_cleanup(Inkscape::NodePath::Path *nodepath) @@ -284,11 +284,11 @@ 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); @@ -1252,7 +1252,7 @@ sp_nodepath_add_node_near_point(SPItem * item, NR::Point p) //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; @@ -1276,7 +1276,7 @@ sp_nodepath_add_node_near_point(SPItem * item, NR::Point p) * 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); @@ -1901,10 +1901,10 @@ sp_nodepath_select_all(Inkscape::NodePath::Path *nodepath, bool invert) } } -/** - * 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) @@ -1997,7 +1997,7 @@ 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) @@ -2439,7 +2439,7 @@ node_request(SPKnot *knot, NR::Point *p, guint state, gpointer data) 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; @@ -3134,17 +3134,17 @@ void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis) 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; @@ -3526,13 +3526,13 @@ sp_nodepath_get_node_by_index(int index) //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) { @@ -3549,7 +3549,7 @@ sp_nodepath_get_node_by_index(int index) } } } - + return e; } diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 3db0f0a21..d96585509 100644 --- 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; diff --git a/src/object-hierarchy.cpp b/src/object-hierarchy.cpp index 30f13e49a..658bcb511 100644 --- a/src/object-hierarchy.cpp +++ b/src/object-hierarchy.cpp @@ -61,7 +61,7 @@ void ObjectHierarchy::setTop(SPObject *object) { } /** - * 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 6552cea96..153abe4af 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -5,7 +5,7 @@ * Authors: * Carl Hetherington * - * Copyright (C) 2005 Authors + * Copyright (C) 2005 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -24,7 +24,7 @@ Inkscape::ObjectSnapper::ObjectSnapper(SPNamedView const *nv, NR::Coord const d) : Snapper(nv, d), _snap_to_nodes(true), _snap_to_paths(true) { - + } @@ -45,7 +45,7 @@ void Inkscape::ObjectSnapper::_findCandidates(std::list& c, 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()); @@ -54,7 +54,7 @@ void Inkscape::ObjectSnapper::_findCandidates(std::list& c, } } } - + _findCandidates(c, o, it, p); } } @@ -77,7 +77,7 @@ void Inkscape::ObjectSnapper::_snapNodes(Inkscape::SnappedPoint &s, 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 */ @@ -89,7 +89,7 @@ void Inkscape::ObjectSnapper::_snapNodes(Inkscape::SnappedPoint &s, if (dist < getDistance() && dist < s.getDistance()) { s = SnappedPoint(n, dist); } - + j++; } } @@ -122,7 +122,7 @@ void Inkscape::ObjectSnapper::_snapPaths(Inkscape::SnappedPoint &s, /* 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 6a5d876d6..ff346edf9 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -161,13 +161,13 @@ sp_selected_path_break_apart (void) 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; @@ -205,7 +205,7 @@ sp_selected_path_break_apart (void) // 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 @@ -227,7 +227,7 @@ sp_selected_path_break_apart (void) } else { SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No path(s) 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); @@ -317,7 +317,7 @@ sp_selected_item_to_curved_repr(SPItem * item, guint32 text_grouping_policy) /* 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); @@ -365,5 +365,5 @@ sp_selected_path_reverse () sp_document_done (SP_DT_DOCUMENT (desktop)); } else { SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No paths to reverse in the selection.")); - } + } } diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 95593f25b..6344cff28 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -1,5 +1,5 @@ -/** \file - * Pen event context implementation. +/** \file + * Pen event context implementation. */ /* @@ -126,7 +126,7 @@ sp_pen_context_init(SPPenContext *pc) 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; @@ -235,7 +235,7 @@ sp_pen_context_set(SPEventContext *ec, gchar const *key, gchar const *val) } } -/** +/** * 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; } @@ -864,7 +864,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event) 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 a75b4c561..0b6900613 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -1,4 +1,4 @@ -/** \file +/** \file * Pencil event context implementation. */ @@ -110,7 +110,7 @@ sp_pencil_context_init(SPPencilContext *pc) 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) { @@ -480,8 +480,8 @@ spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p) /** * Finalize addline. - * - * \todo + * + * \todo * fixme: I'd like remove red reset from concat colors (lauris). * Still not sure, how it will make most sense. */ @@ -567,7 +567,7 @@ fit_and_split(SPPencilContext *pc) 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 5d3981b58..fedfa8568 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -49,9 +49,9 @@ void 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" @@ -71,7 +71,7 @@ Preferences::save() { 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 3c9ec6cae..4999e1524 100644 --- a/src/prefix.cpp +++ b/src/prefix.cpp @@ -3,7 +3,7 @@ * Written by: Mike Hearn * Hongli Lai * http://autopackage.org/ - * + * * This source code is public domain. You can relicense this code * under whatever license you want. * @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "prefix.h" diff --git a/src/rect-context.cpp b/src/rect-context.cpp index be56047f0..1d6266795 100644 --- 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 | @@ -451,7 +451,7 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) } 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); @@ -459,7 +459,7 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) 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 d44662c5b..dd16a62d8 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -22,7 +22,7 @@ Inkscape::Rubberband *Inkscape::Rubberband::_instance = NULL; 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 845561d18..426422fc9 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -95,7 +95,7 @@ void Inkscape::SelCue::_updateItemBboxes() 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) { @@ -104,14 +104,14 @@ void Inkscape::SelCue::_updateItemBboxes() 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); } @@ -128,13 +128,13 @@ void Inkscape::SelCue::_updateItemBboxes() "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 d5288117c..e9ad992a4 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -233,7 +233,7 @@ sp_select_context_abort(SPEventContext *event_context) 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); @@ -470,7 +470,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) 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); } @@ -582,7 +582,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) 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) { diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 1587b2719..36f3b1b3f 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1030,7 +1030,7 @@ void sp_selection_copy() 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()) { @@ -1301,7 +1301,7 @@ sp_selection_scale_absolute(Inkscape::Selection *selection, NR::Rect const bbox(selection->bounds()); if (bbox.isEmpty()) { - return; + return; } NR::translate const p2o(-bbox.min()); @@ -2164,7 +2164,7 @@ sp_selection_create_bitmap_copy () // 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, @@ -2197,12 +2197,12 @@ sp_selection_create_bitmap_copy () 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 diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 9d484b293..3f72afae0 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -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 Shift+D 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 Shift+D 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 Shift+D 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 %i layer. %s.", - "%s in %i layers. %s.", + "%s in %i layers. %s.", selection->numberOfLayers()), object_count_str, selection->numberOfLayers(), when_selected); } diff --git a/src/selection.cpp b/src/selection.cpp index aa77ef894..c40b7b546 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -357,20 +357,20 @@ std::vector Selection::getSnapPointsConvexHull() const { for (GSList const *iter = items; iter != NULL; iter = iter->next) { sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p)); } - - std::vector::iterator i; + + std::vector::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 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 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 520a6faff..1d4557b90 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -119,7 +119,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : "stroke_color", 0x000000a0, "pixbuf", handles[12], NULL); - + _grip = sp_canvas_item_new(SP_DT_CONTROLS(desktop), SP_TYPE_CTRL, "anchor", GTK_ANCHOR_CENTER, @@ -132,7 +132,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : "stroke_color", 0xffffffff, "pixbuf", handles[12], NULL); - + sp_canvas_item_hide(_grip); sp_canvas_item_hide(_norm); @@ -330,7 +330,7 @@ void Inkscape::SelTrans::ungrab() // 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 @@ -485,7 +485,7 @@ void Inkscape::SelTrans::_updateHandles() if (items) { SPItem *first = reinterpret_cast(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(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 @@ -1188,7 +1188,7 @@ void Inkscape::SelTrans::scale(NR::Point &pt, guint state) 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; @@ -1291,9 +1291,9 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) /* This will be our list of possible translations */ std::list > s; - + if (control) { - + /* Snap to things, and also constrain to horizontal or vertical movement */ for (unsigned int dim = 0; dim < 2; dim++) { @@ -1304,7 +1304,7 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) _snap_points, component_vectors[dim], it, dxy)); } - + } else { /* Snap to things with no constraint */ @@ -1327,7 +1327,7 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) } } } - + if (control) { /* Ensure that the horizontal and vertical constraint has been applied */ if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) { @@ -1336,7 +1336,7 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) dxy[NR::X] = 0; } } - + NR::Matrix const move((NR::translate(dxy))); NR::Point const norm(0, 0); transform(move, norm); diff --git a/src/shortcuts-default-xml.cpp b/src/shortcuts-default-xml.cpp index e91f435e2..56b31ceb6 100644 --- a/src/shortcuts-default-xml.cpp +++ b/src/shortcuts-default-xml.cpp @@ -1,4 +1,4 @@ -extern char const shortcuts_default_xml[]= +extern char const shortcuts_default_xml[]= "\n" "\n" " \n" diff --git a/src/snap.cpp b/src/snap.cpp index b14549db3..111ef619f 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -57,7 +57,7 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType t, std::list 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); @@ -87,7 +87,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::Snapper::PointType std::list 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 â‰  (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 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 namedview_dim_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t, +std::pair namedview_dim_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t, const std::vector &p, NR::Coord const dx, NR::Dim2 const dim, std::list const &it @@ -256,7 +256,7 @@ std::pair namedview_dim_snap_list(SPNamedView const *nv, Inksca NR::Coord xdist = dx; SnapManager const m(nv); - + if (m.willSnapSomething()) { for (std::vector::const_iterator i = p.begin(); i != p.end(); i++) { NR::Point q = *i; @@ -276,8 +276,8 @@ std::pair namedview_dim_snap_list(SPNamedView const *nv, Inksca /** * Snap list of points in two dimensions. */ -std::pair namedview_vector_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t, - const std::vector &p, NR::Point const &norm, +std::pair namedview_vector_snap_list(SPNamedView const *nv, Inkscape::Snapper::PointType t, + const std::vector &p, NR::Point const &norm, NR::scale const &s, std::list const &it) { using NR::X; @@ -288,7 +288,7 @@ std::pair 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::const_iterator i = p.begin(); i != p.end(); i++) { @@ -307,7 +307,7 @@ std::pair namedview_vector_snap_list(SPNamedView const *nv, Inksca } } } - + return std::make_pair(ratio, dist < NR_HUGE); } @@ -318,8 +318,8 @@ std::pair 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 namedview_dim_snap_list_scale(SPNamedView const *nv, Inkscape::Snapper::PointType t, - const std::vector &p, NR::Point const &norm, +std::pair namedview_dim_snap_list_scale(SPNamedView const *nv, Inkscape::Snapper::PointType t, + const std::vector &p, NR::Point const &norm, double const sx, NR::Dim2 dim, std::list const &it) { @@ -339,13 +339,13 @@ std::pair 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 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 &p, NR::Point const &norm, +double namedview_dim_snap_list_skew(SPNamedView const *nv, Inkscape::Snapper::PointType t, + const std::vector &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::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 3aebb086a..5d0d242dd 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -13,10 +13,10 @@ 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 27531b50b..fd05809c1 100644 --- a/src/snapper.cpp +++ b/src/snapper.cpp @@ -23,7 +23,7 @@ Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_vi { g_assert(_named_view != NULL); g_assert(SP_IS_NAMEDVIEW(_named_view)); - + setSnapTo(BBOX_POINT, true); } diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index 85d9ccce2..c4425add6 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -48,7 +48,7 @@ SPConnEndPair::~SPConnEndPair() delete _connRef; _connRef = NULL; } - + _invalid_path_connection.disconnect(); _transformed_connection.disconnect(); } @@ -75,7 +75,7 @@ sp_conn_end_pair_build(SPObject *object) } -static void +static void avoid_conn_move(NR::Matrix const *mp, SPItem *moved_item) { // Detach from objects if attached. @@ -94,7 +94,7 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value) 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); @@ -105,7 +105,7 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value) } else { _connType = SP_CONNECTOR_NOAVOID; - + if (_connRef) { _connRef->removeFromGraph(); delete _connRef; @@ -117,7 +117,7 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value) return; } - + unsigned const handle_ix = key - SP_ATTR_CONNECTION_START; g_assert( handle_ix <= 1 ); this->_connEnd[handle_ix]->setAttacherHref(value); @@ -149,13 +149,13 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const { 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); @@ -180,7 +180,7 @@ static void emitPathInvalidationNotification(void *ptr) // 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); } @@ -251,7 +251,7 @@ SPConnEndPair::isAutoRoutingConn(void) } return false; } - + void SPConnEndPair::makePathInvalid(void) { @@ -273,7 +273,7 @@ SPConnEndPair::reroutePath(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); @@ -281,7 +281,7 @@ SPConnEndPair::reroutePath(void) 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 af8692358..536addf4e 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -42,7 +42,7 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item, // 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(); @@ -108,10 +108,10 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item, 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 @@ -120,10 +120,10 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item, 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) { @@ -236,7 +236,7 @@ sp_conn_end_detach(SPObject *const owner, unsigned const handle_ix) 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 f59c63487..339990771 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -51,7 +51,7 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g if (strcmp(p, "None") == 0) { transparent_color = ccode; } - + if (strcmp(p, "#000000") == 0) { black_color = ccode; } @@ -59,7 +59,7 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; ) { - + char value = 0; char maskv = 0; @@ -72,7 +72,7 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g } } } - + pixmap_buffer[(y * 4 + x/8)-1] = value; mask_buffer[(y * 4 + x/8)-1] = maskv; } @@ -86,7 +86,7 @@ GdkCursor *sp_cursor_new_from_xpm (gchar **xpm, gint hot_x, gint hot_y) { 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 ad6cfc578..95823ee62 100644 --- a/src/sp-defs.cpp +++ b/src/sp-defs.cpp @@ -32,7 +32,7 @@ static SPObjectClass *parent_class; GType sp_defs_get_type(void) { static GType defs_type = 0; - + if (!defs_type) { GTypeInfo defs_info = { sizeof(SPDefsClass), @@ -48,7 +48,7 @@ GType sp_defs_get_type(void) }; defs_type = g_type_register_static(SP_TYPE_OBJECT, "SPDefs", &defs_info, (GTypeFlags) 0); } - + return defs_type; } @@ -56,7 +56,7 @@ static void sp_defs_class_init(SPDefsClass *dc) { 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; @@ -65,7 +65,7 @@ static void sp_defs_class_init(SPDefsClass *dc) static void sp_defs_init(SPDefs *defs) { - + } static void sp_defs_release(SPObject *object) @@ -88,9 +88,9 @@ static void sp_defs_update(SPObject *object, SPCtx *ctx, guint flags) 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); @@ -106,17 +106,17 @@ static void sp_defs_modified(SPObject *object, guint flags) 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); @@ -130,23 +130,23 @@ static void sp_defs_modified(SPObject *object, guint flags) 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 5c01483c8..95695768e 100644 --- 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 f54e60dab..4c46a699c 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -284,7 +284,7 @@ sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) 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 ) { @@ -339,7 +339,7 @@ static gchar *sp_flowtext_description(SPItem *item) int const nChars = layout.iteratorToCharIndex(layout.end()); if (SP_FLOWTEXT(item)->has_internal_frame()) return g_strdup_printf(_("Flowed text (%d characters)"), nChars); - else + else return g_strdup_printf(_("Linked flowed text (%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 const &computed = SP_FLOWREGION(child)->computed; diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index db2360225..c2b0b32a3 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -44,7 +44,7 @@ #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); @@ -135,8 +135,8 @@ sp_stop_set(SPObject *object, unsigned key, gchar const *value) * 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. */ { @@ -144,7 +144,7 @@ sp_stop_set(SPObject *object, unsigned key, gchar const *value) 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); } } @@ -844,7 +844,7 @@ sp_gradient_repr_clear_vector(SPGradient *gr) } /** - * 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 @@ -1073,7 +1073,7 @@ sp_gradient_ensure_colors(SPGradient *gr) /** * 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). @@ -1149,7 +1149,7 @@ sp_gradient_render_vector_block_rgba(SPGradient *const gradient, guchar *buf, /** * 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 * @@ -1435,10 +1435,10 @@ sp_lineargradient_painter_new(SPPaintServer *ps, 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()); @@ -1723,7 +1723,7 @@ sp_radialgradient_painter_new(SPPaintServer *ps, 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) */ @@ -1736,7 +1736,7 @@ sp_radialgradient_painter_new(SPPaintServer *ps, } 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 98ca66092..ccaf81649 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -48,7 +48,7 @@ static SPObjectClass *parent_class; GType sp_guide_get_type(void) { static GType guide_type = 0; - + if (!guide_type) { GTypeInfo guide_info = { sizeof(SPGuideClass), @@ -62,7 +62,7 @@ GType sp_guide_get_type(void) }; guide_type = g_type_register_static(SP_TYPE_OBJECT, "SPGuide", &guide_info, (GTypeFlags) 0); } - + return guide_type; } @@ -70,12 +70,12 @@ static void sp_guide_class_init(SPGuideClass *gc) { 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; @@ -87,7 +87,7 @@ static void sp_guide_class_init(SPGuideClass *gc) 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); } @@ -197,7 +197,7 @@ void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler) ( 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); @@ -209,7 +209,7 @@ void sp_guide_hide(SPGuide *guide, SPCanvas *canvas) 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)); @@ -217,7 +217,7 @@ void sp_guide_hide(SPGuide *guide, SPCanvas *canvas) return; } } - + g_assert_not_reached(); } @@ -227,14 +227,14 @@ void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive) 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::const_iterator i(guide.attached_items.begin()), iEnd(guide.attached_items.end()); i != iEnd; ++i) @@ -282,7 +282,7 @@ char *sp_guide_description(SPGuide const *guide) { using NR::X; using NR::Y; - + if ( guide->normal == component_vectors[X] ) { return g_strdup(_("vertical guideline")); } else if ( guide->normal == component_vectors[Y] ) { @@ -301,7 +301,7 @@ char *sp_guide_description(SPGuide const *guide) void sp_guide_remove(SPGuide *guide) { g_assert(SP_IS_GUIDE(guide)); - + for (vector::const_iterator i(guide->attached_items.begin()), iEnd(guide->attached_items.end()); i != iEnd; ++i) @@ -310,7 +310,7 @@ void sp_guide_remove(SPGuide *guide) 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 19b9b19a7..631eb6a9c 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -821,13 +821,13 @@ sp_image_description(SPItem *item) 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(_("Image with bad reference: %s"), href_desc) diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index a2be6daf4..b4b69e1e4 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -613,7 +613,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) } 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); diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index c84792215..163a9f5f8 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -1,4 +1,4 @@ -/** \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 } diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 817bc1b44..beefc7640 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -25,7 +25,7 @@ static NR::translate inverse(NR::translate const m) 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()); @@ -46,7 +46,7 @@ sp_item_scale_rel (SPItem *item, NR::scale const &scale) 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) @@ -60,7 +60,7 @@ 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) { @@ -76,7 +76,7 @@ preference value passed to it. Has to solve a quadratic equation to make sure 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); @@ -93,9 +93,9 @@ get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool 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 ab241a0cd..db7f9fffd 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -636,12 +636,12 @@ sp_item_write(SPObject *const object, Inkscape::XML::Node *repr, guint flags) 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 0c4c9215b..0b4d954bf 100644 --- a/src/sp-marker.cpp +++ b/src/sp-marker.cpp @@ -174,11 +174,11 @@ sp_marker_set (SPObject *object, unsigned int key, const gchar *value) 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: @@ -518,7 +518,7 @@ sp_marker_print (SPItem *item, SPPrintContext *ctx) /* 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. @@ -562,7 +562,7 @@ sp_marker_show_instance (SPMarker *marker, NRArenaItem *parent, } 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 27d65422f..5f05c9fad 100644 --- a/src/sp-metrics.cpp +++ b/src/sp-metrics.cpp @@ -3,7 +3,7 @@ /* * SPMetric handling and stuff - * I hope this will be usefull :-) + * I hope this will be usefull :-) */ gdouble @@ -73,7 +73,7 @@ sp_metric_to_metric_string(gdouble const length, { 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 32e713792..f1d957d84 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -91,12 +91,12 @@ static void sp_namedview_class_init(SPNamedViewClass * klass) { 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; @@ -112,14 +112,14 @@ static void sp_namedview_init(SPNamedView *nv) 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(l->data)->guides, (GCallback) sp_dt_guide_event); - if (static_cast(l->data)->guides_active) - sp_guide_sensitize(g, - SP_DT_CANVAS(static_cast (l->data)), + if (static_cast(l->data)->guides_active) + sp_guide_sensitize(g, + SP_DT_CANVAS(static_cast (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; } @@ -639,9 +639,9 @@ void SPNamedView::show(SPDesktop *desktop) } } } - + 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)); @@ -656,7 +656,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) { 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) @@ -664,22 +664,22 @@ void sp_namedview_window_from_document(SPDesktop *desktop) 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 ) { @@ -708,15 +708,15 @@ void sp_namedview_document_from_window(SPDesktop *desktop) 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); @@ -725,9 +725,9 @@ void sp_namedview_document_from_window(SPDesktop *desktop) 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); } @@ -736,11 +736,11 @@ void SPNamedView::hide(SPDesktop const *desktop) { 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; @@ -751,7 +751,7 @@ void SPNamedView::hide(SPDesktop const *desktop) } 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); @@ -761,9 +761,9 @@ void SPNamedView::activateGuides(gpointer desktop, gboolean active) { g_assert(desktop != NULL); g_assert(g_slist_find(views, desktop)); - + SPDesktop *dt = static_cast(desktop); - + for (GSList *l = guides; l != NULL; l = l->next) { sp_guide_sensitize(SP_GUIDE(l->data), SP_DT_CANVAS(dt), active); } @@ -793,12 +793,12 @@ void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr) } 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); } @@ -808,12 +808,12 @@ void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr) 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); } @@ -832,7 +832,7 @@ static void sp_namedview_setup_grid_item(SPNamedView *nv, SPCanvasItem *item) } else { sp_canvas_item_hide(item); } - + sp_canvas_item_set((GtkObject *) item, "color", nv->gridcolor, "originx", nv->gridorigin[NR::X], @@ -873,7 +873,7 @@ static gboolean sp_str_to_bool(const gchar *str) 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; } @@ -941,27 +941,27 @@ static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color) 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 f97007b51..4a1a2e09e 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -13,7 +13,7 @@ */ /** \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 @@ -327,7 +327,7 @@ sp_object_unref(SPObject *object, SPObject *owner) * * 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 @@ -347,7 +347,7 @@ sp_object_href(SPObject *object, gpointer owner) /** * 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 @@ -369,7 +369,7 @@ sp_object_hunref(SPObject *object, gpointer owner) /** * 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) ) { @@ -391,7 +391,7 @@ SPObject::_updateTotalHRefCount(int increment) { /** * 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); @@ -433,8 +433,8 @@ SPObject const *AncestorSon(SPObject const *obj, SPObject const *ancestor) { /** * 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 @@ -505,33 +505,33 @@ SPObject::defaultLabel() const { } /** 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); @@ -541,12 +541,12 @@ SPObject::_sendDeleteSignalRecursive() { /** * 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); @@ -606,7 +606,7 @@ sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev) /** * 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)); @@ -649,7 +649,7 @@ sp_object_reorder(SPObject *object, SPObject *prev) { /** * 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)); @@ -707,7 +707,7 @@ sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr) * 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); @@ -742,14 +742,14 @@ static void sp_object_release(SPObject *object) } /** - * 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)); @@ -759,7 +759,7 @@ sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) } /** - * 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 @@ -1181,8 +1181,8 @@ SPObject::updateRepr(Inkscape::XML::Node *repr, unsigned int flags) { /* 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). */ @@ -1233,8 +1233,8 @@ SPObject::updateDisplay(SPCtx *ctx, unsigned int flags) // 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)) { @@ -1424,33 +1424,33 @@ sp_object_get_unique_id(SPObject *object, gchar const *id) * 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 - * 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 + * 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 a9730653c..fc9115f24 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -46,24 +46,24 @@ class SPDocument; /** \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); @@ -315,7 +315,7 @@ sp_offset_release(SPObject *object) } /** - * 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 @@ -430,7 +430,7 @@ sp_offset_description(SPItem *item) } /** - * 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 * @@ -438,7 +438,7 @@ bpath_to_liv_path(NArtBpath *bpath) { if (bpath == NULL) return NULL; - + Path *dest = new Path; dest->SetBackData (false); { @@ -545,7 +545,7 @@ sp_offset_set_shape(SPShape *shape) Path *originaux[1]; Path *res = new Path; res->SetBackData (false); - + // and now: offset float o_width; if (offset->rad >= 0) @@ -608,8 +608,8 @@ sp_offset_set_shape(SPShape *shape) // version par makeoffset Shape *theShape = new Shape; Shape *theRes = new Shape; - - + + // and now: offset float o_width; if (offset->rad >= 0) @@ -620,7 +620,7 @@ sp_offset_set_shape(SPShape *shape) { o_width = -offset->rad; } - + // one has to have a measure of the details if (o_width >= 1.0) { @@ -795,21 +795,21 @@ static void sp_offset_snappoints(SPItem const *item, SnapPointsIter p) // 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) @@ -851,12 +851,12 @@ 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 @@ -868,14 +868,14 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) 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 @@ -995,8 +995,8 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) 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. @@ -1142,7 +1142,7 @@ sp_offset_source_modified (SPObject *iSource, guint flags, SPItem *item) sp_shape_set_shape ((SPShape *) offset); } -static void +static void refresh_offset_source(SPOffset* offset) { if ( offset == NULL ) return; @@ -1195,21 +1195,21 @@ refresh_offset_source(SPOffset* offset) { 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); } } diff --git a/src/sp-paint-server.cpp b/src/sp-paint-server.cpp index 24727628c..90263d17c 100644 --- a/src/sp-paint-server.cpp +++ b/src/sp-paint-server.cpp @@ -108,7 +108,7 @@ static void sp_paint_server_painter_free(SPPaintServer *ps, SPPainter *painter) 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) { @@ -125,7 +125,7 @@ static void sp_paint_server_painter_free(SPPaintServer *ps, SPPainter *painter) } r = p; } - + g_assert_not_reached(); } diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index beea89b02..85a8ad649 100644 --- 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); } @@ -964,10 +964,10 @@ sp_pat_fill (SPPainter *painter, NRPixBlock *pb) 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 1bb77ccc7..3773efa83 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -603,7 +603,7 @@ sp_root_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) 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 aced4ec53..d7b703d1a 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -190,7 +190,7 @@ sp_spiral_set (SPObject *object, unsigned int key, const gchar *value) 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)) { @@ -206,11 +206,11 @@ sp_spiral_set (SPObject *object, unsigned int key, const gchar *value) 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); @@ -239,11 +239,11 @@ sp_spiral_set (SPObject *object, unsigned int key, const gchar *value) 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 { @@ -257,9 +257,9 @@ sp_spiral_set (SPObject *object, unsigned int key, const gchar *value) 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 { @@ -300,7 +300,7 @@ sp_spiral_description (SPItem * item) } -/** +/** * Fit beziers together to spiral and draw it. * * \pre dstep \> 0. @@ -336,20 +336,20 @@ sp_spiral_fit_and_draw (SPSpiral const *spiral, && (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. */ } @@ -452,7 +452,7 @@ sp_spiral_position_set (SPSpiral *spiral, 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; @@ -476,12 +476,12 @@ static void sp_spiral_snappoints(SPItem const *item, SnapPointsIter p) } } -/** +/** * 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) @@ -503,7 +503,7 @@ 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. * @@ -536,11 +536,11 @@ sp_spiral_get_tangent (SPSpiral const *spiral, gdouble t) 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; @@ -556,8 +556,8 @@ sp_spiral_get_tangent (SPSpiral const *spiral, gdouble t) 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 dfa34be95..eea11791f 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -259,8 +259,8 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) 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); } @@ -305,9 +305,9 @@ Obvious (but acceptable for my purposes) limits to uniqueness: 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); @@ -416,7 +416,7 @@ sp_star_set_shape (SPShape *shape) 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)); @@ -429,12 +429,12 @@ sp_star_set_shape (SPShape *shape) 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)); @@ -458,12 +458,12 @@ sp_star_set_shape (SPShape *shape) 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 f07783dbe..3b5780721 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -453,7 +453,7 @@ void refresh_textpath_source(SPTextPath* tp) tp->sourcePath->sourceDirty=false; // finalisons - if ( tp->sourcePath->originalPath ) { + if ( tp->sourcePath->originalPath ) { if (tp->originalPath) { delete tp->originalPath; } @@ -574,7 +574,7 @@ sp_textpath_to_text(SPObject *tp) // 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 } @@ -583,7 +583,7 @@ sp_textpath_to_text(SPObject *tp) 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 c1640d427..15bf513dc 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -267,7 +267,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) 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 bee392863..f796f77a9 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -253,7 +253,7 @@ sp_star_context_set (SPEventContext *ec, const gchar *key, const gchar *val) 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(); @@ -432,7 +432,7 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) 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); @@ -448,7 +448,7 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) _("Polygon: radius %s, angle %5g°; with Ctrl to snap angle") : _("Star: radius %s, angle %5g°; with Ctrl 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 c2cda1c2b..4233be7c0 100644 --- a/src/streams-gzip.cpp +++ b/src/streams-gzip.cpp @@ -19,9 +19,9 @@ static int const GZIP_IS_ASCII = 0x01; //file contains text 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); @@ -34,7 +34,7 @@ void GZipBuffer::consume_header() throw(GZipHeaderException) { unsigned int flags; guint8 data[4]; - + try { _urihandle->read(data, 4); check_signature(data); diff --git a/src/streams-handles.cpp b/src/streams-handles.cpp index 0990d0589..9c6e861f8 100644 --- a/src/streams-handles.cpp +++ b/src/streams-handles.cpp @@ -29,7 +29,7 @@ int FileHandle::open(URI const& uri, char const* mode) } FILE *FileHandle::sys_open(URI const& uri, char const* mode) -{ +{ gchar *filename = uri.toNativeFilename(); if ((fp = std::fopen(filename, mode)) == 0) { @@ -83,8 +83,8 @@ int FileHandle::sys_write (void const *buf, int buflen) throw(WriteException) 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 ffaccc2e4..712524cf0 100644 --- a/src/streams-jar.cpp +++ b/src/streams-jar.cpp @@ -21,14 +21,14 @@ void JarBuffer::consume_header() throw(JarHeaderException) 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 @@ -95,7 +95,7 @@ int JarBuffer::consume_compressed(int nbytes) guint8 efbuf[eflen]; _urihandle->read(efbuf, eflen); return 1; - } + } return ret; } @@ -105,7 +105,7 @@ int JarBuffer::consume_uncompressed(int nbytes) guint8 data[nbytes]; if (consume(data, nbytes) == EOF) return EOF; - + copy_to_get(data, nbytes); compressed_left -= nbytes; @@ -119,11 +119,11 @@ GByteArray *JarBuffer::inflate(guint8 *data, const int 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 73106db17..cbe6a75fe 100644 --- a/src/streams-zlib.cpp +++ b/src/streams-zlib.cpp @@ -17,9 +17,9 @@ namespace Inkscape { * ZlibBuffer */ -ZlibBuffer::ZlibBuffer(URIHandle& urih) +ZlibBuffer::ZlibBuffer(URIHandle& urih) : _urihandle(&urih), _putsize(BUFSIZE_STREAM), _getsize(BUFSIZE_STREAM) -{ +{ init_inflation(); } @@ -38,15 +38,15 @@ int ZlibBuffer::allocate_buffers() 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; @@ -57,10 +57,10 @@ int ZlibBuffer::underflow() { if (eback() == 0 && allocate_buffers() == 0) return EOF; - + if (consume_and_inflate() == EOF) return EOF; - + return *(unsigned char *)gptr(); } @@ -72,13 +72,13 @@ int ZlibBuffer::overflow(int c) 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; @@ -93,7 +93,7 @@ int ZlibBuffer::consume(guint8 *buf, int nbytes) int ZlibBuffer::do_consume(guint8 *buf, int nbytes) { nbytes = _urihandle->read(buf, nbytes); - + if (nbytes == EOF) return EOF; else if (nbytes == 0) @@ -107,10 +107,10 @@ int ZlibBuffer::do_consume_and_inflate(int nbytes) 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; } @@ -136,11 +136,11 @@ int ZlibBuffer::flush_output() 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(); } @@ -149,7 +149,7 @@ void ZlibBuffer::init_inflation() throw(ZlibBufferException) void ZlibBuffer::reset_inflation() throw(ZlibBufferException) { - if (inflateReset(&_zs) != Z_OK) + if (inflateReset(&_zs) != Z_OK) throw ZlibBufferException(); } @@ -162,10 +162,10 @@ GByteArray *ZlibBuffer::do_inflate(guint8 *data, int nbytes) { 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; @@ -200,10 +200,10 @@ int ZlibBuffer::copy_to_get(guint8 *data, int nbytes) 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 e0a1dcc7d..ee67469ad 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -658,7 +658,7 @@ sp_style_read(SPStyle *style, SPObject *object, Inkscape::XML::Node *repr) /** * 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) @@ -692,7 +692,7 @@ sp_style_read_from_repr(SPStyle *style, Inkscape::XML::Node *repr) /** - * + * */ static void sp_style_privatize_text(SPStyle *style) @@ -706,7 +706,7 @@ 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. @@ -841,8 +841,8 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) 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); @@ -1033,15 +1033,15 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) 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); @@ -1092,12 +1092,12 @@ sp_repr_sel_eng() * 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. */ @@ -1133,13 +1133,13 @@ void 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) { @@ -1199,9 +1199,9 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent) 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) @@ -1226,7 +1226,7 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const 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; @@ -1374,7 +1374,7 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent) 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; @@ -1440,7 +1440,7 @@ sp_style_merge_paint_prop_from_dying_parent(SPStyle *style, 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(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(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. @@ -2164,7 +2164,7 @@ sp_style_write_string(SPStyle const *const style, guint const flags) /** * Dumps style to CSS string, see sp_style_write_string() - * + * * \pre from != NULL. * \pre to != NULL. * \post ret != NULL. @@ -2198,7 +2198,7 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to) 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); } @@ -2413,7 +2413,7 @@ sp_style_clear(SPStyle *style) /** - * + * */ static void sp_style_read_dash(SPStyle *style, gchar const *str) @@ -2667,9 +2667,9 @@ sp_style_read_ilength(SPILength *val, 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) @@ -3106,7 +3106,7 @@ sp_style_write_istring(gchar *p, gint const len, gchar const *const key, /** - * + * */ static bool sp_length_differ(SPILength const *const a, SPILength const *const b) @@ -3569,16 +3569,16 @@ is_url(char const *p) 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 * @@ -3677,9 +3677,9 @@ sp_css_attr_scale(SPCSSAttr *css, double ex) /** * 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 @@ -3690,7 +3690,7 @@ css2_unescape_unquote (SPIString *val) /// \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 5da24df98..22d9dd120 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -39,7 +39,7 @@ SPSVGView::SPSVGView (SPCanvasGroup *parent) SPSVGView::~SPSVGView() { - if (doc() && _drawing) + if (doc() && _drawing) { sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey); _drawing = NULL; @@ -63,7 +63,7 @@ SPSVGView::setScale (gdouble hscale, gdouble vscale) * 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 ) @@ -201,11 +201,11 @@ SPSVGView::setDocument (SPDocument *document) 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 a181f4f6f..d59ba6bdf 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -180,9 +180,9 @@ sp_text_context_dispose(GObject *obj) 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 @@ -619,7 +619,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) 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 @@ -656,7 +656,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) } break; - case GDK_BUTTON_RELEASE: + case GDK_BUTTON_RELEASE: if (event->button.button == 1) { if (tc->grabbed) { @@ -1004,7 +1004,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) 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; } @@ -1014,7 +1014,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) 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; } @@ -1040,7 +1040,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) 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); } @@ -1048,7 +1048,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); return TRUE; - } + } } break; case GDK_bracketright: @@ -1060,7 +1060,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) 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); } @@ -1151,7 +1151,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event) tc->grabbed = NULL; } Inkscape::Rubberband::get()->stop(); - } + } } } break; diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp index f7bae09e9..62395581f 100644 --- a/src/zoom-context.cpp +++ b/src/zoom-context.cpp @@ -43,7 +43,7 @@ static bool escaped; GType sp_zoom_context_get_type(void) { static GType type = 0; - + if (!type) { GTypeInfo info = { sizeof(SPZoomContextClass), @@ -57,16 +57,16 @@ GType sp_zoom_context_get_type(void) }; 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; @@ -77,7 +77,7 @@ static void sp_zoom_context_class_init(SPZoomContextClass *klass) 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 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; -- 2.30.2