summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-04 19:06:11 +0000
committermental <mental@users.sourceforge.net>2007-03-04 19:06:11 +0000
commit99fe98445f78d07574fcf3a4a0243bff9097fdf5 (patch)
treec5d9561625928907ca56505e6fa672108f2ffeef /src
parentimplement new API via wrapper for now (diff)
downloadinkscape-99fe98445f78d07574fcf3a4a0243bff9097fdf5.tar.gz
inkscape-99fe98445f78d07574fcf3a4a0243bff9097fdf5.zip
switch from invokeBbox to getBounds (need to fix problems with empty
rect handling, though) (bzr r2536)
Diffstat (limited to 'src')
-rw-r--r--src/conn-avoid-ref.cpp4
-rw-r--r--src/dialogs/clonetiler.cpp18
-rw-r--r--src/dialogs/stroke-style.cpp97
-rw-r--r--src/dialogs/tiledialog.cpp14
-rw-r--r--src/dialogs/unclump.cpp4
-rw-r--r--src/gradient-chemistry.cpp42
-rw-r--r--src/main.cpp43
-rw-r--r--src/sp-conn-end-pair.cpp2
-rw-r--r--src/sp-conn-end.cpp8
-rw-r--r--src/sp-item.cpp19
-rw-r--r--src/sp-item.h3
-rw-r--r--src/sp-shape.cpp4
-rw-r--r--src/splivarot.cpp27
-rw-r--r--src/widgets/icon.cpp21
14 files changed, 120 insertions, 186 deletions
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index fbceb4eb5..2a55d43b0 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -186,12 +186,12 @@ static Avoid::Polygn avoid_item_poly(SPItem const *item)
// some convex hull code, though not NR::ConvexHull as this
// only keeps the bounding box of the convex hull currently.
- // TODO: SPItem::invokeBbox gives the wrong result for some objects
+ // TODO: SPItem::getBounds gives the wrong result for some objects
// that have internal representations that are updated later
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(item->document);
- NR::Rect rHull = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect rHull = item->getBounds(sp_item_i2doc_affine(item));
double spacing = desktop->namedview->connector_spacing;
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp
index 5cd5df143..00fcac48e 100644
--- a/src/dialogs/clonetiler.cpp
+++ b/src/dialogs/clonetiler.cpp
@@ -786,11 +786,6 @@ clonetiler_trace_pick (NR::Rect box)
/* Set up pixblock */
guchar *px = g_new(guchar, 4 * width * height);
-
- if (px == NULL) {
- return 0; // buffer is too big or too small, cannot pick, so return 0
- }
-
memset(px, 0x00, 4 * width * height);
/* Render */
@@ -798,7 +793,7 @@ clonetiler_trace_pick (NR::Rect box)
nr_pixblock_setup_extern( &pb, NR_PIXBLOCK_MODE_R8G8B8A8N,
ibox.x0, ibox.y0, ibox.x1, ibox.y1,
px, 4 * width, FALSE, FALSE );
- nr_arena_item_invoke_render(NULL, trace_root, &ibox, &pb,
+ nr_arena_item_invoke_render( trace_root, &ibox, &pb,
NR_ARENA_ITEM_RENDER_NO_CACHE );
double R = 0, G = 0, B = 0, A = 0;
@@ -1085,7 +1080,7 @@ clonetiler_apply (GtkWidget *widget, void *)
w = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-w", 0);
h = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-h", 0);
} else {
- NR::Rect const r = SP_ITEM(obj)->invokeBbox(sp_item_i2doc_affine(SP_ITEM(obj)));
+ NR::Rect const r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)));
c = r.midpoint();
w = r.dimensions()[NR::X];
h = r.dimensions()[NR::Y];
@@ -1286,9 +1281,12 @@ clonetiler_apply (GtkWidget *widget, void *)
center_set = true;
}
- gchar *affinestr=sp_svg_transform_write(t);
- clone->setAttribute("transform", affinestr);
- g_free(affinestr);
+ gchar affinestr[80];
+ if (sp_svg_transform_write(affinestr, 79, t)) {
+ clone->setAttribute("transform", affinestr);
+ } else {
+ clone->setAttribute("transform", NULL);
+ }
if (opacity < 1.0) {
sp_repr_set_css_double(clone, "opacity", opacity);
diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp
index 58505df97..53c5c722f 100644
--- a/src/dialogs/stroke-style.cpp
+++ b/src/dialogs/stroke-style.cpp
@@ -83,7 +83,7 @@ static GtkWidget * marker_mid_menu = NULL;
static GtkWidget * marker_end_menu = NULL;
static SPObject *ink_extract_marker_name(gchar const *n);
-static void ink_markers_menu_update(SPWidget* spw);
+static void ink_markers_menu_update();
static Inkscape::UI::Cache::SvgPreview svg_preview_cache;
@@ -184,6 +184,14 @@ sp_stroke_style_widget_change_subselection ( Inkscape::Application *inkscape,
sp_stroke_style_paint_update (spw);
}
+static void
+sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
+ SPDesktop *desktop,
+ SPWidget *spw )
+{
+ ink_markers_menu_update();
+}
+
/**
* Gets the active stroke style property, then sets the appropriate color, alpha, gradient,
* pattern, etc. for the paint-selector.
@@ -559,16 +567,6 @@ sp_stroke_radio_button(GtkWidget *tb, char const *icon,
}
-static void
-sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
- SPDesktop *desktop,
- SPWidget *spw )
-{
-// TODO: Either of these will cause crashes sometimes
-// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL);
-// ink_markers_menu_update(spw);
-}
-
/**
* Creates a copy of the marker named mname, determines its visible and renderable
* area in menu_id's bounding box, and then renders it. This allows us to fill in
@@ -611,7 +609,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
// Find object's bbox in document
NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Rect const dbox = SP_ITEM(object)->invokeBbox(i2doc);
+ NR::Rect const dbox = SP_ITEM(object)->getBounds(i2doc);
if (dbox.isEmpty()) {
return NULL;
@@ -721,6 +719,15 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour
GSList *ml = ink_marker_list_get(source);
GSList *clean_ml = NULL;
+ // Do this here, outside of loop, to speed up preview generation:
+ /* Create new arena */
+ NRArena const *arena = NRArena::create();
+ /* Create ArenaItem and set transform */
+ unsigned const visionkey = sp_item_display_key_new(1);
+/*
+ NRArenaItem *root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (sandbox)), (NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+*/
+
for (; ml != NULL; ml = ml->next) {
if (!SP_IS_MARKER(ml->data))
continue;
@@ -779,7 +786,7 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
GtkWidget *i = gtk_menu_item_new();
gtk_widget_show(i);
- g_object_set_data(G_OBJECT(i), "marker", (void *) "none");
+// g_object_set_data(G_OBJECT(i), "marker", (void *) "none");
GtkWidget *hb = gtk_hbox_new(FALSE, MARKER_ITEM_MARGIN);
gtk_widget_show(hb);
@@ -818,7 +825,6 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
sp_document_ensure_up_to_date(doc);
sp_marker_list_from_doc ( m, doc, markers_doc, NULL, sandbox, menu_id );
}
-
}
@@ -906,14 +912,9 @@ sp_marker_select(GtkOptionMenu *mnu, GtkWidget *spw)
gchar *menu_id = (gchar *) g_object_get_data(G_OBJECT(mnu), "menu_id");
sp_repr_css_set_property(css, menu_id, marker);
- // Also update the marker dropdown menus, so the document's markers
- // show up at the top of the menu
-// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL);
- ink_markers_menu_update(SP_WIDGET(spw));
-
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ GSList const *items = selection->itemList();
+ for (; items != NULL; items = items->next) {
SPItem *item = (SPItem *) items->data;
if (!SP_IS_SHAPE(item) || SP_IS_RECT(item)) // can't set marker to rect, until it's converted to using <path>
continue;
@@ -930,66 +931,35 @@ sp_marker_select(GtkOptionMenu *mnu, GtkWidget *spw)
sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
_("Set markers"));
+ // Lastly, also update the marker dropdown menus, so the document's markers
+ // show up at the top of the menu
+ ink_markers_menu_update();
};
-static int
-ink_marker_menu_get_pos(GtkMenu* mnu, gchar* markname) {
-
- if (markname == NULL)
- markname = (gchar *) g_object_get_data(G_OBJECT(gtk_menu_get_active(mnu)), "marker");
-
- if (markname == NULL)
- return 0;
-
- GList *kids = GTK_MENU_SHELL(mnu)->children;
- int i = 0;
- for (; kids != NULL; kids = kids->next) {
- gchar *mark = (gchar *) g_object_get_data(G_OBJECT(kids->data), "marker");
- if ( mark && strcmp(mark, markname) == 0 ) {
- break;
- }
- i++;
- }
- return i;
-}
-
static void
-ink_markers_menu_update(SPWidget* spw) {
+ink_markers_menu_update() {
SPDesktop *desktop = inkscape_active_desktop();
SPDocument *document = sp_desktop_document(desktop);
SPDocument *sandbox = ink_markers_preview_doc ();
GtkWidget *m;
- int pos;
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_start_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_start_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-start", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_start_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_start_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_start_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_start_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_mid_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_mid_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-mid", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_mid_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_mid_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_mid_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_mid_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_end_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_end_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-end", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_end_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_end_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_end_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_end_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
}
/**
@@ -1764,7 +1734,17 @@ ink_marker_menu_set_current(SPObject *marker, GtkOptionMenu *mnu)
else
markname = g_strdup(SP_OBJECT_REPR(marker)->attribute("id"));
- int markpos = ink_marker_menu_get_pos(m, markname);
+ int markpos = 0;
+ GList *kids = GTK_MENU_SHELL(m)->children;
+ int i = 0;
+ for (; kids != NULL; kids = kids->next) {
+ gchar *mark = (gchar *) g_object_get_data(G_OBJECT(kids->data), "marker");
+ if ( mark && strcmp(mark, markname) == 0 ) {
+ markpos = i;
+ break;
+ }
+ i++;
+ }
gtk_option_menu_set_history(GTK_OPTION_MENU(mnu), markpos);
g_free (markname);
@@ -1867,6 +1847,7 @@ ink_extract_marker_name(gchar const *n)
gchar* b = g_strdup(p);
b[c] = '\0';
+
SPDesktop *desktop = inkscape_active_desktop();
SPDocument *doc = sp_desktop_document(desktop);
SPObject *marker = doc->getObjectById(b);
diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp
index 693426d2d..d56d083ba 100644
--- a/src/dialogs/tiledialog.cpp
+++ b/src/dialogs/tiledialog.cpp
@@ -49,10 +49,10 @@ sp_compare_x_position(SPItem *first, SPItem *second)
using NR::X;
using NR::Y;
- NR::Rect const a = first->invokeBbox(sp_item_i2doc_affine(first));
+ NR::Rect const a = first->getBounds(sp_item_i2doc_affine(first));
double const a_height = a.dimensions()[Y];
- NR::Rect const b = second->invokeBbox(sp_item_i2doc_affine(second));
+ NR::Rect const b = second->getBounds(sp_item_i2doc_affine(second));
double const b_height = b.dimensions()[Y];
bool a_in_b_vert = false;
@@ -84,8 +84,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- NR::Rect const a = first->invokeBbox(sp_item_i2doc_affine(first));
- NR::Rect const b = second->invokeBbox(sp_item_i2doc_affine(second));
+ NR::Rect const a = first->getBounds(sp_item_i2doc_affine(first));
+ NR::Rect const b = second->getBounds(sp_item_i2doc_affine(second));
if (a.min()[NR::Y] > b.min()[NR::Y]) {
return 1;
@@ -159,7 +159,7 @@ void TileDialog::Grid_Arrange ()
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
cx = b.midpoint()[NR::X];
@@ -196,7 +196,7 @@ void TileDialog::Grid_Arrange ()
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
if (width > col_widths[(cnt % NoOfCols)]) {
@@ -300,7 +300,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
row = cnt / NoOfCols;
diff --git a/src/dialogs/unclump.cpp b/src/dialogs/unclump.cpp
index 64c348be5..f067aef5f 100644
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
@@ -34,7 +34,7 @@ unclump_center (SPItem *item)
return i->second;
}
- NR::Rect const r = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const r = item->getBounds(sp_item_i2d_affine(item));
NR::Point const c = r.midpoint();
c_cache[SP_OBJECT_ID(item)] = c;
return c;
@@ -48,7 +48,7 @@ unclump_wh (SPItem *item)
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- NR::Rect const r = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const r = item->getBounds(sp_item_i2d_affine(item));
wh = r.dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
}
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index f55694fcf..1a161b201 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -258,7 +258,7 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
NR::Coord const width = bbox.dimensions()[NR::X];
NR::Coord const height = bbox.dimensions()[NR::Y];
@@ -280,9 +280,12 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
gr->gradientTransform = squeeze;
{
- gchar *c=sp_svg_transform_write(gr->gradientTransform);
- SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gr->gradientTransform)) {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", NULL);
+ }
}
} else {
sp_repr_set_svg_double(repr, "x1", (center - NR::Point(width/2, 0))[NR::X]);
@@ -316,7 +319,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
NR::Matrix bbox2user(bbox.dimensions()[NR::X], 0,
0, bbox.dimensions()[NR::Y],
bbox.min()[NR::X], bbox.min()[NR::Y]);
@@ -347,9 +350,12 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// apply skew to the gradient
gr->gradientTransform = skew;
{
- gchar *c=sp_svg_transform_write(gr->gradientTransform);
- SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gr->gradientTransform)) {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", NULL);
+ }
}
// Matrix to convert points to userspace coords; postmultiply by inverse of skew so
@@ -417,9 +423,12 @@ sp_gradient_transform_multiply(SPGradient *gradient, NR::Matrix postmul, bool se
}
gradient->gradientTransform_set = TRUE;
- gchar *c=sp_svg_transform_write(gradient->gradientTransform);
- SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gradient->gradientTransform)) {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", NULL);
+ }
}
SPGradient *
@@ -916,9 +925,12 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
gradient->gradientTransform = new_transform;
gradient->gradientTransform_set = TRUE;
if (write_repr) {
- gchar *s=sp_svg_transform_write(gradient->gradientTransform);
- SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", s);
- g_free(s);
+ gchar s[256];
+ if (sp_svg_transform_write(s, 256, gradient->gradientTransform)) {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", s);
+ } else {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", NULL);
+ }
} else {
SP_OBJECT (gradient)->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
@@ -1010,7 +1022,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
if (SP_GRADIENT(gradient)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
p *= NR::Matrix(bbox.dimensions()[NR::X], 0,
0, bbox.dimensions()[NR::Y],
bbox.min()[NR::X], bbox.min()[NR::Y]);
diff --git a/src/main.cpp b/src/main.cpp
index f7be7d940..c5d9256bf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -108,8 +108,6 @@ using Inkscape::Extension::Internal::PrintWin32;
#include "application/application.h"
-#include "main-cmdlineact.h"
-
enum {
SP_ARG_NONE,
SP_ARG_NOGUI,
@@ -146,9 +144,6 @@ enum {
SP_ARG_QUERY_ID,
SP_ARG_VERSION,
SP_ARG_VACUUM_DEFS,
- SP_ARG_VERB_LIST,
- SP_ARG_VERB,
- SP_ARG_SELECT,
SP_ARG_LAST
};
@@ -371,21 +366,6 @@ struct poptOption options[] = {
N_("Remove unused definitions from the defs section(s) of the document"),
NULL},
- {"verb-list", 0,
- POPT_ARG_NONE, NULL, SP_ARG_VERB_LIST,
- N_("List the IDs of all the verbs in Inkscape"),
- NULL},
-
- {"verb", 0,
- POPT_ARG_STRING, NULL, SP_ARG_VERB,
- N_("Verb to call when Inkscape opens."),
- N_("VERB-ID")},
-
- {"select", 0,
- POPT_ARG_STRING, NULL, SP_ARG_SELECT,
- N_("Object ID to select when Inkscape opens."),
- N_("OBJECT-ID")},
-
POPT_AUTOHELP POPT_TABLEEND
};
@@ -674,7 +654,6 @@ sp_main_gui(int argc, char const **argv)
}
}
- Glib::signal_idle().connect(sigc::ptr_fun(&Inkscape::CmdLineAction::idle));
main_instance.run();
#ifdef WIN32
@@ -757,7 +736,6 @@ sp_main_console(int argc, char const **argv)
do_query_dimension (doc, false, sp_query_x? NR::X : NR::Y, sp_query_id);
}
}
-
fl = g_slist_remove(fl, fl->data);
}
@@ -789,7 +767,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch
if (o) {
sp_document_ensure_up_to_date (doc);
SPItem *item = ((SPItem *) o);
- NR::Rect area = item->invokeBbox(sp_item_i2doc_affine(item)); // "true" SVG bbox for scripting
+ NR::Rect area = item->getBounds(sp_item_i2doc_affine(item)); // "true" SVG bbox for scripting
Inkscape::SVGOStringStream os;
if (extent) {
@@ -1392,25 +1370,6 @@ sp_process_args(poptContext ctx)
exit(0);
break;
}
- case SP_ARG_VERB_LIST: {
- // This really shouldn't go here, we should init the app.
- // But, since we're just exiting in this path, there is
- // no harm, and this is really a better place to put
- // everything else.
- Inkscape::Extension::init();
- Inkscape::Verb::list();
- exit(0);
- break;
- }
- case SP_ARG_VERB:
- case SP_ARG_SELECT: {
- gchar const *arg = poptGetOptArg(ctx);
- if (arg != NULL) {
- // printf("Adding in: %s\n", arg);
- new Inkscape::CmdLineAction((a == SP_ARG_VERB), arg);
- }
- break;
- }
default: {
break;
}
diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp
index 40f939e25..25466a4a4 100644
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
@@ -164,7 +164,7 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const {
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
- NR::Rect const bbox = h2attItem[h]->invokeBbox(sp_item_i2doc_affine(h2attItem[h]));
+ NR::Rect const bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
endPts[h] = bbox.midpoint();
}
else
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index 536addf4e..7c0d96506 100644
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
@@ -38,7 +38,7 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
SPPath *const path,
bool const updatePathRepr = true)
{
- // TODO: SPItem::invokeBbox gives the wrong result for some objects
+ // TODO: SPItem::getBounds gives the wrong result for some objects
// that have internal representations that are updated later
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(path->document);
@@ -65,8 +65,8 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
NR::Point h2endPt_icoordsys[2];
NR::Matrix h2i2anc[2];
NR::Rect h2bbox_icoordsys[2] = {
- h2attItem[0]->invokeBbox(NR::identity()),
- h2attItem[1]->invokeBbox(NR::identity())
+ h2attItem[0]->getBounds(NR::identity()),
+ h2attItem[1]->getBounds(NR::identity())
};
NR::Point last_seg_endPt[2] = {
sp_curve_second_point(path->curve),
@@ -107,7 +107,7 @@ 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());
+ h2bbox_icoordsys[ind] = h2attItem[ind]->getBounds(NR::identity());
h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index f94a5e404..c2ef93714 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -277,7 +277,7 @@ SPItem::setExplicitlyHidden(bool const val) {
*/
void
SPItem::setCenter(NR::Point object_centre) {
- NR::Rect bbox = invokeBbox(sp_item_i2d_affine(this));
+ NR::Rect bbox = getBounds(sp_item_i2d_affine(this));
if (!bbox.isEmpty()) {
transform_center_x = object_centre[NR::X] - bbox.midpoint()[NR::X];
if (fabs(transform_center_x) < 1e-5) // rounding error
@@ -299,7 +299,7 @@ bool SPItem::isCenterSet() {
}
NR::Point SPItem::getCenter() {
- NR::Rect bbox = invokeBbox(sp_item_i2d_affine(this));
+ NR::Rect bbox = getBounds(sp_item_i2d_affine(this));
if (!bbox.isEmpty()) {
return bbox.midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
} else {
@@ -711,16 +711,9 @@ sp_item_write(SPObject *const object, Inkscape::XML::Node *repr, guint flags)
return repr;
}
-NR::Rect SPItem::invokeBbox(NR::Matrix const &transform) const
-{
- NRRect r;
- sp_item_invoke_bbox_full(this, &r, transform, 0, TRUE);
- return NR::Rect(r);
-}
-
-NR::Maybe<NR::Rect> SPItem::getBBox(NR::Matrix const &transform,
- SPItem::BBoxType type,
- unsigned int dkey) const
+NR::Maybe<NR::Rect> SPItem::getBounds(NR::Matrix const &transform,
+ SPItem::BBoxType type,
+ unsigned int dkey) const
{
NRRect r;
sp_item_invoke_bbox_full(this, &r, transform, 0, TRUE);
@@ -819,7 +812,7 @@ NR::Rect sp_item_bbox_desktop(SPItem *item)
static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
{
- NR::Rect const bbox = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const bbox = item->getBounds(sp_item_i2d_affine(item));
/* Just a pair of opposite corners of the bounding box suffices given that we don't yet
support angled guide lines. */
diff --git a/src/sp-item.h b/src/sp-item.h
index 559694276..9aee4b30a 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -148,8 +148,7 @@ struct SPItem : public SPObject {
void raiseToTop();
void lowerToBottom();
- NR::Rect invokeBbox(NR::Matrix const &transform) const;
- NR::Maybe<NR::Rect> getBBox(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
+ NR::Maybe<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
sigc::connection _clip_ref_connection;
sigc::connection _mask_ref_connection;
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index a38a10b4d..7d472088c 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -238,7 +238,7 @@ sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
/* This is suboptimal, because changing parent style schedules recalculation */
/* But on the other hand - how can we know that parent does not tie style and transform */
- NR::Rect const paintbox = SP_ITEM(object)->invokeBbox(NR::identity());
+ NR::Rect const paintbox = SP_ITEM(object)->getBounds(NR::identity());
for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -753,7 +753,7 @@ sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flag
NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
nr_arena_shape_set_style(s, object->style);
nr_arena_shape_set_path(s, shape->curve, false);
- NR::Rect const paintbox = item->invokeBbox(NR::identity());
+ NR::Rect const paintbox = item->getBounds(NR::identity());
s->setPaintBox(paintbox);
if (sp_shape_has_markers (shape)) {
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index e5154c130..ecafd2f04 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -474,7 +474,11 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// premultiply by the inverse of parent's repr
SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
NR::Matrix local = sp_item_i2doc_affine(parent_item);
- gchar *transform = sp_svg_transform_write(local);
+ gchar affinestr[80];
+ gchar *transform = NULL;
+ if (!local.test_identity() && sp_svg_transform_write(affinestr, 79, local.inverse())) {
+ transform = affinestr;
+ }
// now that we have the result, add it on the canvas
if ( bop == bool_op_cut || bop == bool_op_slice ) {
@@ -571,8 +575,6 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
Inkscape::GC::release(repr);
}
- g_free(transform);
-
sp_document_done(sp_desktop_document(desktop), verb, description);
delete res;
@@ -1572,7 +1574,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop,
continue;
if (simplifyIndividualPaths) {
- NR::Rect itemBbox = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect itemBbox = item->getBounds(sp_item_i2d_affine(item));
simplifySize = L2(itemBbox.dimensions());
}
@@ -1721,17 +1723,6 @@ Path_for_item(SPItem *item, bool doTransformation, bool transformFull)
bpath=SP_CURVE_BPATH(curve);
}
- Path *dest = bpath_to_Path(bpath);
-
- if ( doTransformation ) {
- if ( bpath ) g_free(bpath);
- } else {
- sp_curve_unref(curve);
- }
- return dest;
-}
-
-Path *bpath_to_Path(NArtBpath const *bpath) {
Path *dest = new Path;
dest->SetBackData(false);
{
@@ -1785,6 +1776,12 @@ Path *bpath_to_Path(NArtBpath const *bpath) {
if (closed)
dest->Close();
}
+
+ if ( doTransformation ) {
+ if ( bpath ) g_free(bpath);
+ } else {
+ sp_curve_unref(curve);
+ }
return dest;
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 4506a3c6a..85666f76c 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -529,17 +529,12 @@ static void sp_icon_paint(SPIcon *icon, GdkRectangle const *area)
int const x1 = std::min(area->x + area->width, widget.allocation.x + padx + static_cast<int>(icon->psize) );
int const y1 = std::min(area->y + area->height, widget.allocation.y + pady + static_cast<int>(icon->psize) );
- int width = x1 - x0;
- int height = y1 - y0;
- // Limit drawing to when we actually have something. Avoids some crashes.
- if ( (width > 0) && (height > 0) ) {
- gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image,
- x0 - widget.allocation.x - padx,
- y0 - widget.allocation.y - pady,
- x0, y0,
- width, height,
- GDK_RGB_DITHER_NORMAL, x0, y0);
- }
+ gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image,
+ x0 - widget.allocation.x - padx,
+ y0 - widget.allocation.y - pady,
+ x0, y0,
+ x1 - x0, y1 - y0,
+ GDK_RGB_DITHER_NORMAL, x0, y0);
}
}
@@ -614,7 +609,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Rect dbox = SP_ITEM(object)->invokeBbox(i2doc);
+ NR::Rect dbox = SP_ITEM(object)->getBounds(i2doc);
if ( SP_OBJECT_PARENT(object) == NULL )
{
@@ -718,7 +713,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
px + 4 * psize * (ua.y0 - area.y0) +
4 * (ua.x0 - area.x0),
4 * psize, FALSE, FALSE );
- nr_arena_item_invoke_render(NULL, root, &ua, &B,
+ nr_arena_item_invoke_render( root, &ua, &B,
NR_ARENA_ITEM_RENDER_NO_CACHE );
nr_pixblock_release(&B);