diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2013-03-19 02:26:40 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2013-03-19 02:26:40 +0000 |
| commit | 5c8a7b8df6203791610487d2435646f86a0eed96 (patch) | |
| tree | 3bf6c7a52f27978f84b267482bb69389051c4085 /src | |
| parent | changes_2013_03_18c.patch (diff) | |
| parent | Drop remaining unused functions (diff) | |
| download | inkscape-5c8a7b8df6203791610487d2435646f86a0eed96.tar.gz inkscape-5c8a7b8df6203791610487d2435646f86a0eed96.zip | |
merge from trunk (r12224)
(bzr r11668.1.60)
Diffstat (limited to 'src')
56 files changed, 137 insertions, 1152 deletions
diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp index d2d01f0b3..8a66bac59 100644 --- a/src/bind/javabind.cpp +++ b/src/bind/javabind.cpp @@ -138,71 +138,6 @@ String getExceptionString(JNIEnv *env) return buf; } -static jint getObjInt(JNIEnv *env, jobject obj, const char *name) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "I"); - return env->GetIntField(obj, fid); -} - -static void setObjInt(JNIEnv *env, jobject obj, const char *name, jint val) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "I"); - env->SetIntField(obj, fid, val); -} - -static jlong getObjLong(JNIEnv *env, jobject obj, const char *name) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "J"); - return env->GetLongField(obj, fid); -} - -static void setObjLong(JNIEnv *env, jobject obj, const char *name, jlong val) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "J"); - env->SetLongField(obj, fid, val); -} - -static jfloat getObjFloat(JNIEnv *env, jobject obj, const char *name) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "F"); - return env->GetFloatField(obj, fid); -} - -static void setObjFloat(JNIEnv *env, jobject obj, const char *name, jfloat val) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "F"); - env->SetFloatField(obj, fid, val); -} - -static jdouble getObjDouble(JNIEnv *env, jobject obj, const char *name) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "D"); - return env->GetDoubleField(obj, fid); -} - -static void setObjDouble(JNIEnv *env, jobject obj, const char *name, jdouble val) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "D"); - env->SetDoubleField(obj, fid, val); -} - -static String getObjString(JNIEnv *env, jobject obj, const char *name) -{ - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "Ljava/lang/String;"); - jstring jstr = (jstring)env->GetObjectField(obj, fid); - return getString(env, jstr); -} - -static void setObjString(JNIEnv *env, jobject obj, const char *name, const String &val) -{ - jstring jstr = env->NewStringUTF(val.c_str()); - jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "Ljava/lang/String;"); - env->SetObjectField(obj, fid, jstr); -} - - - - //######################################################################## //# CONSTRUCTOR/DESTRUCTOR //######################################################################## @@ -241,40 +176,22 @@ JavaBinderyImpl::~JavaBinderyImpl() void err(const char *fmt, ...) { -#if 0 - va_list args; - fprintf(stderr, "JavaBinderyImpl err:"); - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); -#else va_list args; g_warning("JavaBinderyImpl err:"); va_start(args, fmt); g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); g_warning("\n"); -#endif } void msg(const char *fmt, ...) { -#if 0 - va_list args; - fprintf(stdout, "JavaBinderyImpl:"); - va_start(args, fmt); - vfprintf(stdout, fmt, args); - va_end(args); - fprintf(stdout, "\n"); -#else va_list args; g_message("JavaBinderyImpl:"); va_start(args, fmt); g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args); va_end(args); g_message("\n"); -#endif } diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 1cd230a08..ca19c0b72 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -1,12 +1,10 @@ set(dialogs_SRC dialog-events.cpp - find.cpp # ------- # Headers dialog-events.h - find.h ) # add_inkscape_lib(dialogs_LIB "${dialogs_SRC}") diff --git a/src/dialogs/Makefile_insert b/src/dialogs/Makefile_insert index 62641ecb9..f1ed89314 100644 --- a/src/dialogs/Makefile_insert +++ b/src/dialogs/Makefile_insert @@ -2,6 +2,4 @@ ink_common_sources += \ dialogs/dialog-events.cpp \ - dialogs/dialog-events.h \ - dialogs/find.cpp \ - dialogs/find.h + dialogs/dialog-events.h diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp deleted file mode 100644 index 3fabe4d97..000000000 --- a/src/dialogs/find.cpp +++ /dev/null @@ -1,684 +0,0 @@ -/** - * @file - * Find dialog. - */ -/* Authors: - * bulia byak <bulia@users.sf.net> - * Jon A. Cruz <jon@joncruz.org> - * Abhishek Sharma - * - * Copyright (C) 2004 Authors - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "widgets/icon.h" -#include "message-stack.h" - -#include <gtk/gtk.h> - -#include <glibmm/i18n.h> -#include "helper/window.h" -#include "macros.h" -#include "inkscape.h" -#include "document.h" -#include "desktop.h" -#include "selection.h" -#include "desktop-handles.h" - -#include "dialog-events.h" -#include "../preferences.h" -#include "../verbs.h" -#include "../interface.h" -#include "../sp-text.h" -#include "../sp-flowtext.h" -#include "../text-editing.h" -#include "../sp-tspan.h" -#include "../sp-tref.h" -#include "../selection-chemistry.h" -#include "../sp-defs.h" -#include "../sp-rect.h" -#include "../sp-ellipse.h" -#include "../sp-star.h" -#include "../sp-spiral.h" -#include "../sp-path.h" -#include "../sp-line.h" -#include "../sp-polyline.h" -#include "../sp-item-group.h" -#include "../sp-use.h" -#include "../sp-image.h" -#include "../sp-offset.h" -#include <xml/repr.h> -#include "sp-root.h" - -#define MIN_ONSCREEN_DISTANCE 50 - -static GtkWidget *dlg = NULL; -static win_data wd; - -// impossible original values to make sure they are read from prefs -static gint x = -1000, y = -1000, w = 0, h = 0; -static Glib::ustring const prefs_path = "/dialogs/find/"; - - -static void sp_find_dialog_destroy(GObject *object, gpointer) -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt(prefs_path + "visible", 0); - - sp_signal_disconnect_by_data (INKSCAPE, object); - wd.win = dlg = NULL; - wd.stop = 0; -} - - - -static gboolean sp_find_dialog_delete(GObject *, GdkEvent *, gpointer /*data*/) -{ - gtk_window_get_position (GTK_WINDOW (dlg), &x, &y); - gtk_window_get_size (GTK_WINDOW (dlg), &w, &h); - - if (x<0) x=0; - if (y<0) y=0; - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt(prefs_path + "x", x); - prefs->setInt(prefs_path + "y", y); - prefs->setInt(prefs_path + "w", w); - prefs->setInt(prefs_path + "h", h); - - return FALSE; // which means, go ahead and destroy it -} - -static void -sp_find_squeeze_window() -{ - GtkRequisition r; -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_get_preferred_size(dlg, &r, NULL); -#else - gtk_widget_size_request(dlg, &r); -#endif - gtk_window_resize (GTK_WINDOW(dlg), r.width, r.height); -} - -static bool -item_id_match (SPItem *item, const gchar *id, bool exact) -{ - if (item->getRepr() == NULL) { - return false; - } - - if (SP_IS_STRING(item)) { // SPStrings have "on demand" ids which are useless for searching - return false; - } - - const gchar *item_id = item->getRepr()->attribute("id"); - if (item_id == NULL) { - return false; - } - - if (exact) { - return ((bool) !strcmp(item_id, id)); - } else { -// g_print ("strstr: %s %s: %s\n", item_id, id, strstr(item_id, id) != NULL? "yes":"no"); - return ((bool) (strstr(item_id, id) != NULL)); - } -} - -static bool -item_text_match (SPItem *item, const gchar *text, bool exact) -{ - if (item->getRepr() == NULL) { - return false; - } - - if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { - const gchar *item_text = sp_te_get_string_multiline (item); - if (item_text == NULL) - return false; - bool ret; - if (exact) { - ret = ((bool) !strcasecmp(item_text, text)); - } else { - //FIXME: strcasestr - ret = ((bool) (strstr(item_text, text) != NULL)); - } - g_free(static_cast<void*>(g_strdup(item_text))); - return ret; - } - return false; -} - -static bool -item_style_match (SPItem *item, const gchar *text, bool exact) -{ - if (item->getRepr() == NULL) { - return false; - } - - const gchar *item_text = item->getRepr()->attribute("style"); - if (item_text == NULL) { - return false; - } - - if (exact) { - return ((bool) !strcmp(item_text, text)); - } else { - return ((bool) (strstr(item_text, text) != NULL)); - } -} - -static bool -item_attr_match(SPItem *item, const gchar *name, bool exact) -{ - bool result = false; - if (item->getRepr()) { - if (exact) { - const gchar *attr_value = item->getRepr()->attribute(name); - result = (attr_value != NULL); - } else { - result = item->getRepr()->matchAttributeName(name); - } - } - return result; -} - - -static GSList * -filter_onefield (GSList *l, GObject *dlg, const gchar *field, bool (*match_function)(SPItem *, const gchar *, bool), bool exact) -{ - GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), field)); - const gchar *text = gtk_entry_get_text (GTK_ENTRY(widget)); - - if (strlen (text) != 0) { - GSList *n = NULL; - for (GSList *i = l; i != NULL; i = i->next) { - if (match_function (SP_ITEM(i->data), text, exact)) { - n = g_slist_prepend (n, i->data); - } - } - return n; - } else { - return l; - } - - return NULL; -} - - -static bool -type_checkbox (GtkWidget *widget, const gchar *data) -{ - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (widget), data))); -} - -static bool -item_type_match (SPItem *item, GtkWidget *widget) -{ - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - - if (SP_IS_RECT(item)) { - return (type_checkbox (widget, "shapes") || type_checkbox (widget, "rects")); - - } else if (SP_IS_GENERICELLIPSE(item) || SP_IS_ELLIPSE(item) || SP_IS_ARC(item) || SP_IS_CIRCLE(item)) { - return (type_checkbox (widget, "shapes") || type_checkbox (widget, "ellipses")); - - } else if (SP_IS_STAR(item) || SP_IS_POLYGON(item)) { - return (type_checkbox (widget, "shapes") || type_checkbox (widget, "stars")); - - } else if (SP_IS_SPIRAL(item)) { - return (type_checkbox (widget, "shapes") || type_checkbox (widget, "spirals")); - - } else if (SP_IS_PATH(item) || SP_IS_LINE(item) || SP_IS_POLYLINE(item)) { - return (type_checkbox (widget, "paths")); - - } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_TREF(item) || SP_IS_STRING(item)) { - return (type_checkbox (widget, "texts")); - - } else if (SP_IS_GROUP(item) && !desktop->isLayer(item) ) { // never select layers! - return (type_checkbox (widget, "groups")); - - } else if (SP_IS_USE(item)) { - return (type_checkbox (widget, "clones")); - - } else if (SP_IS_IMAGE(item)) { - return (type_checkbox (widget, "images")); - - } else if (SP_IS_OFFSET(item)) { - return (type_checkbox (widget, "offsets")); - } - - return false; -} - -static GSList * -filter_types (GSList *l, GObject *dlg, bool (*match_function)(SPItem *, GtkWidget *)) -{ - GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), "types")); - - GtkWidget *alltypes = GTK_WIDGET (g_object_get_data(G_OBJECT (widget), "all")); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (alltypes))) - return l; - - - GSList *n = NULL; - for (GSList *i = l; i != NULL; i = i->next) { - if (match_function (SP_ITEM(i->data), widget)) { - n = g_slist_prepend (n, i->data); - } - } - return n; -} - - -static GSList * -filter_list (GSList *l, GObject *dlg, bool exact) -{ - l = filter_onefield (l, dlg, "text", item_text_match, exact); - l = filter_onefield (l, dlg, "id", item_id_match, exact); - l = filter_onefield (l, dlg, "style", item_style_match, exact); - l = filter_onefield (l, dlg, "attr", item_attr_match, exact); - - l = filter_types (l, dlg, item_type_match); - - return l; -} - -static GSList * -all_items (SPObject *r, GSList *l, bool hidden, bool locked) -{ - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - - if (SP_IS_DEFS(r)) { - return l; // we're not interested in items in defs - } - - if (!strcmp(r->getRepr()->name(), "svg:metadata")) { - return l; // we're not interested in metadata - } - - for (SPObject *child = r->firstChild(); child; child = child->next) { - if ( SP_IS_ITEM(child) && !child->cloned && !desktop->isLayer(child) ) { - SPItem *item = SP_ITEM(child); - if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { - l = g_slist_prepend (l, child); - } - } - l = all_items (child, l, hidden, locked); - } - return l; -} - -static GSList * -all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked) -{ - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - - for (GSList *i = const_cast<GSList *>(s->itemList()); i != NULL; i = i->next) { - if ( SP_IS_ITEM(i->data) && !SP_OBJECT(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) { - SPItem * item = SP_ITEM(i->data); - if (!ancestor || ancestor->isAncestorOf(item)) { - if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { - l = g_slist_prepend (l, i->data); - } - } - } - if (!ancestor || ancestor->isAncestorOf(SP_OBJECT (i->data))) { - l = all_items (SP_OBJECT (i->data), l, hidden, locked); - } - } - return l; -} - - -static void -sp_find_dialog_find(GObject *, GObject *dlg) -{ - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - - bool hidden = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includehidden"))); - bool locked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includelocked"))); - - GSList *l = NULL; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inselection")))) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) { - l = all_selection_items (desktop->selection, l, desktop->currentLayer(), hidden, locked); - } else { - l = all_selection_items (desktop->selection, l, NULL, hidden, locked); - } - } else { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) { - l = all_items (desktop->currentLayer(), l, hidden, locked); - } else { - l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked); - } - } - guint all = g_slist_length (l); - - bool exact = true; - GSList *n = NULL; - n = filter_list (l, dlg, exact); - if (n == NULL) { - exact = false; - n = filter_list (l, dlg, exact); - } - - if (n != NULL) { - int count = g_slist_length (n); - desktop->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, - // TRANSLATORS: "%s" is replaced with "exact" or "partial" when this string is displayed - ngettext("<b>%d</b> object found (out of <b>%d</b>), %s match.", - "<b>%d</b> objects found (out of <b>%d</b>), %s match.", - count), - count, all, exact? _("exact") : _("partial")); - - Inkscape::Selection *selection = sp_desktop_selection (desktop); - selection->clear(); - selection->setList(n); - scroll_to_show_item (desktop, SP_ITEM(n->data)); - } else { - desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No objects found")); - } -} - -static void -sp_find_reset_searchfield (GObject *dlg, const gchar *field) -{ - GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), field)); - gtk_entry_set_text (GTK_ENTRY(widget), ""); -} - - -static void -sp_find_dialog_reset (GObject *, GObject *dlg) -{ - sp_find_reset_searchfield (dlg, "text"); - sp_find_reset_searchfield (dlg, "id"); - sp_find_reset_searchfield (dlg, "style"); - sp_find_reset_searchfield (dlg, "attr"); - - GtkWidget *types = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), "types")); - GtkToggleButton *tb = GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (types), "all")); - gtk_toggle_button_toggled (tb); - gtk_toggle_button_set_active (tb, TRUE); -} - - -#define FIND_LABELWIDTH 80 - -static void -sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, const gchar *tip) -{ -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif - GtkWidget *l = gtk_label_new_with_mnemonic (label); - gtk_widget_set_size_request (l, FIND_LABELWIDTH, -1); - gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); - - GtkWidget *tf = gtk_entry_new (); - gtk_entry_set_max_length (GTK_ENTRY (tf), 64); - gtk_box_pack_start (GTK_BOX (hb), tf, TRUE, TRUE, 0); - g_object_set_data (G_OBJECT (dlg), id, tf); - gtk_widget_set_tooltip_text (tf, tip); - g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_find_dialog_find), dlg ); - gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf); - - gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); -} - -static void -sp_find_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, const gchar *tip, void (*function) (GObject *, GObject *)) -{ - GtkWidget *b = gtk_button_new_with_mnemonic (label); - gtk_widget_set_tooltip_text (b, tip); - gtk_box_pack_start (GTK_BOX (hb), b, TRUE, TRUE, 0); - g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (function), dlg ); - gtk_widget_show (b); -} - -static void -toggle_alltypes (GtkToggleButton *tb, gpointer data) -{ - GtkWidget *alltypes_pane = GTK_WIDGET (g_object_get_data(G_OBJECT (data), "all-pane")); - if (gtk_toggle_button_get_active (tb)) { - gtk_widget_hide (alltypes_pane); - } else { - gtk_widget_show_all (alltypes_pane); - - // excplicit toggle to make sure its handler gets called, no matter what was the original state - gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "shapes"))); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "shapes")), TRUE); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "paths")), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "texts")), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "groups")), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "clones")), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "images")), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "offsets")), TRUE); - } - sp_find_squeeze_window(); -} - -static void -toggle_shapes (GtkToggleButton *tb, gpointer data) -{ - GtkWidget *shapes_pane = GTK_WIDGET (g_object_get_data(G_OBJECT (data), "shapes-pane")); - if (gtk_toggle_button_get_active (tb)) { - gtk_widget_hide (shapes_pane); - } else { - gtk_widget_show_all (shapes_pane); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "rects")), FALSE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "ellipses")), FALSE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "stars")), FALSE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "spirals")), FALSE); - } - sp_find_squeeze_window(); -} - - -static GtkWidget * -sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active, - const gchar *tip, - const gchar *label, - void (*toggled)(GtkToggleButton *, gpointer)) -{ -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif - gtk_widget_show (hb); - - { - GtkWidget *b = gtk_check_button_new_with_label (label); - gtk_widget_show (b); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), active); - g_object_set_data (G_OBJECT (w), data, b); - gtk_widget_set_tooltip_text (b, tip); - if (toggled) - g_signal_connect (G_OBJECT (b), "toggled", G_CALLBACK (toggled), w); - gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); - } - - return hb; -} - -static GtkWidget * -sp_find_types_checkbox_indented (GtkWidget *w, const gchar *data, gboolean active, - const gchar *tip, - const gchar *label, - void (*toggled)(GtkToggleButton *, gpointer), guint indent) -{ -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif - gtk_widget_show (hb); - - { // empty label for indent - GtkWidget *l = gtk_label_new (""); - gtk_widget_show (l); - gtk_widget_set_size_request (l, FIND_LABELWIDTH + indent, -1); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); - } - - GtkWidget *c = sp_find_types_checkbox (w, data, active, tip, label, toggled); - gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); - - return hb; -} - - -static GtkWidget * -sp_find_types () -{ -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); - gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); -#else - GtkWidget *vb = gtk_vbox_new (FALSE, 4); -#endif - gtk_widget_show (vb); - - { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif - gtk_widget_show (hb); - - { - GtkWidget *l = gtk_label_new_with_mnemonic (_("T_ype: ")); - gtk_widget_show (l); - gtk_widget_set_size_request (l, FIND_LABELWIDTH, -1); - gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); - } - - GtkWidget *alltypes = sp_find_types_checkbox (vb, "all", TRUE, _("Search in all object types"), _("All types"), toggle_alltypes); - gtk_box_pack_start (GTK_BOX (hb), alltypes, FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); - } - - { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *vb_all = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_set_homogeneous(GTK_BOX(vb_all), FALSE); -#else - GtkWidget *vb_all = gtk_vbox_new (FALSE, 0); -#endif - gtk_widget_show (vb_all); - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "shapes", FALSE, _("Search all shapes"), _("All shapes"), toggle_shapes, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - - { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif - gtk_widget_show (hb); - - { // empty label for alignment - GtkWidget *l = gtk_label_new (""); - gtk_widget_show (l); - gtk_widget_set_size_request (l, FIND_LABELWIDTH + 20, -1); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox (vb, "rects", FALSE, _("Search rectangles"), _("Rectangles"), NULL); - gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox (vb, "ellipses", FALSE, _("Search ellipses, arcs, circles"), _("Ellipses"), NULL); - gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox (vb, "stars", FALSE, _("Search stars and polygons"), _("Stars"), NULL); - gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox (vb, "spirals", FALSE, _("Search spirals"), _("Spirals"), NULL); - gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); - } - - g_object_set_data (G_OBJECT (vb), "shapes-pane", hb); - - gtk_box_pack_start (GTK_BOX (vb_all), hb, FALSE, FALSE, 0); - gtk_widget_hide (hb); - } - - { - // TRANSLATORS: polyline is a set of connected straight line segments - // http://www.w3.org/TR/SVG11/shapes.html#PolylineElement - GtkWidget *c = sp_find_types_checkbox_indented (vb, "paths", TRUE, _("Search paths, lines, polylines"), _("Paths"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "texts", TRUE, _("Search text objects"), _("Texts"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "groups", TRUE, _("Search groups"), _("Groups"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, _("Search clones"), - //TRANSLATORS: "Clones" is a noun indicating type of object to find - C_("Find dialog","Clones"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "images", TRUE, _("Search images"), _("Images"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "offsets", TRUE, _("Search offset objects"), _("Offsets"), NULL, 10); - gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); - } - - gtk_box_pack_start (GTK_BOX (vb), vb_all, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (vb), "all-pane", vb_all); - gtk_widget_hide (vb_all); - } - - return vb; -} - - -/* - 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/find.h b/src/dialogs/find.h deleted file mode 100644 index c06d3735f..000000000 --- a/src/dialogs/find.h +++ /dev/null @@ -1,29 +0,0 @@ -/** @file - * @brief Find dialog - */ -/* Authors: - * bulia byak <bulia@users.sf.net> - * - * Copyright (C) 2004 Authors - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifndef SEEN_FIND_H -#define SEEN_FIND_H - -#include <gtk/gtk.h> - - -#endif /* !SEEN_FIND_H */ - -/* - 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/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index a55b05fe3..fc56c7b26 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -655,8 +655,8 @@ int ink_cairo_surface_srgb_to_linear(cairo_surface_t *surface) cairo_surface_flush(surface); int width = cairo_image_surface_get_width(surface); int height = cairo_image_surface_get_height(surface); - int stride = cairo_image_surface_get_stride(surface); - unsigned char *data = cairo_image_surface_get_data(surface); + // int stride = cairo_image_surface_get_stride(surface); + // unsigned char *data = cairo_image_surface_get_data(surface); ink_cairo_surface_filter( surface, surface, SurfaceSrgbToLinear() ); @@ -698,8 +698,8 @@ int ink_cairo_surface_linear_to_srgb(cairo_surface_t *surface) cairo_surface_flush(surface); int width = cairo_image_surface_get_width(surface); int height = cairo_image_surface_get_height(surface); - int stride = cairo_image_surface_get_stride(surface); - unsigned char *data = cairo_image_surface_get_data(surface); + // int stride = cairo_image_surface_get_stride(surface); + // unsigned char *data = cairo_image_surface_get_data(surface); ink_cairo_surface_filter( surface, surface, SurfaceLinearToSrgb() ); @@ -888,4 +888,4 @@ guint32 argb32_from_rgba(guint32 in) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index 0d1b56d54..84b4bd080 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -1,5 +1,4 @@ #include "config.h" -#ifdef ENABLE_SVG_FONTS /* * SVGFonts rendering implementation * @@ -356,8 +355,6 @@ void SvgFont::refresh(){ this->userfont = NULL; } -#endif //#ifdef ENABLE_SVG_FONTS - /* Local Variables: mode:c++ diff --git a/src/document.cpp b/src/document.cpp index 97b3bf584..706710cfc 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -953,7 +953,7 @@ void SPDocument::requestModified() void SPDocument::setupViewport(SPItemCtx *ctx) { - ctx->ctx.flags = 0; + ctx->flags = 0; ctx->i2doc = Geom::identity(); // Set up viewport in case svg has it defined as percentages if (root->viewBox_set) { // if set, take from viewBox diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp index 66dcf4ab9..d41e4059d 100644 --- a/src/dropper-context.cpp +++ b/src/dropper-context.cpp @@ -39,7 +39,6 @@ #include "document.h" #include "document-undo.h" -#include "pixmaps/cursor-dropper.xpm" #include "pixmaps/cursor-dropper-f.xpm" #include "pixmaps/cursor-dropper-s.xpm" diff --git a/src/file.cpp b/src/file.cpp index 97087c1a1..5737f0a8a 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1124,9 +1124,6 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, prevent_id_clashes(doc, in_doc); - SPObject *in_defs = in_doc->getDefs(); - Inkscape::XML::Node *last_def = in_defs->getRepr()->lastChild(); - SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot()); // Count the number of top-level items in the imported document. diff --git a/src/libgdl/Makefile_insert b/src/libgdl/Makefile_insert index 3f5228a20..6669a28fa 100644 --- a/src/libgdl/Makefile_insert +++ b/src/libgdl/Makefile_insert @@ -44,6 +44,16 @@ libgdl/all: libgdl/libgdl.a libgdl/clean: rm -f libgdl/libgdl.a $(libgdl_gdl_a_OBJECTS) +# Suppress some non-critical warnings for libgdl. We will drop our forked copy +# of GDL once we upgrade to Gtk+ 3 so it's more important to minimise the number +# of changes we make to GDL than to fix these minor issues in trunk. + +if CC_WNO_UNUSED_BUT_SET_VARIABLE_SUPPORTED +libgdl_libgdl_a_CFLAGS = -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable $(AM_CFLAGS) +else +libgdl_libgdl_a_CFLAGS = -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable $(AM_CFLAGS) +endif + libgdl_libgdl_a_SOURCES = \ libgdl/gdl-dock-object.h \ libgdl/gdl-dock-master.h \ diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 90900baba..5b495d14d 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -969,6 +969,17 @@ namespace Inkscape } // Helper functions + +// Separator function (if true, a separator will be drawn) +gboolean font_lister_separator_func(GtkTreeModel *model, + GtkTreeIter *iter, + gpointer /*data*/) +{ + gchar* text = 0; + gtk_tree_model_get(model, iter, 0, &text, -1 ); // Column 0: FontList.family + return (text && strcmp(text,"#") == 0); +} + void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/, GtkCellRenderer *cell, GtkTreeModel *model, @@ -1042,3 +1053,13 @@ void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/, g_object_set (G_OBJECT (cell), "markup", markup.c_str(), NULL); } +/* + 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h index 5c48bf7a8..5a8f578d9 100644 --- a/src/libnrtype/font-lister.h +++ b/src/libnrtype/font-lister.h @@ -296,13 +296,9 @@ namespace Inkscape } // Helper functions -// Separator function (if true, a separator will be drawn) -static gboolean font_lister_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer /*data*/) -{ - gchar* text = 0; - gtk_tree_model_get(model, iter, 0, &text, -1 ); // Column 0: FontList.family - return (text && strcmp(text,"#") == 0); -} +gboolean font_lister_separator_func(GtkTreeModel *model, + GtkTreeIter *iter, + gpointer /*data*/); void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/, GtkCellRenderer *cell, diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp index d9f609e87..7d9f3f57d 100644 --- a/src/livarot/PathSimplify.cpp +++ b/src/livarot/PathSimplify.cpp @@ -67,6 +67,7 @@ void Path::Simplify(double treshhold) } +#if 0 // dichomtomic method to get distance to curve approximation // a real polynomial solver would get the minimum more efficiently, but since the polynom // would likely be of degree >= 5, that would imply using some generic solver, liek using the sturm metod @@ -114,7 +115,7 @@ static double RecDistanceToCubic(Geom::Point const &iS, Geom::Point const &isD, return current; } - +#endif static double DistanceToCubic(Geom::Point const &start, PathDescrCubicTo res, Geom::Point &pt) { diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp index a5295d269..30ca5e2d6 100644 --- a/src/live_effects/lpe-dynastroke.cpp +++ b/src/live_effects/lpe-dynastroke.cpp @@ -26,30 +26,6 @@ namespace Inkscape { namespace LivePathEffect { - -//---------------------------------------------------------- -//--- TODO: Test this and move to 2Geom -------------------- -//---------------------------------------------------------- - -static -std::vector<double> -find_corners (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &m){ - using namespace Geom; - std::vector<double> output = std::vector<double>(); - Piecewise<D2<SBasis> > v = derivative(m); - for (unsigned i=0; i<m.size()-1; i++){ - if ( m.segs[i].at1() == m.segs[i+1].at0() && - v.segs[i].at1() != v.segs[i+1].at0()){ - output.push_back(m.cuts[i+1]); - } - } - return output; -} - -//---------------------------------------------------------- -//---------------------------------------------------------- -//---------------------------------------------------------- - //TODO: growfor/fadefor can be expressed in unit of width. //TODO: make round/sharp end choices independant for start and end. //TODO: define more styles like in calligtool. diff --git a/src/live_effects/lpe-recursiveskeleton.cpp b/src/live_effects/lpe-recursiveskeleton.cpp index 452139344..ac571d963 100644 --- a/src/live_effects/lpe-recursiveskeleton.cpp +++ b/src/live_effects/lpe-recursiveskeleton.cpp @@ -91,7 +91,8 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co double scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); // TODO investigate why pattWidth is not being used: - double pattWidth = pattBndsX->extent() * scaling; + // - Doesn't appear to have been used anywhere in bzr history (Alex V: 2013-03-16) + // double pattWidth = pattBndsX->extent() * scaling; if (scaling != 1.0) { x*=scaling; diff --git a/src/marker.cpp b/src/marker.cpp index ba5cd4b05..b3b493b00 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -301,7 +301,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) // fixme: We have to set up clip here too // Copy parent context - rctx.ctx = *ctx; + rctx.flags = ctx->flags; // Initialize tranformations rctx.i2doc = Geom::identity(); @@ -324,13 +324,13 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) // Now set up viewbox transformation // Determine actual viewbox in viewport coordinates - double x = 0; - double y = 0; + // double x = 0; + // double y = 0; double width = 0; double height = 0; if (marker->aspect_align == SP_ASPECT_NONE) { - x = 0.0; - y = 0.0; + // x = 0.0; + // y = 0.0; width = rctx.viewport.width(); height = rctx.viewport.height(); } else { @@ -343,7 +343,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) height = (vb.height()) * scale; // Now place viewbox to requested position - switch (marker->aspect_align) { + /*switch (marker->aspect_align) { case SP_ASPECT_XMIN_YMIN: x = 0.0; y = 0.0; @@ -384,7 +384,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) x = 0.0; y = 0.0; break; - } + }*/ } // TODO fixme: all that work is done to figure out x and y, which are just ignored. Check why. diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 868b606a4..694619089 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -252,9 +252,7 @@ static char const menus_skeleton[] = " </submenu>\n" " <submenu name=\"" N_("_Text") "\">\n" " <verb verb-id=\"DialogText\" />\n" -#ifdef ENABLE_SVG_FONTS " <verb verb-id=\"DialogSVGFonts\" />\n" -#endif // ENABLE_SVG_FONTS " <verb verb-id=\"DialogGlyphs\" />\n" " <separator/>\n" " <verb verb-id=\"SelectionTextToPath\" />\n" diff --git a/src/pixmaps/cursor-dropper.xpm b/src/pixmaps/cursor-dropper.xpm deleted file mode 100644 index 21f96edd0..000000000 --- a/src/pixmaps/cursor-dropper.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const char * cursor_dropper_xpm[] = { -"32 32 3 1", -" c None", -". c #FFFFFF", -"+ c #000000", -" ... ", -" .+. ", -" .+. ", -" .+. ", -".... .... ", -".+++ +++. ", -".... .... ", -" .+. ", -" .+. .... ", -" .+. .+++. ", -" ... .+..+. ", -" .++..+. ", -" .++..+. ", -" .++..+. ", -" .++..+. . ", -" .++..+.+. ", -" .++..+++. ", -" .++++.+. ", -" .++++.+.. ", -" .++++++.++. ", -" .++++++..+. ", -" ..+++++.+. ", -" .++++++. ", -" .+++++. ", -" .+++. ", -" ... ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/src/selection.cpp b/src/selection.cpp index 72f50137c..564f1fdd3 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -418,7 +418,6 @@ Geom::OptRect Selection::documentBounds(SPItem::BBoxType type) const // will be returned; this is also the case in SelTrans::centerRequest() boost::optional<Geom::Point> Selection::center() const { GSList *items = (GSList *) const_cast<Selection *>(this)->itemList(); - Geom::Point center; if (items) { SPItem *first = reinterpret_cast<SPItem*>(g_slist_last(items)->data); // from the first item in selection if (first->isCenterSet()) { // only if set explicitly diff --git a/src/snap.cpp b/src/snap.cpp index 695424194..15f24ef53 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -500,7 +500,6 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( /* The current best metric for the best transformation; lower is better, Geom::infinity() ** means that we haven't snapped anything. */ - Geom::Point best_scale_metric(Geom::infinity(), Geom::infinity()); Inkscape::SnappedPoint best_snapped_point; g_assert(best_snapped_point.getAlwaysSnap() == false); // Check initialization of snapped point g_assert(best_snapped_point.getAtIntersection() == false); diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index a8de68f9b..627907cef 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -86,15 +86,13 @@ sp_flowregion_dispose(GObject *object) group->computed.~vector<Shape*>(); } -static void sp_flowregion_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void +sp_flowregion_child_added(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *ref) { - SP_ITEM(object); - - if (((SPObjectClass *) (sp_flowregion_parent_class))->child_added) { - (* ((SPObjectClass *) (sp_flowregion_parent_class))->child_added) (object, child, ref); - } - - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + SP_OBJECT_CLASS (sp_flowregion_parent_class)->child_added (object, child, ref); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); } /* fixme: hide (Lauris) */ @@ -164,10 +162,10 @@ void SPFlowregion::UpdateComputed(void) } } -static void sp_flowregion_modified(SPObject *object, guint flags) +static void +sp_flowregion_modified(SPObject *object, + guint flags) { - SP_FLOWREGION(object); // ensure it is the proper type. - if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } @@ -278,15 +276,14 @@ sp_flowregionexclude_dispose(GObject *object) } } -static void sp_flowregionexclude_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void +sp_flowregionexclude_child_added(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *ref) { - SP_ITEM(object); - - if (((SPObjectClass *) (sp_flowregionexclude_parent_class))->child_added) { - (* ((SPObjectClass *) (sp_flowregionexclude_parent_class))->child_added) (object, child, ref); - } + SP_OBJECT_CLASS (sp_flowregionexclude_parent_class)->child_added (object, child, ref); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); } /* fixme: hide (Lauris) */ @@ -354,10 +351,10 @@ void SPFlowregionExclude::UpdateComputed(void) } } -static void sp_flowregionexclude_modified(SPObject *object, guint flags) +static void +sp_flowregionexclude_modified(SPObject *object, + guint flags) { - SP_FLOWREGIONEXCLUDE(object); // Ensure it is the proper type - if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp index 4288a5d64..0a649b17f 100644 --- a/src/sp-font-face.cpp +++ b/src/sp-font-face.cpp @@ -2,8 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS - /* * SVG <font-face> element implementation * @@ -849,7 +847,6 @@ static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::D return repr; } -#endif //#ifdef ENABLE_SVG_FONTS /* Local Variables: mode:c++ diff --git a/src/sp-font-face.h b/src/sp-font-face.h index 57702b683..968644556 100644 --- a/src/sp-font-face.h +++ b/src/sp-font-face.h @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #ifndef __SP_FONTFACE_H__ #define __SP_FONTFACE_H__ @@ -122,4 +121,3 @@ GType sp_fontface_get_type (void); G_END_DECLS #endif //#ifndef __SP_FONTFACE_H__ -#endif //#ifdef ENABLE_SVG_FONTS diff --git a/src/sp-font.cpp b/src/sp-font.cpp index 6ebbd5218..a03890fc7 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -2,8 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS - /* * SVG <font> element implementation * @@ -250,7 +248,6 @@ static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Docum return repr; } -#endif //#ifdef ENABLE_SVG_FONTS /* Local Variables: mode:c++ diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index 652d965bb..10884fb81 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #define __SP_ANCHOR_C__ /* @@ -267,7 +266,6 @@ static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::X return repr; } -#endif //#ifdef ENABLE_SVG_FONTS /* Local Variables: mode:c++ diff --git a/src/sp-glyph-kerning.h b/src/sp-glyph-kerning.h index ce9b4bb15..b7f733cad 100644 --- a/src/sp-glyph-kerning.h +++ b/src/sp-glyph-kerning.h @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #ifndef __SP_GLYPH_KERNING_H__ #define __SP_GLYPH_KERNING_H__ @@ -60,4 +59,3 @@ GType sp_glyph_kerning_h_get_type (void); GType sp_glyph_kerning_v_get_type (void); #endif //#ifndef __SP_GLYPH_KERNING_H__ -#endif //#ifdef ENABLE_SVG_FONTS diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp index e14ef8667..0417ea8c1 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #define __SP_GLYPH_C__ /* @@ -284,7 +283,6 @@ static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Docu return repr; } -#endif //#ifdef ENABLE_SVG_FONTS /* Local Variables: mode:c++ diff --git a/src/sp-glyph.h b/src/sp-glyph.h index 316204c23..7556b0e25 100644 --- a/src/sp-glyph.h +++ b/src/sp-glyph.h @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #ifndef __SP_GLYPH_H__ #define __SP_GLYPH_H__ @@ -58,4 +57,3 @@ struct SPGlyphClass { GType sp_glyph_get_type (void); #endif //#ifndef __SP_GLYPH_H__ -#endif //#ifdef ENABLE_SVG_FONTS diff --git a/src/sp-item.h b/src/sp-item.h index e65ffc829..31b7ac034 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -87,9 +87,8 @@ public: #define SP_ITEM_REFERENCE_FLAGS (1 << 1) /// Contains transformations to document/viewport and the viewport size. -class SPItemCtx { +class SPItemCtx : public SPCtx { public: - SPCtx ctx; /** Item to document transformation */ Geom::Affine i2doc; /** Viewport size */ diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp index 9978d0a3a..79953b708 100644 --- a/src/sp-metadata.cpp +++ b/src/sp-metadata.cpp @@ -116,15 +116,17 @@ static void sp_metadata_release(SPObject *object) /** * Sets a specific value in the SPMetadata. */ -static void sp_metadata_set(SPObject *object, unsigned int key, const gchar *value) +static void +sp_metadata_set(SPObject *object, + unsigned int key, + const gchar *value) { debug("0x%08x %s(%u): '%s'",(unsigned int)object, sp_attribute_name(key),key,value); - SP_METADATA(object); // ensures the object is of the proper type. // see if any parents need this value - if (reinterpret_cast<SPObjectClass *>(sp_metadata_parent_class)->set) { - reinterpret_cast<SPObjectClass *>(sp_metadata_parent_class)->set(object, key, value); + if (SP_OBJECT_CLASS(sp_metadata_parent_class)->set) { + SP_OBJECT_CLASS(sp_metadata_parent_class)->set(object, key, value); } } diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp index bdf993e5b..911c9be92 100644 --- a/src/sp-missing-glyph.cpp +++ b/src/sp-missing-glyph.cpp @@ -2,8 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS - /* * SVG <missing-glyph> element implementation * @@ -164,7 +162,6 @@ static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::X return repr; } -#endif //#ifdef ENABLE_SVG_FONTS /* Local Variables: mode:c++ diff --git a/src/sp-missing-glyph.h b/src/sp-missing-glyph.h index 0b3f74360..7930df513 100644 --- a/src/sp-missing-glyph.h +++ b/src/sp-missing-glyph.h @@ -2,7 +2,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS #ifndef __SP_MISSING_GLYPH_H__ #define __SP_MISSING_GLYPH_H__ @@ -40,4 +39,3 @@ struct SPMissingGlyphClass { GType sp_missing_glyph_get_type (void); #endif //#ifndef __SP_MISSING_GLYPH_H__ -#endif //#ifdef ENABLE_SVG_FONTS diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 5158ec70a..e2b601ab9 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -93,8 +93,6 @@ sp_objectgroup_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject - if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { repr = xml_doc->createElement("svg:g"); @@ -118,7 +116,7 @@ sp_objectgroup_write(SPObject *object, } if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write) { - (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write(object, xml_doc, repr, flags); + SP_OBJECT_CLASS(sp_objectgroup_parent_class)->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index cd332cd34..eba38ec67 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -48,13 +48,11 @@ #include "sp-script.h" #include "config.h" -#ifdef ENABLE_SVG_FONTS - #include "sp-font.h" - #include "sp-font-face.h" - #include "sp-glyph.h" - #include "sp-missing-glyph.h" - #include "sp-glyph-kerning.h" -#endif +#include "sp-font.h" +#include "sp-font-face.h" +#include "sp-glyph.h" +#include "sp-missing-glyph.h" +#include "sp-glyph-kerning.h" #include "sp-style-elem.h" #include "sp-switch.h" @@ -151,14 +149,12 @@ populate_dtables() { "svg:flowRegionExclude", SP_TYPE_FLOWREGIONEXCLUDE }, { "svg:flowRoot", SP_TYPE_FLOWTEXT }, { "svg:flowSpan", SP_TYPE_FLOWTSPAN }, -#ifdef ENABLE_SVG_FONTS { "svg:font", SP_TYPE_FONT }, { "svg:font-face", SP_TYPE_FONTFACE }, { "svg:glyph", SP_TYPE_GLYPH }, { "svg:missing-glyph", SP_TYPE_MISSING_GLYPH }, { "svg:hkern", SP_TYPE_HKERN }, { "svg:vkern", SP_TYPE_VKERN }, -#endif { "svg:g", SP_TYPE_GROUP }, { "svg:feBlend", SP_TYPE_FEBLEND }, { "svg:feColorMatrix", SP_TYPE_FECOLORMATRIX }, diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index e5d89a802..2922b66ed 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -116,10 +116,11 @@ sp_polyline_set(SPObject *object, unsigned int key, const gchar *value) } static Inkscape::XML::Node* -sp_polyline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +sp_polyline_write(SPObject *object, + Inkscape::XML::Document *xml_doc, + Inkscape::XML::Node *repr, + guint flags) { - SP_POLYLINE(object); - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:polyline"); } @@ -128,9 +129,7 @@ sp_polyline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: repr->mergeFrom(object->getRepr(), "id"); } - if (((SPObjectClass *) (sp_polyline_parent_class))->write) { - ((SPObjectClass *) (sp_polyline_parent_class))->write (object, xml_doc, repr, flags); - } + SP_OBJECT_CLASS(sp_polyline_parent_class)->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index d4db403e3..989a5b7f3 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -307,19 +307,19 @@ static void sp_symbol_update(SPObject *object, SPCtx *ctx, guint flags) } } -static void sp_symbol_modified(SPObject *object, guint flags) +static void +sp_symbol_modified(SPObject *object, + guint flags) { - SP_SYMBOL(object); - - if (((SPObjectClass *) (sp_symbol_parent_class))->modified) { - (* ((SPObjectClass *) (sp_symbol_parent_class))->modified) (object, flags); - } + SP_OBJECT_CLASS(sp_symbol_parent_class)->modified (object, flags); } -static Inkscape::XML::Node *sp_symbol_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node * +sp_symbol_write(SPObject *object, + Inkscape::XML::Document *xml_doc, + Inkscape::XML::Node *repr, + guint flags) { - SP_SYMBOL(object); - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:symbol"); } @@ -330,9 +330,7 @@ static Inkscape::XML::Node *sp_symbol_write(SPObject *object, Inkscape::XML::Doc //XML Tree being used directly here while it shouldn't be. repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); - if (((SPObjectClass *) (sp_symbol_parent_class))->write) { - ((SPObjectClass *) (sp_symbol_parent_class))->write (object, xml_doc, repr, flags); - } + SP_OBJECT_CLASS(sp_symbol_parent_class)->write (object, xml_doc, repr, flags); return repr; } @@ -404,3 +402,14 @@ static void sp_symbol_print(SPItem *item, SPPrintContext *ctx) sp_print_release (ctx); } } + +/* + 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/splivarot.cpp b/src/splivarot.cpp index f9aaab898..18308be29 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1568,48 +1568,18 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool Inkscape::XML::Node *parent = item->getRepr()->parent(); float o_width = 0; - JoinType o_join = join_straight; - ButtType o_butt = butt_straight; - float o_miter = 0; { SPStyle *i_style = item->style; - int jointype = i_style->stroke_linejoin.value; - int captype = i_style->stroke_linecap.value; o_width = i_style->stroke_width.computed; - if (jointype == SP_STROKE_LINEJOIN_MITER) - { - o_join = join_pointy; - } - else if (jointype == SP_STROKE_LINEJOIN_ROUND) - { - o_join = join_round; - } - else - { - o_join = join_straight; - } - if (captype == SP_STROKE_LINECAP_SQUARE) - { - o_butt = butt_square; - } - else if (captype == SP_STROKE_LINECAP_ROUND) - { - o_butt = butt_round; - } - else - { - o_butt = butt_straight; - } - { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); o_width = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); } - if (o_width < 0.01) + if (o_width < 0.01){ o_width = 0.01; - o_miter = i_style->stroke_miterlimit.value * o_width; + } } Path *orig = Path_for_item(item, true, false); @@ -1707,7 +1677,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *nitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *nitem = reinterpret_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr)); if ( !updating ) { // delete original, apply the transform to the offset diff --git a/src/spray-context.cpp b/src/spray-context.cpp index 694e3a500..6a5684891 100644 --- a/src/spray-context.cpp +++ b/src/spray-context.cpp @@ -610,19 +610,6 @@ static void sp_spray_switch_mode(SPSprayContext *tc, gint mode, bool with_shift) sp_spray_update_cursor(tc, with_shift); } -static void sp_spray_switch_mode_temporarily(SPSprayContext *tc, gint mode, bool with_shift) -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - // Juggling about so that prefs have the old value but tc->mode and the button show new mode: - gint now_mode = prefs->getInt("/tools/spray/mode", 0); - SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue("spray_tool_mode", mode); - // button has changed prefs, restore - prefs->setInt("/tools/spray/mode", now_mode); - // changing prefs changed tc->mode, restore back :) - tc->mode = mode; - sp_spray_update_cursor(tc, with_shift); -} - gint sp_spray_context_root_handler(SPEventContext *event_context, GdkEvent *event) { SPSprayContext *tc = SP_SPRAY_CONTEXT(event_context); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 47b4d35ac..401f56bb2 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -69,7 +69,7 @@ void te_update_layout_now_recursive(SPItem *item) if (SP_IS_GROUP(item)) { GSList *item_list = sp_item_group_item_list(SP_GROUP(item)); for(GSList* elem = item_list; elem; elem = elem->next) { - SPItem* list_item = (SPItem*) elem->data; + SPItem* list_item = static_cast<SPItem*>(elem->data); te_update_layout_now_recursive(list_item); } g_slist_free(item_list); diff --git a/src/trace/quantize.cpp b/src/trace/quantize.cpp index ba9306da8..c386c0ee9 100644 --- a/src/trace/quantize.cpp +++ b/src/trace/quantize.cpp @@ -192,6 +192,7 @@ static void octreeDelete(pool<Ocnode> *pool, Ocnode *node) /** * pretty-print an octree, debugging purposes */ +#if 0 static void ocnodePrint(Ocnode *node, int indent) { if (!node) return; @@ -213,7 +214,6 @@ static void ocnodePrint(Ocnode *node, int indent) } } -#if 0 void octreePrint(Ocnode *node) { printf("<<octree>>\n"); diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 9376fad66..1a1426b83 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -591,7 +591,7 @@ bool SioxImage::writePPM(const std::string &fileName) if (!f) return false; - fprintf(f, "P6 %d %d 255\n", width, height); + fprintf(f, "P6 %u %u 255\n", width, height); for (unsigned int y=0 ; y<height; y++) { @@ -933,7 +933,7 @@ SioxImage Siox::extractForeground(const SioxImage &originalImage, //trace("### bgSignature:%d", bgSignature.size()); - if (bgSignature.size() < 1) + if (bgSignature.empty()) { // segmentation impossible error("Signature size is < 1. Segmentation is impossible"); diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index b14f27b8b..62e6ce3a3 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -31,29 +31,18 @@ namespace { std::map<Inkscape::ControlType, std::vector<int> > sizeTable; // Note: The following operator overloads are local to this file at the moment to discourage flag manipulation elsewhere. - +/* ControlFlags operator |(ControlFlags lhs, ControlFlags rhs) { return static_cast<ControlFlags>(static_cast<int>(lhs) | static_cast<int>(rhs)); } - -ControlFlags& operator |=(ControlFlags &lhs, ControlFlags rhs) -{ - lhs = lhs | rhs; - return lhs; -} +*/ ControlFlags operator &(ControlFlags lhs, ControlFlags rhs) { return static_cast<ControlFlags>(static_cast<int>(lhs) & static_cast<int>(rhs)); } -ControlFlags& operator &=(ControlFlags &lhs, ControlFlags rhs) -{ - lhs = lhs & rhs; - return lhs; -} - ControlFlags operator ^(ControlFlags lhs, ControlFlags rhs) { return static_cast<ControlFlags>(static_cast<int>(lhs) ^ static_cast<int>(rhs)); diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index faba47769..993f48d8f 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -53,10 +53,7 @@ #include "ui/dialog/export.h" #include "ui/dialog/xml-tree.h" #include "ui/dialog/clonetiler.h" - -#ifdef ENABLE_SVG_FONTS #include "ui/dialog/svg-fonts-dialog.h" -#endif // ENABLE_SVG_FONTS namespace Inkscape { namespace UI { @@ -118,9 +115,7 @@ DialogManager::DialogManager() { registerFactory("ObjectProperties", &create<ObjectProperties, FloatingBehavior>); // registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, FloatingBehavior>); registerFactory("Script", &create<ScriptDialog, FloatingBehavior>); -#ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create<SvgFontsDialog, FloatingBehavior>); -#endif registerFactory("Swatches", &create<SwatchesPanel, FloatingBehavior>); registerFactory("Symbols", &create<SymbolsDialog, FloatingBehavior>); registerFactory("TileDialog", &create<TileDialog, FloatingBehavior>); @@ -154,9 +149,7 @@ DialogManager::DialogManager() { registerFactory("ObjectProperties", &create<ObjectProperties, DockBehavior>); // registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, DockBehavior>); registerFactory("Script", &create<ScriptDialog, DockBehavior>); -#ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create<SvgFontsDialog, DockBehavior>); -#endif registerFactory("Swatches", &create<SwatchesPanel, DockBehavior>); registerFactory("Symbols", &create<SymbolsDialog, DockBehavior>); registerFactory("TileDialog", &create<TileDialog, DockBehavior>); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 045b34814..d335fb303 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -792,8 +792,6 @@ void DocumentProperties::build_scripting() _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); #endif - row++; - //# Set up the External Scripts box _ExternalScriptsListStore = Gtk::ListStore::create(_ExternalScriptsListColumns); _ExternalScriptsList.set_model(_ExternalScriptsListStore); diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 66c9e6ed0..99a8c08d2 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -133,6 +133,15 @@ namespace Inkscape { namespace UI { namespace Dialog { +/** A list of strings that is used both in the preferences, and in the + data fields to describe the various values of \c selection_type. */ +static const char * selection_names[SELECTION_NUMBER_OF] = { + "page", "drawing", "selection", "custom"}; + +/** The names on the buttons for the various selection types. */ +static const char * selection_labels[SELECTION_NUMBER_OF] = { + N_("_Page"), N_("_Drawing"), N_("_Selection"), N_("_Custom")}; + Export::Export (void) : UI::Widget::Panel ("", "/dialogs/export/", SP_VERB_DIALOG_EXPORT), current_key(SELECTION_PAGE), @@ -419,7 +428,6 @@ void Export::set_default_filename () { if ( SP_ACTIVE_DOCUMENT && SP_ACTIVE_DOCUMENT->getURI() ) { - gchar *name; SPDocument * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = doc->getURI(); const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str(); @@ -448,7 +456,7 @@ void Export::set_default_filename () { g_free(uri_copy); } } else { - name = g_strconcat(uri, ".png", NULL); + gchar *name = g_strconcat(uri, ".png", NULL); filename_entry.set_text(name); filename_entry.set_position(strlen(name)); @@ -1317,7 +1325,7 @@ void Export::onBrowse () WCHAR _filename[_MAX_PATH + 1]; memset(_filename, 0, sizeof(_filename)); gunichar2* utf16_path_string = g_utf8_to_utf16(filename.c_str(), -1, NULL, NULL, NULL); - wcsncpy(_filename, (wchar_t*)utf16_path_string, _MAX_PATH); + wcsncpy(_filename, reinterpret_cast<wchar_t*>(utf16_path_string), _MAX_PATH); g_free(utf16_path_string); opf.hwndOwner = (HWND)(GDK_WINDOW_HWND(gtk_widget_get_window(GTK_WIDGET(this)))); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 202443a78..b10c98fd2 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -35,7 +35,6 @@ namespace Inkscape { namespace UI { namespace Dialog { - /** What type of button is being pressed */ enum selection_type { SELECTION_PAGE = 0, /**< Export the whole page */ @@ -45,16 +44,6 @@ enum selection_type { SELECTION_NUMBER_OF /**< A counter for the number of these guys */ }; -/** A list of strings that is used both in the preferences, and in the - data fields to describe the various values of \c selection_type. */ -static const char * selection_names[SELECTION_NUMBER_OF] = { - "page", "drawing", "selection", "custom"}; - -/** The names on the buttons for the various selection types. */ -static const char * selection_labels[SELECTION_NUMBER_OF] = { - N_("_Page"), N_("_Drawing"), N_("_Selection"), N_("_Custom")}; - - /** * A dialog widget to export to various image formats such as bitmap and png. * diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 75f80ed4a..cb6d92799 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1068,7 +1068,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, std::vector<Gtk::Entry *> entries; findEntryWidgets(cont, entries); //g_message("Found %d entry widgets\n", entries.size()); - if (entries.size() >=1 ) + if (!entries.empty()) { //Catch when user hits [return] on the text field fileNameEntry = entries[0]; @@ -1080,7 +1080,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, std::vector<Gtk::Expander *> expanders; findExpanderWidgets(cont, expanders); //g_message("Found %d expander widgets\n", expanders.size()); - if (expanders.size() >=1 ) + if (!expanders.empty()) { //Always show the file list Gtk::Expander *expander = expanders[0]; @@ -1639,7 +1639,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow, std::vector<Gtk::Entry *> entries; findEntryWidgets(cont, entries); //g_message("Found %d entry widgets\n", entries.size()); - if (entries.size() >=1 ) + if (!entries.empty()) { //Catch when user hits [return] on the text field fileNameEntry = entries[0]; @@ -1651,7 +1651,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow, std::vector<Gtk::Expander *> expanders; findExpanderWidgets(cont, expanders); //g_message("Found %d expander widgets\n", expanders.size()); - if (expanders.size() >=1 ) + if (!expanders.empty()) { //Always show the file list Gtk::Expander *expander = expanders[0]; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 989c40264..5afc85f10 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -945,13 +945,11 @@ private: and all widgets within the setting group are aligned automatically. */ void add_widget(Gtk::Widget* w, const Glib::ustring& label) { - Gtk::Label *lbl = 0; Gtk::HBox *hb = Gtk::manage(new Gtk::HBox); hb->set_spacing(12); if(label != "") { - //lbl = Gtk::manage(new Gtk::Label(label + (label == "" ? "" : ":"), Gtk::ALIGN_LEFT)); colon now in label (LP #358921) - lbl = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START)); + Gtk::Label *lbl = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START)); hb->pack_start(*lbl, false, false); _size_group->add_widget(*lbl); lbl->show(); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 0da39dd73..bce63093d 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -15,8 +15,6 @@ # include <config.h> #endif -#ifdef ENABLE_SVG_FONTS - #include "svg-fonts-dialog.h" #include "document-private.h" #include "document-undo.h" @@ -945,8 +943,6 @@ SvgFontsDialog::~SvgFontsDialog(){} } // namespace UI } // namespace Inkscape -#endif //#ifdef ENABLE_SVG_FONTS - /* Local Variables: mode:c++ diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 67c6578f9..c87e94fc6 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -424,12 +424,11 @@ void TextEdit::onSelectionChange() void TextEdit::updateObjectText ( SPItem *text ) { GtkTextIter start, end; - gchar *str; // write text if (gtk_text_buffer_get_modified (text_buffer)) { gtk_text_buffer_get_bounds (text_buffer, &start, &end); - str = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE); + gchar *str = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE); sp_te_set_repr_text_multiline (text, str); g_free (str); gtk_text_buffer_set_modified (text_buffer, FALSE); diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 1f074c8da..629608242 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -65,7 +65,6 @@ typedef std::pair<double, IterPair> DistanceMapItem; void find_join_iterators(ControlPointSelection &sel, IterPairList &pairs) { IterSet join_iters; - DistanceMap dists; // find all endnodes in selection for (ControlPointSelection::iterator i = sel.begin(); i != sel.end(); ++i) { diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index fbb9c0e24..7b1a8dbfb 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -163,17 +163,6 @@ LayerSelector::~LayerSelector() { _selection_changed_connection.disconnect(); } -namespace { - -/** Helper function - detaches desktop from selector - */ -bool detach(LayerSelector *selector) { - selector->setDesktop(NULL); - return FALSE; -} - -} - /** Sets the desktop for the widget. First disconnects signals * for the current desktop, then stores the pointer to the * given \a desktop, and attaches its signals to this one. diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 8ecd36af2..c729354cb 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -79,7 +79,8 @@ void LicenseItem::on_toggled() //--------------------------------------------------- Licensor::Licensor() -: Gtk::VBox(false,4) +: Gtk::VBox(false,4), + _eentry (NULL) { } diff --git a/src/verbs.cpp b/src/verbs.cpp index cdeeab99a..f8bfbab40 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -39,7 +39,6 @@ #include "bind/javabind.h" #include "desktop.h" #include "desktop-handles.h" -#include "dialogs/find.h" #include "display/curve.h" #include "document.h" #include "draw-context.h" diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 7e9f9c484..6ea20b87a 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -69,71 +69,6 @@ static void sp_xml_ns_register_defaults(); static char *sp_xml_ns_auto_prefix(char const *uri); /*##################### -# UTILITY -#####################*/ - -/** - * Locale-independent double to string conversion - */ -static unsigned int sp_xml_dtoa(gchar *buf, double val, unsigned int tprec, unsigned int fprec, unsigned int padf) -{ - double dival, fval, epsilon; - int idigits, ival, i; - i = 0; - if (val < 0.0) { - buf[i++] = '-'; - val = -val; - } - /* Determine number of integral digits */ - if (val >= 1.0) { - idigits = (int) floor(log10(val)); - } else { - idigits = 0; - } - /* Determine the actual number of fractional digits */ - fprec = MAX(fprec, tprec - idigits); - /* Find epsilon */ - epsilon = 0.5 * pow(10.0, - (double) fprec); - /* Round value */ - val += epsilon; - /* Extract integral and fractional parts */ - dival = floor(val); - ival = (int) dival; - fval = val - dival; - /* Write integra */ - if (ival > 0) { - char c[32]; - int j; - j = 0; - while (ival > 0) { - c[32 - (++j)] = '0' + (ival % 10); - ival /= 10; - } - memcpy(buf + i, &c[32 - j], j); - i += j; - tprec -= j; - } else { - buf[i++] = '0'; - tprec -= 1; - } - if ((fprec > 0) && (padf || (fval > epsilon))) { - buf[i++] = '.'; - while ((fprec > 0) && (padf || (fval > epsilon))) { - fval *= 10.0; - dival = floor(fval); - fval -= dival; - buf[i++] = '0' + (int) dival; - fprec -= 1; - } - - } - buf[i] = 0; - return i; -} - - - -/*##################### # MAIN #####################*/ |
