diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 9d50018e9c6d1e9b3780663b4920f992be0416c3..720cebbedc0efbba201efc66060ec85a54dd2eab 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
#include "io/sys.h"
+#include "helper/png-write.h"
+
#define SP_EXPORT_MIN_SIZE 1.0
Gtk::Button *b = new Gtk::Button();
Gtk::HBox* pixlabel = new Gtk::HBox(false, 3);
- Gtk::Image *im = new Gtk::Image(Gtk::StockID(Gtk::Stock::DIRECTORY),
+ Gtk::Image *im = new Gtk::Image(Gtk::StockID(Gtk::Stock::INDEX),
Gtk::ICON_SIZE_BUTTON);
pixlabel->pack_start(*im);
case SELECTION_DRAWING:
if ( SP_ACTIVE_DESKTOP ) {
SPDocument *doc;
- NRRect bbox;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), &bbox);
+ NR::Rect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
- if (!(bbox.x0 > bbox.x1 && bbox.y0 > bbox.y1)) {
- sp_export_set_area (base, bbox.x0, bbox.y0, bbox.x1, bbox.y1);
+ if (!(bbox.min()[NR::X] > bbox.max()[NR::X] &&
+ bbox.min()[NR::Y] > bbox.max()[NR::Y])) {
+ sp_export_set_area (base, bbox.min()[NR::X],
+ bbox.min()[NR::Y],
+ bbox.max()[NR::X],
+ bbox.max()[NR::Y]);
}
}
break;
if ( SP_ACTIVE_DESKTOP )
{
SPDocument *doc;
- NRRect bbox;
+ NR::Rect bbox;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
/* Notice how the switch is used to 'fall through' here to get
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false)
{
- (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds(&bbox);
+ bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
/* Only if there is a selection that we can set
do we break, otherwise we fall through to the
drawing */
/** \todo
* This returns wrong values if the document has a viewBox.
*/
- sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), &bbox);
+ bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
/* If the drawing is valid, then we'll use it and break
otherwise we drop through to the page settings */
- if (!(bbox.x0 > bbox.x1 && bbox.y0 > bbox.y1)) {
+ if (!(bbox.min()[NR::X] > bbox.max()[NR::X] &&
+ bbox.min()[NR::Y] > bbox.max()[NR::Y])) {
// std::cout << "Using selection: DRAWING" << std::endl;
key = SELECTION_DRAWING;
break;
}
case SELECTION_PAGE:
- bbox.x0 = 0.0;
- bbox.y0 = 0.0;
- bbox.x1 = sp_document_width (doc);
- bbox.y1 = sp_document_height (doc);
+ bbox = NR::Rect(NR::Point(0.0, 0.0),
+ NR::Point(sp_document_width(doc), sp_document_height(doc))
+ );
+
// std::cout << "Using selection: PAGE" << std::endl;
key = SELECTION_PAGE;
break;
"value", selection_names[key]);
if (key != SELECTION_CUSTOM) {
- sp_export_set_area (base, bbox.x0, bbox.y0, bbox.x1, bbox.y1);
+ sp_export_set_area (base, bbox.min()[NR::X],
+ bbox.min()[NR::Y],
+ bbox.max()[NR::X],
+ bbox.max()[NR::Y]);
}
} // end of if ( SP_ACTIVE_DESKTOP )
/* Do export */
if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), filename,
- x0, y0, x1, y1, width, height,
+ x0, y0, x1, y1, width, height, xdpi, ydpi,
nv->pagecolor,
sp_export_progress_callback, base)) {
gchar * error;
case SELECTION_DRAWING: {
SPDocument * doc = SP_ACTIVE_DOCUMENT;
Inkscape::XML::Node * repr = sp_document_repr_root(doc);
- bool modified = FALSE;
+ bool modified = false;
const gchar * temp_string;
bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, FALSE);
+ sp_document_set_undo_sensitive(doc, false);
temp_string = repr->attribute("inkscape:export-filename");
if (temp_string == NULL || strcmp(temp_string, filename)) {
repr->setAttribute("inkscape:export-filename", filename);
- modified = TRUE;
+ modified = true;
}
temp_string = repr->attribute("inkscape:export-xdpi");
if (temp_string == NULL || xdpi != atof(temp_string)) {
sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
- modified = TRUE;
+ modified = true;
}
temp_string = repr->attribute("inkscape:export-ydpi");
if (temp_string == NULL || xdpi != atof(temp_string)) {
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
- modified = TRUE;
+ modified = true;
}
if (modified)
case SELECTION_SELECTION: {
const GSList * reprlst;
SPDocument * doc = SP_ACTIVE_DOCUMENT;
- bool modified = FALSE;
+ bool modified = false;
bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, FALSE);
+ sp_document_set_undo_sensitive(doc, false);
reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
for(; reprlst != NULL; reprlst = reprlst->next) {
temp_string = repr->attribute("inkscape:export-filename");
if (temp_string == NULL || strcmp(temp_string, filename)) {
repr->setAttribute("inkscape:export-filename", filename);
- modified = TRUE;
+ modified = true;
}
}
temp_string = repr->attribute("inkscape:export-xdpi");
if (temp_string == NULL || xdpi != atof(temp_string)) {
sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
- modified = TRUE;
+ modified = true;
}
temp_string = repr->attribute("inkscape:export-ydpi");
if (temp_string == NULL || xdpi != atof(temp_string)) {
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
- modified = TRUE;
+ modified = true;
}
}