summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2008-02-24 00:55:22 +0000
committerjoncruz <joncruz@users.sourceforge.net>2008-02-24 00:55:22 +0000
commit646ae07a0fcbbea4a0105c02102cdbbe3784ce1c (patch)
tree30de664be9cc9249204cee4b0b6fa64eebc6382f
parentM build.xml (diff)
downloadinkscape-646ae07a0fcbbea4a0105c02102cdbbe3784ce1c.tar.gz
inkscape-646ae07a0fcbbea4a0105c02102cdbbe3784ce1c.zip
Warning and whitespace cleanup
(bzr r4838)
-rw-r--r--src/dialogs/text-edit.cpp58
-rw-r--r--src/document.cpp18
-rw-r--r--src/extension/internal/odf.cpp54
-rw-r--r--src/helper/pixbuf-ops.cpp376
-rw-r--r--src/live_effects/parameter/bool.cpp4
-rw-r--r--src/live_effects/parameter/parameter.cpp2
-rw-r--r--src/live_effects/parameter/random.cpp10
-rw-r--r--src/sp-fecomponenttransfer-funcnode.cpp5
-rw-r--r--src/sp-fecomponenttransfer.cpp10
-rw-r--r--src/sp-item.cpp17
-rw-r--r--src/sp-namedview.cpp26
-rw-r--r--src/trace/siox.h12
-rw-r--r--src/trace/trace.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp34
-rw-r--r--src/ui/dialog/dialog.cpp26
-rw-r--r--src/ui/dialog/dock-behavior.cpp44
-rw-r--r--src/ui/dialog/document-properties.cpp39
-rw-r--r--src/ui/dialog/print.cpp12
-rw-r--r--src/widgets/sp-widget.cpp18
-rw-r--r--src/widgets/sp-xmlview-content.cpp160
20 files changed, 474 insertions, 459 deletions
diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp
index d96583f85..4ba31b413 100644
--- a/src/dialogs/text-edit.cpp
+++ b/src/dialogs/text-edit.cpp
@@ -526,34 +526,34 @@ sp_get_text_dialog_style ()
/* font */
font_instance *font = sp_font_selector_get_font (SP_FONT_SELECTOR (fontsel));
- if ( font ) {
- Glib::ustring fontName = font_factory::Default()->ConstructFontSpecification(font);
- sp_repr_css_set_property (css, "-inkscape-font-specification", fontName.c_str());
-
- gchar c[256];
-
- font->Family(c, 256);
- sp_repr_css_set_property (css, "font-family", c);
+ if ( font ) {
+ Glib::ustring fontName = font_factory::Default()->ConstructFontSpecification(font);
+ sp_repr_css_set_property (css, "-inkscape-font-specification", fontName.c_str());
- font->Attribute( "weight", c, 256);
- sp_repr_css_set_property (css, "font-weight", c);
+ gchar c[256];
- font->Attribute("style", c, 256);
- sp_repr_css_set_property (css, "font-style", c);
+ font->Family(c, 256);
+ sp_repr_css_set_property (css, "font-family", c);
- font->Attribute("stretch", c, 256);
- sp_repr_css_set_property (css, "font-stretch", c);
+ font->Attribute( "weight", c, 256);
+ sp_repr_css_set_property (css, "font-weight", c);
- font->Attribute("variant", c, 256);
- sp_repr_css_set_property (css, "font-variant", c);
+ font->Attribute("style", c, 256);
+ sp_repr_css_set_property (css, "font-style", c);
- Inkscape::CSSOStringStream os;
- os << sp_font_selector_get_size (SP_FONT_SELECTOR (fontsel)) << "px"; // must specify px, see inkscape bug 1221626 and 1610103
- sp_repr_css_set_property (css, "font-size", os.str().c_str());
+ font->Attribute("stretch", c, 256);
+ sp_repr_css_set_property (css, "font-stretch", c);
- font->Unref();
- font=NULL;
- }
+ font->Attribute("variant", c, 256);
+ sp_repr_css_set_property (css, "font-variant", c);
+
+ Inkscape::CSSOStringStream os;
+ os << sp_font_selector_get_size (SP_FONT_SELECTOR (fontsel)) << "px"; // must specify px, see inkscape bug 1221626 and 1610103
+ sp_repr_css_set_property (css, "font-size", os.str().c_str());
+
+ font->Unref();
+ font=NULL;
+ }
/* Layout */
GtkWidget *b = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), "text_anchor_start");
@@ -571,7 +571,7 @@ sp_get_text_dialog_style ()
sp_repr_css_set_property (css, "text-align", "center");
} else {
// Align Right
- b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg),
+ b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg),
"text_anchor_end");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (b))) {
sp_repr_css_set_property (css, "text-anchor", "end");
@@ -741,8 +741,8 @@ sp_text_edit_dialog_read_selection ( GtkWidget *dlg,
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
// query style from desktop into it. This returns a result flag and fills query with the style of subselection, if any, or selection
int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
- int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
- int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
+ int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
+ int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
@@ -759,17 +759,17 @@ sp_text_edit_dialog_read_selection ( GtkWidget *dlg,
}
// FIXME: process result_family/style == QUERY_STYLE_MULTIPLE_DIFFERENT by showing "Many" in the lists
-
+
// Get a font_instance using the font-specification attribute stored in SPStyle if available
font_instance *font = font_factory::Default()->FaceFromStyle(query);
-
+
if (font) {
// the font is oversized, so we need to pass the true size separately
sp_font_selector_set_font (SP_FONT_SELECTOR (fontsel), font, query->font_size.computed);
sp_font_preview_set_font (SP_FONT_PREVIEW (preview), font, SP_FONT_SELECTOR(fontsel));
- font->Unref();
- font=NULL;
+ font->Unref();
+ font=NULL;
}
GtkWidget *b;
diff --git a/src/document.cpp b/src/document.cpp
index fb160fd9e..cdebaabba 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -204,7 +204,7 @@ SPDocument::~SPDocument() {
}
-void SPDocument::add_persp3d (Persp3D * const persp)
+void SPDocument::add_persp3d (Persp3D * const /*persp*/)
{
SPDefs *defs = SP_ROOT(this->root)->defs;
for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) {
@@ -217,7 +217,7 @@ void SPDocument::add_persp3d (Persp3D * const persp)
persp3d_create_xml_element (this);
}
-void SPDocument::remove_persp3d (Persp3D * const persp)
+void SPDocument::remove_persp3d (Persp3D * const /*persp*/)
{
// TODO: Delete the repr, maybe perform a check if any boxes are still linked to the perspective.
// Anything else?
@@ -689,13 +689,13 @@ void SPDocument::bindObjectToId(gchar const *id, SPObject *object) {
void
SPDocument::addUndoObserver(Inkscape::UndoStackObserver& observer)
{
- this->priv->undoStackObservers.add(observer);
+ this->priv->undoStackObservers.add(observer);
}
void
SPDocument::removeUndoObserver(Inkscape::UndoStackObserver& observer)
{
- this->priv->undoStackObservers.remove(observer);
+ this->priv->undoStackObservers.remove(observer);
}
SPObject *SPDocument::getObjectById(gchar const *id) {
@@ -741,7 +741,7 @@ Glib::ustring SPDocument::getLanguage() {
if ( NULL == document_language || *document_language == 0 ) {
document_language = getenv ("LANG");
}
-
+
if ( NULL != document_language ) {
gchar *pos = strchr(document_language, '_');
if ( NULL != pos ) {
@@ -786,7 +786,7 @@ sp_document_setup_viewport (SPDocument *doc, SPItemCtx *ctx)
}
/**
- * Tries to update the document state based on the modified and
+ * Tries to update the document state based on the modified and
* "update required" flags, and return true if the document has
* been brought fully up to date.
*/
@@ -959,7 +959,7 @@ find_item_at_point(unsigned int dkey, SPGroup *group, NR::Point const p, gboolea
if (upto && SP_ITEM(o) == upto)
break;
- if (SP_IS_GROUP(o) && (SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER || into_groups)) {
+ if (SP_IS_GROUP(o) && (SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER || into_groups)) {
// if nothing found yet, recurse into the group
newseen = find_item_at_point(dkey, SP_GROUP(o), p, into_groups, take_insensitive, upto);
if (newseen) {
@@ -1051,8 +1051,8 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto
{
GSList *items = NULL;
- // When picking along the path, we don't want small objects close together
- // (such as hatching strokes) to obscure each other by their deltas,
+ // When picking along the path, we don't want small objects close together
+ // (such as hatching strokes) to obscure each other by their deltas,
// so we temporarily set delta to a small value
gdouble saved_delta = prefs_get_double_attribute ("options.cursortolerance", "value", 1.0);
prefs_set_double_attribute ("options.cursortolerance", "value", 0.25);
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 58d19be32..f94084e4f 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -186,8 +186,8 @@ public:
for (unsigned int i=0 ; i<rows ; i++)
{
for (unsigned int j=0 ; j<other.cols ; j++)
- {
- double sum = 0.0;
+ {
+ double sum = 0.0;
for (unsigned int k=0 ; k<cols ; k++)
{
//sum += a[i][k] * b[k][j];
@@ -205,7 +205,7 @@ public:
SVDMatrix result(cols, rows);
for (unsigned int i=0 ; i<rows ; i++)
for (unsigned int j=0 ; j<cols ; j++)
- result(j, i) = d[i*cols + j];
+ result(j, i) = d[i*cols + j];
return result;
}
@@ -991,8 +991,8 @@ static NR::Matrix getODFItemTransform(const SPItem *item)
* Get some fun facts from the transform
*/
static void analyzeTransform(NR::Matrix &tf,
- double &rotate, double &xskew, double &yskew,
- double &xscale, double &yscale)
+ double &rotate, double &/*xskew*/, double &/*yskew*/,
+ double &xscale, double &yscale)
{
SVDMatrix mat(2, 2);
mat(0, 0) = tf[0];
@@ -1028,7 +1028,7 @@ static void gatherText(Inkscape::XML::Node *node, Glib::ustring &buf)
if (s)
buf.append(s);
}
-
+
for (Inkscape::XML::Node *child = node->firstChild() ;
child != NULL; child = child->next())
{
@@ -1245,7 +1245,7 @@ bool OdfOutput::writeMeta(ZipFile &zf)
Glib::ustring value = iter->second;
if (name.size() > 0 && value.size()>0)
{
- outs.printf(" <%#s>%#s</%#s>\n",
+ outs.printf(" <%#s>%#s</%#s>\n",
name.c_str(), value.c_str(), name.c_str());
}
}
@@ -1495,19 +1495,19 @@ writePath(Writer &outs, NArtBpath const *bpath,
code = bp->code;
NR::Point const p1(bp->c(1) * tf);
- NR::Point const p2(bp->c(2) * tf);
- NR::Point const p3(bp->c(3) * tf);
- double x1 = (p1[NR::X] - xoff) * 1000.0;
+ NR::Point const p2(bp->c(2) * tf);
+ NR::Point const p3(bp->c(3) * tf);
+ double x1 = (p1[NR::X] - xoff) * 1000.0;
if (fabs(x1)<1.0) x1=0.0;
- double y1 = (p1[NR::Y] - yoff) * 1000.0;
+ double y1 = (p1[NR::Y] - yoff) * 1000.0;
if (fabs(y1)<1.0) y1=0.0;
- double x2 = (p2[NR::X] - xoff) * 1000.0;
+ double x2 = (p2[NR::X] - xoff) * 1000.0;
if (fabs(x2)<1.0) x2=0.0;
- double y2 = (p2[NR::Y] - yoff) * 1000.0;
+ double y2 = (p2[NR::Y] - yoff) * 1000.0;
if (fabs(y2)<1.0) y2=0.0;
- double x3 = (p3[NR::X] - xoff) * 1000.0;
+ double x3 = (p3[NR::X] - xoff) * 1000.0;
if (fabs(x3)<1.0) x3=0.0;
- double y3 = (p3[NR::Y] - yoff) * 1000.0;
+ double y3 = (p3[NR::Y] - yoff) * 1000.0;
if (fabs(y3)<1.0) y3=0.0;
destx = x3;
desty = y3;
@@ -1646,7 +1646,7 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item,
bool OdfOutput::processGradient(Writer &outs, SPItem *item,
- const Glib::ustring &id, NR::Matrix &tf)
+ const Glib::ustring &id, NR::Matrix &/*tf*/)
{
if (!item)
return false;
@@ -1841,7 +1841,7 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item,
outs.printf(" draw:textarea-horizontal-align=\"center\" ");
outs.printf("draw:textarea-vertical-align=\"middle\"/>\n");
outs.printf("</style:style>\n\n");
-
+
return true;
}
@@ -2045,17 +2045,17 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
couts.printf("draw:layer=\"layout\" svg:x=\"%.3fcm\" svg:y=\"%.3fcm\" ",
bbox_x, bbox_y);
- couts.printf("svg:width=\"%.3fcm\" svg:height=\"%.3fcm\" ",
- bbox_width, bbox_height);
- couts.printf("svg:viewBox=\"0.0 0.0 %.3f %.3f\"\n",
- bbox_width * 1000.0, bbox_height * 1000.0);
+ couts.printf("svg:width=\"%.3fcm\" svg:height=\"%.3fcm\" ",
+ bbox_width, bbox_height);
+ couts.printf("svg:viewBox=\"0.0 0.0 %.3f %.3f\"\n",
+ bbox_width * 1000.0, bbox_height * 1000.0);
- couts.printf(" svg:d=\"");
- int nrPoints = writePath(couts, SP_CURVE_BPATH(curve),
+ couts.printf(" svg:d=\"");
+ int nrPoints = writePath(couts, SP_CURVE_BPATH(curve),
tf, bbox_x, bbox_y);
- couts.printf("\"");
+ couts.printf("\"");
- couts.printf(">\n");
+ couts.printf(">\n");
couts.printf(" <!-- %d nodes -->\n", nrPoints);
couts.printf("</draw:path>\n\n");
@@ -2376,7 +2376,7 @@ OdfOutput::reset()
* Descends into the SVG tree, mapping things to ODF when appropriate
*/
void
-OdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *uri)
+OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gchar const *uri)
{
reset();
@@ -2437,7 +2437,7 @@ OdfOutput::init()
* Make sure that we are in the database
*/
bool
-OdfOutput::check (Inkscape::Extension::Extension *module)
+OdfOutput::check (Inkscape::Extension::Extension */*module*/)
{
/* We don't need a Key
if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_POV))
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp
index acfb6ed30..f44a514a1 100644
--- a/src/helper/pixbuf-ops.cpp
+++ b/src/helper/pixbuf-ops.cpp
@@ -1,188 +1,188 @@
-#define __SP_PIXBUF_OPS_C__
-
-/*
- * Helpers for SPItem -> gdk_pixbuf related stuff
- *
- * Authors:
- * John Cliff <simarilius@yahoo.com>
- *
- * Copyright (C) 2008 John Cliff
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <interface.h>
-#include <libnr/nr-pixops.h>
-#include <glib.h>
-#include <glib/gmessages.h>
-#include <png.h>
-#include "png-write.h"
-#include <display/nr-arena-item.h>
-#include <display/nr-arena.h>
-#include <document.h>
-#include <sp-item.h>
-#include <sp-root.h>
-#include <sp-defs.h>
-
-#include "libnr/nr-matrix-translate-ops.h"
-#include "libnr/nr-scale-ops.h"
-#include "libnr/nr-scale-translate-ops.h"
-#include "libnr/nr-translate-matrix-ops.h"
-#include "libnr/nr-translate-scale-ops.h"
-
-#include "pixbuf-ops.h"
-
-/**
- * Hide all items that are not listed in list, recursively, skipping groups and defs.
- */
-static void
-hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
-{
- if ( SP_IS_ITEM(o)
- && !SP_IS_DEFS(o)
- && !SP_IS_ROOT(o)
- && !SP_IS_GROUP(o)
- && !g_slist_find(list, o) )
- {
- sp_item_invoke_hide(SP_ITEM(o), dkey);
- }
-
- // recurse
- if (!g_slist_find(list, o)) {
- for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- hide_other_items_recursively(child, list, dkey);
- }
- }
-}
-
-
-// The following is a mutation of the flood fill code, the marker preview, and random other samplings.
-// The dpi settings dont do anything yet, but I want them to, and was wanting to keep reasonably close
-// to the call for the interface to the png writing.
-
-bool
-sp_export_jpg_file(SPDocument *doc, gchar const *filename,
- double x0, double y0, double x1, double y1,
- unsigned width, unsigned height, double xdpi, double ydpi,
- unsigned long bgcolor, double quality,GSList *items)
-
-{
-
-
- GdkPixbuf* pixbuf;
- pixbuf = sp_generate_internal_bitmap(doc, filename, x0, y0, x1, y1,
- width, height, xdpi, ydpi,
- bgcolor, items );
-
-
- gchar c[32];
- g_snprintf(c, 32, "%f", quality);
- gboolean saved = gdk_pixbuf_save (pixbuf, filename, "jpeg", NULL, "quality", c, NULL);
- g_free(c);
- if (saved) return true;
- else return false;
-}
-
-GdkPixbuf*
-sp_generate_internal_bitmap(SPDocument *doc, gchar const *filename,
- double x0, double y0, double x1, double y1,
- unsigned width, unsigned height, double xdpi, double ydpi,
- unsigned long bgcolor,
- GSList *items_only)
-
-{
-
-
- /* Create new arena */
- NRArena *arena = NRArena::create();
- unsigned dkey = sp_item_display_key_new(1);
-
- sp_document_ensure_up_to_date (doc);
-
- NR::Rect screen=NR::Rect(NR::Point(x0,y0), NR::Point(x1, y1));
-
- double zoom_scale = 1.0;
- double padding = 1.0;
-
- width = (int)ceil(screen.extent(NR::X) * zoom_scale * padding);
- height = (int)ceil(screen.extent(NR::Y) * zoom_scale * padding);
-
- NR::Point origin(screen.min()[NR::X],
- sp_document_height(doc) - screen.extent(NR::Y) - screen.min()[NR::Y]);
-
- origin[NR::X] = origin[NR::X] + (screen.extent(NR::X) * ((1 - padding) / 2));
- origin[NR::Y] = origin[NR::Y] + (screen.extent(NR::Y) * ((1 - padding) / 2));
-
- NR::scale scale(zoom_scale, zoom_scale);
- NR::Matrix affine = scale * NR::translate(-origin * scale);
-
- /* Create ArenaItems and set transform */
- NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
-
- NRGC gc(NULL);
- nr_matrix_set_identity(&gc.transform);
-
- // We show all and then hide all items we don't want, instead of showing only requested items,
- // because that would not work if the shown item references something in defs
- if (items_only) {
- hide_other_items_recursively(sp_document_root(doc), items_only, dkey);
- }
-
- NRRectL final_bbox;
- final_bbox.x0 = 0;
- final_bbox.y0 = 0;//row;
- final_bbox.x1 = width;
- final_bbox.y1 = height;//row + num_rows;
-
- nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
-
- guchar *px = g_new(guchar, 4 * width * height);
-
- NRPixBlock B;
- nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N,
- final_bbox.x0, final_bbox.y0, final_bbox.x1, final_bbox.y1,
- px, 4 * width, FALSE, FALSE );
-
- unsigned char dtc[4];
- dtc[0] = NR_RGBA32_R(bgcolor);
- dtc[1] = NR_RGBA32_G(bgcolor);
- dtc[2] = NR_RGBA32_B(bgcolor);
- dtc[3] = NR_RGBA32_A(bgcolor);
-
- for (unsigned int fy = 0; fy < height; fy++) {
- guchar *p = NR_PIXBLOCK_PX(&B) + fy * B.rs;
- for (unsigned int fx = 0; fx < width; fx++) {
- for (int i = 0; i < 4; i++) {
- *p++ = dtc[i];
- }
- }
- }
-
- nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE );
-
- GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(px, GDK_COLORSPACE_RGB,
- TRUE,
- 8, width, height, width * 4,
- (GdkPixbufDestroyNotify)g_free,
- NULL);
-
-// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
-
- return pixbuf;
-}
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+#define __SP_PIXBUF_OPS_C__
+
+/*
+ * Helpers for SPItem -> gdk_pixbuf related stuff
+ *
+ * Authors:
+ * John Cliff <simarilius@yahoo.com>
+ *
+ * Copyright (C) 2008 John Cliff
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <interface.h>
+#include <libnr/nr-pixops.h>
+#include <glib.h>
+#include <glib/gmessages.h>
+#include <png.h>
+#include "png-write.h"
+#include <display/nr-arena-item.h>
+#include <display/nr-arena.h>
+#include <document.h>
+#include <sp-item.h>
+#include <sp-root.h>
+#include <sp-defs.h>
+
+#include "libnr/nr-matrix-translate-ops.h"
+#include "libnr/nr-scale-ops.h"
+#include "libnr/nr-scale-translate-ops.h"
+#include "libnr/nr-translate-matrix-ops.h"
+#include "libnr/nr-translate-scale-ops.h"
+
+#include "pixbuf-ops.h"
+
+/**
+ * Hide all items that are not listed in list, recursively, skipping groups and defs.
+ */
+static void
+hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
+{
+ if ( SP_IS_ITEM(o)
+ && !SP_IS_DEFS(o)
+ && !SP_IS_ROOT(o)
+ && !SP_IS_GROUP(o)
+ && !g_slist_find(list, o) )
+ {
+ sp_item_invoke_hide(SP_ITEM(o), dkey);
+ }
+
+ // recurse
+ if (!g_slist_find(list, o)) {
+ for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+ hide_other_items_recursively(child, list, dkey);
+ }
+ }
+}
+
+
+// The following is a mutation of the flood fill code, the marker preview, and random other samplings.
+// The dpi settings dont do anything yet, but I want them to, and was wanting to keep reasonably close
+// to the call for the interface to the png writing.
+
+bool
+sp_export_jpg_file(SPDocument *doc, gchar const *filename,
+ double x0, double y0, double x1, double y1,
+ unsigned width, unsigned height, double xdpi, double ydpi,
+ unsigned long bgcolor, double quality,GSList *items)
+
+{
+
+
+ GdkPixbuf* pixbuf;
+ pixbuf = sp_generate_internal_bitmap(doc, filename, x0, y0, x1, y1,
+ width, height, xdpi, ydpi,
+ bgcolor, items );
+
+
+ gchar c[32];
+ g_snprintf(c, 32, "%f", quality);
+ gboolean saved = gdk_pixbuf_save (pixbuf, filename, "jpeg", NULL, "quality", c, NULL);
+ g_free(c);
+ if (saved) return true;
+ else return false;
+}
+
+GdkPixbuf*
+sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
+ double x0, double y0, double x1, double y1,
+ unsigned width, unsigned height, double /*xdpi*/, double /*ydpi*/,
+ unsigned long bgcolor,
+ GSList *items_only)
+
+{
+
+
+ /* Create new arena */
+ NRArena *arena = NRArena::create();
+ unsigned dkey = sp_item_display_key_new(1);
+
+ sp_document_ensure_up_to_date (doc);
+
+ NR::Rect screen=NR::Rect(NR::Point(x0,y0), NR::Point(x1, y1));
+
+ double zoom_scale = 1.0;
+ double padding = 1.0;
+
+ width = (int)ceil(screen.extent(NR::X) * zoom_scale * padding);
+ height = (int)ceil(screen.extent(NR::Y) * zoom_scale * padding);
+
+ NR::Point origin(screen.min()[NR::X],
+ sp_document_height(doc) - screen.extent(NR::Y) - screen.min()[NR::Y]);
+
+ origin[NR::X] = origin[NR::X] + (screen.extent(NR::X) * ((1 - padding) / 2));
+ origin[NR::Y] = origin[NR::Y] + (screen.extent(NR::Y) * ((1 - padding) / 2));
+
+ NR::scale scale(zoom_scale, zoom_scale);
+ NR::Matrix affine = scale * NR::translate(-origin * scale);
+
+ /* Create ArenaItems and set transform */
+ NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
+
+ NRGC gc(NULL);
+ nr_matrix_set_identity(&gc.transform);
+
+ // We show all and then hide all items we don't want, instead of showing only requested items,
+ // because that would not work if the shown item references something in defs
+ if (items_only) {
+ hide_other_items_recursively(sp_document_root(doc), items_only, dkey);
+ }
+
+ NRRectL final_bbox;
+ final_bbox.x0 = 0;
+ final_bbox.y0 = 0;//row;
+ final_bbox.x1 = width;
+ final_bbox.y1 = height;//row + num_rows;
+
+ nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
+
+ guchar *px = g_new(guchar, 4 * width * height);
+
+ NRPixBlock B;
+ nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N,
+ final_bbox.x0, final_bbox.y0, final_bbox.x1, final_bbox.y1,
+ px, 4 * width, FALSE, FALSE );
+
+ unsigned char dtc[4];
+ dtc[0] = NR_RGBA32_R(bgcolor);
+ dtc[1] = NR_RGBA32_G(bgcolor);
+ dtc[2] = NR_RGBA32_B(bgcolor);
+ dtc[3] = NR_RGBA32_A(bgcolor);
+
+ for (unsigned int fy = 0; fy < height; fy++) {
+ guchar *p = NR_PIXBLOCK_PX(&B) + fy * B.rs;
+ for (unsigned int fx = 0; fx < width; fx++) {
+ for (int i = 0; i < 4; i++) {
+ *p++ = dtc[i];
+ }
+ }
+ }
+
+ nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE );
+
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(px, GDK_COLORSPACE_RGB,
+ TRUE,
+ 8, width, height, width * 4,
+ (GdkPixbufDestroyNotify)g_free,
+ NULL);
+
+// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
+
+ return pixbuf;
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index f0eb84e5f..336f42425 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -55,9 +55,9 @@ BoolParam::param_writeSVGValue() const
}
Gtk::Widget *
-BoolParam::param_newWidget(Gtk::Tooltips * tooltips)
+BoolParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
{
- Inkscape::UI::Widget::RegisteredCheckButton * checkwdg = Gtk::manage(
+ Inkscape::UI::Widget::RegisteredCheckButton * checkwdg = Gtk::manage(
new Inkscape::UI::Widget::RegisteredCheckButton( param_label,
param_tooltip,
param_key,
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index a0ce04487..f800017b8 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -124,7 +124,7 @@ ScalarParam::param_make_integer(bool yes)
}
Gtk::Widget *
-ScalarParam::param_newWidget(Gtk::Tooltips * tooltips)
+ScalarParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
{
Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar(
param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) );
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 26f1868a9..d5efc7ce3 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -75,13 +75,13 @@ RandomParam::param_writeSVGValue() const
}
void
-RandomParam::param_set_default()
+RandomParam::param_set_default()
{
param_set_value(defvalue, defseed);
}
void
-RandomParam::param_set_value(gdouble val, long newseed)
+RandomParam::param_set_value(gdouble val, long newseed)
{
value = val;
if (integer)
@@ -96,7 +96,7 @@ RandomParam::param_set_value(gdouble val, long newseed)
}
void
-RandomParam::param_set_range(gdouble min, gdouble max)
+RandomParam::param_set_range(gdouble min, gdouble max)
{
this->min = min;
this->max = max;
@@ -116,9 +116,9 @@ RandomParam::resetRandomizer()
Gtk::Widget *
-RandomParam::param_newWidget(Gtk::Tooltips * tooltips)
+RandomParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
{
- Inkscape::UI::Widget::RegisteredRandom* regrandom = Gtk::manage(
+ Inkscape::UI::Widget::RegisteredRandom* regrandom = Gtk::manage(
new Inkscape::UI::Widget::RegisteredRandom( param_label,
param_tooltip,
param_key,
diff --git a/src/sp-fecomponenttransfer-funcnode.cpp b/src/sp-fecomponenttransfer-funcnode.cpp
index 84f71970c..8b506a45e 100644
--- a/src/sp-fecomponenttransfer-funcnode.cpp
+++ b/src/sp-fecomponenttransfer-funcnode.cpp
@@ -8,7 +8,7 @@
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
- *
+ *
* Copyright (C) 2006, 2007, 2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -175,7 +175,7 @@ sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
sp_object_read_attr(object, "amplitude");
sp_object_read_attr(object, "exponent");
sp_object_read_attr(object, "offset");
-
+
//is this necessary?
sp_document_add_resource(document, "fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
@@ -317,6 +317,7 @@ sp_fefuncnode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME
}
+ (void)fefuncnode;
/*
TODO: I'm not sure what to do here...
diff --git a/src/sp-fecomponenttransfer.cpp b/src/sp-fecomponenttransfer.cpp
index 0b0054639..d8ee639e4 100644
--- a/src/sp-fecomponenttransfer.cpp
+++ b/src/sp-fecomponenttransfer.cpp
@@ -82,7 +82,7 @@ sp_feComponentTransfer_class_init(SPFeComponentTransferClass *klass)
}
static void
-sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer)
+sp_feComponentTransfer_init(SPFeComponentTransfer */*feComponentTransfer*/)
{}
/**
@@ -140,18 +140,18 @@ sp_feComponentTransfer_child_added(SPObject *object, Inkscape::XML::Node *child,
sp_feComponentTransfer_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-
+
/**
* Callback for remove_child event.
*/
static void
sp_feComponentTransfer_remove_child(SPObject *object, Inkscape::XML::Node *child)
-{
+{
SPFeComponentTransfer *f = SP_FECOMPONENTTRANSFER(object);
if (((SPObjectClass *) feComponentTransfer_parent_class)->remove_child)
- (* ((SPObjectClass *) feComponentTransfer_parent_class)->remove_child)(object, child);
+ (* ((SPObjectClass *) feComponentTransfer_parent_class)->remove_child)(object, child);
sp_feComponentTransfer_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -177,7 +177,7 @@ sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *valu
(void)feComponentTransfer;
switch(key) {
- /*DEAL WITH SETTING ATTRIBUTES HERE*/
+ /*DEAL WITH SETTING ATTRIBUTES HERE*/
default:
if (((SPObjectClass *) feComponentTransfer_parent_class)->set)
((SPObjectClass *) feComponentTransfer_parent_class)->set(object, key, value);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 6b61e3246..65d8b997c 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -411,8 +411,8 @@ sp_item_release(SPObject *object)
item->_clip_ref_connection.disconnect();
item->_mask_ref_connection.disconnect();
- // Note: do this here before the clip_ref is deleted, since calling
- // sp_document_ensure_up_to_date for triggered routing may reference
+ // Note: do this here before the clip_ref is deleted, since calling
+ // sp_document_ensure_up_to_date for triggered routing may reference
// the deleted clip_ref.
if (item->avoidRef) {
delete item->avoidRef;
@@ -744,27 +744,27 @@ sp_item_invoke_bbox_full(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matr
sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
nr_rect_d_intersect (&temp_bbox, &temp_bbox, &b);
}
-
+
if (temp_bbox.x0 > temp_bbox.x1 || temp_bbox.y0 > temp_bbox.y1) {
// We'll assume here that when x0 > x1 or y0 > y1, the bbox is "nothing"
// However it has never been explicitely defined this way for NRRects
// (as opposed to NR::Maybe<NR::Rect>)
*bbox = NR::Nothing();
return;
- }
-
+ }
+
if (temp_bbox.x0 == temp_bbox.y0 == NR_HUGE && temp_bbox.x1 == temp_bbox.y1 == -NR_HUGE) {
// The bbox hasn't been touched by the SPItemClass' bbox method
// or it has explicitely been set to be like this (e.g. in sp_shape_bbox)
*bbox = NR::Nothing();
return;
}
-
+
// Do not use temp_bbox.upgrade() here, because it uses a test that returns NR::Nothing
// for any rectangle with zero area. The geometrical bbox of for example a vertical line
- // would therefore be translated into NR::Nothing (see bug https://bugs.launchpad.net/inkscape/+bug/168684)
+ // would therefore be translated into NR::Nothing (see bug https://bugs.launchpad.net/inkscape/+bug/168684)
NR::Maybe<NR::Rect> temp_bbox_new = NR::Rect(NR::Point(temp_bbox.x0, temp_bbox.y0), NR::Point(temp_bbox.x1, temp_bbox.y1));
-
+
*bbox = NR::union_bounds(*bbox, temp_bbox_new);
}
@@ -1599,6 +1599,7 @@ void
sp_item_convert_to_guides(SPItem *item) {
SPDesktop *dt = inkscape_active_desktop();
SPNamedView *nv = sp_desktop_namedview(dt);
+ (void)nv;
gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box");
SPItem::BBoxType bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::RENDERING_BBOX;
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index cc7adeaa8..268150a16 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -70,15 +70,15 @@ sp_namedview_get_type()
if (!namedview_type) {
GTypeInfo namedview_info = {
sizeof(SPNamedViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
+ NULL, /* base_init */
+ NULL, /* base_finalize */
(GClassInitFunc) sp_namedview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
sizeof(SPNamedView),
- 16, /* n_preallocs */
+ 16, /* n_preallocs */
(GInstanceInitFunc) sp_namedview_init,
- NULL, /* value_table */
+ NULL, /* value_table */
};
namedview_type = g_type_register_static(SP_TYPE_OBJECTGROUP, "SPNamedView", &namedview_info, (GTypeFlags)0);
}
@@ -122,7 +122,7 @@ static void sp_namedview_init(SPNamedView *nv)
new (&nv->snap_manager) SnapManager(nv);
}
-static void sp_namedview_generate_old_grid(SPNamedView * nv, SPDocument *document, Inkscape::XML::Node *repr) {
+static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *document, Inkscape::XML::Node *repr) {
bool old_grid_settings_present = false;
// set old settings
@@ -246,7 +246,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
sp_object_read_attr(object, "inkscape:window-x");
sp_object_read_attr(object, "inkscape:window-y");
sp_object_read_attr(object, "inkscape:snap-global");
- sp_object_read_attr(object, "inkscape:snap-bbox");
+ sp_object_read_attr(object, "inkscape:snap-bbox");
sp_object_read_attr(object, "inkscape:snap-nodes");
sp_object_read_attr(object, "inkscape:snap-guide");
sp_object_read_attr(object, "inkscape:snap-center");
@@ -255,7 +255,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
sp_object_read_attr(object, "inkscape:object-paths");
sp_object_read_attr(object, "inkscape:object-nodes");
sp_object_read_attr(object, "inkscape:bbox-paths");
- sp_object_read_attr(object, "inkscape:bbox-nodes");
+ sp_object_read_attr(object, "inkscape:bbox-nodes");
sp_object_read_attr(object, "inkscape:current-layer");
sp_object_read_attr(object, "inkscape:connector-spacing");
@@ -398,12 +398,12 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_BORDEROPACITY:
+ case SP_ATTR_BORDEROPACITY:
nv->bordercolor = (nv->bordercolor & 0xffffff00) | (DEFAULTBORDERCOLOR & 0xff);
sp_nv_read_opacity(value, &nv->bordercolor);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_PAGECOLOR:
+ case SP_ATTR_PAGECOLOR:
nv->pagecolor = (nv->pagecolor & 0xff) | (DEFAULTPAGECOLOR & 0xffffff00);
if (value) {
nv->pagecolor = (nv->pagecolor & 0xff) | sp_svg_read_color(value, nv->pagecolor);
@@ -456,7 +456,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_SNAP_BBOX:
- nv->snap_manager.setSnapModeBBox(value ? sp_str_to_bool(value) : FALSE);
+ nv->snap_manager.setSnapModeBBox(value ? sp_str_to_bool(value) : FALSE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_SNAP_NODES:
@@ -492,7 +492,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_BBOX_NODES:
- nv->snap_manager.object.setSnapToBBoxNode(value ? sp_str_to_bool(value) : FALSE);
+ nv->snap_manager.object.setSnapToBBoxNode(value ? sp_str_to_bool(value) : FALSE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_CURRENT_LAYER:
diff --git a/src/trace/siox.h b/src/trace/siox.h
index 5d6059d3c..42fd30421 100644
--- a/src/trace/siox.h
+++ b/src/trace/siox.h
@@ -267,8 +267,8 @@ public:
* If the coordinates are out of range, do nothing.
*/
virtual void setPixel(unsigned int x, unsigned int y,
- unsigned int a,
- unsigned int r,
+ unsigned int a,
+ unsigned int r,
unsigned int g,
unsigned int b);
@@ -368,7 +368,7 @@ private:
* Confidence matrix data
*/
float *cmdata;
-
+
private:
/**
@@ -411,7 +411,7 @@ public:
* Informs the observer how much has been completed.
* Return false if the processing should be aborted.
*/
- virtual bool progress(float percentCompleted)
+ virtual bool progress(float /*percentCompleted*/)
{
return true;
}
@@ -420,7 +420,7 @@ public:
* Send an error string to the Observer. Processing will
* be halted.
*/
- virtual void error(const std::string &msg)
+ virtual void error(const std::string &/*msg*/)
{
}
@@ -453,7 +453,7 @@ public:
*/
static const float FOREGROUND_CONFIDENCE; //=0.8f;
- /**
+ /**
* Confidence for foreground or background type being equally likely.
*/
static const float UNKNOWN_REGION_CONFIDENCE; //=0.5f;
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index 925e4e195..5833db4fd 100644
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
@@ -180,7 +180,7 @@ public:
* Informs the observer how much has been completed.
* Return false if the processing should be aborted.
*/
- virtual bool progress(float percentCompleted)
+ virtual bool progress(float /*percentCompleted*/)
{
//Tracer *tracer = (Tracer *)context;
//## Allow the GUI to update
@@ -194,7 +194,7 @@ public:
* Send an error string to the Observer. Processing will
* be halted.
*/
- virtual void error(const std::string &msg)
+ virtual void error(const std::string &/*msg*/)
{
//Tracer *tracer = (Tracer *)context;
}
@@ -303,7 +303,7 @@ Tracer::sioxProcessImage(SPImage *img,
{
//g_message("hit!\n");
//dumpMap->setPixelLong(dumpMap, col, row, 0L);
- simage.setConfidence(col, row,
+ simage.setConfidence(col, row,
Siox::UNKNOWN_REGION_CONFIDENCE);
}
else
@@ -465,7 +465,7 @@ void Tracer::traceThread()
msgStack->flash(Inkscape::NORMAL_MESSAGE, _("Trace: Starting trace..."));
desktop->updateCanvasNow();
-
+
std::vector<TracingEngineResult> results =
engine->trace(pixbuf);
//printf("nrPaths:%d\n", results.size());
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 4846158a7..2767a32d1 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -99,7 +99,7 @@ class ActionAlign : public Action {
public :
struct Coeffs {
double mx0, mx1, my0, my1;
- double sx0, sx1, sy0, sy1;
+ double sx0, sx1, sy0, sy1;
};
ActionAlign(const Glib::ustring &id,
const Glib::ustring &tiptext,
@@ -392,7 +392,7 @@ private :
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
if (changed) {
- sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Distribute"));
}
}
@@ -427,8 +427,8 @@ private :
{
if (!_dialog.getDesktop()) return;
- SPEventContext *event_context = sp_desktop_event_context(_dialog.getDesktop());
- if (!SP_IS_NODE_CONTEXT (event_context)) return ;
+ SPEventContext *event_context = sp_desktop_event_context(_dialog.getDesktop());
+ if (!SP_IS_NODE_CONTEXT (event_context)) return ;
if (_distribute)
SP_NODE_CONTEXT (event_context)->shape_editor->distribute(_orientation);
@@ -455,7 +455,7 @@ public:
dialog.removeOverlap_table(), dialog.tooltips(), dialog)
{
dialog.removeOverlap_table().set_col_spacings(3);
-
+
removeOverlapXGap.set_digits(1);
removeOverlapXGap.set_size_request(60, -1);
removeOverlapXGap.set_increments(1.0, 5.0);
@@ -501,7 +501,7 @@ private :
// restore compensation setting
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Remove overlaps"));
}
};
@@ -531,7 +531,7 @@ private :
// restore compensation setting
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Arrange connector network"));
}
};
@@ -561,7 +561,7 @@ private :
// restore compensation setting
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
- sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Unclump"));
}
};
@@ -617,7 +617,7 @@ private :
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
NR::Maybe<NR::Rect> item_box = sp_item_bbox_desktop (*it);
if (item_box) {
- // find new center, staying within bbox
+ // find new center, staying within bbox
double x = _dialog.randomize_bbox->min()[NR::X] + item_box->extent(NR::X)/2 +
g_random_double_range (0, _dialog.randomize_bbox->extent(NR::X) - item_box->extent(NR::X));
double y = _dialog.randomize_bbox->min()[NR::Y] + item_box->extent(NR::Y)/2 +
@@ -631,7 +631,7 @@ private :
// restore compensation setting
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Randomize positions"));
}
};
@@ -728,7 +728,7 @@ private :
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Distribute text baselines"));
}
@@ -748,7 +748,7 @@ private :
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Align text baselines"));
}
}
@@ -757,14 +757,14 @@ private :
-void on_tool_changed(Inkscape::Application *inkscape, SPEventContext *context, AlignAndDistribute *daad)
+void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*context*/, AlignAndDistribute *daad)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop && sp_desktop_event_context(desktop))
daad->setMode(tools_active(desktop) == TOOLS_NODES);
}
-void on_selection_changed(Inkscape::Application *inkscape, Inkscape::Selection *selection, AlignAndDistribute *daad)
+void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad)
{
daad->randomize_bbox = NR::Nothing();
}
@@ -774,7 +774,7 @@ void on_selection_changed(Inkscape::Application *inkscape, Inkscape::Selection *
-AlignAndDistribute::AlignAndDistribute()
+AlignAndDistribute::AlignAndDistribute()
: UI::Widget::Panel ("", "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
randomize_bbox(NR::Nothing()),
_alignFrame(_("Align")),
@@ -946,7 +946,7 @@ AlignAndDistribute::AlignAndDistribute()
on_tool_changed (NULL, NULL, this); // set current mode
}
-AlignAndDistribute::~AlignAndDistribute()
+AlignAndDistribute::~AlignAndDistribute()
{
sp_signal_disconnect_by_data (G_OBJECT (INKSCAPE), this);
@@ -1055,7 +1055,7 @@ void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::
{
_actionList.push_back(
new ActionBaseline(
- id, tiptext, row, col,
+ id, tiptext, row, col,
*this, table, orientation, distribute));
}
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 7d2242802..1361b4977 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -4,7 +4,7 @@
*
* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
- * buliabyak@gmail.com
+ * buliabyak@gmail.com
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Gustav Broberg <broberg@kth.se>
*
@@ -42,7 +42,7 @@ namespace UI {
namespace Dialog {
void
-sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr)
+sp_retransientize(Inkscape::Application */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onDesktopActivated (desktop);
@@ -57,14 +57,14 @@ sp_retransientize_again(gpointer dlgPtr)
}
void
-sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr)
+sp_dialog_shutdown(GtkObject */*object*/, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onShutdown();
}
-void hideCallback(GtkObject *object, gpointer dlgPtr)
+void hideCallback(GtkObject */*object*/, gpointer dlgPtr)
{
g_return_if_fail( dlgPtr != NULL );
@@ -72,7 +72,7 @@ void hideCallback(GtkObject *object, gpointer dlgPtr)
dlg->onHideF12();
}
-void unhideCallback(GtkObject *object, gpointer dlgPtr)
+void unhideCallback(GtkObject */*object*/, gpointer dlgPtr)
{
g_return_if_fail( dlgPtr != NULL );
@@ -95,7 +95,7 @@ void unhideCallback(GtkObject *object, gpointer dlgPtr)
*/
Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path, int verb_num,
- Glib::ustring const &apply_label)
+ Glib::ustring const &apply_label)
: _hiddenF12 (false),
_prefs_path (prefs_path),
_verb_num(verb_num),
@@ -109,7 +109,7 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
_title = title;
_behavior = behavior_factory(*this);
-
+
if (Inkscape::NSApplication::Application::getNewGui()) {
_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*this, &Dialog::onDesktopActivated));
_dialogs_hidden_connection = Inkscape::NSApplication::Editor::connectDialogsHidden (sigc::mem_fun (*this, &Dialog::onHideF12));
@@ -137,7 +137,7 @@ Dialog::~Dialog()
_dialogs_unhidden_connection.disconnect();
_shutdown_connection.disconnect();
}
-
+
save_geometry();
delete _behavior;
}
@@ -152,7 +152,7 @@ Dialog::onDesktopActivated(SPDesktop *desktop)
_behavior->onDesktopActivated(desktop);
}
-void
+void
Dialog::onShutdown()
{
save_geometry();
@@ -218,7 +218,7 @@ Dialog::read_geometry()
if (w != 0 && h != 0) {
resize(w, h);
}
-
+
// If there are stored values for where the dialog should be
// located, then restore the dialog to that position.
// also check if (x,y) is actually onscreen with the current screen dimensions
@@ -264,7 +264,7 @@ Dialog::_handleResponse(int response_id)
}
bool
-Dialog::_onDeleteEvent(GdkEventAny *event)
+Dialog::_onDeleteEvent(GdkEventAny */*event*/)
{
save_geometry();
_user_hidden = true;
@@ -342,12 +342,12 @@ Dialog::_close()
event.window = dlg->window;
event.send_event = TRUE;
- if (event.window)
+ if (event.window)
g_object_ref(G_OBJECT(event.window));
gtk_main_do_event ((GdkEvent*)&event);
- if (event.window)
+ if (event.window)
g_object_unref(G_OBJECT(event.window));
}
diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp
index 13ce20abe..4f6fe64bc 100644
--- a/src/ui/dialog/dock-behavior.cpp
+++ b/src/ui/dialog/dock-behavior.cpp
@@ -41,10 +41,10 @@ DockBehavior::DockBehavior(Dialog &dialog) :
Behavior(dialog),
_dock_item(*SP_ACTIVE_DESKTOP->getDock(),
Inkscape::Verb::get(dialog._verb_num)->get_id(), dialog._title.c_str(),
- (Inkscape::Verb::get(dialog._verb_num)->get_image() ?
+ (Inkscape::Verb::get(dialog._verb_num)->get_image() ?
Inkscape::Verb::get(dialog._verb_num)->get_image() : ""),
static_cast<Widget::DockItem::State>(
- prefs_get_int_attribute (_dialog._prefs_path, "state",
+ prefs_get_int_attribute (_dialog._prefs_path, "state",
UI::Widget::DockItem::DOCKED_STATE)))
{
// Connect signals
@@ -87,7 +87,7 @@ DockBehavior::get_vbox()
}
void
-DockBehavior::present()
+DockBehavior::present()
{
bool was_attached = _dock_item.isAttached();
@@ -106,31 +106,31 @@ DockBehavior::hide()
}
void
-DockBehavior::show()
-{
+DockBehavior::show()
+{
_dock_item.show();
}
-void
+void
DockBehavior::show_all_children()
{
get_vbox()->show_all_children();
}
-void
+void
DockBehavior::get_position(int &x, int &y)
-{
+{
_dock_item.get_position(x, y);
}
-void
+void
DockBehavior::get_size(int &width, int &height)
-{
+{
_dock_item.get_size(width, height);
}
void
-DockBehavior::resize(int width, int height)
+DockBehavior::resize(int width, int height)
{
_dock_item.resize(width, height);
}
@@ -153,9 +153,9 @@ DockBehavior::set_size_request(int width, int height)
_dock_item.set_size_request(width, height);
}
-void
+void
DockBehavior::size_request(Gtk::Requisition &requisition)
-{
+{
_dock_item.size_request(requisition);
}
@@ -168,6 +168,7 @@ DockBehavior::set_title(Glib::ustring title)
void
DockBehavior::set_sensitive(bool sensitive)
{
+ // TODO check this. Seems to be bad that we ignore the parameter
get_vbox()->set_sensitive();
}
@@ -181,9 +182,10 @@ DockBehavior::_onHide()
}
void
-DockBehavior::_onStateChanged(Widget::DockItem::State prev_state,
+DockBehavior::_onStateChanged(Widget::DockItem::State /*prev_state*/,
Widget::DockItem::State new_state)
{
+// TODO probably need to avoid window calls unless the state is different. Check.
prefs_set_int_attribute (_dialog._prefs_path, "state", new_state);
if (new_state == Widget::DockItem::FLOATING_STATE) {
@@ -219,11 +221,11 @@ DockBehavior::onDesktopActivated(SPDesktop *desktop)
#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
if (prefs_get_int_attribute ( "options.dialogsontopwin32", "value", 0))
transient_policy = 2;
- else
+ else
return;
-#endif
+#endif
- if (!transient_policy)
+ if (!transient_policy)
return;
Gtk::Window *floating_win = _dock_item.getWindow();
@@ -243,7 +245,7 @@ DockBehavior::onDesktopActivated(SPDesktop *desktop)
if (GtkWindow *dialog_win = floating_win->gobj()) {
_dialog.retransientize_suppress = true; // disallow other attempts to retranzientize this dialog
-
+
desktop->setWindowTransient (dialog_win);
/*
@@ -267,13 +269,13 @@ DockBehavior::onDesktopActivated(SPDesktop *desktop)
/* Signal wrappers */
-Glib::SignalProxy0<void>
+Glib::SignalProxy0<void>
DockBehavior::signal_show() { return _dock_item.signal_show(); }
-Glib::SignalProxy0<void>
+Glib::SignalProxy0<void>
DockBehavior::signal_hide() { return _dock_item.signal_hide(); }
-Glib::SignalProxy1<bool, GdkEventAny *>
+Glib::SignalProxy1<bool, GdkEventAny *>
DockBehavior::signal_delete_event() { return _dock_item.signal_delete_event(); }
Glib::SignalProxy0<void>
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index b4199c678..66b1ddf56 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -283,7 +283,7 @@ DocumentProperties::build_snap()
_("If set, objects only snap to a grid line when it's within the range specified below"),
"gridtolerance", _wr);
- //Options for snapping to guides
+ //Options for snapping to guides
_rsu_gusn.init (_("Snap dist_ance"), _("Snap only when close_r than:"),
_("Snapping distance, in screen pixels, for snapping to guides"),
_("If set, objects only snap to a guide when it's within the range specified below"),
@@ -300,24 +300,24 @@ DocumentProperties::build_snap()
slaves.push_back(&_rcbsnbbp);
slaves.push_back(&_rcbsnbbn);
_rcbsnbb.setSlaveWidgets(slaves);
-
+
slaves.clear();
slaves.push_back(&_rcbsnn);
slaves.push_back(&_rcbsnbb);
-
+
_rcbsg.setSlaveWidgets(slaves);
Gtk::Label *label_g = manage (new Gtk::Label);
label_g->set_markup (_("<b>Snapping</b>"));
Gtk::Label *label_w = manage (new Gtk::Label);
- label_w->set_markup (_("<b>What snaps</b>"));
+ label_w->set_markup (_("<b>What snaps</b>"));
Gtk::Label *label_o = manage (new Gtk::Label);
label_o->set_markup (_("<b>Snap to objects</b>"));
Gtk::Label *label_gr = manage (new Gtk::Label);
label_gr->set_markup (_("<b>Snap to grids</b>"));
Gtk::Label *label_gu = manage (new Gtk::Label);
label_gu->set_markup (_("<b>Snap to guides</b>"));
-
+
Gtk::Widget *const array[] =
{
label_g, 0,
@@ -326,19 +326,19 @@ DocumentProperties::build_snap()
label_w, 0,
0, &_rcbsnn,
0, &_rcbsnbb,
- 0, 0,
+ 0, 0,
label_o, 0,
0, &_rcbsnop,
0, &_rcbsnon,
0, &_rcbsnbbp,
0, &_rcbsnbbn,
0, _rsu_sno._vbox,
- 0, 0,
+ 0, 0,
label_gr, 0,
0, _rsu_sn._vbox,
- 0, 0,
- label_gu, 0,
- 0, _rsu_gusn._vbox
+ 0, 0,
+ label_gu, 0,
+ 0, _rsu_gusn._vbox
};
attach_all(_page_snap.table(), array, G_N_ELEMENTS(array));
@@ -422,6 +422,7 @@ DocumentProperties::build_gridspage()
SPDesktop *dt = getDesktop();
SPNamedView *nv = sp_desktop_namedview(dt);
+ (void)nv;
_grids_label_crea.set_markup(_("<b>Creation</b>"));
_grids_label_def.set_markup(_("<b>Defined grids</b>"));
@@ -488,7 +489,7 @@ DocumentProperties::update()
_rcbsng.setActive (nv->snap_manager.getSnapModeGuide());
_rcbic.setActive (nv->snap_manager.getIncludeItemCenter());
_rcbsigg.setActive (nv->snap_manager.getSnapIntersectionGG());
- _rcbsils.setActive (nv->snap_manager.getSnapIntersectionLS());
+ _rcbsils.setActive (nv->snap_manager.getSnapIntersectionLS());
_rcbsnop.setActive(nv->snap_manager.object.getSnapToItemPath());
_rcbsnon.setActive(nv->snap_manager.object.getSnapToItemNode());
_rcbsnbbp.setActive(nv->snap_manager.object.getSnapToBBoxPath());
@@ -498,8 +499,8 @@ DocumentProperties::update()
_rsu_sn.setValue (nv->gridtolerance);
_rsu_gusn.setValue (nv->guidetolerance);
-
- _rcbsg.setActive (nv->snap_manager.getSnapEnabledGlobally());
+
+ _rcbsg.setActive (nv->snap_manager.getSnapEnabledGlobally());
//-----------------------------------------------------------grids page
@@ -541,7 +542,7 @@ DocumentProperties::on_response (int id)
hide();
}
-void
+void
DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document)
{
Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop));
@@ -551,7 +552,7 @@ DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docu
update();
}
-void
+void
DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
{
Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop));
@@ -574,14 +575,14 @@ static void
on_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
{
if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
- dialog->update_gridspage();
+ dialog->update_gridspage();
}
static void
on_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
{
if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
- dialog->update_gridspage();
+ dialog->update_gridspage();
}
@@ -593,7 +594,7 @@ static void
on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer data)
{
if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
- dialog->update();
+ dialog->update();
}
@@ -652,7 +653,7 @@ DocumentProperties::onRemoveGrid()
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
- indent-tabs-mode:nilu
+ indent-tabs-mode:nil
fill-column:99
End:
*/
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 4528fe656..3deb4204a 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -29,9 +29,9 @@
static void
-draw_page (GtkPrintOperation *operation,
+draw_page (GtkPrintOperation */*operation*/,
GtkPrintContext *context,
- gint page_nr,
+ gint /*page_nr*/,
gpointer user_data)
{
struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data;
@@ -112,8 +112,8 @@ draw_page (GtkPrintOperation *operation,
}
static GObject*
-create_custom_widget (GtkPrintOperation *operation,
- gpointer user_data)
+create_custom_widget (GtkPrintOperation */*operation*/,
+ gpointer user_data)
{
//printf("%s\n",__FUNCTION__);
return G_OBJECT(user_data);
@@ -121,8 +121,8 @@ create_custom_widget (GtkPrintOperation *operation,
static void
begin_print (GtkPrintOperation *operation,
- GtkPrintContext *context,
- gpointer user_data)
+ GtkPrintContext */*context*/,
+ gpointer /*user_data*/)
{
//printf("%s\n",__FUNCTION__);
gtk_print_operation_set_n_pages (operation, 1);
diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp
index cf40b2c73..40f1514cd 100644
--- a/src/widgets/sp-widget.cpp
+++ b/src/widgets/sp-widget.cpp
@@ -124,7 +124,7 @@ sp_widget_destroy (GtkObject *object)
if (spw->inkscape) {
/* Disconnect signals */
- // the checks are necessary because when destroy is caused by the the program shutting down,
+ // the checks are necessary because when destroy is caused by the the program shutting down,
// the inkscape object may already be (partly?) invalid --bb
if (G_IS_OBJECT(spw->inkscape) && G_OBJECT_GET_CLASS(G_OBJECT(spw->inkscape)))
sp_signal_disconnect_by_data (spw->inkscape, spw);
@@ -241,22 +241,32 @@ sp_widget_construct_global (SPWidget *spw, Inkscape::Application *inkscape)
}
static void
-sp_widget_modify_selection (Inkscape::Application *inkscape, Inkscape::Selection *selection, guint flags, SPWidget *spw)
+sp_widget_modify_selection (Inkscape::Application */*inkscape*/, Inkscape::Selection *selection, guint flags, SPWidget *spw)
{
g_signal_emit (G_OBJECT (spw), signals[MODIFY_SELECTION], 0, selection, flags);
}
static void
-sp_widget_change_selection (Inkscape::Application *inkscape, Inkscape::Selection *selection, SPWidget *spw)
+sp_widget_change_selection (Inkscape::Application */*inkscape*/, Inkscape::Selection *selection, SPWidget *spw)
{
g_signal_emit (G_OBJECT (spw), signals[CHANGE_SELECTION], 0, selection);
}
static void
-sp_widget_set_selection (Inkscape::Application *inkscape, Inkscape::Selection *selection, SPWidget *spw)
+sp_widget_set_selection (Inkscape::Application */*inkscape*/, Inkscape::Selection *selection, SPWidget *spw)
{
/* Emit "set_selection" signal */
g_signal_emit (G_OBJECT (spw), signals[SET_SELECTION], 0, selection);
/* Inkscape will force "change_selection" anyways */
}
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp
index 6f0b0dff1..393c136c7 100644
--- a/src/widgets/sp-xmlview-content.cpp
+++ b/src/widgets/sp-xmlview-content.cpp
@@ -31,138 +31,138 @@ static void event_content_changed (Inkscape::XML::Node * repr, const gchar * old
static GtkTextViewClass * parent_class = NULL;
static Inkscape::XML::NodeEventVector repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- NULL, /* attr_changed */
- event_content_changed,
- NULL /* order_changed */
+ NULL, /* child_added */
+ NULL, /* child_removed */
+ NULL, /* attr_changed */
+ event_content_changed,
+ NULL /* order_changed */
};
GtkWidget *
sp_xmlview_content_new (Inkscape::XML::Node * repr)
{
- GtkTextBuffer *tb;
- SPXMLViewContent *text;
+ GtkTextBuffer *tb;
+ SPXMLViewContent *text;
- tb = gtk_text_buffer_new (NULL);
- text = (SPXMLViewContent*)gtk_type_new (SP_TYPE_XMLVIEW_CONTENT);
- gtk_text_view_set_buffer (GTK_TEXT_VIEW (text), tb);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text), GTK_WRAP_CHAR);
+ tb = gtk_text_buffer_new (NULL);
+ text = (SPXMLViewContent*)gtk_type_new (SP_TYPE_XMLVIEW_CONTENT);
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW (text), tb);
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text), GTK_WRAP_CHAR);
- g_signal_connect (G_OBJECT (tb), "changed", G_CALLBACK (sp_xmlview_content_changed), text);
+ g_signal_connect (G_OBJECT (tb), "changed", G_CALLBACK (sp_xmlview_content_changed), text);
- /* should we alter the scrolling adjustments here? */
+ /* should we alter the scrolling adjustments here? */
- sp_xmlview_content_set_repr (text, repr);
+ sp_xmlview_content_set_repr (text, repr);
- return (GtkWidget *) text;
+ return (GtkWidget *) text;
}
void
sp_xmlview_content_set_repr (SPXMLViewContent * text, Inkscape::XML::Node * repr)
{
- if ( repr == text->repr ) return;
- if (text->repr) {
- sp_repr_remove_listener_by_data (text->repr, text);
- Inkscape::GC::release(text->repr);
- }
- text->repr = repr;
- if (repr) {
- Inkscape::GC::anchor(repr);
- sp_repr_add_listener (repr, &repr_events, text);
- sp_repr_synthesize_events (repr, &repr_events, text);
- } else {
- gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), "", 0);
- gtk_text_view_set_editable (GTK_TEXT_VIEW (text), FALSE);
- }
+ if ( repr == text->repr ) return;
+ if (text->repr) {
+ sp_repr_remove_listener_by_data (text->repr, text);
+ Inkscape::GC::release(text->repr);
+ }
+ text->repr = repr;
+ if (repr) {
+ Inkscape::GC::anchor(repr);
+ sp_repr_add_listener (repr, &repr_events, text);
+ sp_repr_synthesize_events (repr, &repr_events, text);
+ } else {
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), "", 0);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text), FALSE);
+ }
}
GtkType
sp_xmlview_content_get_type (void)
{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info = {
- "SPXMLViewContent",
- sizeof (SPXMLViewContent),
- sizeof (SPXMLViewContentClass),
- (GtkClassInitFunc) sp_xmlview_content_class_init,
- (GtkObjectInitFunc) sp_xmlview_content_init,
- NULL, NULL, NULL
- };
- type = gtk_type_unique (GTK_TYPE_TEXT_VIEW, &info);
- }
-
- return type;
+ static GtkType type = 0;
+
+ if (!type) {
+ static const GtkTypeInfo info = {
+ "SPXMLViewContent",
+ sizeof (SPXMLViewContent),
+ sizeof (SPXMLViewContentClass),
+ (GtkClassInitFunc) sp_xmlview_content_class_init,
+ (GtkObjectInitFunc) sp_xmlview_content_init,
+ NULL, NULL, NULL
+ };
+ type = gtk_type_unique (GTK_TYPE_TEXT_VIEW, &info);
+ }
+
+ return type;
}
void
sp_xmlview_content_class_init (SPXMLViewContentClass * klass)
{
- GtkObjectClass * object_class;
+ GtkObjectClass * object_class;
- object_class = (GtkObjectClass *) klass;
+ object_class = (GtkObjectClass *) klass;
- parent_class = (GtkTextViewClass*)gtk_type_class (GTK_TYPE_TEXT_VIEW);
+ parent_class = (GtkTextViewClass*)gtk_type_class (GTK_TYPE_TEXT_VIEW);
- object_class->destroy = sp_xmlview_content_destroy;
+ object_class->destroy = sp_xmlview_content_destroy;
}
void
sp_xmlview_content_init (SPXMLViewContent *text)
{
- text->repr = NULL;
- text->blocked = FALSE;
+ text->repr = NULL;
+ text->blocked = FALSE;
}
void
sp_xmlview_content_destroy (GtkObject * object)
{
- SPXMLViewContent * text;
+ SPXMLViewContent * text;
- text = SP_XMLVIEW_CONTENT (object);
+ text = SP_XMLVIEW_CONTENT (object);
- sp_xmlview_content_set_repr (text, NULL);
+ sp_xmlview_content_set_repr (text, NULL);
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
void
-event_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data)
+event_content_changed (Inkscape::XML::Node * /*repr*/, const gchar * /*old_content*/, const gchar * new_content, gpointer data)
{
- SPXMLViewContent * text;
- text = SP_XMLVIEW_CONTENT (data);
+ SPXMLViewContent * text;
+ text = SP_XMLVIEW_CONTENT (data);
- if (text->blocked) return;
+ if (text->blocked) return;
- text->blocked = TRUE;
+ text->blocked = TRUE;
- if (new_content) {
- gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), new_content, strlen (new_content));
- } else {
- gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), "", 0);
- }
- gtk_text_view_set_editable (GTK_TEXT_VIEW (text), new_content != NULL);
+ if (new_content) {
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), new_content, strlen (new_content));
+ } else {
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), "", 0);
+ }
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text), new_content != NULL);
- text->blocked = FALSE;
+ text->blocked = FALSE;
}
void
sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text)
{
- if (text->blocked) return;
-
- if (text->repr) {
- GtkTextIter start, end;
- gchar *data;
- text->blocked = TRUE;
- gtk_text_buffer_get_bounds (tb, &start, &end);
- data = gtk_text_buffer_get_text (tb, &start, &end, TRUE);
- text->repr->setContent(data);
- g_free (data);
- text->blocked = FALSE;
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR,
- _("Type text in a text node"));
- }
+ if (text->blocked) return;
+
+ if (text->repr) {
+ GtkTextIter start, end;
+ gchar *data;
+ text->blocked = TRUE;
+ gtk_text_buffer_get_bounds (tb, &start, &end);
+ data = gtk_text_buffer_get_text (tb, &start, &end, TRUE);
+ text->repr->setContent(data);
+ g_free (data);
+ text->blocked = FALSE;
+ sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR,
+ _("Type text in a text node"));
+ }
}