summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56ad016)
raw | patch | inline | side by side (parent: 56ad016)
author | joncruz <joncruz@users.sourceforge.net> | |
Mon, 17 Dec 2007 06:33:24 +0000 (06:33 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Mon, 17 Dec 2007 06:33:24 +0000 (06:33 +0000) |
Warning and CRLF cleanup
src/extension/internal/pdfinput/pdf-input.cpp | patch | blob | history | |
src/widgets/layer-selector.cpp | patch | blob | history |
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 9b671a7c386c362a737be838f9e2cf605e37938a..537837efa3d3ac249c52963666e6fb3c2d586704 100644 (file)
/** \file
* Native PDF import using libpoppler.
- *
+ *
* Authors:
* miklos erdelyi
*
namespace Inkscape {
namespace Extension {
namespace Internal {
-\r
+
/**
* \brief The PDF import dialog
* FIXME: Probably this should be placed into src/ui/dialog
Glib::ustring(_("art box"))
};
-PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar *uri)
+PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
{
+#ifdef HAVE_POPPLER_CAIRO
_poppler_doc = NULL;
+#endif // HAVE_POPPLER_CAIRO
_pdf_doc = doc;
cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
_pageSettingsFrame = Gtk::manage(new class Gtk::Frame());
_labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:")));
_labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance.")));
-
+
_fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10));
_fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj));
_fallbackPrecisionSlider->set_value(2.0);
_textHandlingCombo = Gtk::manage(new class Gtk::ComboBoxText());
_textHandlingCombo->append_text(_("Import text as text"));
_textHandlingCombo->set_active_text(_("Import text as text"));
-
+
hbox5 = Gtk::manage(new class Gtk::HBox(false, 4));
_embedImagesCheck = Gtk::manage(new class Gtk::CheckButton(_("Embed images")));
vbox3 = Gtk::manage(new class Gtk::VBox(false, 4));
_render_thumb = true;
// Create PopplerDocument
gchar *doc_uri = g_filename_to_uri(uri, NULL, NULL);
- if (doc_uri) {\r
+ if (doc_uri) {
_poppler_doc = poppler_document_new_from_file(doc_uri, NULL, NULL);
g_free(doc_uri);
}
src++;
}
}
-}\r
-\r
+}
+
#endif
/**
* \brief Updates the preview area with the previously rendered thumbnail
*/
-bool PdfImportDialog::_onExposePreview(GdkEventExpose *event) {
+bool PdfImportDialog::_onExposePreview(GdkEventExpose */*event*/) {
// Check if we have a thumbnail at all
if (!_thumb_data) {
* Parses the selected page of the given PDF document using PdfParser.
*/
SPDocument *
-PdfInput::open(::Inkscape::Extension::Input * mod, const gchar * uri) {
+PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
// Initialize the globalParams variable for poppler
if (!globalParams) {
globalParams = new GlobalParams();
- }\r
- // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from glib gstdio.c\r
+ }
+ // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from glib gstdio.c
#ifndef WIN32
- GooString *filename_goo = new GooString(uri);\r
- PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password\r
+ GooString *filename_goo = new GooString(uri);
+ PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password
delete filename_goo;
-#else\r
- wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL);\r
-\r
- if (wfilename == NULL) {\r
- return NULL;\r
- }\r
-\r
- PDFDoc *pdf_doc = new PDFDoc(wfilename, wcslen(wfilename), NULL, NULL, NULL); // TODO: Could ask for password\r
- g_free (wfilename);\r
-#endif\r
-\r
+#else
+ wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL);
+
+ if (wfilename == NULL) {
+ return NULL;
+ }
+
+ PDFDoc *pdf_doc = new PDFDoc(wfilename, wcslen(wfilename), NULL, NULL, NULL); // TODO: Could ask for password
+ g_free (wfilename);
+#endif
+
if (!pdf_doc->isOk()) {
int error = pdf_doc->getErrorCode();
delete pdf_doc;
if (error == errEncrypted) {
g_message("Document is encrypted.");
- } else if (error == errOpenFile) {\r
- g_message("couldn't open the PDF file.");\r
- } else if (error == errBadCatalog) {\r
- g_message("couldn't read the page catalog.");\r
- } else if (error == errDamaged) {\r
- g_message("PDF file was damaged and couldn't be repaired.");\r
- } else if (error == errHighlightFile) {\r
- g_message("nonexistent or invalid highlight file.");\r
- } else if (error == errBadPrinter) {\r
- g_message("invalid printer.");\r
- } else if (error == errPrinting) {\r
- g_message("Error during printing.");\r
- } else if (error == errPermission) {\r
- g_message("PDF file does not allow that operation.");\r
- } else if (error == errBadPageNum) {\r
- g_message("invalid page number.");\r
- } else if (error == errFileIO) {\r
- g_message("file IO error.");\r
- } else {\r
+ } else if (error == errOpenFile) {
+ g_message("couldn't open the PDF file.");
+ } else if (error == errBadCatalog) {
+ g_message("couldn't read the page catalog.");
+ } else if (error == errDamaged) {
+ g_message("PDF file was damaged and couldn't be repaired.");
+ } else if (error == errHighlightFile) {
+ g_message("nonexistent or invalid highlight file.");
+ } else if (error == errBadPrinter) {
+ g_message("invalid printer.");
+ } else if (error == errPrinting) {
+ g_message("Error during printing.");
+ } else if (error == errPermission) {
+ g_message("PDF file does not allow that operation.");
+ } else if (error == errBadPageNum) {
+ g_message("invalid page number.");
+ } else if (error == errFileIO) {
+ g_message("file IO error.");
+ } else {
g_message("Failed to load document from data (error %d)", error);
}
-
+
return NULL;
}
PdfImportDialog *dlg = new PdfImportDialog(pdf_doc, uri);
for ( int i = 1 ; i <= pdfNumShadingTypes ; i++ ) {
pdf_parser->setApproximationPrecision(i, color_delta, 6);
}
-
+
// Parse the document structure
Object obj;
page->getContents(&obj);
if (!obj.isNull()) {
pdf_parser->parse(&obj);
}
-
+
// Cleanup
obj.free();
delete pdf_parser;
index b6898b2feb0391910d46bd3ae0d7ecc58f7cb0cf..10b497cacacb8b730d65d5afd261f6f41370c06f 100644 (file)
}
private:
- Gtk::Widget *_a;
+ Gtk::Widget *_a;
Gtk::Widget *_b;
bool _state;
};
}
-/** LayerSelector constructor. Creates lock and hide buttons,
+/** LayerSelector constructor. Creates lock and hide buttons,
* initalizes the layer dropdown selector with a label renderer,
* and hooks up signal for setting the desktop layer when the
* selector is changed.
- */
+ */
LayerSelector::LayerSelector(SPDesktop *desktop)
: _desktop(NULL), _layer(NULL)
{
setDesktop(desktop);
}
-/** Destructor - disconnects signal handler
+/** Destructor - disconnects signal handler
*/
LayerSelector::~LayerSelector() {
setDesktop(NULL);
namespace {
-/** Helper function - detaches desktop from selector
+/** Helper function - detaches desktop from selector
*/
bool detach(LayerSelector *selector) {
selector->setDesktop(NULL);
}
-/** Selects the given layer in the dropdown selector.
+/** Selects the given layer in the dropdown selector.
*/
void LayerSelector::_selectLayer(SPObject *layer) {
using Inkscape::Util::List;
sigc::slot<void> update_list;
};
-void attribute_changed(Inkscape::XML::Node *repr, gchar const *name,
- gchar const *old_value, gchar const *new_value,
- bool is_interactive, void *data)
+void attribute_changed(Inkscape::XML::Node */*repr*/, gchar const *name,
+ gchar const */*old_value*/, gchar const */*new_value*/,
+ bool /*is_interactive*/, void *data)
{
if ( !std::strcmp(name, "inkscape:groupmode") ) {
reinterpret_cast<Callbacks *>(data)->update_list();
}
}
-void node_added(Inkscape::XML::Node *parent, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void *data) {
+void node_added(Inkscape::XML::Node */*parent*/, Inkscape::XML::Node *child, Inkscape::XML::Node */*ref*/, void *data) {
gchar const *mode=child->attribute("inkscape:groupmode");
if ( mode && !std::strcmp(mode, "layer") ) {
reinterpret_cast<Callbacks *>(data)->update_list();
}
}
-void node_removed(Inkscape::XML::Node *parent, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void *data) {
+void node_removed(Inkscape::XML::Node */*parent*/, Inkscape::XML::Node *child, Inkscape::XML::Node */*ref*/, void *data) {
gchar const *mode=child->attribute("inkscape:groupmode");
if ( mode && !std::strcmp(mode, "layer") ) {
reinterpret_cast<Callbacks *>(data)->update_list();
}
}
-void node_reordered(Inkscape::XML::Node *parent, Inkscape::XML::Node *child,
- Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref,
+void node_reordered(Inkscape::XML::Node */*parent*/, Inkscape::XML::Node *child,
+ Inkscape::XML::Node */*old_ref*/, Inkscape::XML::Node */*new_ref*/,
void *data)
{
gchar const *mode=child->attribute("inkscape:groupmode");
delete callbacks;
}
-/** Formats the label for a given layer row
+/** Formats the label for a given layer row
*/
void LayerSelector::_prepareLabelRenderer(
Gtk::TreeModel::const_iterator const &row
label = _("(root)");
}
- gchar *text = g_markup_printf_escaped(format, label);
+ gchar *text = g_markup_printf_escaped(format, label);
_label_renderer.property_markup() = text;
g_free(text);
g_free(format);
void LayerSelector::_lockLayer(bool lock) {
if ( _layer && SP_IS_ITEM(_layer) ) {
SP_ITEM(_layer)->setLocked(lock);
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
+ sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
lock? _("Lock layer") : _("Unlock layer"));
}
}
void LayerSelector::_hideLayer(bool hide) {
if ( _layer && SP_IS_ITEM(_layer) ) {
SP_ITEM(_layer)->setHidden(hide);
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
+ sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
hide? _("Hide layer") : _("Unhide layer"));
}
}