diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-03-10 20:36:05 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-03-10 20:36:05 +0000 |
| commit | 8db86f8405ff74e590566bfd552d1c23f00bdf5b (patch) | |
| tree | 2913da86831eb11925cdc4d978982507dfe8e751 /src/extension | |
| parent | Add pencil BSpline mode (diff) | |
| parent | Migrate Object Properties dialog to Gtk::Grid (diff) | |
| download | inkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.tar.gz inkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.zip | |
Merge from trunk
(bzr r11950.1.50)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/error-file.cpp | 4 | ||||
| -rw-r--r-- | src/extension/extension.cpp | 26 | ||||
| -rw-r--r-- | src/extension/extension.h | 10 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 112 | ||||
| -rw-r--r-- | src/extension/internal/pdf-input-cairo.cpp | 8 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 8 | ||||
| -rw-r--r-- | src/extension/prefdialog.cpp | 15 |
8 files changed, 138 insertions, 49 deletions
diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index 2a56f55e8..778295f47 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -56,7 +56,11 @@ ErrorFileNotice::ErrorFileNotice (void) : g_free(ext_error_file); set_message(dialog_text, true); +#if WITH_GTKMM_3_0 + Gtk::Box * vbox = get_content_area(); +#else Gtk::Box * vbox = get_vbox(); +#endif /* This is some filler text, needs to change before relase */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 4e2c5b9e4..28f556e75 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -19,12 +19,16 @@ # include "config.h" #endif - #include <glibmm/i18n.h> #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/frame.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif #include "inkscape.h" #include "extension/implementation/implementation.h" @@ -720,7 +724,12 @@ Extension::get_info_widget(void) Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information")); retval->pack_start(*info, true, true, 5); +#if WITH_GTKMM_3_0 + Gtk::Grid * table = Gtk::manage(new Gtk::Grid()); +#else Gtk::Table * table = Gtk::manage(new Gtk::Table()); +#endif + info->add(*table); int row = 0; @@ -733,8 +742,11 @@ Extension::get_info_widget(void) return retval; } -void -Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row) +#if WITH_GTKMM_3_0 +void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row) +#else +void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row) +#endif { Gtk::Label * label; Gtk::Label * value; @@ -742,8 +754,14 @@ Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * (*row)++; label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); + +#if WITH_GTKMM_3_0 + table->attach(*label, 0, (*row) - 1, 1, 1); + table->attach(*value, 1, (*row) - 1, 1, 1); +#else table->attach(*label, 0, 1, (*row) - 1, *row); table->attach(*value, 1, 2, (*row) - 1, *row); +#endif label->show(); value->show(); diff --git a/src/extension/extension.h b/src/extension/extension.h index 78999631a..dcabb3df7 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -22,7 +22,12 @@ #include <sigc++/signal.h> namespace Gtk { +#if WITH_GTKMM_3_0 + class Grid; +#else class Table; +#endif + class VBox; class Widget; } @@ -285,8 +290,11 @@ public: Gtk::VBox * get_help_widget(void); Gtk::VBox * get_params_widget(void); protected: +#if WITH_GTKMM_3_0 + inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row); +#else inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row); - +#endif }; diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index fa46569e2..3ac1e06ab 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -854,7 +854,11 @@ void Script::checkStderr (const Glib::ustring &data, GtkWidget *dlg = GTK_WIDGET(warning.gobj()); sp_transientize(dlg); +#if WITH_GTKMM_3_0 + Gtk::Box * vbox = warning.get_content_area(); +#else Gtk::Box * vbox = warning.get_vbox(); +#endif /* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */ Gtk::TextView * textview = new Gtk::TextView(); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index bd74ba47c..7634c7aa1 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -15,8 +15,10 @@ * Authors: * Bob Jamison * Abhishek Sharma + * Kris De Gussem * * Copyright (C) 2006, 2007 Bob Jamison + * Copyright (C) 2013 Kris De Gussem * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1180,7 +1182,7 @@ bool OdfOutput::writeManifest(ZipFile &zf) else if (ext == ".jpg") outs.printf("image/jpeg"); outs.printf("\" manifest:full-path=\""); - outs.printf(newName.c_str()); + outs.writeString(newName.c_str()); outs.printf("\"/>\n"); } outs.printf("</manifest:manifest>\n"); @@ -1241,7 +1243,7 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.printf("office:version=\"1.0\">\n"); outs.printf("<office:meta>\n"); Glib::ustring tmp = Glib::ustring(" <meta:generator>Inkscape.org - ") + Inkscape::version_string + "</meta:generator>\n"; - outs.writeString(tmp); + outs.writeUString(tmp); outs.printf(" <meta:initial-creator>%#s</meta:initial-creator>\n", creator.c_str()); outs.printf(" <meta:creation-date>%#s</meta:creation-date>\n", date.c_str()); @@ -1889,35 +1891,47 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, if (nodeName == "svg" || nodeName == "svg:svg") - { + { //# Iterate through the children for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next()) - { + { if (!writeTree(couts, souts, child)) + { return false; } - return true; } + return true; + } else if (nodeName == "g" || nodeName == "svg:g") + { + if (!id.empty()) { - if (id.size() > 0) couts.printf("<draw:g id=\"%s\">\n", id.c_str()); + } else + { couts.printf("<draw:g>\n"); + } //# Iterate through the children for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next()) - { + { if (!writeTree(couts, souts, child)) + { return false; } - if (id.size() > 0) + } + if (!id.empty()) + { couts.printf("</draw:g> <!-- id=\"%s\" -->\n", id.c_str()); + } else + { couts.printf("</draw:g>\n"); - return true; } + return true; + } //###################################### //# S T Y L E @@ -1930,19 +1944,17 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, processGradient(souts, item, id, tf); - - //###################################### //# I T E M D A T A //###################################### //g_message("##### %s #####", nodeName.c_str()); if (nodeName == "image" || nodeName == "svg:image") - { + { if (!SP_IS_IMAGE(item)) - { + { g_warning("<image> is not an SPImage. Why? ;-)"); return false; - } + } SPImage *img = SP_IMAGE(item); double ix = img->x.value; @@ -1954,8 +1966,6 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, ibbox = ibbox * tf; ix = ibbox.min()[Geom::X]; iy = ibbox.min()[Geom::Y]; - //iwidth = ibbox.max()[Geom::X] - ibbox.min()[Geom::X]; - //iheight = ibbox.max()[Geom::Y] - ibbox.min()[Geom::Y]; iwidth = xscale * iwidth; iheight = yscale * iheight; @@ -1966,29 +1976,30 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, Glib::ustring href = getAttribute(node, "xlink:href"); std::map<Glib::ustring, Glib::ustring>::iterator iter = imageTable.find(href); if (iter == imageTable.end()) - { + { g_warning("image '%s' not in table", href.c_str()); return false; - } + } Glib::ustring newName = iter->second; couts.printf("<draw:frame "); - if (id.size() > 0) + if (!id.empty()) + { couts.printf("id=\"%s\" ", id.c_str()); + } couts.printf("draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:layer=\"layout\" "); //no x or y. make them the translate transform, last one couts.printf("svg:width=\"%.3fcm\" svg:height=\"%.3fcm\" ", iwidth, iheight); - if (itemTransformString.size() > 0) - { + if (!itemTransformString.empty()) + { couts.printf("draw:transform=\"%s translate(%.3fcm, %.3fcm)\" ", itemTransformString.c_str(), ix, iy); - } + } else - { - couts.printf("draw:transform=\"translate(%.3fcm, %.3fcm)\" ", - ix, iy); - } + { + couts.printf("draw:transform=\"translate(%.3fcm, %.3fcm)\" ", ix, iy); + } couts.printf(">\n"); couts.printf(" <draw:image xlink:href=\"%s\" xlink:type=\"simple\"\n", @@ -1998,41 +2009,41 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, couts.printf(" </draw:image>\n"); couts.printf("</draw:frame>\n"); return true; - } + } else if (SP_IS_SHAPE(item)) - { - //g_message("### %s is a shape", nodeName.c_str()); + { curve = SP_SHAPE(item)->getCurve(); - } + } else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) - { + { curve = te_get_layout(item)->convertToCurves(); - } + } if (curve) - { + { //### Default <path> output - couts.printf("<draw:path "); - if (id.size()>0) + if (!id.empty()) + { couts.printf("id=\"%s\" ", id.c_str()); + } std::map<Glib::ustring, Glib::ustring>::iterator siter; siter = styleLookupTable.find(id); if (siter != styleLookupTable.end()) - { + { Glib::ustring styleName = siter->second; couts.printf("draw:style-name=\"%s\" ", styleName.c_str()); - } + } std::map<Glib::ustring, Glib::ustring>::iterator giter; giter = gradientLookupTable.find(id); if (giter != gradientLookupTable.end()) - { + { Glib::ustring gradientName = giter->second; couts.printf("draw:fill-gradient-name=\"%s\" ", gradientName.c_str()); - } + } couts.printf("draw:layer=\"layout\" svg:x=\"%.3fcm\" svg:y=\"%.3fcm\" ", bbox_x, bbox_y); @@ -2052,7 +2063,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, curve->unref(); - } + } return true; } @@ -2304,29 +2315,40 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node) OutputStreamWriter couts(cbouts); if (!writeContentHeader(couts)) + { return false; + } //Style.xml stream BufferOutputStream sbouts; OutputStreamWriter souts(sbouts); if (!writeStyleHeader(souts)) + { return false; - + } //# Descend into the tree, doing all of our conversions - //# to both files as the same time + //# to both files at the same time + char *oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL)); + setlocale (LC_NUMERIC, "C"); if (!writeTree(couts, souts, node)) - { + { g_warning("Failed to convert SVG tree"); + setlocale (LC_NUMERIC, oldlocale); + g_free (oldlocale); return false; - } + } + setlocale (LC_NUMERIC, oldlocale); + g_free (oldlocale); //# Finish content file if (!writeContentFooter(couts)) + { return false; + } ZipEntry *ze = zf.newEntry("content.xml", "ODF master content file"); ze->setUncompressedData(cbouts.getBuffer()); @@ -2336,7 +2358,9 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node) //# Finish style file if (!writeStyleFooter(souts)) + { return false; + } ze = zf.newEntry("styles.xml", "ODF style file"); ze->setUncompressedData(sbouts.getBuffer()); diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index d3c6c5931..c83ebad82 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -224,9 +224,17 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); hbox1->pack_start(*vbox1); hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4); + +#if WITH_GTKMM_3_0 + get_content_area()->set_homogeneous(false); + get_content_area()->set_spacing(0); + get_content_area()->pack_start(*hbox1); +#else this->get_vbox()->set_homogeneous(false); this->get_vbox()->set_spacing(0); this->get_vbox()->pack_start(*hbox1); +#endif + this->set_title(_("PDF Import Settings")); this->set_modal(true); sp_transientize(GTK_WIDGET(this->gobj())); //Make transient diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 535deafce..531cda20a 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -240,9 +240,17 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); hbox1->pack_start(*vbox1); hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4); + +#if WITH_GTKMM_3_0 + get_content_area()->set_homogeneous(false); + get_content_area()->set_spacing(0); + get_content_area()->pack_start(*hbox1); +#else this->get_vbox()->set_homogeneous(false); this->get_vbox()->set_spacing(0); this->get_vbox()->pack_start(*hbox1); +#endif + this->set_title(_("PDF Import Settings")); this->set_modal(true); sp_transientize(GTK_WIDGET(this->gobj())); //Make transient diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 649dc398a..f3c6508af 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -67,7 +67,12 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox->pack_start(*controls, true, true, 6); hbox->show(); + +#if WITH_GTKMM_3_0 + this->get_content_area()->pack_start(*hbox, true, true, 6); +#else this->get_vbox()->pack_start(*hbox, true, true, 6); +#endif /* Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); @@ -95,14 +100,24 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co #endif sep->show(); + +#if WITH_GTKMM_3_0 + this->get_content_area()->pack_start(*sep, true, true, 4); +#else this->get_vbox()->pack_start(*sep, true, true, 4); +#endif hbox = Gtk::manage(new Gtk::HBox()); _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); _button_preview->show(); hbox->pack_start(*_button_preview, true, true,6); hbox->show(); + +#if WITH_GTKMM_3_0 + this->get_content_area()->pack_start(*hbox, true, true, 6); +#else this->get_vbox()->pack_start(*hbox, true, true, 6); +#endif Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview); if (hbox != NULL) { |
