diff options
| author | root <root@jtx.marker.es> | 2013-03-11 23:49:54 +0000 |
|---|---|---|
| committer | root <root@jtx.marker.es> | 2013-03-11 23:49:54 +0000 |
| commit | 71b9a4b54c026c0fb8c73ef6cac4ae4c1ea82e7f (patch) | |
| tree | 2f2c808a23fc507f9c813104415236573f25bb9a /src | |
| parent | ~sub fix, double click to reset default handles and control to 10% step (diff) | |
| parent | readding entries in Cmake and make include lists that were not removed after ... (diff) | |
| download | inkscape-71b9a4b54c026c0fb8c73ef6cac4ae4c1ea82e7f.tar.gz inkscape-71b9a4b54c026c0fb8c73ef6cac4ae4c1ea82e7f.zip | |
update to trunk
(bzr r11950.1.52)
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop-style.cpp | 2 | ||||
| -rw-r--r-- | src/dom/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | src/dom/Makefile_insert | 6 | ||||
| -rw-r--r-- | src/dom/io/stringstream.cpp | 159 | ||||
| -rw-r--r-- | src/dom/io/stringstream.h | 131 | ||||
| -rw-r--r-- | src/dom/io/uristream.cpp | 462 | ||||
| -rw-r--r-- | src/dom/io/uristream.h | 207 | ||||
| -rw-r--r-- | src/ege-color-prof-tracker.cpp | 3 | ||||
| -rw-r--r-- | src/ege-select-one-action.cpp | 10 | ||||
| -rw-r--r-- | src/extension/dependency.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/filter/paint.h | 1 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 94 | ||||
| -rw-r--r-- | src/extension/internal/odf.h | 7 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-parser.cpp | 565 | ||||
| -rw-r--r-- | src/interface.cpp | 2 | ||||
| -rw-r--r-- | src/io/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/io/Makefile_insert | 2 | ||||
| -rw-r--r-- | src/io/bufferstream.cpp (renamed from src/dom/io/bufferstream.cpp) | 18 | ||||
| -rw-r--r-- | src/io/bufferstream.h (renamed from src/dom/io/bufferstream.h) | 38 | ||||
| -rw-r--r-- | src/ui/dialog/aboutbox.cpp | 19 |
20 files changed, 372 insertions, 1372 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 2ea3c876b..40132ec58 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -446,9 +446,9 @@ stroke_average_width (GSList const *objects) static bool vectorsClose( std::vector<double> const &lhs, std::vector<double> const &rhs ) { - static double epsilon = 1e-6; bool isClose = false; if ( lhs.size() == rhs.size() ) { + static double epsilon = 1e-6; isClose = true; for ( size_t i = 0; (i < lhs.size()) && isClose; ++i ) { isClose = fabs(lhs[i] - rhs[i]) < epsilon; diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 5d761e649..74832a6f5 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -14,16 +14,12 @@ set(dom_SRC ucd.cpp uri.cpp xmlreader.cpp - # xmlwriter.cpp xpathimpl.cpp xpathparser.cpp xpathtoken.cpp - - io/bufferstream.cpp + io/domstream.cpp - io/stringstream.cpp - io/uristream.cpp - + util/digest.cpp util/ziptool.cpp @@ -59,10 +55,7 @@ set(dom_SRC xpathparser.h xpathtoken.h - io/bufferstream.h io/domstream.h - io/stringstream.h - io/uristream.h util/digest.h util/ziptool.h diff --git a/src/dom/Makefile_insert b/src/dom/Makefile_insert index 91c91eeac..4ed529a35 100644 --- a/src/dom/Makefile_insert +++ b/src/dom/Makefile_insert @@ -50,14 +50,8 @@ dom_libdom_a_SOURCES = \ dom/xpathparser.h \ dom/xpathtoken.h \ dom/xpathtoken.cpp \ - dom/io/bufferstream.cpp \ - dom/io/bufferstream.h \ dom/io/domstream.cpp \ dom/io/domstream.h \ - dom/io/stringstream.cpp \ - dom/io/stringstream.h \ - dom/io/uristream.cpp \ - dom/io/uristream.h \ dom/util/digest.h \ dom/util/digest.cpp \ dom/util/ziptool.h \ diff --git a/src/dom/io/stringstream.cpp b/src/dom/io/stringstream.cpp deleted file mode 100644 index ca058a575..000000000 --- a/src/dom/io/stringstream.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - * - * Authors: - * Bob Jamison - * - * Copyright (C) 2005 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * Our base String stream classes. We implement these to - * be based on DOMString - * - */ - - -#include "stringstream.h" - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - - -//######################################################################### -//# S T R I N G I N P U T S T R E A M -//######################################################################### - - -/** - * - */ -StringInputStream::StringInputStream(const DOMString &sourceString) - : buffer((DOMString &)sourceString) -{ - position = 0; -} - -/** - * - */ -StringInputStream::~StringInputStream() -{ - -} - -/** - * Returns the number of bytes that can be read (or skipped over) from - * this input stream without blocking by the next caller of a method for - * this input stream. - */ -int StringInputStream::available() -{ - return buffer.size() - position; -} - - -/** - * Closes this input stream and releases any system resources - * associated with the stream. - */ -void StringInputStream::close() -{ -} - -/** - * Reads the next byte of data from the input stream. -1 if EOF - */ -int StringInputStream::get() -{ - if (position >= (int)buffer.size()) - return -1; - int ch = (int) buffer[position++]; - return ch; -} - - - - -//######################################################################### -//# S T R I N G O U T P U T S T R E A M -//######################################################################### - -/** - * - */ -StringOutputStream::StringOutputStream() -{ -} - -/** - * - */ -StringOutputStream::~StringOutputStream() -{ -} - -/** - * Closes this output stream and releases any system resources - * associated with this stream. - */ -void StringOutputStream::close() -{ -} - -/** - * Flushes this output stream and forces any buffered output - * bytes to be written out. - */ -void StringOutputStream::flush() -{ - //nothing to do -} - -/** - * Writes the specified byte to this output stream. - */ -int StringOutputStream::put(gunichar ch) -{ - buffer.push_back(ch); - return 1; -} - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - -//######################################################################### -//# E N D O F F I L E -//######################################################################### diff --git a/src/dom/io/stringstream.h b/src/dom/io/stringstream.h deleted file mode 100644 index 9ba24fc26..000000000 --- a/src/dom/io/stringstream.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef SEEN_STRINGSTREAM_H -#define SEEN_STRINGSTREAM_H -/** - * @file - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - */ -/* - * Authors: - * Bob Jamison - * - * Copyright (C) 2006 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include "domstream.h" - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - -//######################################################################### -//# S T R I N G I N P U T S T R E A M -//######################################################################### - -/** - * This class is for reading character from a DOMString - * - */ -class StringInputStream : public InputStream -{ - -public: - - StringInputStream(const DOMString &sourceString); - - virtual ~StringInputStream(); - - virtual int available(); - - virtual void close(); - - virtual int get(); - -private: - - DOMString &buffer; - - long position; - -}; // class StringInputStream - - - - -//######################################################################### -//# S T R I N G O U T P U T S T R E A M -//######################################################################### - -/** - * This class is for sending a stream to a DOMString - * - */ -class StringOutputStream : public OutputStream -{ - -public: - - StringOutputStream(); - - virtual ~StringOutputStream(); - - virtual void close(); - - virtual void flush(); - - virtual int put(gunichar ch); - - virtual DOMString &getString() - { return buffer; } - - virtual void clear() - { buffer = ""; } - -private: - - DOMString buffer; - - -}; // class StringOutputStream - - - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - - - -#endif // SEEN_STRINGSTREAM_H diff --git a/src/dom/io/uristream.cpp b/src/dom/io/uristream.cpp deleted file mode 100644 index f6172d9e0..000000000 --- a/src/dom/io/uristream.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - * - * Authors: - * Bob Jamison - * - * Copyright (C) 2005-2008 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - - -#include "uristream.h" -#include <cstdio> -#include <string.h> - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - - -//######################################################################### -//# U R I I N P U T S T R E A M / R E A D E R -//######################################################################### - - -/** - * - */ -UriInputStream::UriInputStream(const URI &source) - throw (StreamException): uri((URI &)source) -{ - init(); -} - -/** - * - */ -void UriInputStream::init() throw (StreamException) -{ - //get information from uri - scheme = uri.getScheme(); - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - DOMString npath = uri.getNativePath(); - inf = fopen(npath.c_str(), "rb"); - if (!inf) - { - DOMString err = "UriInputStream cannot open file "; - err.append(npath); - throw StreamException(err); - } - break; - } - - case URI::SCHEME_DATA: - { - data = uri.getPath(); - //printf("in data:'%s'\n", data.c_str()); - dataPos = 0; - dataLen = uri.getPath().size(); - break; - } - } - - closed = false; -} - - - - - -/** - * - */ -UriInputStream::~UriInputStream() throw(StreamException) -{ - close(); -} - -/** - * Returns the number of bytes that can be read (or skipped over) from - * this input stream without blocking by the next caller of a method for - * this input stream. - */ -int UriInputStream::available() throw(StreamException) -{ - return 0; -} - - -/** - * Closes this input stream and releases any system resources - * associated with the stream. - */ -void UriInputStream::close() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!inf) - return; - fflush(inf); - fclose(inf); - inf=NULL; - break; - } - - case URI::SCHEME_DATA: - { - //do nothing - break; - } - }//switch - - closed = true; -} - -/** - * Reads the next byte of data from the input stream. -1 if EOF - */ -int UriInputStream::get() throw(StreamException) -{ - int retVal = -1; - if (closed) - { - return -1; - } - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!inf || feof(inf)) - { - retVal = -1; - } - else - { - retVal = fgetc(inf); - } - break; - } - - case URI::SCHEME_DATA: - { - if (dataPos >= dataLen) - { - retVal = -1; - } - else - { - retVal = data[dataPos++]; - } - break; - } - }//switch - - return retVal; -} - - - - - - -/** - * - */ -UriReader::UriReader(const URI &uri) throw (StreamException) -{ - inputStream = new UriInputStream(uri); -} - -/** - * - */ -UriReader::~UriReader() throw (StreamException) -{ - delete inputStream; -} - -/** - * - */ -int UriReader::available() throw(StreamException) -{ - return inputStream->available(); -} - -/** - * - */ -void UriReader::close() throw(StreamException) -{ - inputStream->close(); -} - -/** - * - */ -gunichar UriReader::get() throw(StreamException) -{ - //int ch = (int)inputStream->get(); - return inputStream->get();//ch; -} - - -//######################################################################### -//# U R I O U T P U T S T R E A M / W R I T E R -//######################################################################### - -/** - * - */ -UriOutputStream::UriOutputStream(const URI &destination) - throw (StreamException): closed(false), - ownsFile(true), - outf(NULL), - uri((URI &)destination) -{ - init(); -} - - -/** - * - */ -void UriOutputStream::init() throw(StreamException) -{ - //get information from uri - scheme = uri.getScheme(); - - //printf("out schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - char *cpath = NULL; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - cpath = (char *) uri.getNativePath().c_str(); - //printf("out path:'%s'\n", cpath); - outf = fopen(cpath, "wb"); - if (!outf) - { - DOMString err = "UriOutputStream cannot open file "; - err += cpath; - throw StreamException(err); - } - break; - } - - case URI::SCHEME_DATA: - { - data = "data:"; - break; - } - - }//switch -} - -/** - * - */ -UriOutputStream::~UriOutputStream() throw(StreamException) -{ - close(); -} - -/** - * Closes this output stream and releases any system resources - * associated with this stream. - */ -void UriOutputStream::close() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return; - fflush(outf); - if ( ownsFile ) - fclose(outf); - outf=NULL; - break; - } - - case URI::SCHEME_DATA: - { - uri = URI(data); - break; - } - - }//switch - - closed = true; -} - - -/** - * Flushes this output stream and forces any buffered output - * bytes to be written out. - */ -void UriOutputStream::flush() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return; - fflush(outf); - break; - } - - case URI::SCHEME_DATA: - { - //nothing - break; - } - - }//switch - -} - -/** - * Writes the specified byte to this output stream. - */ -int UriOutputStream::put(gunichar ch) throw(StreamException) -{ - if (closed) - return -1; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return -1; - unsigned char uch = (unsigned char)(ch & 0xff); - fputc(uch, outf); - //fwrite(uch, 1, 1, outf); - break; - } - - case URI::SCHEME_DATA: - { - data.push_back(ch); - break; - } - - }//switch - return 1; -} - - - - - -/** - * - */ -UriWriter::UriWriter(const URI &uri) - throw (StreamException) -{ - outputStream = new UriOutputStream(uri); -} - -/** - * - */ -UriWriter::~UriWriter() throw (StreamException) -{ - delete outputStream; -} - -/** - * - */ -void UriWriter::close() throw(StreamException) -{ - outputStream->close(); -} - -/** - * - */ -void UriWriter::flush() throw(StreamException) -{ - outputStream->flush(); -} - -/** - * - */ -int UriWriter::put(gunichar ch) throw(StreamException) -{ - if (outputStream->put(ch) < 0) - return -1; - return 1; -} - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - - -//######################################################################### -//# E N D O F F I L E -//######################################################################### diff --git a/src/dom/io/uristream.h b/src/dom/io/uristream.h deleted file mode 100644 index 51227acc9..000000000 --- a/src/dom/io/uristream.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef SEEN_URISTREAM_H -#define SEEN_URISTREAM_H - -/** - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - */ -/* - * Authors: - * Bob Jamison - * - * Copyright (C) 2005-2008 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * This should be the only way that we provide sources/sinks - * to any input/output stream. - * - */ - - -#include "../uri.h" -#include "domstream.h" - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - -//######################################################################### -//# U R I I N P U T S T R E A M / R E A D E R -//######################################################################### - -/** - * This class is for receiving a stream of data from a resource - * defined in a URI - */ -class UriInputStream : public InputStream -{ - -public: - - UriInputStream(const URI &source) throw(StreamException); - - virtual ~UriInputStream() throw(StreamException); - - virtual int available() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual int get() throw(StreamException); - -private: - - void init() throw(StreamException);//common code called by constructor - - bool closed; - - FILE *inf; //for file: uris - DOMString data; //for data: uris - int dataPos; // current read position in data field - int dataLen; // length of data buffer - - URI uri; - - int scheme; -}; // class UriInputStream - - - - -/** - * This class is for receiving a stream of formatted data from a resource - * defined in a URI - */ -class UriReader : public Reader -{ - -public: - - UriReader(const URI &source) throw(StreamException); - - virtual ~UriReader() throw(StreamException); - - virtual int available() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual gunichar get() throw(StreamException); - -private: - - UriInputStream *inputStream; - -}; // class UriReader - - - -//######################################################################### -//# U R I O U T P U T S T R E A M / W R I T E R -//######################################################################### - -/** - * This class is for sending a stream to a destination resource - * defined in a URI - * - */ -class UriOutputStream : public OutputStream -{ - -public: - - UriOutputStream(const URI &destination) throw(StreamException); - - virtual ~UriOutputStream() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual void flush() throw(StreamException); - - virtual int put(gunichar ch) throw(StreamException); - -private: - - void init() throw(StreamException); //common code called by constructor - - bool closed; - bool ownsFile; - - FILE *outf; //for file: uris - DOMString data; //for data: uris - - URI uri; - - int scheme; -}; // class UriOutputStream - - - - - -/** - * This class is for sending a stream of formatted data to a resource - * defined in a URI - */ -class UriWriter : public Writer -{ - -public: - - UriWriter(const URI &source) throw(StreamException); - - virtual ~UriWriter() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual void flush() throw(StreamException); - - virtual int put(gunichar ch) throw(StreamException); - -private: - - UriOutputStream *outputStream; - -}; // class UriReader - - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - -/*######################################################################### -## E N D O F F I L E -#########################################################################*/ - - -#endif // SEEN_URISTREAM_H diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index 2e1b8188f..53004a96d 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -566,9 +566,8 @@ GdkFilterReturn x11_win_filter(GdkXEvent *xevent, const gchar* name = gdk_x11_get_xatom_name(note->atom); if ( strncmp("_ICC_PROFILE", name, 12 ) == 0 ) { XEvent* native = (XEvent*)xevent; - Status stat = Success; XWindowAttributes tmp; - stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp ); + Status stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp ); if ( stat ) { GdkDisplay* display = gdk_x11_lookup_xdisplay(native->xproperty.display); if ( display ) { diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 33cfd04f2..871b961bd 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -567,7 +567,6 @@ GtkWidget* create_menu_item( GtkAction* action ) if ( IS_EGE_SELECT_ONE_ACTION(action) ) { EgeSelectOneAction* act = EGE_SELECT_ONE_ACTION( action ); gchar* sss = 0; - gboolean valid = FALSE; gint index = 0; GtkTreeIter iter; GSList* group = 0; @@ -577,7 +576,7 @@ GtkWidget* create_menu_item( GtkAction* action ) item = gtk_menu_item_new_with_label( sss ); - valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter ); + gboolean valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter ); while ( valid ) { gchar* str = 0; gtk_tree_model_get( act->private_data->model, &iter, @@ -746,8 +745,6 @@ GtkWidget* create_tool_item( GtkAction* action ) gtk_container_add( GTK_CONTAINER(item), holder ); } else { - GtkCellRenderer * renderer = 0; - #if GTK_CHECK_VERSION(3,0,0) GtkWidget* holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_set_homogeneous(GTK_BOX(holder), FALSE); @@ -759,8 +756,8 @@ GtkWidget* create_tool_item( GtkAction* action ) GtkWidget *normal; if (act->private_data->selectionMode == SELECTION_OPEN) { - normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model); - gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn); + normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model); + gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn); GtkWidget *child = gtk_bin_get_child( GTK_BIN(normal) ); if (GTK_IS_ENTRY(child)) { @@ -783,6 +780,7 @@ GtkWidget* create_tool_item( GtkAction* action ) } } else { + GtkCellRenderer * renderer = NULL; normal = gtk_combo_box_new_with_model( act->private_data->model ); if ( act->private_data->iconColumn >= 0 ) { renderer = gtk_cell_renderer_pixbuf_new(); diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 7c358d871..78012ccc8 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -122,8 +122,7 @@ Dependency::~Dependency (void) found then a TRUE is returned. If we get all the way through the path then a FALSE is returned, the command could not be found. */ -bool -Dependency::check (void) const +bool Dependency::check (void) const { // std::cout << "Checking: " << *this << std::endl; @@ -216,7 +215,6 @@ Dependency::check (void) const g_free(orig_path); return FALSE; /* Reverse logic in this one */ - break; } } /* switch _location */ break; diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index f04dd92f9..4052f4391 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -133,7 +133,6 @@ Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream noise; std::ostringstream dblend; std::ostringstream smooth; - std::ostringstream grain; std::ostringstream grainxf; std::ostringstream grainyf; std::ostringstream grainc; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 7634c7aa1..4c27925ae 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -4,7 +4,7 @@ * This is an an entry in the extensions mechanism to begin to enable * the inputting and outputting of OpenDocument Format (ODF) files from * within Inkscape. Although the initial implementations will be very lossy - * do to the differences in the models of SVG and ODF, they will hopefully + * due to the differences in the models of SVG and ODF, they will hopefully * improve greatly with time. People should consider this to be a framework * that can be continously upgraded for ever improving fidelity. Potential * developers should especially look in preprocess() and writeTree() to see how @@ -80,16 +80,15 @@ //# DOM-specific includes #include "dom/dom.h" #include "dom/util/ziptool.h" -#include "dom/io/domstream.h" -#include "dom/io/bufferstream.h" -#include "dom/io/stringstream.h" +//#include "dom/io/domstream.h" #include "inkscape-version.h" #include "document.h" #include "extension/extension.h" - +#include "io/inkscapestream.h" +#include "io/bufferstream.h" namespace Inkscape { @@ -97,15 +96,12 @@ namespace Extension { namespace Internal { - - - //# Shorthand notation typedef org::w3c::dom::DOMString DOMString; -typedef org::w3c::dom::XMLCh XMLCh; -typedef org::w3c::dom::io::OutputStreamWriter OutputStreamWriter; -typedef org::w3c::dom::io::BufferOutputStream BufferOutputStream; -typedef org::w3c::dom::io::StringOutputStream StringOutputStream; +typedef Inkscape::IO::BufferOutputStream BufferOutputStream; +typedef Inkscape::IO::OutputStreamWriter OutputStreamWriter; +typedef Inkscape::IO::StringOutputStream StringOutputStream; + //######################################################################## //# C L A S S SingularValueDecomposition @@ -295,11 +291,13 @@ public: @return Structure to access U, S and V. */ - SingularValueDecomposition (const SVDMatrix &mat) + SingularValueDecomposition (const SVDMatrix &mat) : + A (mat), + U (), + s (NULL), + s_size (0), + V () { - A = mat; - s = NULL; - s_size = 0; calculate(); } @@ -1080,14 +1078,16 @@ OdfOutput::preprocess(ZipFile &zf, Inkscape::XML::Node *node) //Now consider items. SPObject *reprobj = SP_ACTIVE_DOCUMENT->getObjectByRepr(node); if (!reprobj) + { return; + } if (!SP_IS_ITEM(reprobj)) - { + { return; - } - SPItem *item = SP_ITEM(reprobj); + } + //SPItem *item = SP_ITEM(reprobj); //### Get SVG-to-ODF transform - Geom::Affine tf = getODFTransform(item); + //Geom::Affine tf = getODFTransform(item); if (nodeName == "image" || nodeName == "svg:image") { @@ -1210,14 +1210,19 @@ bool OdfOutput::writeMeta(ZipFile &zf) time(&tim); std::map<Glib::ustring, Glib::ustring>::iterator iter; - Glib::ustring creator = "unknown"; + Glib::ustring InkscapeVersion = Glib::ustring("Inkscape.org - ") + Inkscape::version_string; + Glib::ustring creator = InkscapeVersion; iter = metadata.find("dc:creator"); if (iter != metadata.end()) + { creator = iter->second; + } Glib::ustring date = ""; iter = metadata.find("dc:date"); if (iter != metadata.end()) + { date = iter->second; + } outs.printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); outs.printf("\n"); @@ -1242,21 +1247,20 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.printf("xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n"); 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"; + Glib::ustring tmp = Glib::ustring(" <meta:generator>") + InkscapeVersion + "</meta:generator>\n"; 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()); + 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()); for (iter = metadata.begin() ; iter != metadata.end() ; ++iter) - { + { Glib::ustring name = iter->first; Glib::ustring value = iter->second; - if (name.size() > 0 && value.size()>0) - { - outs.printf(" <%#s>%#s</%#s>\n", - name.c_str(), value.c_str(), name.c_str()); - } + if (!name.empty() && !value.empty()) + { + tmp = Glib::ustring::compose(" <%1>%2</%3>\n", name, value, name); + outs.writeUString(tmp); } + } outs.printf(" <meta:editing-cycles>2</meta:editing-cycles>\n"); outs.printf(" <meta:editing-duration>PT56S</meta:editing-duration>\n"); outs.printf(" <meta:user-defined meta:name=\"Info 1\"/>\n"); @@ -1333,7 +1337,7 @@ bool OdfOutput::writeStyle(ZipFile &zf) } //## Dump our gradient table - int gradientCount = 0; + unsigned int gradientCount = 0; outs.printf("\n"); outs.printf("<!-- ####### Gradients from Inkscape document ####### -->\n"); std::vector<GradientInfo>::iterator giter; @@ -1359,8 +1363,8 @@ bool OdfOutput::writeStyle(ZipFile &zf) continue; } outs.printf("<svg:linearGradient "); - outs.printf("id=\"%#s_g\" ", gi.name.c_str()); - outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str()); + outs.printf("id=\"%s\" ", gi.name.c_str()); + outs.printf("draw:name=\"%s\"\n", gi.name.c_str()); outs.printf(" draw:display-name=\"imported linear %u\"\n", gradientCount); outs.printf(" svg:x1=\"%05.3fcm\" svg:y1=\"%05.3fcm\"\n", @@ -1402,9 +1406,9 @@ bool OdfOutput::writeStyle(ZipFile &zf) continue; } outs.printf("<svg:radialGradient "); - outs.printf("id=\"%#s_g\" ", gi.name.c_str()); - outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str()); - outs.printf(" draw:display-name=\"imported radial %d\"\n", + outs.printf("id=\"%s\" ", gi.name.c_str()); + outs.printf("draw:name=\"%s\"\n", gi.name.c_str()); + outs.printf(" draw:display-name=\"imported radial %u\"\n", gradientCount); outs.printf(" svg:cx=\"%05.3f\" svg:cy=\"%05.3f\"\n", gi.cx, gi.cy); @@ -1431,11 +1435,11 @@ bool OdfOutput::writeStyle(ZipFile &zf) { g_warning("unsupported gradient style '%s'", gi.style.c_str()); } - outs.printf("<style:style style:name=\"%#s\" style:family=\"graphic\" ", + outs.printf("<style:style style:name=\"%s\" style:family=\"graphic\" ", gi.name.c_str()); outs.printf("style:parent-style-name=\"standard\">\n"); outs.printf(" <style:graphic-properties draw:fill=\"gradient\" "); - outs.printf("draw:fill-gradient-name=\"%#s_g\"\n", + outs.printf("draw:fill-gradient-name=\"%s\"\n", gi.name.c_str()); outs.printf(" draw:textarea-horizontal-align=\"center\" "); outs.printf("draw:textarea-vertical-align=\"middle\"/>\n"); @@ -1752,8 +1756,8 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, return false;; } outs.printf("<svg:linearGradient "); - outs.printf("id=\"%#s_g\" ", gi.name.c_str()); - outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str()); + outs.printf("id=\"%s\" ", gi.name.c_str()); + outs.printf("draw:name=\"%s\"\n", gi.name.c_str()); outs.printf(" draw:display-name=\"imported linear %d\"\n", gradientCount); outs.printf(" svg:gradientUnits=\"objectBoundingBox\"\n"); @@ -1795,8 +1799,8 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, return false; } outs.printf("<svg:radialGradient "); - outs.printf("id=\"%#s_g\" ", gi.name.c_str()); - outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str()); + outs.printf("id=\"%s\" ", gi.name.c_str()); + outs.printf("draw:name=\"%s\"\n", gi.name.c_str()); outs.printf(" draw:display-name=\"imported radial %d\"\n", gradientCount); outs.printf(" svg:gradientUnits=\"objectBoundingBox\"\n"); @@ -1825,11 +1829,11 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, g_warning("unsupported gradient style '%s'", gi.style.c_str()); return false; } - outs.printf("<style:style style:name=\"%#s\" style:family=\"graphic\" ", + outs.printf("<style:style style:name=\"%s\" style:family=\"graphic\" ", gi.name.c_str()); outs.printf("style:parent-style-name=\"standard\">\n"); outs.printf(" <style:graphic-properties draw:fill=\"gradient\" "); - outs.printf("draw:fill-gradient-name=\"%#s_g\"\n", + outs.printf("draw:fill-gradient-name=\"%s\"\n", gi.name.c_str()); outs.printf(" draw:textarea-horizontal-align=\"center\" "); outs.printf("draw:textarea-vertical-align=\"middle\"/>\n"); diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 6b8883134..219a99a4f 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -24,7 +24,7 @@ #define EXTENSION_INTERNAL_ODG_OUT_H #include <dom/dom.h> -#include <dom/io/stringstream.h> +#include <io/stringstream.h> #include <dom/uri.h> #include <glibmm.h> @@ -37,7 +37,7 @@ #include <map> #include <dom/util/ziptool.h> -#include <dom/io/domstream.h> +//#include <io/domstream.h> #include "sp-item.h" namespace Inkscape @@ -48,8 +48,7 @@ namespace Internal { typedef org::w3c::dom::URI URI; -typedef org::w3c::dom::io::Writer Writer; - +typedef Inkscape::IO::Writer Writer; class StyleInfo { diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index e57161e5a..3be7af34f 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -1220,7 +1220,6 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { void PdfParser::opSetFillColorN(Object args[], int numArgs) { GfxColor color; - GfxPattern *pattern; int i; if (state->getFillColorSpace()->getMode() == csPattern) { @@ -1243,6 +1242,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { state->setFillColor(&color); builder->updateStyle(state); } + GfxPattern *pattern; #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) if (args[numArgs-1].isName() && (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { @@ -1279,7 +1279,6 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { GfxColor color; - GfxPattern *pattern; int i; if (state->getStrokeColorSpace()->getMode() == csPattern) { @@ -1303,6 +1302,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { state->setStrokeColor(&color); builder->updateStyle(state); } + GfxPattern *pattern; #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) if (args[numArgs-1].isName() && (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { @@ -2702,333 +2702,338 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) { - Dict *dict, *maskDict; - int width, height; - int bits; - StreamColorSpaceMode csMode; - GBool mask; - GBool invert; - GfxColorSpace *colorSpace, *maskColorSpace; - GfxImageColorMap *colorMap, *maskColorMap; - Object maskObj, smaskObj; - GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; - int maskColors[2*gfxColorMaxComps]; - int maskWidth, maskHeight; - GBool maskInvert; - Stream *maskStr; - Object obj1, obj2; - int i; - - // get info from the stream - bits = 0; - csMode = streamCSNone; - str->getImageParams(&bits, &csMode); - - // get stream dict - dict = str->getDict(); - - // get size - dict->lookup(const_cast<char*>("Width"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("W"), &obj1); - } - if (obj1.isInt()) - width = obj1.getInt(); - else if (obj1.isReal()) - width = (int)obj1.getReal(); - else - goto err2; - obj1.free(); - dict->lookup(const_cast<char*>("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("H"), &obj1); - } - if (obj1.isInt()) - height = obj1.getInt(); - else if (obj1.isReal()) - height = (int)obj1.getReal(); - else - goto err2; - obj1.free(); - - // image or mask? - dict->lookup(const_cast<char*>("ImageMask"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("IM"), &obj1); - } - mask = gFalse; - if (obj1.isBool()) - mask = obj1.getBool(); - else if (!obj1.isNull()) - goto err2; - obj1.free(); - - // bit depth - if (bits == 0) { - dict->lookup(const_cast<char*>("BitsPerComponent"), &obj1); + Dict *dict; + int width, height; + int bits; + StreamColorSpaceMode csMode; + GBool mask; + GBool invert; + Object maskObj, smaskObj; + GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; + GBool maskInvert; + Object obj1, obj2; + + // get info from the stream + bits = 0; + csMode = streamCSNone; + str->getImageParams(&bits, &csMode); + + // get stream dict + dict = str->getDict(); + + // get size + dict->lookup(const_cast<char*>("Width"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("BPC"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("W"), &obj1); } - if (obj1.isInt()) { - bits = obj1.getInt(); - } else if (mask) { - bits = 1; - } else { - goto err2; + if (obj1.isInt()){ + width = obj1.getInt(); } - obj1.free(); - } - - // display a mask - if (mask) { - - // check for inverted mask - if (bits != 1) - goto err1; - invert = gFalse; - dict->lookup(const_cast<char*>("Decode"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("D"), &obj1); + else if (obj1.isReal()) { + width = (int)obj1.getReal(); } - if (obj1.isArray()) { - obj1.arrayGet(0, &obj2); - if (obj2.isInt() && obj2.getInt() == 1) - invert = gTrue; - obj2.free(); - } else if (!obj1.isNull()) { - goto err2; + else { + goto err2; } obj1.free(); - - // draw it - builder->addImageMask(state, str, width, height, invert); - - } else { - - // get color space and color map - dict->lookup(const_cast<char*>("ColorSpace"), &obj1); + dict->lookup(const_cast<char*>("Height"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("CS"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("H"), &obj1); } - if (obj1.isName()) { - res->lookupColorSpace(obj1.getName(), &obj2); - if (!obj2.isNull()) { - obj1.free(); - obj1 = obj2; - } else { - obj2.free(); - } + if (obj1.isInt()) { + height = obj1.getInt(); } - if (!obj1.isNull()) { -#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - colorSpace = GfxColorSpace::parse(&obj1, NULL); -#else - colorSpace = GfxColorSpace::parse(&obj1); -#endif - } else if (csMode == streamCSDeviceGray) { - colorSpace = new GfxDeviceGrayColorSpace(); - } else if (csMode == streamCSDeviceRGB) { - colorSpace = new GfxDeviceRGBColorSpace(); - } else if (csMode == streamCSDeviceCMYK) { - colorSpace = new GfxDeviceCMYKColorSpace(); - } else { - colorSpace = NULL; + else if (obj1.isReal()){ + height = static_cast<int>(obj1.getReal()); } - obj1.free(); - if (!colorSpace) { - goto err1; + else { + goto err2; } - dict->lookup(const_cast<char*>("Decode"), &obj1); + obj1.free(); + + // image or mask? + dict->lookup(const_cast<char*>("ImageMask"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast<char*>("D"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("IM"), &obj1); + } + mask = gFalse; + if (obj1.isBool()) { + mask = obj1.getBool(); + } + else if (!obj1.isNull()) { + goto err2; } - colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); - if (!colorMap->isOk()) { - delete colorMap; - goto err1; - } - - // get the mask - haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; - maskStr = NULL; // make gcc happy - maskWidth = maskHeight = 0; // make gcc happy - maskInvert = gFalse; // make gcc happy - maskColorMap = NULL; // make gcc happy - dict->lookup(const_cast<char*>("Mask"), &maskObj); - dict->lookup(const_cast<char*>("SMask"), &smaskObj); - if (smaskObj.isStream()) { - // soft mask - if (inlineImg) { - goto err1; - } - maskStr = smaskObj.getStream(); - maskDict = smaskObj.streamGetDict(); - maskDict->lookup(const_cast<char*>("Width"), &obj1); + + // bit depth + if (bits == 0) { + dict->lookup(const_cast<char*>("BitsPerComponent"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("W"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("BPC"), &obj1); } - if (!obj1.isInt()) { - goto err2; + if (obj1.isInt()) { + bits = obj1.getInt(); + } else if (mask) { + bits = 1; + } else { + goto err2; } - maskWidth = obj1.getInt(); obj1.free(); - maskDict->lookup(const_cast<char*>("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("H"), &obj1); - } - if (!obj1.isInt()) { - goto err2; + } + + // display a mask + if (mask) { + // check for inverted mask + if (bits != 1) { + goto err1; } - maskHeight = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1); + invert = gFalse; + dict->lookup(const_cast<char*>("Decode"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("BPC"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("D"), &obj1); } - if (!obj1.isInt()) { - goto err2; + if (obj1.isArray()) { + obj1.arrayGet(0, &obj2); + if (obj2.isInt() && obj2.getInt() == 1) { + invert = gTrue; + } + obj2.free(); + } else if (!obj1.isNull()) { + goto err2; } - int maskBits = obj1.getInt(); obj1.free(); - maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1); + + // draw it + builder->addImageMask(state, str, width, height, invert); + + } else { + // get color space and color map + GfxColorSpace *colorSpace; + dict->lookup(const_cast<char*>("ColorSpace"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("CS"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("CS"), &obj1); } if (obj1.isName()) { - res->lookupColorSpace(obj1.getName(), &obj2); - if (!obj2.isNull()) { + res->lookupColorSpace(obj1.getName(), &obj2); + if (!obj2.isNull()) { obj1.free(); obj1 = obj2; - } else { + } else { obj2.free(); - } + } } + if (!obj1.isNull()) { #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - maskColorSpace = GfxColorSpace::parse(&obj1, NULL); + colorSpace = GfxColorSpace::parse(&obj1, NULL); #else - maskColorSpace = GfxColorSpace::parse(&obj1); -#endif + colorSpace = GfxColorSpace::parse(&obj1); +#endif + } else if (csMode == streamCSDeviceGray) { + colorSpace = new GfxDeviceGrayColorSpace(); + } else if (csMode == streamCSDeviceRGB) { + colorSpace = new GfxDeviceRGBColorSpace(); + } else if (csMode == streamCSDeviceCMYK) { + colorSpace = new GfxDeviceCMYKColorSpace(); + } else { + colorSpace = NULL; + } obj1.free(); - if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { + if (!colorSpace) { goto err1; } - maskDict->lookup(const_cast<char*>("Decode"), &obj1); + dict->lookup(const_cast<char*>("Decode"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("D"), &obj1); + obj1.free(); + dict->lookup(const_cast<char*>("D"), &obj1); } - maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace); + GfxImageColorMap *colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); - if (!maskColorMap->isOk()) { - delete maskColorMap; + if (!colorMap->isOk()) { + delete colorMap; goto err1; } - //~ handle the Matte entry - haveSoftMask = gTrue; - } else if (maskObj.isArray()) { - // color key mask - for (i = 0; - i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; - ++i) { - maskObj.arrayGet(i, &obj1); - maskColors[i] = obj1.getInt(); - obj1.free(); - } - haveColorKeyMask = gTrue; - } else if (maskObj.isStream()) { - // explicit mask - if (inlineImg) { - goto err1; - } - maskStr = maskObj.getStream(); - maskDict = maskObj.streamGetDict(); - maskDict->lookup(const_cast<char*>("Width"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("W"), &obj1); - } - if (!obj1.isInt()) { - goto err2; - } - maskWidth = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast<char*>("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("H"), &obj1); - } - if (!obj1.isInt()) { - goto err2; - } - maskHeight = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast<char*>("ImageMask"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("IM"), &obj1); - } - if (!obj1.isBool() || !obj1.getBool()) { - goto err2; - } - obj1.free(); - maskInvert = gFalse; - maskDict->lookup(const_cast<char*>("Decode"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast<char*>("D"), &obj1); - } - if (obj1.isArray()) { - obj1.arrayGet(0, &obj2); - if (obj2.isInt() && obj2.getInt() == 1) { - maskInvert = gTrue; - } - obj2.free(); - } else if (!obj1.isNull()) { - goto err2; - } - obj1.free(); - haveExplicitMask = gTrue; - } - - // draw it - if (haveSoftMask) { - builder->addSoftMaskedImage(state, str, width, height, colorMap, + + // get the mask + int maskColors[2*gfxColorMaxComps]; + haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; + Stream *maskStr = NULL; + int maskWidth = 0; + int maskHeight = 0; + maskInvert = gFalse; + GfxImageColorMap *maskColorMap = NULL; + dict->lookup(const_cast<char*>("Mask"), &maskObj); + dict->lookup(const_cast<char*>("SMask"), &smaskObj); + Dict* maskDict; + if (smaskObj.isStream()) { + // soft mask + if (inlineImg) { + goto err1; + } + maskStr = smaskObj.getStream(); + maskDict = smaskObj.streamGetDict(); + maskDict->lookup(const_cast<char*>("Width"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("W"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskWidth = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast<char*>("Height"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("H"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskHeight = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("BPC"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + int maskBits = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("CS"), &obj1); + } + if (obj1.isName()) { + res->lookupColorSpace(obj1.getName(), &obj2); + if (!obj2.isNull()) { + obj1.free(); + obj1 = obj2; + } else { + obj2.free(); + } + } +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL); +#else + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1); +#endif + obj1.free(); + if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { + goto err1; + } + maskDict->lookup(const_cast<char*>("Decode"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("D"), &obj1); + } + maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace); + obj1.free(); + if (!maskColorMap->isOk()) { + delete maskColorMap; + goto err1; + } + //~ handle the Matte entry + haveSoftMask = gTrue; + } else if (maskObj.isArray()) { + // color key mask + int i; + for (i = 0; i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; ++i) { + maskObj.arrayGet(i, &obj1); + maskColors[i] = obj1.getInt(); + obj1.free(); + } + haveColorKeyMask = gTrue; + } else if (maskObj.isStream()) { + // explicit mask + if (inlineImg) { + goto err1; + } + maskStr = maskObj.getStream(); + maskDict = maskObj.streamGetDict(); + maskDict->lookup(const_cast<char*>("Width"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("W"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskWidth = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast<char*>("Height"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("H"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskHeight = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast<char*>("ImageMask"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("IM"), &obj1); + } + if (!obj1.isBool() || !obj1.getBool()) { + goto err2; + } + obj1.free(); + maskInvert = gFalse; + maskDict->lookup(const_cast<char*>("Decode"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast<char*>("D"), &obj1); + } + if (obj1.isArray()) { + obj1.arrayGet(0, &obj2); + if (obj2.isInt() && obj2.getInt() == 1) { + maskInvert = gTrue; + } + obj2.free(); + } else if (!obj1.isNull()) { + goto err2; + } + obj1.free(); + haveExplicitMask = gTrue; + } + + // draw it + if (haveSoftMask) { + builder->addSoftMaskedImage(state, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); - delete maskColorMap; - } else if (haveExplicitMask) { - builder->addMaskedImage(state, str, width, height, colorMap, + delete maskColorMap; + } else if (haveExplicitMask) { + builder->addMaskedImage(state, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); - } else { - builder->addImage(state, str, width, height, colorMap, - haveColorKeyMask ? maskColors : (int *)NULL); + } else { + builder->addImage(state, str, width, height, colorMap, + haveColorKeyMask ? maskColors : static_cast<int *>(NULL)); + } + delete colorMap; + + maskObj.free(); + smaskObj.free(); } - delete colorMap; - maskObj.free(); - smaskObj.free(); - } - - return; + return; err2: - obj1.free(); + obj1.free(); err1: #ifdef POPPLER_NEW_ERRORAPI - error(errSyntaxError, getPos(), "Bad image parameters"); + error(errSyntaxError, getPos(), "Bad image parameters"); #else - error(getPos(), const_cast<char*>("Bad image parameters")); + error(getPos(), const_cast<char*>("Bad image parameters")); #endif } diff --git a/src/interface.cpp b/src/interface.cpp index bf497b407..69832a2eb 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -468,6 +468,8 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb item = gtk_image_menu_item_new_with_mnemonic(action->name); } + gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name); + GtkAccelGroup *accel_group = sp_shortcut_get_accel_group(); gtk_menu_set_accel_group(menu, accel_group); diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index c5606779e..34502d3db 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -1,6 +1,7 @@ set(io_SRC base64stream.cpp + bufferstream.cpp ftos.cpp gzipstream.cpp inkjar.cpp @@ -12,10 +13,10 @@ set(io_SRC uristream.cpp xsltstream.cpp - # ------- # Headers base64stream.h + bufferstream.h ftos.h gzipstream.h inkjar.h diff --git a/src/io/Makefile_insert b/src/io/Makefile_insert index bb47b46b8..935c0cc07 100644 --- a/src/io/Makefile_insert +++ b/src/io/Makefile_insert @@ -3,6 +3,8 @@ ink_common_sources += \ io/base64stream.h \ io/base64stream.cpp \ + io/bufferstream.cpp \ + io/bufferstream.h \ io/ftos.cpp \ io/ftos.h \ io/gzipstream.cpp \ diff --git a/src/dom/io/bufferstream.cpp b/src/io/bufferstream.cpp index 3389bd80e..ba440254f 100644 --- a/src/dom/io/bufferstream.cpp +++ b/src/io/bufferstream.cpp @@ -33,22 +33,14 @@ #include "bufferstream.h" -namespace org +namespace Inkscape { -namespace w3c +namespace IO { -namespace dom -{ -namespace io -{ - - //######################################################################### //# B U F F E R I N P U T S T R E A M //######################################################################### - - /** * */ @@ -157,10 +149,8 @@ int BufferOutputStream::put(gunichar ch) -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org +} //namespace IO +} //namespace Inkscape //######################################################################### //# E N D O F F I L E diff --git a/src/dom/io/bufferstream.h b/src/io/bufferstream.h index 0ac06b362..ed565572a 100644 --- a/src/dom/io/bufferstream.h +++ b/src/io/bufferstream.h @@ -31,20 +31,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <vector.h> +#include "inkscapestream.h" -#include "domstream.h" - -namespace org -{ -namespace w3c -{ -namespace dom +namespace Inkscape { -namespace io +namespace IO { - //######################################################################### //# S T R I N G I N P U T S T R E A M //######################################################################### @@ -59,21 +54,14 @@ class BufferInputStream : public InputStream public: BufferInputStream(const std::vector<unsigned char> &sourceBuffer); - virtual ~BufferInputStream(); - virtual int available(); - virtual void close(); - virtual int get(); private: - const std::vector<unsigned char> &buffer; - long position; - bool closed; }; // class BufferInputStream @@ -95,15 +83,10 @@ class BufferOutputStream : public OutputStream public: BufferOutputStream(); - virtual ~BufferOutputStream(); - virtual void close(); - virtual void flush(); - virtual int put(gunichar ch); - virtual std::vector<unsigned char> &getBuffer() { return buffer; } @@ -111,24 +94,15 @@ public: { buffer.clear(); } private: - std::vector<unsigned char> buffer; - bool closed; - }; // class BufferOutputStream - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org +} //namespace IO +} //namespace Inkscape diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index d4928d25d..ba9670d86 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -447,7 +447,7 @@ void AboutBox::initStrings() { "Aleksandar Urošević <urke@users.sourceforge.net>, 2004-2006.\n" "Alessio Frusciante <algol@firenze.linux.it>, 2002, 2003.\n" "Alexander Shopov <ash@contact.bg>, 2006.\n" -"Alexandre Prokoudine <alexandre.prokoudine@gmail.com>, 2005, 2010-2011.\n" +"Alexandre Prokoudine <alexandre.prokoudine@gmail.com>, 2005, 2010-2013.\n" "Alexey Remizov <alexey@remizov.pp.ru>, 2004.\n" "Ali Ghanavatian <ghanvatian.ali@gmail.com>, 2010.\n" "Álvaro Lopes <alvieboy@alvie.com>, 2001, 2002.\n" @@ -468,14 +468,14 @@ void AboutBox::initStrings() { "Christian Meyer <chrisime@gnome.org>, 2000-2002.\n" "Christian Neumair <chris@gnome-de.org>, 2002, 2003.\n" "Christian Rose <menthos@menthos.com>, 2000-2003.\n" -"Cristian Secară <cristi@secarica.ro>, 2010.\n" +"Cristian Secară <cristi@secarica.ro>, 2010-2013.\n" "Christophe Merlet (RedFox) <redfox@redfoxcenter.org>, 2000-2002.\n" "Clytie Siddall <clytie@riverland.net.au>, 2004-2008.\n" "Colin Marquardt <colin@marquardt-home.de>, 2004-2006.\n" "Cédric Gemy <radar.map35@free.fr>, 2006.\n" "Daniel Díaz <yosoy@danieldiaz.org>, 2004.\n" "Didier Conchaudron <conchaudron@free.fr>, 2003.\n" -"Dimitris Spingos <dmtrs32@gmail.com>, 2011.\n" +"Dimitris Spingos <dmtrs32@gmail.com>, 2011-2013.\n" "Dorji Tashi <dorjee_doss@hotmail.com>, 2006.\n" "Duarte Loreto <happyguy_pt@hotmail.com> 2002, 2003 (Maintainer).\n" "Elias Norberg <elno0959 at student.su.se>, 2009.\n" @@ -493,6 +493,7 @@ void AboutBox::initStrings() { "Ilia Penev <lichopicho@gmail.com>, 2006.\n" "Ivan Masár <helix84@centrum.sk>, 2006-2010. \n" "Iñaki Larrañaga <dooteo@euskalgnu.org>, 2006.\n" +"Jānis Eisaks <jancs@dv.lv>, 2012, 2013.\n" "Jeffrey Steve Borbón Sanabria <jeff_kerokid@yahoo.com>, 2005.\n" "Jesper Öqvist <jesper@llbit.se>, 2010, 2011.\n" "Joaquim Perez i Noguer <noguer@gmail.com>, 2008-2009.\n" @@ -514,16 +515,16 @@ void AboutBox::initStrings() { "Kingsley Turner <kingsley@maddogsbreakfast.com.au>, 2006.\n" "Kitae <bluetux@gmail.com>, 2006.\n" "Kjartan Maraas <kmaraas@gnome.org>, 2000-2002.\n" -"Kris De Gussem <kris.DeGussem@gmail.com>, 2008-2011.\n" +"Kris De Gussem <Kris.DeGussem@gmail.com>, 2008-2013.\n" "Lauris Kaplinski <lauris@ariman.ee>, 2000.\n" "Leandro Regueiro <leandro.regueiro@gmail.com>, 2006-2008, 2010.\n" "Liu Xiaoqin <liuxqsmile@gmail.com>, 2008.\n" "Luca Bruno <luca.br@uno.it>, 2005.\n" -"Lucas Vieites Fariña<lucas@codexion.com>, 2003-2010.\n" +"Lucas Vieites Fariña<lucas@codexion.com>, 2003-2013.\n" "Mahesh subedi <submanesh@hotmail.com>, 2006.\n" "Martin Srebotnjak, <miles@filmsi.net>, 2005, 2010.\n" "Masatake YAMATO <jet@gyve.org>, 2002.\n" -"Masato Hashimoto <cabezon.hashimoto@gmail.com>, 2009-2011.\n" +"Masato Hashimoto <cabezon.hashimoto@gmail.com>, 2009-2012.\n" "Matiphas <matiphas _a_ free _point_ fr>, 2004-2006.\n" "Mattias Hultgren <mattias_hultgren@tele2.se>, 2005, 2006.\n" "Maxim Dziumanenko <mvd@mylinux.com.ua>, 2004.\n" @@ -534,7 +535,7 @@ void AboutBox::initStrings() { "Muhammad Bashir Al-Noimi <mhdbnoimi@gmail.com>, 2008.\n" "Myckel Habets <myckel@sdf.lonestar.org>, 2008.\n" "Nguyen Dinh Trung <nguyendinhtrung141@gmail.com>, 2007, 2008.\n" -"Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2011.\n" +"Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2013.\n" "Pawan Chitrakar <pchitrakar@gmail.com>, 2006.\n" "Przemysław Loesch <p_loesch@poczta.onet.pl>, 2005.\n" "Quico Llach <quico@softcatala.org>, 2000. Traducció sodipodi.\n" @@ -555,7 +556,7 @@ void AboutBox::initStrings() { "Thiago Pimentel <thiago.merces@gmail.com>, 2006.\n" "Toshifumi Sato <sato@centrosystem.com>, 2005.\n" "Jon South <striker@lunar-linux.org>, 2006. \n" -"Uwe Schöler <oss@oss-marketplace.com>, 2006-2011.\n" +"Uwe Schöler <oss@oss-marketplace.com>, 2006-2013.\n" "Valek Filippov <frob@df.ru>, 2000, 2003.\n" "Victor Dachev <vdachev@gmail.com>, 2006.\n" "Vincent van Adrighem <V.vanAdrighem@dirck.mine.nu>, 2003.\n" @@ -570,7 +571,7 @@ void AboutBox::initStrings() { "Yaron Shahrabani <sh.yaron@gmail.com>, 2009.\n" "Yukihiro Nakai <nakai@gnome.gr.jp>, 2000, 2003.\n" "Yuri Beznos <zhiz0id@gmail.com>, 2006.\n" -"Yuri Chornoivan <yurchor@ukr.net>, 2007-2011.\n" +"Yuri Chornoivan <yurchor@ukr.net>, 2007-2013.\n" "Yuri Syrota <rasta@renome.rovno.ua>, 2000.\n" "Yves Guillou <yvesguillou@users.sourceforge.net>, 2004.\n" "Zdenko Podobný <zdpo@mailbox.sk>, 2003, 2004." |
