diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2013-05-16 16:00:19 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2013-05-16 16:00:19 +0000 |
| commit | 58f7c54bdd82261552c308b672e8d5f079bf5c6d (patch) | |
| tree | c62c20759bfdea3c52cd2805289957731ab38305 /src | |
| parent | merge from trunk (r12322) (diff) | |
| parent | Win32. More include fixes for glibmm 2.36 (file dialog). (diff) | |
| download | inkscape-58f7c54bdd82261552c308b672e8d5f079bf5c6d.tar.gz inkscape-58f7c54bdd82261552c308b672e8d5f079bf5c6d.zip | |
merge from trunk (r12337)
(bzr r11668.1.70)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/dbus/wrapper/inkscape-dbus-wrapper.c | 2 | ||||
| -rw-r--r-- | src/extension/internal/image-resolution.cpp | 33 | ||||
| -rw-r--r-- | src/extension/internal/image-resolution.h | 23 | ||||
| -rw-r--r-- | src/selcue.cpp | 48 | ||||
| -rw-r--r-- | src/selcue.h | 17 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 30 | ||||
| -rw-r--r-- | src/selection-chemistry.h | 1 | ||||
| -rw-r--r-- | src/seltrans.cpp | 25 | ||||
| -rw-r--r-- | src/seltrans.h | 15 | ||||
| -rw-r--r-- | src/sp-image.cpp | 8 | ||||
| -rw-r--r-- | src/sp-object.cpp | 4 | ||||
| -rw-r--r-- | src/text-context.cpp | 34 | ||||
| -rw-r--r-- | src/ui/dialog/export.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/filedialog.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.h | 9 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 5 | ||||
| -rw-r--r-- | src/ui/dialog/layers.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/symbols.h | 21 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.cpp | 532 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.h | 62 |
22 files changed, 569 insertions, 323 deletions
diff --git a/src/extension/dbus/wrapper/inkscape-dbus-wrapper.c b/src/extension/dbus/wrapper/inkscape-dbus-wrapper.c index 7a33d4f38..0be1be42e 100644 --- a/src/extension/dbus/wrapper/inkscape-dbus-wrapper.c +++ b/src/extension/dbus/wrapper/inkscape-dbus-wrapper.c @@ -96,7 +96,9 @@ inkscape_desktop_init_dbus () GError *error; DBusGProxy *proxy; +#if !GLIB_CHECK_VERSION(2,36,0) g_type_init (); +#endif error = NULL; connection = dbus_g_bus_get (DBUS_BUS_SESSION, diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index 51a3fe9c1..3c254a59c 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -21,6 +21,9 @@ #ifdef HAVE_JPEG #define IR_TRY_JFIF 1 #endif +#ifdef WITH_IMAGE_MAGICK +#include <Magick++.h> +#endif namespace Inkscape { namespace Extension { @@ -39,6 +42,9 @@ ImageResolution::ImageResolution(char const *fn) { if (!ok_) { readexif(fn); } + if (!ok_) { + readmagick(fn); + } } bool ImageResolution::ok() const { @@ -328,6 +334,33 @@ void ImageResolution::readjfif(char const *) { #endif +#ifdef WITH_IMAGE_MAGICK +void ImageResolution::readmagick(char const *fn) { + Magick::Image image; + try { + image.read(fn); + } catch (...) {} + Magick::Geometry geo = image.density(); + std::string type = image.magick(); + + if (type == "PNG") { // PNG only supports pixelspercentimeter + x_ = (double)geo.width() * 2.54; + y_ = (double)geo.height() * 2.54; + } else { + x_ = (double)geo.width(); + y_ = (double)geo.height(); + } + ok_ = true; +} + +#else + +// Dummy implementation +void ImageResolution::readmagick(char const *) { +} + +#endif /* WITH_IMAGE_MAGICK */ + } } } diff --git a/src/extension/internal/image-resolution.h b/src/extension/internal/image-resolution.h index c42260f7d..6c4928a35 100644 --- a/src/extension/internal/image-resolution.h +++ b/src/extension/internal/image-resolution.h @@ -18,19 +18,20 @@ namespace Internal { class ImageResolution { public: - ImageResolution(char const *fn); - bool ok() const; - double x() const; - double y() const; + ImageResolution(char const *fn); + bool ok() const; + double x() const; + double y() const; private: - bool ok_; - double x_; - double y_; + bool ok_; + double x_; + double y_; private: - void readpng(char const *fn); - void readexif(char const *fn); - void readexiv(char const *fn); - void readjfif(char const *fn); + void readpng(char const *fn); + void readexif(char const *fn); + void readexiv(char const *fn); + void readjfif(char const *fn); + void readmagick(char const *fn); }; } diff --git a/src/selcue.cpp b/src/selcue.cpp index 4c35307f7..3f8a93e21 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -25,8 +25,20 @@ #include "preferences.h" #include "selcue.h" +Inkscape::SelCue::BoundingBoxPrefsObserver::BoundingBoxPrefsObserver(SelCue &sel_cue) : + Observer("/tools/bounding_box"), + _sel_cue(sel_cue) +{ +} + +void Inkscape::SelCue::BoundingBoxPrefsObserver::notify(Preferences::Entry const &val) +{ + _sel_cue._boundingBoxPrefsChanged(static_cast<int>(val.getBool())); +} + Inkscape::SelCue::SelCue(SPDesktop *desktop) - : _desktop(desktop) + : _desktop(desktop), + _bounding_box_prefs_observer(*this) { _selection = sp_desktop_selection(_desktop); @@ -34,11 +46,16 @@ Inkscape::SelCue::SelCue(SPDesktop *desktop) sigc::hide(sigc::mem_fun(*this, &Inkscape::SelCue::_newItemBboxes)) ); - _sel_modified_connection = _selection->connectModified( - sigc::hide(sigc::hide(sigc::mem_fun(*this, &Inkscape::SelCue::_updateItemBboxes))) + { + void(SelCue::*modifiedSignal)() = &SelCue::_updateItemBboxes; + _sel_modified_connection = _selection->connectModified( + sigc::hide(sigc::hide(sigc::mem_fun(*this, modifiedSignal))) ); + } - _updateItemBboxes(); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + _updateItemBboxes(prefs); + prefs->addObserver(_bounding_box_prefs_observer); } Inkscape::SelCue::~SelCue() @@ -59,7 +76,11 @@ Inkscape::SelCue::~SelCue() void Inkscape::SelCue::_updateItemBboxes() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + _updateItemBboxes(Inkscape::Preferences::get()); +} + +void Inkscape::SelCue::_updateItemBboxes(Inkscape::Preferences *prefs) +{ gint mode = prefs->getInt("/options/selcue/value", MARK); if (mode == NONE) { return; @@ -69,6 +90,11 @@ void Inkscape::SelCue::_updateItemBboxes() int prefs_bbox = prefs->getBool("/tools/bounding_box"); + _updateItemBboxes(mode, prefs_bbox); +} + +void Inkscape::SelCue::_updateItemBboxes(gint mode, int prefs_bbox) +{ GSList const *items = _selection->itemList(); if (_item_bboxes.size() != g_slist_length((GSList *) items)) { _newItemBboxes(); @@ -201,6 +227,18 @@ void Inkscape::SelCue::_newTextBaselines() } } +void Inkscape::SelCue::_boundingBoxPrefsChanged(int prefs_bbox) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + gint mode = prefs->getInt("/options/selcue/value", MARK); + if (mode == NONE) { + return; + } + + g_return_if_fail(_selection != NULL); + + _updateItemBboxes(mode, prefs_bbox); +} /* Local Variables: diff --git a/src/selcue.h b/src/selcue.h index f62ef768a..bcac7315f 100644 --- a/src/selcue.h +++ b/src/selcue.h @@ -37,10 +37,25 @@ public: }; private: + class BoundingBoxPrefsObserver: public Preferences::Observer + { + public: + BoundingBoxPrefsObserver(SelCue &sel_cue); + + void notify(Preferences::Entry const &val); + + private: + SelCue &_sel_cue; + }; + + friend class Inkscape::SelCue::BoundingBoxPrefsObserver; void _updateItemBboxes(); + void _updateItemBboxes(Inkscape::Preferences *prefs); + void _updateItemBboxes(gint mode, int prefs_bbox); void _newItemBboxes(); void _newTextBaselines(); + void _boundingBoxPrefsChanged(int prefs_bbox); SPDesktop *_desktop; Selection *_selection; @@ -48,6 +63,8 @@ private: sigc::connection _sel_modified_connection; std::vector<SPCanvasItem*> _item_bboxes; std::vector<SPCanvasItem*> _text_baselines; + + BoundingBoxPrefsObserver _bounding_box_prefs_observer; }; } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index d94b085a0..cd0001175 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -250,6 +250,36 @@ void SelectionHelper::selectPrev(SPDesktop *dt) } } +/* + * Fixes the current selection, removing locked objects from it + */ +void SelectionHelper::fixSelection(SPDesktop *dt) +{ + if(!dt) + return; + + Inkscape::Selection *selection = sp_desktop_selection(dt); + + GSList *items = NULL; + + GSList const *selList = selection->itemList(); + + for( GSList const *i = selList; i; i = i->next ) { + if( SP_IS_ITEM(i->data) && + !dt->isLayer(SP_ITEM(i->data)) && + (!SP_ITEM(i->data)->isLocked())) + { + items = g_slist_prepend(items, SP_ITEM(i->data)); + } + } + + selection->setList(items); + + if(items) { + g_slist_free(items); + } +} + } // namespace Inkscape diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 1c627fd1a..8711a6cdf 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -47,6 +47,7 @@ namespace Inkscape { static void reverse(SPDesktop *dt); static void selectNext(SPDesktop *desktop); static void selectPrev(SPDesktop *desktop); + static void fixSelection(SPDesktop *desktop); }; } // namespace Inkscape diff --git a/src/seltrans.cpp b/src/seltrans.cpp index b6c6baaf7..84c73e452 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -86,6 +86,17 @@ static gboolean sp_seltrans_handle_event(SPKnot *knot, GdkEvent *event, gpointer return FALSE; } +Inkscape::SelTrans::BoundingBoxPrefsObserver::BoundingBoxPrefsObserver(SelTrans &sel_trans) : + Observer("/tools/bounding_box"), + _sel_trans(sel_trans) +{ +} + +void Inkscape::SelTrans::BoundingBoxPrefsObserver::notify(Preferences::Entry const &val) +{ + _sel_trans._boundingBoxPrefsChanged(static_cast<int>(val.getBool())); +} + Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _desktop(desktop), _selcue(desktop), @@ -103,7 +114,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _origin_for_bboxpoints(Geom::Point(0,0)), _chandle(NULL), _stamp_cache(NULL), - _message_context(desktop->messageStack()) + _message_context(desktop->messageStack()), + _bounding_box_prefs_observer(*this) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getBool("/tools/bounding_box"); @@ -169,6 +181,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : ); _all_snap_sources_iter = _all_snap_sources_sorted.end(); + + prefs->addObserver(_bounding_box_prefs_observer); } Inkscape::SelTrans::~SelTrans() @@ -873,6 +887,15 @@ void Inkscape::SelTrans::_selModified(Inkscape::Selection */*selection*/, guint } } +void Inkscape::SelTrans::_boundingBoxPrefsChanged(int prefs_bbox) +{ + _snap_bbox_type = !prefs_bbox ? + SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; + + _updateVolatileState(); + _updateHandles(); +} + /* * handlers for handle move-request */ diff --git a/src/seltrans.h b/src/seltrans.h index effc767e3..10860f58f 100644 --- a/src/seltrans.h +++ b/src/seltrans.h @@ -97,10 +97,24 @@ public: void getNextClosestPoint(bool reverse); private: + class BoundingBoxPrefsObserver: public Preferences::Observer + { + public: + BoundingBoxPrefsObserver(SelTrans &sel_trans); + + void notify(Preferences::Entry const &val); + + private: + SelTrans &_sel_trans; + }; + + friend class Inkscape::SelTrans::BoundingBoxPrefsObserver; + void _updateHandles(); void _updateVolatileState(); void _selChanged(Inkscape::Selection *selection); void _selModified(Inkscape::Selection *selection, guint flags); + void _boundingBoxPrefsChanged(int prefs_bbox); void _showHandles(SPKnot *knot[], SPSelTransHandle const handle[], gint num, gchar const *even_tip, gchar const *odd_tip); Geom::Point _getGeomHandlePos(Geom::Point const &visual_handle_pos); @@ -179,6 +193,7 @@ private: Inkscape::MessageContext _message_context; sigc::connection _sel_changed_connection; sigc::connection _sel_modified_connection; + BoundingBoxPrefsObserver _bounding_box_prefs_observer; }; } diff --git a/src/sp-image.cpp b/src/sp-image.cpp index dacea3417..d60fbc181 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -42,6 +42,7 @@ #include "xml/quote.h" #include "xml/repr.h" #include "snap-candidate.h" +#include "preferences.h" #include "io/sys.h" #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -63,7 +64,7 @@ g_message( __VA_ARGS__ );\ } -#include "preferences.h" + #include <gtk/gtk.h> #endif // DEBUG_LCMS #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -1469,9 +1470,12 @@ void sp_embed_image( Inkscape::XML::Node *image_node, GdkPixbuf *pb, Glib::ustri format = "png"; } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring quality = Glib::ustring::format(prefs->getInt("/dialogs/import/quality", 100)); + gchar *data = 0; gsize length = 0; - gdk_pixbuf_save_to_buffer(pb, &data, &length, format.data(), NULL, NULL); + gdk_pixbuf_save_to_buffer(pb, &data, &length, format.data(), NULL, "quality", quality.c_str(), NULL); // Save base64 encoded data in image node // this formula taken from Glib docs diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 4d2a5a709..b5c93e792 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -455,13 +455,15 @@ void SPObject::setLabel(gchar const *label) void SPObject::requestOrphanCollection() { g_return_if_fail(document != NULL); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // do not remove style or script elements (Bug #276244) if (SP_IS_STYLE_ELEM(this)) { // leave it } else if (SP_IS_SCRIPT(this)) { // leave it - } else if (SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(this)->isSwatch() ) { + + } else if ((! prefs->getBool("/options/cleanupswatches/value", false)) && SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(this)->isSwatch() ) { // leave it } else if (IS_COLORPROFILE(this)) { // leave it diff --git a/src/text-context.cpp b/src/text-context.cpp index d137b673d..862c50737 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -307,6 +307,7 @@ static gint sp_text_context_item_handler(SPEventContext *event_context, SPItem * gint ret = FALSE; sp_text_context_validate_cursor_iterators(tc); + Inkscape::Text::Layout::iterator old_start = tc->text_sel_start; switch (event->type) { case GDK_BUTTON_PRESS: @@ -319,7 +320,12 @@ static gint sp_text_context_item_handler(SPEventContext *event_context, SPItem * // find out click point in document coordinates Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y)); // set the cursor closest to that point - tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p); + if (event->button.state & GDK_SHIFT_MASK) { + tc->text_sel_start = old_start; + tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p); + } else { + tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p); + } // update display sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -948,13 +954,21 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd bool noSelection = false; - if (tc->text_sel_start == tc->text_sel_end) { - tc->text_sel_start.prevCursorPosition(); + if (MOD__CTRL(event)) { + tc->text_sel_start = tc->text_sel_end; + } + + if (tc->text_sel_start == tc->text_sel_end) { + if (MOD__CTRL(event)) { + tc->text_sel_start.prevStartOfWord(); + } else { + tc->text_sel_start.prevCursorPosition(); + } noSelection = true; } - iterator_pair bspace_pair; - bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, bspace_pair); + iterator_pair bspace_pair; + bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, bspace_pair); if (noSelection) { if (success) { @@ -982,8 +996,16 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd if (tc->text) { bool noSelection = false; + if (MOD__CTRL(event)) { + tc->text_sel_start = tc->text_sel_end; + } + if (tc->text_sel_start == tc->text_sel_end) { - tc->text_sel_end.nextCursorPosition(); + if (MOD__CTRL(event)) { + tc->text_sel_end.nextEndOfWord(); + } else { + tc->text_sel_end.nextCursorPosition(); + } noSelection = true; } diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 3017dc117..fe15a4e86 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -87,6 +87,7 @@ #include <windows.h> #include <commdlg.h> #include <gdk/gdkwin32.h> +#include <glibmm/fileutils.h> #endif #include <gtk/gtk.h> diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 3413b0b0d..e71605739 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -15,9 +15,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "filedialogimpl-win32.h" #include "filedialogimpl-gtkmm.h" #include "filedialog.h" -#include "filedialogimpl-win32.h" #include "gc-core.h" #include <dialogs/dialog-events.h> diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 496836c4d..9d91f5d56 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -16,7 +16,7 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif - +#include "filedialogimpl-win32.h" //General includes #include <list> #include <unistd.h> @@ -26,9 +26,7 @@ #include <gdk/gdkwin32.h> #include <glib/gstdio.h> #include <glibmm/i18n.h> -#if GLIB_CHECK_VERSION(2,32,0) -#include <glibmm/thread.h> -#endif +#include <glibmm/fileutils.h> #include <gtkmm/window.h> //Inkscape includes @@ -44,7 +42,7 @@ #include "display/canvas-arena.h" #include "filedialog.h" -#include "filedialogimpl-win32.h" + #include "sp-root.h" #include <zlib.h> diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index e9d8829f7..0839be8a8 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -9,11 +9,18 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ +#if HAVE_CONFIG_H +# include "config.h" +#endif #ifdef WIN32 - +#if WITH_GLIBMM_2_32 +# include <glibmm/threads.h> +#endif #include "gc-core.h" #include <windows.h> +#include "filedialogimpl-gtkmm.h" + namespace Inkscape { diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8eb643c6e..bc648002d 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1341,6 +1341,13 @@ void InkscapePreferences::initPageBehavior() _("Update marker color when object color changes")); this->AddPage(_page_markers, _("Markers"), iter_behavior, PREFS_PAGE_BEHAVIOR_MARKERS); + + + _page_cleanup.add_group_header( _("Document cleanup")); + _cleanup_swatches.init ( _("Remove unused swatches when doing a document cleanup"), "/options/cleanupswatches/value", false); // text label + _page_cleanup.add_line( true, "", _cleanup_swatches, "", + _("Remove unused swatches when doing a document cleanup")); // tooltip + this->AddPage(_page_cleanup, _("Cleanup"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLEANUP); } void InkscapePreferences::initPageRendering() @@ -1432,6 +1439,9 @@ void InkscapePreferences::initPageBitmaps() Glib::ustring values[] = {"embed", "link", "ask"}; _bitmap_import.init("/dialogs/import/link", labels, values, G_N_ELEMENTS(values), "ask"); _page_bitmaps.add_line( false, _("Bitmap import:"), _bitmap_import, "", "", false); + + _bitmap_import_quality.init("/dialogs/import/quality", 1, 100, 1, 1, 100, true, false); + _page_bitmaps.add_line( false, _("Bitmap import quality:"), _bitmap_import_quality, "%", "Bitmap import quality (jpeg only). 100 is best quality", false); } _importexport_import_res.init("/dialogs/import/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); _page_bitmaps.add_line( false, _("Default _import resolution:"), _importexport_import_res, _("dpi"), diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index f4d8c1d9a..37c05df05 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -74,6 +74,7 @@ enum { PREFS_PAGE_BEHAVIOR_CLONES, PREFS_PAGE_BEHAVIOR_MASKS, PREFS_PAGE_BEHAVIOR_MARKERS, + PREFS_PAGE_BEHAVIOR_CLEANUP, PREFS_PAGE_IO, PREFS_PAGE_IO_MOUSE, PREFS_PAGE_IO_SVGOUTPUT, @@ -167,6 +168,7 @@ protected: UI::Widget::DialogPage _page_clones; UI::Widget::DialogPage _page_mask; UI::Widget::DialogPage _page_markers; + UI::Widget::DialogPage _page_cleanup; UI::Widget::DialogPage _page_io; UI::Widget::DialogPage _page_mouse; @@ -311,6 +313,8 @@ protected: UI::Widget::PrefCheckButton _markers_color_stock; UI::Widget::PrefCheckButton _markers_color_custom; UI::Widget::PrefCheckButton _markers_color_update; + + UI::Widget::PrefCheckButton _cleanup_swatches; UI::Widget::PrefSpinButton _importexport_export_res; UI::Widget::PrefSpinButton _importexport_import_res; @@ -367,6 +371,7 @@ protected: UI::Widget::PrefCheckButton _misc_bitmap_autoreload; UI::Widget::PrefSpinButton _bitmap_copy_res; UI::Widget::PrefCombo _bitmap_import; + UI::Widget::PrefSpinButton _bitmap_import_quality; UI::Widget::PrefEntry _kb_search; UI::Widget::PrefCombo _kb_filelist; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index dd147d00f..5cc9578f1 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -41,6 +41,7 @@ #include "xml/repr.h" #include "sp-root.h" #include "event-context.h" +#include "selection-chemistry.h" //#define DUMP_LAYERS 1 @@ -536,6 +537,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) break; } } + Inkscape::SelectionHelper::fixSelection(_desktop); } bool LayersPanel::_handleKeyEvent(GdkEventKey *event) diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index b81f6981e..352d24ec0 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -2,9 +2,10 @@ * @brief Symbols dialog */ /* Authors: - * Tavmjong Bah + * Tavmjong Bah, Martin Owens * * Copyright (C) 2012 Tavmjong Bah + * 2013 Martin Owens * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -29,7 +30,23 @@ namespace Dialog { class SymbolColumns; // For Gtk::ListStore /** - * A dialog that displays selectable symbols. + * A dialog that displays selectable symbols and allows users to drag or paste + * those symbols from the dialog into the document. + * + * Symbol documents are loaded from the preferences paths and displayed in a + * drop-down list to the user. The user then selects which of the symbols + * documents they want to get symbols from. The first document in the list is + * always the current document. + * + * This then updates an icon-view with all the symbols available. Selecting one + * puts it onto the clipboard. Dragging it or pasting it onto the canvas copies + * the symbol from the symbol document, into the current document and places a + * new <use element at the correct location on the canvas. + * + * Selected groups on the canvas can be added to the current document's symbols + * table, and symbols can be removed from the current document. This allows + * new symbols documents to be constructed and if saved in the prefs folder will + * make those symbols available for all future documents. */ class SymbolsDialog : public UI::Widget::Panel { diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index ce9323311..08cd7264f 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -9,6 +9,7 @@ #include "../dialogs/dialog-events.h" #include "sp-color-icc-selector.h" #include "sp-color-scales.h" +#include "sp-color-slider.h" #include "svg/svg-icc-color.h" #include "document.h" #include "inkscape.h" @@ -71,27 +72,81 @@ static void sp_color_icc_selector_hide(GtkWidget *widget); G_END_DECLS +class ColorICCSelectorImpl +{ +public: + + ColorICCSelectorImpl( ColorICCSelector *owner); + + ~ColorICCSelectorImpl(); + + static void _adjustmentChanged ( GtkAdjustment *adjustment, SPColorICCSelector *cs ); + + static void _sliderGrabbed( SPColorSlider *slider, SPColorICCSelector *cs ); + static void _sliderReleased( SPColorSlider *slider, SPColorICCSelector *cs ); + static void _sliderChanged( SPColorSlider *slider, SPColorICCSelector *cs ); + + static void _profileSelected( GtkWidget* src, gpointer data ); + static void _fixupHit( GtkWidget* src, gpointer data ); + +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + void _setProfile( SVGICCColor* profile ); + void _switchToProfile( gchar const* name ); +#endif + void _updateSliders( gint ignore ); + void _profilesChanged( std::string const & name ); + + ColorICCSelector *_owner; + + gboolean _updating : 1; + gboolean _dragging : 1; + + guint32 _fixupNeeded; + GtkWidget* _fixupBtn; + GtkWidget* _profileSel; + + guint _fooCount; + guint const* _fooScales; + GtkAdjustment** _fooAdj; + GtkWidget** _fooSlider; + GtkWidget** _fooBtn; + GtkWidget** _fooLabel; + guchar** _fooMap; + + GtkAdjustment* _adj; // Channel adjustment + GtkWidget* _slider; + GtkWidget* _sbtn; // Spinbutton + GtkWidget* _label; // Label + +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + std::string _profileName; + Inkscape::ColorProfile* _prof; + guint _profChannelCount; + gulong _profChangedID; +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +}; + + static SPColorSelectorClass *parent_class; #define XPAD 4 #define YPAD 1 -GType -sp_color_icc_selector_get_type (void) +GType sp_color_icc_selector_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { sizeof (SPColorICCSelectorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ + NULL, // base_init + NULL, // base_finalize (GClassInitFunc) sp_color_icc_selector_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + NULL, // class_finalize + NULL, // class_data sizeof (SPColorICCSelector), - 0, /* n_preallocs */ + 0, // n_preallocs (GInstanceInitFunc) sp_color_icc_selector_init, - 0, /* value_table */ + 0, // value_table }; type = g_type_register_static (SP_TYPE_COLOR_SELECTOR, @@ -122,41 +177,20 @@ static void sp_color_icc_selector_class_init(SPColorICCSelectorClass *klass) ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) - : ColorSelector( csel ), - _updating( FALSE ), - _dragging( FALSE ), - _fixupNeeded(0), - _fixupBtn(0), - _profileSel(0), - _fooCount(0), - _fooScales(0), - _fooAdj(0), - _fooSlider(0), - _fooBtn(0), - _fooLabel(0), - _fooMap(0), - _adj(0), - _slider(0), - _sbtn(0), - _label(0) -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - , - _profileName(""), - _prof(), - _profChannelCount(0), - _profChangedID(0) -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + : ColorSelector( csel ) { } ColorICCSelector::~ColorICCSelector() { - _adj = 0; - _sbtn = 0; - _label = 0; + if (_impl) + { + delete _impl; + _impl = 0; + } } -void sp_color_icc_selector_init (SPColorICCSelector *cs) +void sp_color_icc_selector_init(SPColorICCSelector *cs) { SP_COLOR_SELECTOR(cs)->base = new ColorICCSelector( SP_COLOR_SELECTOR(cs) ); @@ -267,13 +301,47 @@ void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner) : + _owner(owner), + _updating( FALSE ), + _dragging( FALSE ), + _fixupNeeded(0), + _fixupBtn(0), + _profileSel(0), + _fooCount(4), + _fooAdj(new GtkAdjustment*[_fooCount]), + _fooSlider(new GtkWidget*[_fooCount]), + _fooBtn(new GtkWidget*[_fooCount]), + _fooLabel(new GtkWidget*[_fooCount]), + _fooMap(new guchar*[_fooCount]), + _adj(0), + _slider(0), + _sbtn(0), + _label(0) +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + , + _profileName(), + _prof(0), + _profChannelCount(0), + _profChangedID(0) +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +{ +} + +ColorICCSelectorImpl::~ColorICCSelectorImpl() +{ + _adj = 0; + _sbtn = 0; + _label = 0; +} void ColorICCSelector::init() { + _impl = new ColorICCSelectorImpl(this); gint row = 0; - _updating = FALSE; - _dragging = FALSE; + _impl->_updating = FALSE; + _impl->_dragging = FALSE; #if GTK_CHECK_VERSION(3,0,0) GtkWidget *t = gtk_grid_new(); @@ -288,228 +356,218 @@ void ColorICCSelector::init() //guint partCount = _cmsChannelsOf( icSigRgbData ); gchar const** names = 0; gchar const** tips = 0; - getThings( cmsSigRgbData, names, tips, _fooScales ); + getThings( cmsSigRgbData, names, tips, _impl->_fooScales ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - /* Create components */ + // Create components row = 0; - _fixupBtn = gtk_button_new_with_label(_("Fix")); - g_signal_connect( G_OBJECT(_fixupBtn), "clicked", G_CALLBACK(_fixupHit), (gpointer)this ); - gtk_widget_set_sensitive( _fixupBtn, FALSE ); - gtk_widget_set_tooltip_text( _fixupBtn, _("Fix RGB fallback to match icc-color() value.") ); - //gtk_misc_set_alignment( GTK_MISC (_fixupBtn), 1.0, 0.5 ); - gtk_widget_show( _fixupBtn ); + _impl->_fixupBtn = gtk_button_new_with_label(_("Fix")); + g_signal_connect( G_OBJECT(_impl->_fixupBtn), "clicked", G_CALLBACK(ColorICCSelectorImpl::_fixupHit), (gpointer)_impl ); + gtk_widget_set_sensitive( _impl->_fixupBtn, FALSE ); + gtk_widget_set_tooltip_text( _impl->_fixupBtn, _("Fix RGB fallback to match icc-color() value.") ); + //gtk_misc_set_alignment( GTK_MISC (_impl->_fixupBtn), 1.0, 0.5 ); + gtk_widget_show( _impl->_fixupBtn ); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_fixupBtn, XPAD); - gtk_widget_set_margin_right(_fixupBtn, XPAD); - gtk_widget_set_margin_top(_fixupBtn, YPAD); - gtk_widget_set_margin_bottom(_fixupBtn, YPAD); - gtk_grid_attach(GTK_GRID(t), _fixupBtn, 0, row, 1, 1); + gtk_widget_set_margin_left(_impl->_fixupBtn, XPAD); + gtk_widget_set_margin_right(_impl->_fixupBtn, XPAD); + gtk_widget_set_margin_top(_impl->_fixupBtn, YPAD); + gtk_widget_set_margin_bottom(_impl->_fixupBtn, YPAD); + gtk_grid_attach(GTK_GRID(t), _impl->_fixupBtn, 0, row, 1, 1); #else - gtk_table_attach( GTK_TABLE (t), _fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); + gtk_table_attach( GTK_TABLE (t), _impl->_fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); #endif // Combobox and store with 2 columns : label (0) and full name (1) GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); - _profileSel = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); + _impl->_profileSel = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (_profileSel), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (_profileSel), renderer, "text", 0, NULL); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(_impl->_profileSel), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(_impl->_profileSel), renderer, "text", 0, NULL); GtkTreeIter iter; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, _("<none>"), 1, _("<none>"), -1); - gtk_widget_show( _profileSel ); - gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 ); + gtk_widget_show( _impl->_profileSel ); + gtk_combo_box_set_active( GTK_COMBO_BOX(_impl->_profileSel), 0 ); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_profileSel, XPAD); - gtk_widget_set_margin_right(_profileSel, XPAD); - gtk_widget_set_margin_top(_profileSel, YPAD); - gtk_widget_set_margin_bottom(_profileSel, YPAD); - gtk_grid_attach(GTK_GRID(t), _profileSel, 1, row, 1, 1); + gtk_widget_set_margin_left(_impl->_profileSel, XPAD); + gtk_widget_set_margin_right(_impl->_profileSel, XPAD); + gtk_widget_set_margin_top(_impl->_profileSel, YPAD); + gtk_widget_set_margin_bottom(_impl->_profileSel, YPAD); + gtk_grid_attach(GTK_GRID(t), _impl->_profileSel, 1, row, 1, 1); #else - gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); + gtk_table_attach( GTK_TABLE(t), _impl->_profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); #endif #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - _profChangedID = g_signal_connect( G_OBJECT(_profileSel), "changed", G_CALLBACK(_profileSelected), (gpointer)this ); + _impl->_profChangedID = g_signal_connect( G_OBJECT(_impl->_profileSel), "changed", G_CALLBACK(ColorICCSelectorImpl::_profileSelected), (gpointer)_impl ); #else - gtk_widget_set_sensitive( _profileSel, false ); + gtk_widget_set_sensitive( _impl->_profileSel, false ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) row++; - _fooCount = 4; - _fooAdj = new GtkAdjustment*[_fooCount]; - _fooSlider = new GtkWidget*[_fooCount]; - _fooBtn = new GtkWidget*[_fooCount]; - _fooLabel = new GtkWidget*[_fooCount]; - _fooMap = new guchar*[_fooCount]; - - for ( guint i = 0; i < _fooCount; i++ ) { - /* Label */ + for ( guint i = 0; i < _impl->_fooCount; i++ ) { + // Label #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - _fooLabel[i] = gtk_label_new_with_mnemonic( names[i] ); + _impl->_fooLabel[i] = gtk_label_new_with_mnemonic( names[i] ); #else - _fooLabel[i] = gtk_label_new_with_mnemonic( "." ); + _impl->_fooLabel[i] = gtk_label_new_with_mnemonic( "." ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_misc_set_alignment( GTK_MISC (_fooLabel[i]), 1.0, 0.5 ); - gtk_widget_show( _fooLabel[i] ); + gtk_misc_set_alignment( GTK_MISC (_impl->_fooLabel[i]), 1.0, 0.5 ); + gtk_widget_show( _impl->_fooLabel[i] ); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_fooLabel[i], XPAD); - gtk_widget_set_margin_right(_fooLabel[i], XPAD); - gtk_widget_set_margin_top(_fooLabel[i], YPAD); - gtk_widget_set_margin_bottom(_fooLabel[i], YPAD); - gtk_grid_attach(GTK_GRID(t), _fooLabel[i], 0, row, 1, 1); + gtk_widget_set_margin_left(_impl->_fooLabel[i], XPAD); + gtk_widget_set_margin_right(_impl->_fooLabel[i], XPAD); + gtk_widget_set_margin_top(_impl->_fooLabel[i], YPAD); + gtk_widget_set_margin_bottom(_impl->_fooLabel[i], YPAD); + gtk_grid_attach(GTK_GRID(t), _impl->_fooLabel[i], 0, row, 1, 1); #else - gtk_table_attach( GTK_TABLE (t), _fooLabel[i], 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); + gtk_table_attach( GTK_TABLE (t), _impl->_fooLabel[i], 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); #endif - /* Adjustment */ - gdouble step = static_cast<gdouble>(_fooScales[i]) / 100.0; - gdouble page = static_cast<gdouble>(_fooScales[i]) / 10.0; + // Adjustment + gdouble step = static_cast<gdouble>(_impl->_fooScales[i]) / 100.0; + gdouble page = static_cast<gdouble>(_impl->_fooScales[i]) / 10.0; gint digits = (step > 0.9) ? 0 : 2; - _fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, 0.0, _fooScales[i], step, page, page ) ); + _impl->_fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, 0.0, _impl->_fooScales[i], step, page, page ) ); - /* Slider */ - _fooSlider[i] = sp_color_slider_new( _fooAdj[i] ); + // Slider + _impl->_fooSlider[i] = sp_color_slider_new( _impl->_fooAdj[i] ); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_set_tooltip_text( _fooSlider[i], tips[i] ); + gtk_widget_set_tooltip_text( _impl->_fooSlider[i], tips[i] ); #else - gtk_widget_set_tooltip_text( _fooSlider[i], "." ); + gtk_widget_set_tooltip_text( _impl->_fooSlider[i], "." ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_show( _fooSlider[i] ); + gtk_widget_show( _impl->_fooSlider[i] ); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_fooSlider[i], XPAD); - gtk_widget_set_margin_right(_fooSlider[i], XPAD); - gtk_widget_set_margin_top(_fooSlider[i], YPAD); - gtk_widget_set_margin_bottom(_fooSlider[i], YPAD); - gtk_widget_set_hexpand(_fooSlider[i], TRUE); - gtk_grid_attach(GTK_GRID(t), _fooSlider[i], 1, row, 1, 1); + gtk_widget_set_margin_left(_impl->_fooSlider[i], XPAD); + gtk_widget_set_margin_right(_impl->_fooSlider[i], XPAD); + gtk_widget_set_margin_top(_impl->_fooSlider[i], YPAD); + gtk_widget_set_margin_bottom(_impl->_fooSlider[i], YPAD); + gtk_widget_set_hexpand(_impl->_fooSlider[i], TRUE); + gtk_grid_attach(GTK_GRID(t), _impl->_fooSlider[i], 1, row, 1, 1); #else - gtk_table_attach( GTK_TABLE (t), _fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD ); + gtk_table_attach( GTK_TABLE (t), _impl->_fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD ); #endif - _fooBtn[i] = gtk_spin_button_new( _fooAdj[i], step, digits ); + _impl->_fooBtn[i] = gtk_spin_button_new( _impl->_fooAdj[i], step, digits ); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_set_tooltip_text( _fooBtn[i], tips[i] ); + gtk_widget_set_tooltip_text( _impl->_fooBtn[i], tips[i] ); #else - gtk_widget_set_tooltip_text( _fooBtn[i], "." ); + gtk_widget_set_tooltip_text( _impl->_fooBtn[i], "." ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - sp_dialog_defocus_on_enter( _fooBtn[i] ); - gtk_label_set_mnemonic_widget( GTK_LABEL(_fooLabel[i]), _fooBtn[i] ); - gtk_widget_show( _fooBtn[i] ); + sp_dialog_defocus_on_enter( _impl->_fooBtn[i] ); + gtk_label_set_mnemonic_widget( GTK_LABEL(_impl->_fooLabel[i]), _impl->_fooBtn[i] ); + gtk_widget_show( _impl->_fooBtn[i] ); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_fooBtn[i], XPAD); - gtk_widget_set_margin_right(_fooBtn[i], XPAD); - gtk_widget_set_margin_top(_fooBtn[i], YPAD); - gtk_widget_set_margin_bottom(_fooBtn[i], YPAD); - gtk_widget_set_halign(_fooBtn[i], GTK_ALIGN_CENTER); - gtk_widget_set_valign(_fooBtn[i], GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(t), _fooBtn[i], 2, row, 1, 1); + gtk_widget_set_margin_left(_impl->_fooBtn[i], XPAD); + gtk_widget_set_margin_right(_impl->_fooBtn[i], XPAD); + gtk_widget_set_margin_top(_impl->_fooBtn[i], YPAD); + gtk_widget_set_margin_bottom(_impl->_fooBtn[i], YPAD); + gtk_widget_set_halign(_impl->_fooBtn[i], GTK_ALIGN_CENTER); + gtk_widget_set_valign(_impl->_fooBtn[i], GTK_ALIGN_CENTER); + gtk_grid_attach(GTK_GRID(t), _impl->_fooBtn[i], 2, row, 1, 1); #else - gtk_table_attach( GTK_TABLE (t), _fooBtn[i], 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD ); + gtk_table_attach( GTK_TABLE (t), _impl->_fooBtn[i], 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD ); #endif - _fooMap[i] = g_new( guchar, 4 * 1024 ); - memset( _fooMap[i], 0x0ff, 1024 * 4 ); + _impl->_fooMap[i] = g_new( guchar, 4 * 1024 ); + memset( _impl->_fooMap[i], 0x0ff, 1024 * 4 ); - /* Signals */ - g_signal_connect( G_OBJECT( _fooAdj[i] ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); + // Signals + g_signal_connect( G_OBJECT( _impl->_fooAdj[i] ), "value_changed", G_CALLBACK( ColorICCSelectorImpl::_adjustmentChanged ), _csel ); - g_signal_connect( G_OBJECT( _fooSlider[i] ), "grabbed", G_CALLBACK( _sliderGrabbed ), _csel ); - g_signal_connect( G_OBJECT( _fooSlider[i] ), "released", G_CALLBACK( _sliderReleased ), _csel ); - g_signal_connect( G_OBJECT( _fooSlider[i] ), "changed", G_CALLBACK( _sliderChanged ), _csel ); + g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "grabbed", G_CALLBACK( ColorICCSelectorImpl::_sliderGrabbed ), _csel ); + g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "released", G_CALLBACK( ColorICCSelectorImpl::_sliderReleased ), _csel ); + g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "changed", G_CALLBACK( ColorICCSelectorImpl::_sliderChanged ), _csel ); row++; } - /* Label */ - _label = gtk_label_new_with_mnemonic (_("_A:")); - gtk_misc_set_alignment (GTK_MISC (_label), 1.0, 0.5); - gtk_widget_show (_label); + // Label + _impl->_label = gtk_label_new_with_mnemonic(_("_A:")); + gtk_misc_set_alignment(GTK_MISC(_impl->_label), 1.0, 0.5); + gtk_widget_show(_impl->_label); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_label, XPAD); - gtk_widget_set_margin_right(_label, XPAD); - gtk_widget_set_margin_top(_label, YPAD); - gtk_widget_set_margin_bottom(_label, YPAD); - gtk_grid_attach(GTK_GRID(t), _label, 0, row, 1, 1); + gtk_widget_set_margin_left(_impl->_label, XPAD); + gtk_widget_set_margin_right(_impl->_label, XPAD); + gtk_widget_set_margin_top(_impl->_label, YPAD); + gtk_widget_set_margin_bottom(_impl->_label, YPAD); + gtk_grid_attach(GTK_GRID(t), _impl->_label, 0, row, 1, 1); #else - gtk_table_attach (GTK_TABLE (t), _label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); + gtk_table_attach(GTK_TABLE (t), _impl->_label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); #endif - /* Adjustment */ - _adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 255.0, 1.0, 10.0, 10.0)); + // Adjustment + _impl->_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 255.0, 1.0, 10.0, 10.0)); - /* Slider */ - _slider = sp_color_slider_new (_adj); - gtk_widget_set_tooltip_text (_slider, _("Alpha (opacity)")); - gtk_widget_show (_slider); + // Slider + _impl->_slider = sp_color_slider_new(_impl->_adj); + gtk_widget_set_tooltip_text(_impl->_slider, _("Alpha (opacity)")); + gtk_widget_show(_impl->_slider); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_slider, XPAD); - gtk_widget_set_margin_right(_slider, XPAD); - gtk_widget_set_margin_top(_slider, YPAD); - gtk_widget_set_margin_bottom(_slider, YPAD); - gtk_widget_set_hexpand(_slider, TRUE); - gtk_grid_attach(GTK_GRID(t), _slider, 1, row, 1, 1); + gtk_widget_set_margin_left(_impl->_slider, XPAD); + gtk_widget_set_margin_right(_impl->_slider, XPAD); + gtk_widget_set_margin_top(_impl->_slider, YPAD); + gtk_widget_set_margin_bottom(_impl->_slider, YPAD); + gtk_widget_set_hexpand(_impl->_slider, TRUE); + gtk_grid_attach(GTK_GRID(t), _impl->_slider, 1, row, 1, 1); #else - gtk_table_attach (GTK_TABLE (t), _slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD); + gtk_table_attach (GTK_TABLE (t), _impl->_slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD); #endif - sp_color_slider_set_colors( SP_COLOR_SLIDER( _slider ), + sp_color_slider_set_colors( SP_COLOR_SLIDER( _impl->_slider ), SP_RGBA32_F_COMPOSE( 1.0, 1.0, 1.0, 0.0 ), SP_RGBA32_F_COMPOSE( 1.0, 1.0, 1.0, 0.5 ), SP_RGBA32_F_COMPOSE( 1.0, 1.0, 1.0, 1.0 ) ); - /* Spinbutton */ - _sbtn = gtk_spin_button_new (GTK_ADJUSTMENT (_adj), 1.0, 0); - gtk_widget_set_tooltip_text (_sbtn, _("Alpha (opacity)")); - sp_dialog_defocus_on_enter (_sbtn); - gtk_label_set_mnemonic_widget (GTK_LABEL(_label), _sbtn); - gtk_widget_show (_sbtn); + // Spinbutton + _impl->_sbtn = gtk_spin_button_new(GTK_ADJUSTMENT(_impl->_adj), 1.0, 0); + gtk_widget_set_tooltip_text(_impl->_sbtn, _("Alpha (opacity)")); + sp_dialog_defocus_on_enter(_impl->_sbtn); + gtk_label_set_mnemonic_widget(GTK_LABEL(_impl->_label), _impl->_sbtn); + gtk_widget_show(_impl->_sbtn); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_sbtn, XPAD); - gtk_widget_set_margin_right(_sbtn, XPAD); - gtk_widget_set_margin_top(_sbtn, YPAD); - gtk_widget_set_margin_bottom(_sbtn, YPAD); - gtk_widget_set_halign(_sbtn, GTK_ALIGN_CENTER); - gtk_widget_set_valign(_sbtn, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(t), _sbtn, 2, row, 1, 1); + gtk_widget_set_margin_left(_impl->_sbtn, XPAD); + gtk_widget_set_margin_right(_impl->_sbtn, XPAD); + gtk_widget_set_margin_top(_impl->_sbtn, YPAD); + gtk_widget_set_margin_bottom(_impl->_sbtn, YPAD); + gtk_widget_set_halign(_impl->_sbtn, GTK_ALIGN_CENTER); + gtk_widget_set_valign(_impl->_sbtn, GTK_ALIGN_CENTER); + gtk_grid_attach(GTK_GRID(t), _impl->_sbtn, 2, row, 1, 1); #else - gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); + gtk_table_attach(GTK_TABLE (t), _impl->_sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); #endif - /* Signals */ - g_signal_connect (G_OBJECT (_adj), "value_changed", - G_CALLBACK (_adjustmentChanged), _csel); + // Signals + g_signal_connect(G_OBJECT(_impl->_adj), "value_changed", G_CALLBACK(ColorICCSelectorImpl::_adjustmentChanged), _csel); - g_signal_connect (G_OBJECT (_slider), "grabbed", - G_CALLBACK (_sliderGrabbed), _csel); - g_signal_connect (G_OBJECT (_slider), "released", - G_CALLBACK (_sliderReleased), _csel); - g_signal_connect (G_OBJECT (_slider), "changed", - G_CALLBACK (_sliderChanged), _csel); + g_signal_connect(G_OBJECT(_impl->_slider), "grabbed", G_CALLBACK(ColorICCSelectorImpl::_sliderGrabbed), _csel); + g_signal_connect(G_OBJECT(_impl->_slider), "released", G_CALLBACK(ColorICCSelectorImpl::_sliderReleased), _csel); + g_signal_connect(G_OBJECT(_impl->_slider), "changed", G_CALLBACK(ColorICCSelectorImpl::_sliderChanged), _csel); } static void sp_color_icc_selector_dispose(GObject *object) { - if ((G_OBJECT_CLASS(parent_class))->dispose) + if ((G_OBJECT_CLASS(parent_class))->dispose) { (* (G_OBJECT_CLASS(parent_class))->dispose)(object); + } } static void @@ -534,24 +592,24 @@ sp_color_icc_selector_new (void) } -void ColorICCSelector::_fixupHit( GtkWidget* /*src*/, gpointer data ) +void ColorICCSelectorImpl::_fixupHit( GtkWidget* /*src*/, gpointer data ) { - ColorICCSelector* self = reinterpret_cast<ColorICCSelector*>(data); + ColorICCSelectorImpl* self = reinterpret_cast<ColorICCSelectorImpl*>(data); gtk_widget_set_sensitive( self->_fixupBtn, FALSE ); - self->_adjustmentChanged( self->_fooAdj[0], SP_COLOR_ICC_SELECTOR(self->_csel) ); + self->_adjustmentChanged( self->_fooAdj[0], SP_COLOR_ICC_SELECTOR(self->_owner->_csel) ); } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -void ColorICCSelector::_profileSelected( GtkWidget* /*src*/, gpointer data ) +void ColorICCSelectorImpl::_profileSelected( GtkWidget* /*src*/, gpointer data ) { - ColorICCSelector* self = reinterpret_cast<ColorICCSelector*>(data); + ColorICCSelectorImpl* self = reinterpret_cast<ColorICCSelectorImpl*>(data); GtkTreeIter iter; - if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX(self->_profileSel), &iter)) { - GtkTreeModel *store = gtk_combo_box_get_model (GTK_COMBO_BOX(self->_profileSel)); + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(self->_profileSel), &iter)) { + GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(self->_profileSel)); gchar* name = 0; - gtk_tree_model_get (store, &iter, 1, &name, -1); + gtk_tree_model_get(store, &iter, 1, &name, -1); self->_switchToProfile( name ); gtk_widget_set_tooltip_text(self->_profileSel, name ); @@ -559,15 +617,14 @@ void ColorICCSelector::_profileSelected( GtkWidget* /*src*/, gpointer data ) g_free( name ); } } - } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -void ColorICCSelector::_switchToProfile( gchar const* name ) +void ColorICCSelectorImpl::_switchToProfile( gchar const* name ) { bool dirty = false; - SPColor tmp( _color ); + SPColor tmp( _owner->_color ); if ( name ) { if ( tmp.icc && tmp.icc->colorProfile == name ) { @@ -588,7 +645,7 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) if ( newProf ) { cmsHTRANSFORM trans = newProf->getTransfFromSRGB8(); if ( trans ) { - guint32 val = _color.toRGBA32(0); + guint32 val = _owner->_color.toRGBA32(0); guchar pre[4] = { static_cast<guchar>(SP_RGBA32_R_U(val)), static_cast<guchar>(SP_RGBA32_G_U(val)), @@ -655,7 +712,7 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) #endif // DEBUG_LCMS _setProfile( tmp.icc ); //_adjustmentChanged( _fooAdj[0], SP_COLOR_ICC_SELECTOR(_csel) ); - setColorAlpha( tmp, _alpha, true ); + _owner->setColorAlpha( tmp, _owner->_alpha, true ); #ifdef DEBUG_LCMS g_message("+_________________"); #endif // DEBUG_LCMS @@ -664,7 +721,7 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -void ColorICCSelector::_profilesChanged( std::string const & name ) +void ColorICCSelectorImpl::_profilesChanged( std::string const & name ) { GtkComboBox* combo = GTK_COMBO_BOX(_profileSel); @@ -675,7 +732,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name ) GtkTreeIter iter; gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, _("<none>"), 1, _("<none>"), -1); + gtk_list_store_set(store, &iter, 0, _("<none>"), 1, _("<none>"), -1); gtk_combo_box_set_active( combo, 0 ); @@ -686,7 +743,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name ) Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj); gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, gr_ellipsize_text(prof->name, 25).c_str(), 1, prof->name, -1); + gtk_list_store_set(store, &iter, 0, gr_ellipsize_text(prof->name, 25).c_str(), 1, prof->name, -1); if ( name == prof->name ) { gtk_combo_box_set_active( combo, index ); @@ -700,16 +757,16 @@ void ColorICCSelector::_profilesChanged( std::string const & name ) g_signal_handler_unblock( G_OBJECT(_profileSel), _profChangedID ); } #else -void ColorICCSelector::_profilesChanged( std::string const & /*name*/ ) +void ColorICCSelectorImpl::_profilesChanged( std::string const & /*name*/ ) { } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -/* Helpers for setting color value */ +// Helpers for setting color value void ColorICCSelector::_colorChanged() { - _updating = TRUE; + _impl->_updating = TRUE; //sp_color_icc_set_color( SP_COLOR_ICC( _icc ), &color ); #ifdef DEBUG_LCMS @@ -722,36 +779,36 @@ void ColorICCSelector::_colorChanged() g_message("FLIPPIES!!!! %p '%s'", _color.icc, (_color.icc ? _color.icc->colorProfile.c_str():"<null>")); #endif // DEBUG_LCMS - _profilesChanged( (_color.icc) ? _color.icc->colorProfile : std::string("") ); - ColorScales::setScaled( _adj, _alpha ); + _impl->_profilesChanged( (_color.icc) ? _color.icc->colorProfile : std::string("") ); + ColorScales::setScaled( _impl->_adj, _alpha ); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - _setProfile( _color.icc ); - _fixupNeeded = 0; - gtk_widget_set_sensitive( _fixupBtn, FALSE ); + _impl->_setProfile( _color.icc ); + _impl->_fixupNeeded = 0; + gtk_widget_set_sensitive( _impl->_fixupBtn, FALSE ); - if (_prof) { - if (_prof->getTransfToSRGB8() ) { + if (_impl->_prof) { + if (_impl->_prof->getTransfToSRGB8() ) { cmsUInt16Number tmp[4]; - for ( guint i = 0; i < _profChannelCount; i++ ) { + for ( guint i = 0; i < _impl->_profChannelCount; i++ ) { gdouble val = 0.0; if ( _color.icc->colors.size() > i ) { - if ( _fooScales[i] == 256 ) { - val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]); + if ( _impl->_fooScales[i] == 256 ) { + val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_impl->_fooScales[i]); } else { - val = _color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]); + val = _color.icc->colors[i] / static_cast<gdouble>(_impl->_fooScales[i]); } } tmp[i] = val * 0x0ffff; } guchar post[4] = {0,0,0,0}; - cmsHTRANSFORM trans = _prof->getTransfToSRGB8(); + cmsHTRANSFORM trans = _impl->_prof->getTransfToSRGB8(); if ( trans ) { cmsDoTransform( trans, tmp, post, 1 ); guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 ); if ( other != _color.toRGBA32(255) ) { - _fixupNeeded = other; - gtk_widget_set_sensitive( _fixupBtn, TRUE ); + _impl->_fixupNeeded = other; + gtk_widget_set_sensitive( _impl->_fixupBtn, TRUE ); #ifdef DEBUG_LCMS g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 ); #endif // DEBUG_LCMS @@ -762,17 +819,17 @@ void ColorICCSelector::_colorChanged() #else //(void)color; #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - _updateSliders( -1 ); + _impl->_updateSliders( -1 ); - _updating = FALSE; + _impl->_updating = FALSE; #ifdef DEBUG_LCMS g_message( "\\_________ %p::_colorChanged()", this ); #endif // DEBUG_LCMS } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -void ColorICCSelector::_setProfile( SVGICCColor* profile ) +void ColorICCSelectorImpl::_setProfile( SVGICCColor* profile ) { #ifdef DEBUG_LCMS g_message( "/^^^^^^^^^ %p::_setProfile(%s)", this, @@ -852,25 +909,25 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -void ColorICCSelector::_updateSliders( gint ignore ) +void ColorICCSelectorImpl::_updateSliders( gint ignore ) { #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - if ( _color.icc ) + if ( _owner->_color.icc ) { for ( guint i = 0; i < _profChannelCount; i++ ) { gdouble val = 0.0; - if ( _color.icc->colors.size() > i ) { + if ( _owner->_color.icc->colors.size() > i ) { if ( _fooScales[i] == 256 ) { - val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]); + val = (_owner->_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]); } else { - val = _color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]); + val = _owner->_color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]); } } gtk_adjustment_set_value( _fooAdj[i], val ); } - if ( _prof) { - if (_prof->getTransfToSRGB8() ) { + if ( _prof ) { + if ( _prof->getTransfToSRGB8() ) { for ( guint i = 0; i < _profChannelCount; i++ ) { if ( static_cast<gint>(i) != ignore ) { cmsUInt16Number* scratch = getScratch(); @@ -904,16 +961,15 @@ void ColorICCSelector::_updateSliders( gint ignore ) (void)ignore; #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - guint32 start = _color.toRGBA32( 0x00 ); - guint32 mid = _color.toRGBA32( 0x7f ); - guint32 end = _color.toRGBA32( 0xff ); + guint32 start = _owner->_color.toRGBA32( 0x00 ); + guint32 mid = _owner->_color.toRGBA32( 0x7f ); + guint32 end = _owner->_color.toRGBA32( 0xff ); sp_color_slider_set_colors( SP_COLOR_SLIDER(_slider), start, mid, end ); - } -void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICCSelector *cs ) +void ColorICCSelectorImpl::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICCSelector *cs ) { // // TODO check this. It looks questionable: // // if a value is entered between 0 and 1 exclusive, normalize it to (int) 0..255 or 0..100 @@ -926,24 +982,24 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC #endif // DEBUG_LCMS ColorICCSelector* iccSelector = static_cast<ColorICCSelector*>(SP_COLOR_SELECTOR(cs)->base); - if (iccSelector->_updating) { + if (iccSelector->_impl->_updating) { return; } - iccSelector->_updating = TRUE; + iccSelector->_impl->_updating = TRUE; gint match = -1; SPColor newColor( iccSelector->_color ); - gfloat scaled = ColorScales::getScaled( iccSelector->_adj ); - if ( iccSelector->_adj == adjustment ) { + gfloat scaled = ColorScales::getScaled( iccSelector->_impl->_adj ); + if ( iccSelector->_impl->_adj == adjustment ) { #ifdef DEBUG_LCMS g_message("ALPHA"); #endif // DEBUG_LCMS } else { #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - for ( guint i = 0; i < iccSelector->_fooCount; i++ ) { - if ( iccSelector->_fooAdj[i] == adjustment ) { + for ( guint i = 0; i < iccSelector->_impl->_fooCount; i++ ) { + if ( iccSelector->_impl->_fooAdj[i] == adjustment ) { match = i; break; } @@ -957,11 +1013,11 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC cmsUInt16Number tmp[4]; for ( guint i = 0; i < 4; i++ ) { - tmp[i] = ColorScales::getScaled( iccSelector->_fooAdj[i] ) * 0x0ffff; + tmp[i] = ColorScales::getScaled( iccSelector->_impl->_fooAdj[i] ) * 0x0ffff; } guchar post[4] = {0,0,0,0}; - cmsHTRANSFORM trans = iccSelector->_prof->getTransfToSRGB8(); + cmsHTRANSFORM trans = iccSelector->_impl->_prof->getTransfToSRGB8(); if ( trans ) { cmsDoTransform( trans, tmp, post, 1 ); } @@ -982,11 +1038,11 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC #endif // DEBUG_LCMS newColor = other; newColor.icc->colors.clear(); - for ( guint i = 0; i < iccSelector->_profChannelCount; i++ ) { - gdouble val = ColorScales::getScaled( iccSelector->_fooAdj[i] ); - if ( iccSelector->_fooScales ) { - val *= iccSelector->_fooScales[i]; - if ( iccSelector->_fooScales[i] == 256 ) { + for ( guint i = 0; i < iccSelector->_impl->_profChannelCount; i++ ) { + gdouble val = ColorScales::getScaled( iccSelector->_impl->_fooAdj[i] ); + if ( iccSelector->_impl->_fooScales ) { + val *= iccSelector->_impl->_fooScales[i]; + if ( iccSelector->_impl->_fooScales[i] == 256 ) { val -= 128; } } @@ -995,26 +1051,26 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } - iccSelector->_updateInternals( newColor, scaled, iccSelector->_dragging ); - iccSelector->_updateSliders( match ); + iccSelector->_updateInternals( newColor, scaled, iccSelector->_impl->_dragging ); + iccSelector->_impl->_updateSliders( match ); - iccSelector->_updating = FALSE; + iccSelector->_impl->_updating = FALSE; #ifdef DEBUG_LCMS g_message( "\\_________ %p::_adjustmentChanged()", cs ); #endif // DEBUG_LCMS } -void ColorICCSelector::_sliderGrabbed( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ ) +void ColorICCSelectorImpl::_sliderGrabbed( SPColorSlider * /*slider*/, SPColorICCSelector * /*cs*/ ) { // ColorICCSelector* iccSelector = dynamic_cast<ColorICCSelector*>(SP_COLOR_SELECTOR(cs)->base); // if (!iccSelector->_dragging) { // iccSelector->_dragging = TRUE; // iccSelector->_grabbed(); -// iccSelector->_updateInternals( iccSelector->_color, ColorScales::getScaled( iccSelector->_adj ), iccSelector->_dragging ); +// iccSelector->_updateInternals( iccSelector->_color, ColorScales::getScaled( iccSelector->_impl->_adj ), iccSelector->_dragging ); // } } -void ColorICCSelector::_sliderReleased( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ ) +void ColorICCSelectorImpl::_sliderReleased( SPColorSlider * /*slider*/, SPColorICCSelector * /*cs*/ ) { // ColorICCSelector* iccSelector = dynamic_cast<ColorICCSelector*>(SP_COLOR_SELECTOR(cs)->base); // if (iccSelector->_dragging) { @@ -1025,9 +1081,9 @@ void ColorICCSelector::_sliderReleased( SPColorSlider */*slider*/, SPColorICCSel } #ifdef DEBUG_LCMS -void ColorICCSelector::_sliderChanged( SPColorSlider *slider, SPColorICCSelector *cs ) +void ColorICCSelectorImpl::_sliderChanged( SPColorSlider *slider, SPColorICCSelector *cs ) #else -void ColorICCSelector::_sliderChanged( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ ) +void ColorICCSelectorImpl::_sliderChanged( SPColorSlider * /*slider*/, SPColorICCSelector * /*cs*/ ) #endif // DEBUG_LCMS { #ifdef DEBUG_LCMS diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index 67fedf590..404bc7265 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -5,7 +5,6 @@ #include <gtk/gtk.h> #include "../color.h" -#include "sp-color-slider.h" #include "sp-color-selector.h" namespace Inkscape { @@ -15,6 +14,7 @@ struct ColorProfile; struct SPColorICCSelector; struct SPColorICCSelectorClass; +class ColorICCSelectorImpl; class ColorICCSelector: public ColorSelector { @@ -27,63 +27,25 @@ public: protected: virtual void _colorChanged(); - static void _adjustmentChanged ( GtkAdjustment *adjustment, SPColorICCSelector *cs ); - - static void _sliderGrabbed( SPColorSlider *slider, SPColorICCSelector *cs ); - static void _sliderReleased( SPColorSlider *slider, SPColorICCSelector *cs ); - static void _sliderChanged( SPColorSlider *slider, SPColorICCSelector *cs ); - - static void _fixupHit( GtkWidget* src, gpointer data ); - static void _profileSelected( GtkWidget* src, gpointer data ); - void _recalcColor( gboolean changing ); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - void _setProfile( SVGICCColor* profile ); - void _switchToProfile( gchar const* name ); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - void _updateSliders( gint ignore ); - void _profilesChanged( std::string const & name ); - - gboolean _updating : 1; - gboolean _dragging : 1; - - guint32 _fixupNeeded; - GtkWidget* _fixupBtn; - GtkWidget* _profileSel; - - guint _fooCount; - guint const* _fooScales; - GtkAdjustment** _fooAdj; - GtkWidget** _fooSlider; - GtkWidget** _fooBtn; - GtkWidget** _fooLabel; - guchar** _fooMap; - - GtkAdjustment* _adj; /* Channel adjustment */ - GtkWidget* _slider; - GtkWidget* _sbtn; /* Spinbutton */ - GtkWidget* _label; /* Label */ - -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - std::string _profileName; - Inkscape::ColorProfile* _prof; - guint _profChannelCount; - gulong _profChangedID; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) private: + friend class ColorICCSelectorImpl; + // By default, disallow copy constructor and assignment operator ColorICCSelector( const ColorICCSelector& obj ); ColorICCSelector& operator=( const ColorICCSelector& obj ); + + ColorICCSelectorImpl *_impl; }; -#define SP_TYPE_COLOR_ICC_SELECTOR (sp_color_icc_selector_get_type ()) -#define SP_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelector)) -#define SP_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelectorClass)) -#define SP_IS_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_ICC_SELECTOR)) -#define SP_IS_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_ICC_SELECTOR)) +#define SP_TYPE_COLOR_ICC_SELECTOR (sp_color_icc_selector_get_type()) +#define SP_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelector)) +#define SP_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelectorClass)) +#define SP_IS_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_COLOR_ICC_SELECTOR)) +#define SP_IS_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_COLOR_ICC_SELECTOR)) struct SPColorICCSelector { SPColorSelector parent; @@ -93,9 +55,9 @@ struct SPColorICCSelectorClass { SPColorSelectorClass parent_class; }; -GType sp_color_icc_selector_get_type (void); +GType sp_color_icc_selector_get_type(void); -GtkWidget *sp_color_icc_selector_new (void); +GtkWidget *sp_color_icc_selector_new(void); |
