Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / widgets / stroke-style.cpp
index 65732d4885312572df5746297d0194c0ddeb3fe3..ffcbe48f88ed1e5b43579919bedba5816358c091 100644 (file)
@@ -7,6 +7,8 @@
  *   bulia byak <buliabyak@users.sf.net>
  *   Maximilian Albert <maximilian.albert@gmail.com>
  *   Josh Andler <scislac@users.sf.net>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2001-2005 authors
  * Copyright (C) 2001 Ximian, Inc.
@@ -59,6 +61,8 @@
 #include "fill-style.h" // to get sp_fill_style_widget_set_desktop
 #include "fill-n-stroke-factory.h"
 
+using Inkscape::DocumentUndo;
+
 /** Marker selection option menus */
 static Gtk::OptionMenu * marker_start_menu = NULL;
 static Gtk::OptionMenu * marker_mid_menu = NULL;
@@ -156,7 +160,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
         return NULL;
 
     // Create a copy repr of the marker with id="sample"
-    Inkscape::XML::Document *xml_doc = sp_document_repr_doc(sandbox);
+    Inkscape::XML::Document *xml_doc = sandbox->getReprDoc();
     Inkscape::XML::Node *mrepr = SP_OBJECT_REPR (marker)->duplicate(xml_doc);
     mrepr->setAttribute("id", "sample");
 
@@ -170,13 +174,13 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
 
 // Uncomment this to get the sandbox documents saved (useful for debugging)
     //FILE *fp = fopen (g_strconcat(menu_id, mname, ".svg", NULL), "w");
-    //sp_repr_save_stream (sp_document_repr_doc (sandbox), fp);
+    //sp_repr_save_stream(sandbox->getReprDoc(), fp);
     //fclose (fp);
 
     // object to render; note that the id is the same as that of the menu we're building
     SPObject *object = sandbox->getObjectById(menu_id);
-    sp_document_root (sandbox)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-    sandbox->ensure_up_to_date();
+    sandbox->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+    sandbox->ensureUpToDate();
 
     if (object == NULL || !SP_IS_ITEM(object))
         return NULL; // sandbox broken?
@@ -193,7 +197,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
     double sf = 0.8;
 
     gchar *cache_name = g_strconcat(menu_id, mname, NULL);
-    Glib::ustring key = svg_preview_cache.cache_key(source->uri, cache_name, psize);
+    Glib::ustring key = svg_preview_cache.cache_key(source->getURI(), cache_name, psize);
     g_free (cache_name);
     // TODO: is this correct?
     Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(svg_preview_cache.get_preview_from_cache(key));
@@ -221,9 +225,7 @@ ink_marker_list_get (SPDocument *source)
 
     GSList *ml   = NULL;
     SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS (source);
-    for ( SPObject *child = SP_OBJECT(defs)->first_child();
-          child != NULL;
-          child = SP_OBJECT_NEXT (child) )
+    for ( SPObject *child = SP_OBJECT(defs)->firstChild(); child; child = child->getNext() )
     {
         if (SP_IS_MARKER(child)) {
             ml = g_slist_prepend (ml, child);
@@ -243,7 +245,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD
     // Do this here, outside of loop, to speed up preview generation:
     NRArena const *arena = NRArena::create();
     unsigned const visionkey = SPItem::display_key_new(1);
-    NRArenaItem *root =  SP_ITEM(SP_DOCUMENT_ROOT (sandbox))->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
+    NRArenaItem *root =  SP_ITEM(sandbox->getRoot())->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
 
     for (; marker_list != NULL; marker_list = marker_list->next) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) marker_list->data);
@@ -280,7 +282,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD
         m->append(*i);
     }
 
-    SP_ITEM(sp_document_root(sandbox))->invoke_hide(visionkey);
+    SP_ITEM(sandbox->getRoot())->invoke_hide(visionkey);
     nr_object_unref((NRObject *) arena);
 }
 
@@ -391,7 +393,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc,
 
     // suck in from markers.svg
     if (markers_doc) {
-        doc->ensure_up_to_date();
+        doc->ensureUpToDate();
         sp_marker_list_from_doc(m, doc, markers_doc, NULL, sandbox, menu_id);
     }
 
@@ -498,8 +500,8 @@ sp_marker_select(Gtk::OptionMenu *mnu, Gtk::Container *spw, SPMarkerLoc const wh
     sp_repr_css_attr_unref(css);
     css = 0;
 
-    SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-                     _("Set markers"));
+    DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+                       _("Set markers"));
 
 };
 
@@ -671,10 +673,7 @@ sp_stroke_style_line_widget_new(void)
 
     gint i = 0;
 
-    //TRANSLATORS: only translate "string" in "context|string".
-    // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
-    /* Stroke width */
-    spw_label(t, Q_("StrokeWidth|Width:"), 0, i);
+    spw_label(t, C_("Stroke width", "Width:"), 0, i);
 
     hb = spw_hbox(t, 3, 1, i);
 
@@ -1203,8 +1202,8 @@ sp_stroke_style_scale_line(Gtk::Container *spw)
     sp_repr_css_attr_unref(css);
     css = 0;
 
-    SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-                     _("Set stroke style"));
+    DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+                       _("Set stroke style"));
 
     spw->set_data("update", GINT_TO_POINTER(FALSE));
 }
@@ -1300,8 +1299,8 @@ sp_stroke_style_any_toggled(Gtk::ToggleButton *tb, Gtk::Container *spw)
         sp_repr_css_attr_unref(css);
         css = 0;
 
-        SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE,
-                         _("Set stroke style"));
+        DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE,
+                           _("Set stroke style"));
     }
 }
 
@@ -1474,4 +1473,4 @@ ink_extract_marker_name(gchar const *n, SPDocument *doc)
   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 :