diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2013-03-13 21:22:43 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2013-03-13 21:22:43 +0000 |
| commit | 5fdab345ed60a124a25aa0efecd36b4307b72681 (patch) | |
| tree | 9da8eae3a08679edbbb5994b6b2681a2c81b97f1 /src | |
| parent | Prevent crashing on windows systems due to locale issues (diff) | |
| parent | cppcheck (diff) | |
| download | inkscape-5fdab345ed60a124a25aa0efecd36b4307b72681.tar.gz inkscape-5fdab345ed60a124a25aa0efecd36b4307b72681.zip | |
merge from trunk (r12201)
(bzr r11668.1.57)
Diffstat (limited to 'src')
44 files changed, 1224 insertions, 1540 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 47671a8d2..4c27925ae 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -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 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/extension/system.cpp b/src/extension/system.cpp index 56cc6d1af..f7fd48b3f 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -280,10 +280,9 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // remember attributes in case this is an unofficial save and/or overwrite fails gchar *saved_uri = g_strdup(doc->getURI()); - bool saved_modified = false; gchar *saved_output_extension = NULL; gchar *saved_dataloss = NULL; - saved_modified = doc->isModifiedSinceSave(); + bool saved_modified = doc->isModifiedSinceSave(); saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); if (official) { 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..af5580efb 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> +#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/io/gzipstream.cpp b/src/io/gzipstream.cpp index 8db7155db..380c42411 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -71,11 +71,11 @@ GzipInputStream::~GzipInputStream() { close(); if ( srcBuf ) { - free(srcBuf); + delete[] srcBuf; srcBuf = NULL; } if ( outputBuf ) { - free(outputBuf); + delete[] outputBuf; outputBuf = NULL; } } @@ -108,11 +108,11 @@ void GzipInputStream::close() } if ( srcBuf ) { - free(srcBuf); + delete[] srcBuf; srcBuf = NULL; } if ( outputBuf ) { - free(outputBuf); + delete[] outputBuf; outputBuf = NULL; } closed = true; @@ -161,7 +161,7 @@ bool GzipInputStream::load() int ch = source.get(); if (ch<0) break; - inputBuf.push_back((Byte)(ch & 0xff)); + inputBuf.push_back(static_cast<Byte>(ch & 0xff)); } long inputBufLen = inputBuf.size(); @@ -171,15 +171,15 @@ bool GzipInputStream::load() } srcLen = inputBuf.size(); - srcBuf = (Bytef *)malloc(srcLen * sizeof(Byte)); + srcBuf = new Byte [srcLen]; if (!srcBuf) { return false; } - outputBuf = (unsigned char *)malloc(OUT_SIZE); + outputBuf = new unsigned char [OUT_SIZE]; if ( !outputBuf ) { - free(srcBuf); - srcBuf = 0; + delete[] srcBuf; + srcBuf = NULL; return false; } outputBufLen = 0; // Not filled in yet @@ -187,33 +187,35 @@ bool GzipInputStream::load() std::vector<unsigned char>::iterator iter; Bytef *p = srcBuf; for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) + { *p++ = *iter; + } int headerLen = 10; //Magic - int val = (int)srcBuf[0]; - //printf("val:%x\n", val); - val = (int)srcBuf[1]; - //printf("val:%x\n", val); + //int val = (int)srcBuf[0]; + ////printf("val:%x\n", val); + //val = (int)srcBuf[1]; + ////printf("val:%x\n", val); - //Method - val = (int)srcBuf[2]; - //printf("val:%x\n", val); + ////Method + //val = (int)srcBuf[2]; + ////printf("val:%x\n", val); //flags - int flags = (int)srcBuf[3]; + int flags = static_cast<int>(srcBuf[3]); - //time - val = (int)srcBuf[4]; - val = (int)srcBuf[5]; - val = (int)srcBuf[6]; - val = (int)srcBuf[7]; + ////time + //val = (int)srcBuf[4]; + //val = (int)srcBuf[5]; + //val = (int)srcBuf[6]; + //val = (int)srcBuf[7]; - //xflags - val = (int)srcBuf[8]; - //OS - val = (int)srcBuf[9]; + ////xflags + //val = (int)srcBuf[8]; + ////OS + //val = (int)srcBuf[9]; // if ( flags & FEXTRA ) { // headerLen += 2; @@ -272,19 +274,17 @@ bool GzipInputStream::load() int GzipInputStream::fetchMore() { - int zerr = Z_OK; - // TODO assumes we aren't called till the buffer is empty d_stream.next_out = outputBuf; d_stream.avail_out = OUT_SIZE; outputBufLen = 0; outputBufPos = 0; - zerr = inflate( &d_stream, Z_SYNC_FLUSH ); + int zerr = inflate( &d_stream, Z_SYNC_FLUSH ); if ( zerr == Z_OK || zerr == Z_STREAM_END ) { outputBufLen = OUT_SIZE - d_stream.avail_out; if ( outputBufLen ) { - crc = crc32(crc, (const Bytef *)outputBuf, outputBufLen); + crc = crc32(crc, const_cast<const Bytef *>(outputBuf), outputBufLen); } //printf("crc:%lx\n", crc); // } else if ( zerr != Z_STREAM_END ) { @@ -359,14 +359,14 @@ void GzipOutputStream::close() uLong outlong = crc; for (int n = 0; n < 4; n++) { - destination.put((int)(outlong & 0xff)); + destination.put(static_cast<gunichar>(outlong & 0xff)); outlong >>= 8; } //# send the file length outlong = totalIn & 0xffffffffL; for (int n = 0; n < 4; n++) { - destination.put((int)(outlong & 0xff)); + destination.put(static_cast<gunichar>(outlong & 0xff)); outlong >>= 8; } @@ -380,21 +380,23 @@ void GzipOutputStream::close() */ void GzipOutputStream::flush() { - if (closed || inputBuf.size()<1) + if (closed || inputBuf.empty()) + { return; - + } + uLong srclen = inputBuf.size(); - Bytef *srcbuf = (Bytef *)malloc(srclen * sizeof(Byte)); + Bytef *srcbuf = new Bytef [srclen]; if (!srcbuf) { return; } uLong destlen = srclen; - Bytef *destbuf = (Bytef *)malloc((destlen + (srclen/100) + 13) * sizeof(Byte)); + Bytef *destbuf = new Bytef [(destlen + (srclen/100) + 13)]; if (!destbuf) { - free(srcbuf); + delete[] srcbuf; return; } @@ -403,9 +405,9 @@ void GzipOutputStream::flush() for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) *p++ = *iter; - crc = crc32(crc, (const Bytef *)srcbuf, srclen); + crc = crc32(crc, const_cast<const Bytef *>(srcbuf), srclen); - int zerr = compress(destbuf, (uLongf *)&destlen, srcbuf, srclen); + int zerr = compress(destbuf, static_cast<uLongf *>(&destlen), srcbuf, srclen); if (zerr != Z_OK) { printf("Some kind of problem\n"); @@ -421,11 +423,8 @@ void GzipOutputStream::flush() destination.flush(); inputBuf.clear(); - free(srcbuf); - free(destbuf); - - //printf("done\n"); - + delete[] srcbuf; + delete[] destbuf; } diff --git a/src/io/inkjar.cpp b/src/io/inkjar.cpp index 20b164b99..4af140737 100644 --- a/src/io/inkjar.cpp +++ b/src/io/inkjar.cpp @@ -311,7 +311,7 @@ guint8 *JarFile::get_uncompressed_file(guint32 compressed_size, guint32 crc, in_a -= nbytes; #ifdef DEBUG - std::printf("%d bytes written\n", out_a); + std::printf("%u bytes written\n", out_a); #endif } lseek(fd, eflen, SEEK_CUR); diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 91f779ef3..2f57b710b 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -61,8 +61,6 @@ LPEAngleBisector::doEffect_path (std::vector<Geom::Path> const & path_in) { using namespace Geom; - std::vector<Geom::Path> path_out; - // we assume that the path has >= 3 nodes ptA = path_in[0].pointAt(1); Point B = path_in[0].initialPoint(); diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp index 467fdfd9c..a5295d269 100644 --- a/src/live_effects/lpe-dynastroke.cpp +++ b/src/live_effects/lpe-dynastroke.cpp @@ -152,7 +152,7 @@ LPEDynastroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p double angle_rad = angle*M_PI/180.;//TODO: revert orientation?... Piecewise<SBasis> w; - std::vector<double> corners = find_corners(m); + // std::vector<double> corners = find_corners(m); DynastrokeMethod stroke_method = method.get_value(); if (roundness==1.) { diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp index 7f5a00cf8..8b3f4714a 100644 --- a/src/live_effects/lpe-extrude.cpp +++ b/src/live_effects/lpe-extrude.cpp @@ -124,9 +124,9 @@ LPEExtrude::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2 } std::vector<double> connector_pts; - if (rts.size() < 1) { + if (rts.empty()) { connector_pts = cusps; - } else if (cusps.size() < 1) { + } else if (cusps.empty()) { connector_pts = rts; } else { connector_pts = rts; diff --git a/src/live_effects/lpe-recursiveskeleton.cpp b/src/live_effects/lpe-recursiveskeleton.cpp index 906c430c1..452139344 100644 --- a/src/live_effects/lpe-recursiveskeleton.cpp +++ b/src/live_effects/lpe-recursiveskeleton.cpp @@ -49,8 +49,6 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co using namespace Geom; Piecewise<D2<SBasis> > output; - std::vector<Piecewise<D2<SBasis> > > pre_output; - double prop_scale = 1.0; D2<Piecewise<SBasis> > patternd2 = make_cuts_independent(pwd2_in); @@ -90,8 +88,7 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co Piecewise<D2<SBasis> > n = rot90(derivative(uskeleton)); n = force_continuity(remove_short_cuts(n,.1)); - double scaling = 1; - scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); + double scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); // TODO investigate why pattWidth is not being used: double pattWidth = pattBndsX->extent() * scaling; diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 88743548b..fefdad95a 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -80,11 +80,10 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const { using namespace Geom; - gboolean success; double real_mark_length = mark_length; - success = sp_convert_distance(&real_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); double real_minor_mark_length = minor_mark_length; - success = sp_convert_distance(&real_minor_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_minor_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); n_major = real_mark_length * n; n_minor = real_minor_mark_length * n; @@ -134,10 +133,10 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i std::vector<double> s_cuts; double real_mark_distance = mark_distance; - gboolean success = sp_convert_distance(&real_mark_distance, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_mark_distance, unit, &sp_unit_get_by_id(SP_UNIT_PX)); double real_offset = offset; - success = sp_convert_distance(&real_offset, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_offset, unit, &sp_unit_get_by_id(SP_UNIT_PX)); for (double s = real_offset; s<totlength; s+=real_mark_distance){ s_cuts.push_back(s); } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 460e223a3..045b34814 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -22,6 +22,7 @@ # include <config.h> #endif +#include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" #include "document.h" @@ -50,8 +51,9 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include <gtkmm/stock.h> #include <gtkmm/imagemenuitem.h> +#include <gtkmm/stock.h> +#include <gtkmm/table.h> using std::pair; @@ -90,15 +92,15 @@ DocumentProperties& DocumentProperties::getInstance() DocumentProperties::DocumentProperties() : UI::Widget::Panel ("", "/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW), - _page_page(1, 1, true, true), - _page_guides(1, 1), - _page_snap(1, 1), - _page_cms(1, 1), - _page_scripting(1, 1), - _page_external_scripts(1, 1), - _page_embedded_scripts(1, 1), - _page_metadata1(1, 1), - _page_metadata2(1, 1), + _page_page(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_guides(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_snap(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_cms(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_scripting(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_external_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_embedded_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), @@ -141,14 +143,14 @@ DocumentProperties::DocumentProperties() _getContents()->set_spacing (4); _getContents()->pack_start(_notebook, true, true); - _notebook.append_page(_page_page, _("Page")); - _notebook.append_page(_page_guides, _("Guides")); + _notebook.append_page(*_page_page, _("Page")); + _notebook.append_page(*_page_guides, _("Guides")); _notebook.append_page(_grids_vbox, _("Grids")); - _notebook.append_page(_page_snap, _("Snap")); - _notebook.append_page(_page_cms, _("Color")); - _notebook.append_page(_page_scripting, _("Scripting")); - _notebook.append_page(_page_metadata1, _("Metadata")); - _notebook.append_page(_page_metadata2, _("License")); + _notebook.append_page(*_page_snap, _("Snap")); + _notebook.append_page(*_page_cms, _("Color")); + _notebook.append_page(*_page_scripting, _("Scripting")); + _notebook.append_page(*_page_metadata1, _("Metadata")); + _notebook.append_page(*_page_metadata2, _("License")); _wr.setUpdating (true); build_page(); @@ -203,12 +205,25 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ +#if WITH_GTKMM_3_0 +inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#else inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#endif { for (unsigned i = 0, r = start; i < n; i += 2) { if (arr[i] && arr[i+1]) { +#if WITH_GTKMM_3_0 + arr[i]->set_hexpand(); + arr[i+1]->set_hexpand(); + arr[i]->set_valign(Gtk::ALIGN_CENTER); + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + table.attach(*arr[i], 1, r, 1, 1); + table.attach(*arr[i+1], 2, r, 1, 1); +#else table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; @@ -218,21 +233,70 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con } if (docum_prop_flag) { if( i==(n-4) || i==(n-6) ) { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + arr[i+1]->set_margin_left(20); + arr[i+1]->set_margin_right(20); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); +#endif } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else if (arr[i]) { Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*arr[i]); label.set_alignment (0.0); + +#if WITH_GTKMM_3_0 + label.set_hexpand(); + label.set_valign(Gtk::ALIGN_CENTER); + table.attach(label, 0, r, 3, 1); +#else table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + space->set_halign(Gtk::ALIGN_CENTER); + space->set_valign(Gtk::ALIGN_CENTER); + table.attach(*space, 0, r, 1, 1); +#else table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); +#endif } } ++r; @@ -241,7 +305,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con void DocumentProperties::build_page() { - _page_page.show(); + _page_page->show(); Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("<b>General</b>")); @@ -275,12 +339,12 @@ void DocumentProperties::build_page() _slaveList.push_back(&_rcb_shad); _rcb_canb.setSlaveWidgets(_slaveList); - attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array),0,1); + attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1); } void DocumentProperties::build_guides() { - _page_guides.show(); + _page_guides->show(); Gtk::Label *label_gui = manage (new Gtk::Label); label_gui->set_markup (_("<b>Guides</b>")); @@ -293,12 +357,12 @@ void DocumentProperties::build_guides() _rcp_hgui._label, &_rcp_hgui }; - attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array)); + attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array)); } void DocumentProperties::build_snap() { - _page_snap.show(); + _page_snap->show(); Gtk::Label *label_o = manage (new Gtk::Label); label_o->set_markup (_("<b>Snap to objects</b>")); @@ -327,7 +391,7 @@ void DocumentProperties::build_snap() 0, &_rcb_tang }; - attach_all(_page_snap.table(), array, G_N_ELEMENTS(array)); + attach_all(_page_snap->table(), array, G_N_ELEMENTS(array)); } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -532,7 +596,7 @@ void DocumentProperties::removeSelectedProfile(){ void DocumentProperties::build_cms() { - _page_cms.show(); + _page_cms->show(); Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_link->set_markup (_("<b>Linked Color Profiles:</b>")); Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); @@ -544,26 +608,75 @@ void DocumentProperties::build_cms() _unlink_btn.set_tooltip_text(_("Unlink Profile")); _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_cms.set_spacing(4); + _page_cms->set_spacing(4); gint row = 0; label_link->set_alignment(0.0); - _page_cms.table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_link->set_hexpand(); + label_link->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_link, 0, row, 3, 1); +#else + _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_cms.table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _LinkedProfilesListScroller.set_hexpand(); + _LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1); +#else + _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_cms.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer->set_hexpand(); + spacer->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*spacer, 0, row, 3, 1); +#else + _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; label_avail->set_alignment(0.0); - _page_cms.table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_avail->set_hexpand(); + label_avail->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_avail, 0, row, 3, 1); +#else + _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_cms.table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms.table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_cms.table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _combo_avail.set_hexpand(); + _combo_avail.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_combo_avail, 0, row, 1, 1); + + _link_btn.set_halign(Gtk::ALIGN_CENTER); + _link_btn.set_valign(Gtk::ALIGN_CENTER); + _link_btn.set_margin_left(2); + _link_btn.set_margin_right(2); + _page_cms->table().attach(_link_btn, 1, row, 1, 1); + + _unlink_btn.set_halign(Gtk::ALIGN_CENTER); + _unlink_btn.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_unlink_btn, 2, row, 1, 1); +#else + _page_cms->table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif populate_available_profiles(); @@ -601,16 +714,16 @@ void DocumentProperties::build_cms() void DocumentProperties::build_scripting() { - _page_scripting.show(); + _page_scripting->show(); - _page_scripting.set_spacing (4); - _page_scripting.pack_start(_scripting_notebook, true, true); + _page_scripting->set_spacing (4); + _page_scripting->pack_start(_scripting_notebook, true, true); - _scripting_notebook.append_page(_page_external_scripts, _("External scripts")); - _scripting_notebook.append_page(_page_embedded_scripts, _("Embedded scripts")); + _scripting_notebook.append_page(*_page_external_scripts, _("External scripts")); + _scripting_notebook.append_page(*_page_embedded_scripts, _("Embedded scripts")); //# External scripts tab - _page_external_scripts.show(); + _page_external_scripts->show(); Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("<b>External script files:</b>")); @@ -621,23 +734,64 @@ void DocumentProperties::build_scripting() _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_external_scripts.set_spacing(4); + _page_external_scripts->set_spacing(4); gint row = 0; label_external->set_alignment(0.0); - _page_external_scripts.table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_external->set_hexpand(); + label_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*label_external, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_external_scripts.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _ExternalScriptsListScroller.set_hexpand(); + _ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_external_scripts.table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer_external->set_hexpand(); + spacer_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_external_scripts.table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts.table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_external_scripts.table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _script_entry.set_hexpand(); + _script_entry.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_script_entry, 0, row, 1, 1); + + _external_add_btn.set_halign(Gtk::ALIGN_CENTER); + _external_add_btn.set_valign(Gtk::ALIGN_CENTER); + _external_add_btn.set_margin_left(2); + _external_add_btn.set_margin_right(2); + _page_external_scripts->table().attach(_external_add_btn, 1, row, 1, 1); + + _external_remove_btn.set_halign(Gtk::ALIGN_CENTER); + _external_remove_btn.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1); +#else + _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the External Scripts box @@ -649,7 +803,7 @@ void DocumentProperties::build_scripting() //# Embedded scripts tab - _page_embedded_scripts.show(); + _page_embedded_scripts->show(); Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded->set_markup (_("<b>Embedded script files:</b>")); @@ -669,21 +823,52 @@ void DocumentProperties::build_scripting() _embed_button_box.add(_embed_new_btn); _embed_button_box.add(_embed_remove_btn); - _page_embedded_scripts.set_spacing(4); + _page_embedded_scripts->set_spacing(4); row = 0; label_embedded->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_embedded->set_hexpand(); + label_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _EmbeddedScriptsListScroller.set_hexpand(); + _EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _embed_button_box.set_hexpand(); + _embed_button_box.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1); +#else + _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_embedded_scripts.table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer_embedded->set_hexpand(); + spacer_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the Embedded Scripts box @@ -698,10 +883,24 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("<b>Content:</b>")); label_embedded_content->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_embedded_content->set_hexpand(); + label_embedded_content->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _EmbeddedContentScroller.set_hexpand(); + _EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -757,12 +956,19 @@ void DocumentProperties::build_metadata() { using Inkscape::UI::Widget::EntityEntry; - _page_metadata1.show(); + _page_metadata1->show(); Gtk::Label *label = manage (new Gtk::Label); label->set_markup (_("<b>Dublin Core Entities</b>")); label->set_alignment (0.0); - _page_metadata1.table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + label->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach (*label, 0,0,3,1); +#else + _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; int row = 1; @@ -772,9 +978,22 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata1.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*space, 0, row, 1, 1); + + w->_label.set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(w->_label, 1, row, 1, 1); + + w->_packable->set_hexpand(); + w->_packable->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*w->_packable, 2, row, 1, 1); +#else + _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } } @@ -782,30 +1001,53 @@ void DocumentProperties::build_metadata() button_save->set_tooltip_text(_("Save this metadata as the default metadata")); Gtk::Button *button_load = manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *box_buttons = manage (new Gtk::ButtonBox); +#else Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox); +#endif + box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); box_buttons->pack_start(*button_save, true, true, 6); box_buttons->pack_start(*button_load, true, true, 6); - _page_metadata1.pack_end(*box_buttons, false, false, 0); + _page_metadata1->pack_end(*box_buttons, false, false, 0); button_save->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::save_default_metadata)); button_load->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::load_default_metadata)); - _page_metadata2.show(); + _page_metadata2->show(); row = 0; Gtk::Label *llabel = manage (new Gtk::Label); llabel->set_markup (_("<b>License</b>")); llabel->set_alignment (0.0); - _page_metadata2.table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + llabel->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*llabel, 0, row, 3, 1); +#else + _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata2.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2.table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*space, 0, row, 1, 1); + + _licensor.set_hexpand(); + _licensor.set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(_licensor, 1, row, 3, 1); +#else + _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif } void DocumentProperties::addExternalScript(){ diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 5bafddc32..56fed30c4 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -15,8 +15,7 @@ #define INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H #include <stddef.h> -#include <sigc++/sigc++.h>// -#include "ui/widget/notebook-page.h" +#include <sigc++/sigc++.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/liststore.h> #include <gtkmm/notebook.h> @@ -39,6 +38,7 @@ namespace Inkscape { namespace UI { namespace Widget { class EntityEntry; + class NotebookPage; } namespace Dialog { @@ -100,18 +100,18 @@ protected: Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer; Gtk::Notebook _notebook; - UI::Widget::NotebookPage _page_page; - UI::Widget::NotebookPage _page_guides; - UI::Widget::NotebookPage _page_snap; - UI::Widget::NotebookPage _page_cms; - UI::Widget::NotebookPage _page_scripting; + UI::Widget::NotebookPage *_page_page; + UI::Widget::NotebookPage *_page_guides; + UI::Widget::NotebookPage *_page_snap; + UI::Widget::NotebookPage *_page_cms; + UI::Widget::NotebookPage *_page_scripting; Gtk::Notebook _scripting_notebook; - UI::Widget::NotebookPage _page_external_scripts; - UI::Widget::NotebookPage _page_embedded_scripts; + UI::Widget::NotebookPage *_page_external_scripts; + UI::Widget::NotebookPage *_page_embedded_scripts; - UI::Widget::NotebookPage _page_metadata1; - UI::Widget::NotebookPage _page_metadata2; + UI::Widget::NotebookPage *_page_metadata1; + UI::Widget::NotebookPage *_page_metadata2; Gtk::VBox _grids_vbox; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index ecdfd3346..603786742 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -193,9 +193,15 @@ Export::Export (void) : selectiontype_buttons[i]->signal_clicked().connect(sigc::mem_fun(*this, &Export::onAreaToggled)); } +#if WITH_GTKMM_3_0 + Gtk::Grid* t = new Gtk::Grid(); + t->set_row_spacing(4); + t->set_column_spacing(4); +#else Gtk::Table* t = new Gtk::Table(3, 4, false); t->set_row_spacings (4); t->set_col_spacings (4); +#endif x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(), t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1, @@ -236,9 +242,17 @@ Export::Export (void) : bm_label = new Gtk::Label(_("<b>Image size</b>"), Gtk::ALIGN_START); bm_label->set_use_markup(true); size_box.pack_start(*bm_label, false, false, 0); + +#if WITH_GTKMM_3_0 + Gtk::Grid *t = new Gtk::Grid(); + t->set_row_spacing(4); + t->set_column_spacing(4); +#else Gtk::Table *t = new Gtk::Table(2, 5, false); t->set_row_spacings (4); t->set_col_spacings (4); +#endif + size_box.pack_start(*t); bmwidth_adj = createSpinbutton ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0, @@ -442,7 +456,7 @@ void Export::set_default_filename () { #if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, float step, float page, GtkWidget *us, - Gtk::Table *t, int x, int y, + Gtk::Grid *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ) @@ -470,17 +484,29 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!ll.empty()) { l = new Gtk::Label(ll,true); l->set_alignment (1.0, 0.5); + +#if WITH_GTKMM_3_0 + l->set_hexpand(); + l->set_vexpand(); + t->attach(*l, x + pos, y, 1, 1); +#else t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + l->set_sensitive(sensitive); pos++; } #if WITH_GTKMM_3_0 Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); + sb->set_hexpand(); + sb->set_vexpand(); + t->attach(*sb, x + pos, y, 1, 1); #else Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); -#endif t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + sb->set_width_chars(7); sb->set_sensitive (sensitive); pos++; @@ -490,7 +516,15 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!lr.empty()) { l = new Gtk::Label(lr,true); l->set_alignment (0.0, 0.5); + +#if WITH_GTKMM_3_0 + l->set_hexpand(); + l->set_vexpand(); + t->attach(*l, x + pos, y, 1, 1); +#else t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + l->set_sensitive (sensitive); pos++; l->set_mnemonic_widget (*sb); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index c5782fabc..5dca9cfa5 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -126,7 +126,7 @@ private: #if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max, float step, float page, GtkWidget *us, - Gtk::Table *t, int x, int y, + Gtk::Grid *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ); diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 5ba4e7e39..8de2da18b 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -15,6 +15,7 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#include "ui/widget/notebook-page.h" #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -35,15 +36,17 @@ #include "ui/view/view-widget.h" +#include <gtkmm/table.h> + namespace Inkscape { namespace UI { namespace Dialog { FillAndStroke::FillAndStroke() : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE), - _page_fill(1, 1, true, true), - _page_stroke_paint(1, 1, true, true), - _page_stroke_style(1, 1, true, true), + _page_fill(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_stroke_paint(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_stroke_style(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", UI::Widget::SimpleFilterModifier::BLUR), deskTrack(), targetDesktop(0), @@ -56,9 +59,9 @@ FillAndStroke::FillAndStroke() contents->pack_start(_notebook, true, true); - _notebook.append_page(_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON("object-fill"))); - _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke"))); - _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style"))); + _notebook.append_page(*_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON("object-fill"))); + _notebook.append_page(*_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke"))); + _notebook.append_page(*_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style"))); _notebook.signal_switch_page().connect(sigc::mem_fun(this, &FillAndStroke::_onSwitchPage)); @@ -129,14 +132,14 @@ void FillAndStroke::_layoutPageFill() { fillWdgt = manage(sp_fill_style_widget_new()); - _page_fill.table().attach(*fillWdgt, 0, 1, 0, 1); + _page_fill->table().attach(*fillWdgt, 0, 0, 1, 1); } void FillAndStroke::_layoutPageStrokePaint() { strokeWdgt = manage(sp_stroke_style_paint_widget_new()); - _page_stroke_paint.table().attach(*strokeWdgt, 0, 1, 0, 1); + _page_stroke_paint->table().attach(*strokeWdgt, 0, 0, 1, 1); } void @@ -145,7 +148,7 @@ FillAndStroke::_layoutPageStrokeStyle() //Gtk::Widget *strokeStyleWdgt = manage(Glib::wrap(sp_stroke_style_line_widget_new())); //Gtk::Widget *strokeStyleWdgt = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new()); strokeStyleWdgt = sp_stroke_style_line_widget_new(); - _page_stroke_style.table().attach(*strokeStyleWdgt, 0, 1, 0, 1); + _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 0, 1, 1); } void diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index 255cea89a..340cb860f 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -16,7 +16,6 @@ #define INKSCAPE_UI_DIALOG_FILL_AND_STROKE_H #include "ui/widget/panel.h" -#include "ui/widget/notebook-page.h" #include "ui/widget/object-composite-settings.h" #include "ui/dialog/desktop-tracker.h" @@ -25,6 +24,11 @@ namespace Inkscape { namespace UI { + +namespace Widget { +class NotebookPage; +} + namespace Dialog { class FillAndStroke : public UI::Widget::Panel { @@ -47,9 +51,9 @@ public: protected: Gtk::Notebook _notebook; - UI::Widget::NotebookPage _page_fill; - UI::Widget::NotebookPage _page_stroke_paint; - UI::Widget::NotebookPage _page_stroke_style; + UI::Widget::NotebookPage *_page_fill; + UI::Widget::NotebookPage *_page_stroke_paint; + UI::Widget::NotebookPage *_page_stroke_style; UI::Widget::StyleSubject::Selection _subject; UI::Widget::ObjectCompositeSettings _composite_settings; diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index be44794d0..9bad90e7c 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -19,7 +19,13 @@ #include <gtkmm/label.h> #include <gtkmm/liststore.h> #include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/treemodelcolumn.h> #include <gtkmm/widget.h> @@ -336,7 +342,12 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns(), desktopConns() { +#if WITH_GTKMM_3_0 + Gtk::Grid *table = new Gtk::Grid(); +#else Gtk::Table *table = new Gtk::Table(3, 1, false); +#endif + _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; @@ -349,9 +360,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : gtk_widget_set_size_request (fontsel, 0, 150); g_signal_connect( G_OBJECT(fontsel), "font_set", G_CALLBACK(fontChangeCB), this ); +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, row, 3, 1); +#else table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, 3, row, row + 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); +#endif + row++; @@ -359,9 +375,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : { Gtk::Label *label = new Gtk::Label(_("Script: ")); + +#if WITH_GTKMM_3_0 + table->attach( *Gtk::manage(label), 0, row, 1, 1); +#else table->attach( *Gtk::manage(label), 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); +#endif scriptCombo = new Gtk::ComboBoxText(); for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) @@ -372,11 +393,17 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : scriptCombo->set_active_text(getScriptToName()[G_UNICODE_SCRIPT_INVALID_CODE]); sigc::connection conn = scriptCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild)); instanceConns.push_back(conn); - Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); + Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0)); align->add(*Gtk::manage(scriptCombo)); - table->attach( *Gtk::manage(align), + +#if WITH_GTKMM_3_0 + align->set_hexpand(); + table->attach( *align, 1, row, 1, 1); +#else + table->attach( *align, 1, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); +#endif } row++; @@ -385,9 +412,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : { Gtk::Label *label = new Gtk::Label(_("Range: ")); + +#if WITH_GTKMM_3_0 + table->attach( *Gtk::manage(label), 0, row, 1, 1); +#else table->attach( *Gtk::manage(label), 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); +#endif rangeCombo = new Gtk::ComboBoxText(); for ( std::vector<NamedRange>::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { @@ -399,9 +431,15 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns.push_back(conn); Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); align->add(*Gtk::manage(rangeCombo)); + +#if WITH_GTKMM_3_0 + align->set_hexpand(); + table->attach( *Gtk::manage(align), 1, row, 1, 1); +#else table->attach( *Gtk::manage(align), 1, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); +#endif } row++; @@ -424,9 +462,17 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); + +#if WITH_GTKMM_3_0 + scroller->set_hexpand(); + scroller->set_vexpand(); + table->attach(*Gtk::manage(scroller), 0, row, 3, 1); +#else table->attach(*Gtk::manage(scroller), 0, 3, row, row + 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); +#endif + row++; // ------------------------------- @@ -456,9 +502,15 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); +#if WITH_GTKMM_3_0 + box->set_hexpand(); + table->attach( *Gtk::manage(box), 0, row, 3, 1); +#else table->attach( *Gtk::manage(box), 0, 3, row, row + 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); +#endif + row++; // ------------------------------- diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 1df0d606e..9c9f7faa3 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -31,7 +31,13 @@ #include <gtkmm/paned.h> #include <gtkmm/progressbar.h> #include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/treemodel.h> #include <gtkmm/treemodelcolumn.h> #include <gtkmm/treestore.h> @@ -504,7 +510,12 @@ private: Gtk::Label devAxesCount; Gtk::ComboBoxText axesCombo; Gtk::ProgressBar axesValues[6]; + +#if WITH_GTKMM_3_0 + Gtk::Grid axisTable; +#else Gtk::Table axisTable; +#endif Gtk::ComboBoxText buttonCombo; Gtk::ComboBoxText linkCombo; @@ -515,7 +526,13 @@ private: Gtk::Image testThumb; Gtk::Image testButtons[24]; Gtk::Image testAxes[8]; + +#if WITH_GTKMM_3_0 + Gtk::Grid imageTable; +#else Gtk::Table imageTable; +#endif + Gtk::EventBox testDetector; ConfPanel cfgPanel; @@ -603,13 +620,18 @@ InputDialogImpl::InputDialogImpl() : splitter(), #if WITH_GTKMM_3_0 split2(Gtk::ORIENTATION_VERTICAL), + axisTable(), #else split2(), -#endif axisTable(11, 2), +#endif linkCombo(), topHolder(), +#if WITH_GTKMM_3_0 + imageTable(), +#else imageTable(8, 7), +#endif testDetector(), cfgPanel() { @@ -631,13 +653,27 @@ InputDialogImpl::InputDialogImpl() : testFrame.add(testDetector); testThumb.set(getPix(PIX_TABLET)); testThumb.set_padding(24, 24); + +#if WITH_GTKMM_3_0 + testThumb.set_hexpand(); + testThumb.set_vexpand(); + imageTable.attach(testThumb, 0, 0, 8, 1); +#else imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND); +#endif + { guint col = 0; guint row = 1; for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) { testButtons[num].set(getPix(PIX_BUTTONS_NONE)); + +#if WITH_GTKMM_3_0 + imageTable.attach(testButtons[num], col, row, 1, 1); +#else imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); +#endif + col++; if (col > 7) { col = 0; @@ -648,7 +684,13 @@ InputDialogImpl::InputDialogImpl() : col = 0; for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) { testAxes[num].set(getPix(PIX_AXIS_NONE)); + +#if WITH_GTKMM_3_0 + imageTable.attach(testAxes[num], col * 2, row, 2, 1); +#else imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); +#endif + col++; if (col > 3) { col = 0; @@ -686,28 +728,44 @@ InputDialogImpl::InputDialogImpl() : axisFrame.add(axisTable); Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif linkCombo.append(_("None")); linkCombo.set_active_text(_("None")); linkCombo.set_sensitive(false); linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged)); +#if WITH_GTKMM_3_0 + axisTable.attach(linkCombo, 1, rowNum, 1, 1); +#else axisTable.attach(linkCombo, 1, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; lbl = Gtk::manage(new Gtk::Label(_("Axes count:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); + axisTable.attach(devAxesCount, 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); axisTable.attach(devAxesCount, 1, 2, rowNum, rowNum + 1, ::Gtk::SHRINK, ::Gtk::SHRINK); +#endif rowNum++; @@ -726,12 +784,22 @@ InputDialogImpl::InputDialogImpl() : for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) { lbl = Gtk::manage(new Gtk::Label(_("axis:"))); + +#if WITH_GTKMM_3_0 + lbl->set_hexpand(); + axisTable.attach(*lbl, 0, rowNum, 1, 1); + + axesValues[barNum].set_hexpand(); + axisTable.attach(axesValues[barNum], 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::EXPAND, ::Gtk::SHRINK); axisTable.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1, ::Gtk::EXPAND, ::Gtk::SHRINK); +#endif + axesValues[barNum].set_sensitive(false); rowNum++; @@ -740,12 +808,18 @@ InputDialogImpl::InputDialogImpl() : } lbl = Gtk::manage(new Gtk::Label(_("Button count:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); + axisTable.attach(devKeyCount, 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); axisTable.attach(devKeyCount, 1, 2, rowNum, rowNum + 1, ::Gtk::SHRINK, ::Gtk::SHRINK); +#endif rowNum++; @@ -761,9 +835,14 @@ InputDialogImpl::InputDialogImpl() : rowNum++; */ +#if WITH_GTKMM_3_0 + axisTable.attach(keyVal, 0, rowNum, 2, 1); +#else axisTable.attach(keyVal, 0, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; @@ -781,9 +860,14 @@ InputDialogImpl::InputDialogImpl() : #endif testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK); +#if WITH_GTKMM_3_0 + axisTable.attach(keyEntry, 0, rowNum, 2, 1); +#else axisTable.attach(keyEntry, 0, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 97d8b0523..cc6ddd7de 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -22,7 +22,13 @@ #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/scrolledwindow.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/iconview.h> @@ -100,20 +106,35 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : { /******************** Table *************************/ - // Replace by Grid for GTK 3.0 +#if WITH_GTKMM_3_0 + Gtk::Grid *table = new Gtk::Grid(); +#else Gtk::Table *table = new Gtk::Table(2, 4, false); +#endif + // panel is a cloked Gtk::VBox _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; /******************** Symbol Sets *************************/ Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelSet),0,row,1,1); +#else table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif symbolSet = new Gtk::ComboBoxText(); // Fill in later symbolSet->append(_("Current Document")); symbolSet->set_active_text(_("Current Document")); + +#if WITH_GTKMM_3_0 + symbolSet->set_hexpand(); + table->attach(*Gtk::manage(symbolSet),1,row,1,1); +#else table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connSet = symbolSet->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); @@ -143,13 +164,25 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); + +#if WITH_GTKMM_3_0 + scroller->set_hexpand(); + scroller->set_vexpand(); + table->attach(*Gtk::manage(scroller),0,row,2,1); +#else table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL); +#endif ++row; /******************** Preview Scale ***********************/ Gtk::Label* labelScale = new Gtk::Label(_("Preview scale: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelScale),0,row,1,1); +#else table->attach(*Gtk::manage(labelScale),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif previewScale = new Gtk::ComboBoxText(); const gchar *scales[] = @@ -158,7 +191,13 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : previewScale->append(scales[i]); } previewScale->set_active_text(scales[0]); + +#if WITH_GTKMM_3_0 + previewScale->set_hexpand(); + table->attach(*Gtk::manage(previewScale),1,row,1,1); +#else table->attach(*Gtk::manage(previewScale),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connScale = previewScale->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); @@ -168,7 +207,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /******************** Preview Size ************************/ Gtk::Label* labelSize = new Gtk::Label(_("Preview size: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelSize),0,row,1,1); +#else table->attach(*Gtk::manage(labelSize),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif previewSize = new Gtk::ComboBoxText(); const gchar *sizes[] = {"16", "24", "32", "48", "64", NULL}; @@ -176,7 +220,13 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : previewSize->append(sizes[i]); } previewSize->set_active_text(sizes[2]); + +#if WITH_GTKMM_3_0 + previewSize->set_hexpand(); + table->attach(*Gtk::manage(previewSize),1,row,1,1); +#else table->attach(*Gtk::manage(previewSize),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connSize = previewSize->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 410cdbda9..c35d3b554 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -14,14 +14,17 @@ */ //#define DEBUG_GRID_ARRANGE 1 -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include "tile.h" #include <gtk/gtk.h> //for GTK_RESPONSE* types #include <glibmm/i18n.h> #include <gtkmm/stock.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <2geom/transforms.h> #include "verbs.h" @@ -614,7 +617,11 @@ TileDialog::TileDialog() : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns", &PaddingUnitMenu), YPadding(_("Y:"), _("Vertical spacing between rows."), UNIT_TYPE_LINEAR, "", "object-rows", &PaddingUnitMenu), - PaddingTable(2, 2, false) +#if WITH_GTKMM_3_0 + PaddingTable(Gtk::manage(new Gtk::Grid())) +#else + PaddingTable(Gtk::manage(new Gtk::Table(2, 2, false))) +#endif { // bool used by spin button callbacks to stop loops where they change each other. updating = false; @@ -834,13 +841,23 @@ TileDialog::TileDialog() XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_xpad_spinbutton_changed)); } - PaddingTable.set_border_width(MARGIN); - PaddingTable.set_row_spacings(MARGIN); - PaddingTable.set_col_spacings(MARGIN); - PaddingTable.attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable.attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable.attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); - TileBox.pack_start(PaddingTable, false, false, MARGIN); + PaddingTable->set_border_width(MARGIN); + +#if WITH_GTKMM_3_0 + PaddingTable->set_row_spacing(MARGIN); + PaddingTable->set_column_spacing(MARGIN); + PaddingTable->attach(XPadding, 0, 0, 1, 1); + PaddingTable->attach(PaddingUnitMenu, 1, 0, 1, 1); + PaddingTable->attach(YPadding, 0, 1, 1, 1); +#else + PaddingTable->set_row_spacings(MARGIN); + PaddingTable->set_col_spacings(MARGIN); + PaddingTable->attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + PaddingTable->attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + PaddingTable->attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + + TileBox.pack_start(*PaddingTable, false, false, MARGIN); contents->pack_start(TileBox); diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 884cd3bae..86dbd25a9 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -15,11 +15,14 @@ #ifndef SEEN_UI_DIALOG_TILE_H #define SEEN_UI_DIALOG_TILE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/checkbutton.h> #include <gtkmm/radiobutton.h> -#include <gtkmm/table.h> #include "ui/widget/panel.h" #include "ui/widget/spinbutton.h" @@ -27,6 +30,12 @@ namespace Gtk { class Button; + +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif } namespace Inkscape { @@ -133,7 +142,12 @@ private: Inkscape::UI::Widget::UnitMenu PaddingUnitMenu; Inkscape::UI::Widget::ScalarUnit XPadding; Inkscape::UI::Widget::ScalarUnit YPadding; - Gtk::Table PaddingTable; + +#if WITH_GTKMM_3_0 + Gtk::Grid *PaddingTable; +#else + Gtk::Table *PaddingTable; +#endif // BBox or manual spacing Gtk::VBox SpacingVBox; diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 329450b52..c071fcf95 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -216,25 +216,40 @@ void Transformation::layoutPageMove() _scalar_move_vertical.setIncrements(0.1, 1.0); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_HOR ); + +#if WITH_GTKMM_3_0 + _page_move.table().attach(_scalar_move_horizontal, 0, 0, 2, 1); + _page_move.table().attach(_units_move, 2, 0, 1, 1); +#else _page_move.table() .attach(_scalar_move_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); _page_move.table() .attach(_units_move, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif _scalar_move_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_VER ); +#if WITH_GTKMM_3_0 + _page_move.table().attach(_scalar_move_vertical, 0, 1, 2, 1); +#else _page_move.table() .attach(_scalar_move_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif _scalar_move_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); // Relative moves +#if WITH_GTKMM_3_0 + _page_move.table().attach(_check_move_relative, 0, 2, 2, 1); +#else _page_move.table() .attach(_check_move_relative, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_move_relative.set_active(true); _check_move_relative.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onMoveRelativeToggled)); @@ -259,21 +274,37 @@ void Transformation::layoutPageScale() _scalar_scale_vertical.setAbsoluteIsIncrement(true); _scalar_scale_vertical.setPercentageIsIncrement(true); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_scalar_scale_horizontal, 0, 0, 2, 1); +#else _page_scale.table() .attach(_scalar_scale_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_scale_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleXValueChanged)); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_units_scale, 2, 0, 1, 1); + _page_scale.table().attach(_scalar_scale_vertical, 0, 1, 2, 1); +#else _page_scale.table() .attach(_units_scale, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); _page_scale.table() .attach(_scalar_scale_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_scale_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleYValueChanged)); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_check_scale_proportional, 0, 2, 2, 1); +#else _page_scale.table() .attach(_check_scale_proportional, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_scale_proportional.set_active(false); _check_scale_proportional.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onScaleProportionalToggled)); @@ -304,6 +335,12 @@ void Transformation::layoutPageRotate() Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group(); _clockwise_rotate.set_group(group); +#if WITH_GTKMM_3_0 + _page_rotate.table().attach(_scalar_rotate, 0, 0, 2, 1); + _page_rotate.table().attach(_units_rotate, 2, 0, 1, 1); + _page_rotate.table().attach(_counterclockwise_rotate, 3, 0, 1, 1); + _page_rotate.table().attach(_clockwise_rotate, 4, 0, 1, 1); +#else _page_rotate.table() .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); @@ -315,6 +352,7 @@ void Transformation::layoutPageRotate() _page_rotate.table() .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { @@ -348,16 +386,27 @@ void Transformation::layoutPageSkew() _scalar_skew_vertical.setDigits(3); _scalar_skew_vertical.setIncrements(0.1, 1.0); +#if WITH_GTKMM_3_0 + _page_skew.table().attach(_scalar_skew_horizontal, 0, 0, 2, 1); +#else _page_skew.table() .attach(_scalar_skew_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_skew_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); +#if WITH_GTKMM_3_0 + _page_skew.table().attach(_units_skew, 2, 0, 1, 1); + _page_skew.table().attach(_scalar_skew_vertical, 0, 1, 2, 1); +#else _page_skew.table() .attach(_units_skew, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); _page_skew.table() .attach(_scalar_skew_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_skew_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); @@ -373,30 +422,46 @@ void Transformation::layoutPageTransform() _scalar_transform_a.setDigits(3); _scalar_transform_a.setIncrements(0.1, 1.0); _scalar_transform_a.setValue(1.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_a, 0, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_a, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_a.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); - _scalar_transform_b.setWidgetSizeRequest(65, -1); _scalar_transform_b.setRange(-1e10, 1e10); _scalar_transform_b.setDigits(3); _scalar_transform_b.setIncrements(0.1, 1.0); _scalar_transform_b.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_b, 0, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_b, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_b.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); - _scalar_transform_c.setWidgetSizeRequest(65, -1); _scalar_transform_c.setRange(-1e10, 1e10); _scalar_transform_c.setDigits(3); _scalar_transform_c.setIncrements(0.1, 1.0); _scalar_transform_c.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_c, 1, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_c, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_c.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -406,8 +471,14 @@ void Transformation::layoutPageTransform() _scalar_transform_d.setDigits(3); _scalar_transform_d.setIncrements(0.1, 1.0); _scalar_transform_d.setValue(1.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_d, 1, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_d, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_d.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -417,8 +488,14 @@ void Transformation::layoutPageTransform() _scalar_transform_e.setDigits(3); _scalar_transform_e.setIncrements(0.1, 1.0); _scalar_transform_e.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_e, 2, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_e, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_e.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -428,14 +505,25 @@ void Transformation::layoutPageTransform() _scalar_transform_f.setDigits(3); _scalar_transform_f.setIncrements(0.1, 1.0); _scalar_transform_f.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_f, 2, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_f, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_f.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); // Edit existing matrix +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_check_replace_matrix, 0, 2, 2, 1); +#else _page_transform.table() .attach(_check_replace_matrix, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_replace_matrix.set_active(false); _check_replace_matrix.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onReplaceMatrixToggled)); diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index 92bcb6937..6653499b8 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -9,22 +9,35 @@ * Released under GNU GPL. Read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include "notebook-page.h" +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + namespace Inkscape { namespace UI { namespace Widget { NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, guint padding) - :_table(n_rows, n_columns) +#if WITH_GTKMM_3_0 + :_table(Gtk::manage(new Gtk::Grid())) +#else + :_table(Gtk::manage(new Gtk::Table(n_rows, n_columns))) +#endif { set_border_width(2); - _table.set_spacings(2); - pack_start(_table, expand, fill, padding); + +#if WITH_GTKMM_3_0 + _table->set_row_spacing(2); + _table->set_column_spacing(2); +#else + _table->set_spacings(2); +#endif + + pack_start(*_table, expand, fill, padding); } } // namespace Widget diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index 140b7cb33..d8b8fb0c4 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -10,8 +10,19 @@ #ifndef INKSCAPE_UI_WIDGET_NOTEBOOK_PAGE_H #define INKSCAPE_UI_WIDGET_NOTEBOOK_PAGE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <gtkmm/box.h> -#include <gtkmm/table.h> + +namespace Gtk { +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif +} namespace Inkscape { namespace UI { @@ -31,10 +42,19 @@ public: */ NotebookPage(int n_rows, int n_columns, bool expand=false, bool fill=false, guint padding=0); - Gtk::Table& table() { return _table; } +#if WITH_GTKMM_3_0 + Gtk::Grid& table() { return *_table; } +#else + Gtk::Table& table() { return *_table; } +#endif protected: - Gtk::Table _table; + +#if WITH_GTKMM_3_0 + Gtk::Grid *_table; +#else + Gtk::Table *_table; +#endif }; } // namespace Widget diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 44bceb826..a89f42575 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -11,15 +11,11 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "style-swatch.h" #include <cstring> #include <string> -#include "style-swatch.h" - #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -37,6 +33,12 @@ #include "verbs.h" #include <glibmm/i18n.h> +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + enum { SS_FILL, SS_STROKE @@ -114,7 +116,11 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _css(NULL), _tool_obs(NULL), _style_obs(NULL), - _table(2, 6), +#if WITH_GTKMM_3_0 + _table(Gtk::manage(new Gtk::Grid())), +#else + _table(Gtk::manage(new Gtk::Table(2, 6))), +#endif _sw_unit(NULL) { _label[SS_FILL].set_markup(_("Fill:")); @@ -130,23 +136,35 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_value.set_alignment(0.0, 0.5); _opacity_value.set_padding(0, 0); - _table.set_col_spacings (2); - _table.set_row_spacings (0); +#if WITH_GTKMM_3_0 + _table->set_column_spacing(2); + _table->set_row_spacing(0); +#else + _table->set_col_spacings(2); + _table->set_row_spacings(0); +#endif _stroke.pack_start(_place[SS_STROKE]); _stroke_width_place.add(_stroke_width); _stroke.pack_start(_stroke_width_place, Gtk::PACK_SHRINK); - - _table.attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table.attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - - _table.attach(_place[SS_FILL], 1,2, 0,1); - _table.attach(_stroke, 1,2, 1,2); - + _opacity_place.add(_opacity_value); - _table.attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); - _swatch.add(_table); +#if WITH_GTKMM_3_0 + _table->attach(_label[SS_FILL], 0, 0, 1, 1); + _table->attach(_label[SS_STROKE], 0, 1, 1, 1); + _table->attach(_place[SS_FILL], 1, 0, 1, 1); + _table->attach(_stroke, 1, 1, 1, 1); + _table->attach(_opacity_place, 2, 0, 1, 2); +#else + _table->attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); + _table->attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); + _table->attach(_place[SS_FILL], 1,2, 0,1); + _table->attach(_stroke, 1,2, 1,2); + _table->attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); +#endif + + _swatch.add(*_table); pack_start(_swatch, true, true, 0); set_size_request (STYLE_SWATCH_WIDTH, -1); diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 999bbd4ca..7e385e3df 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -13,8 +13,11 @@ #ifndef INKSCAPE_UI_CURRENT_STYLE_H #define INKSCAPE_UI_CURRENT_STYLE_H +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include <gtkmm/box.h> -#include <gtkmm/table.h> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> #include <gtkmm/enums.h> @@ -27,6 +30,14 @@ class SPUnit; class SPStyle; class SPCSSAttr; +namespace Gtk { +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif +} + namespace Inkscape { namespace UI { namespace Widget { @@ -60,7 +71,13 @@ private: Glib::ustring _tool_path; Gtk::EventBox _swatch; - Gtk::Table _table; + +#if WITH_GTKMM_3_0 + Gtk::Grid *_table; +#else + Gtk::Table *_table; +#endif + Gtk::Label _label[2]; Gtk::EventBox _place[2]; Gtk::EventBox _opacity_place; diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index a1702a864..1f0fcd94e 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -12,9 +12,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "sp-attribute-widget.h" + #include <glibmm/i18n.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <sigc++/functors/ptr_fun.h> #include <sigc++/adaptors/bind.h> @@ -24,7 +33,6 @@ #include "document.h" #include "document-undo.h" #include "verbs.h" -#include "sp-attribute-widget.h" using Inkscape::DocumentUndo; @@ -150,11 +158,14 @@ void SPAttributeTable::set_object(SPObject *object, release_connection = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this)); // Create table - table = new Gtk::Table (attributes.size(), 2, false); +#if WITH_GTKMM_3_0 + table = new Gtk::Grid(); +#else + table = new Gtk::Table(attributes.size(), 2, false); +#endif + if (!(parent == NULL)) - { - gtk_container_add (GTK_CONTAINER (parent),(GtkWidget*)table->gobj()); - } + gtk_container_add(GTK_CONTAINER(parent), (GtkWidget*)table->gobj()); // Fill rows _attributes = attributes; @@ -162,18 +173,41 @@ void SPAttributeTable::set_object(SPObject *object, Gtk::Label *ll = new Gtk::Label (_(labels[i].c_str())); ll->show(); ll->set_alignment (1.0, 0.5); + +#if WITH_GTKMM_3_0 + ll->set_vexpand(); + ll->set_margin_left(XPAD); + ll->set_margin_right(XPAD); + ll->set_margin_top(XPAD); + ll->set_margin_bottom(XPAD); + table->attach(*ll, 0, i, 1, 1); +#else table->attach (*ll, 0, 1, i, i + 1, Gtk::FILL, (Gtk::EXPAND | Gtk::FILL), XPAD, YPAD ); +#endif + Gtk::Entry *ee = new Gtk::Entry(); ee->show(); const gchar *val = object->getRepr()->attribute(attributes[i].c_str()); ee->set_text (val ? val : (const gchar *) ""); + +#if WITH_GTKMM_3_0 + ee->set_hexpand(); + ee->set_vexpand(); + ee->set_margin_left(XPAD); + ee->set_margin_right(XPAD); + ee->set_margin_top(XPAD); + ee->set_margin_bottom(XPAD); + table->attach(*ee, 1, i, 1, 1); +#else table->attach (*ee, 1, 2, i, i + 1, (Gtk::EXPAND | Gtk::FILL), (Gtk::EXPAND | Gtk::FILL), XPAD, YPAD ); +#endif + _entries.push_back(ee); g_signal_connect ( ee->gobj(), "changed", G_CALLBACK (sp_attribute_table_entry_changed), diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index fb8a74632..d9b972201 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -15,13 +15,22 @@ #ifndef SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H #define SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H -#include <gtkmm/table.h> +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include <gtkmm/widget.h> #include <stddef.h> #include <sigc++/connection.h> namespace Gtk { class Entry; + +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif } namespace Inkscape { @@ -126,12 +135,16 @@ public: bool blocked; private: - /** + /** * Container widget for the dynamically created child widgets (labels and entry boxes). */ +#if WITH_GTKMM_3_0 + Gtk::Grid *table; +#else Gtk::Table *table; +#endif - /** + /** * List of attributes. * * _attributes stores the attribute names of the selected object that |
