From b40f9bd37abc96d579f930dee9e6fb95031d74f0 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 6 Jul 2011 00:26:32 -0700 Subject: Refactoring color profile to bring more internal. Help to prep for optional lcms2 support. (bzr r10420) --- src/widgets/sp-color-icc-selector.h | 8 +++----- src/widgets/sp-color-notebook.cpp | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index 9238e3f68..a3915cd48 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -8,11 +8,9 @@ #include "sp-color-slider.h" #include "sp-color-selector.h" -#if ENABLE_LCMS -#include "color-profile.h" -#endif // ENABLE_LCMS - - +namespace Inkscape { +struct ColorProfile; +} struct SPColorICCSelector; struct SPColorICCSelectorClass; diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 377abf219..d041f85df 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -37,6 +37,7 @@ #include "../inkscape.h" #include "../document.h" #include "../profile-manager.h" +#include "color-profile.h" struct SPColorNotebookTracker { const gchar* name; @@ -529,7 +530,7 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) if (color.icc){ Inkscape::ColorProfile* target_profile = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); if ( target_profile ) - gtk_widget_set_sensitive (_box_outofgamut, target_profile->GamutCheck(color)); + gtk_widget_set_sensitive(_box_outofgamut, target_profile->GamutCheck(color)); } /* update too-much-ink icon */ -- cgit v1.2.3 From 2994e0b96e7d5d6d198b3d8139e4134f9d454229 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 9 Jul 2011 02:18:40 -0700 Subject: Next step in refactoring color management. More to come. (bzr r10429) --- src/widgets/sp-color-icc-selector.cpp | 11 ++++++----- src/widgets/sp-color-notebook.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 94f450e50..9e5291cc4 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -16,6 +16,7 @@ #if ENABLE_LCMS #include "color-profile-fns.h" +#include "color-profile-cms-fns.h" #include "color-profile.h" #ifdef DEBUG_LCMS @@ -497,12 +498,12 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) #ifdef DEBUG_LCMS g_message("got on out [%04x] [%04x] [%04x] [%04x]", post[0], post[1], post[2], post[3]); #endif // DEBUG_LCMS - guint count = _cmsChannelsOf( newProf->getColorSpace() ); + guint count = _cmsChannelsOf( asICColorSpaceSig(newProf->getColorSpace()) ); gchar const** names = 0; gchar const** tips = 0; guint const* scales = 0; - getThings( newProf->getColorSpace(), names, tips, scales ); + getThings( asICColorSpaceSig(newProf->getColorSpace()), names, tips, scales ); for ( guint i = 0; i < count; i++ ) { gdouble val = (((gdouble)post[i])/65535.0) * (gdouble)scales[i]; @@ -680,12 +681,12 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) if ( profile ) { _prof = SP_ACTIVE_DOCUMENT->profileManager->find(profile->colorProfile.c_str()); - if ( _prof && _prof->getProfileClass() != icSigNamedColorClass ) { - _profChannelCount = _cmsChannelsOf( _prof->getColorSpace() ); + if ( _prof && (asICColorProfileClassSig(_prof->getProfileClass()) != icSigNamedColorClass) ) { + _profChannelCount = _cmsChannelsOf( asICColorSpaceSig(_prof->getColorSpace()) ); gchar const** names = 0; gchar const** tips = 0; - getThings( _prof->getColorSpace(), names, tips, _fooScales ); + getThings( asICColorSpaceSig(_prof->getColorSpace()), names, tips, _fooScales ); if ( profChanged ) { for ( guint i = 0; i < _profChannelCount; i++ ) { diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index d041f85df..546f7838b 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -1,5 +1,3 @@ -#define __SP_COLOR_NOTEBOOK_C__ - /* * A notebook with RGB, CMYK, CMS, HSL, and Wheel pages * @@ -38,6 +36,11 @@ #include "../document.h" #include "../profile-manager.h" #include "color-profile.h" +#include "color-profile-fns.h" +#if ENABLE_LCMS +//#include "lcms.h" +//#include "color-profile-cms-fns.h" +#endif // ENABLE_LCMS struct SPColorNotebookTracker { const gchar* name; @@ -537,7 +540,7 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) gtk_widget_set_sensitive (_box_toomuchink, false); if (color.icc){ Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); - if ( prof && ( (prof->getColorSpace() == icSigCmykData) || (prof->getColorSpace() == icSigCmyData) ) ) { + if ( prof && colorprofile_isPrintColorSpace(prof) ) { gtk_widget_show(GTK_WIDGET(_box_toomuchink)); double ink_sum = 0; for (unsigned int i=0; icolors.size(); i++){ -- cgit v1.2.3 From df7bda1a8b9d4a1c6f0fd4b82cdeb614eb1ea8d2 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 10 Jul 2011 00:13:05 -0700 Subject: Refactored to abstract lcms usage more. Added CMSSystem class. (bzr r10437) --- src/widgets/desktop-widget.cpp | 8 ++++---- src/widgets/sp-color-icc-selector.cpp | 10 ++++++++-- src/widgets/sp-color-notebook.cpp | 10 ++++------ 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 52008625a..34c3ab75a 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -28,7 +28,7 @@ #include #include "box3d-context.h" -#include "color-profile-fns.h" +#include "cms-system.h" #include "conn-avoid-ref.h" #include "desktop-events.h" #include "desktop-handles.h" @@ -193,7 +193,7 @@ void CMSPrefWatcher::hook(EgeColorProfTracker */*tracker*/, gint screen, gint mo guint len = 0; ege_color_prof_tracker_get_profile_for( screen, monitor, reinterpret_cast(&buf), &len ); - Glib::ustring id = Inkscape::colorprofile_set_display_per( buf, len, screen, monitor ); + Glib::ustring id = Inkscape::CMSSystem::setDisplayPer( buf, len, screen, monitor ); #endif // ENABLE_LCMS } @@ -540,7 +540,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) #if ENABLE_LCMS bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display"); if ( fromDisplay ) { - Glib::ustring id = Inkscape::colorprofile_get_display_id( 0, 0 ); + Glib::ustring id = Inkscape::CMSSystem::getDisplayId( 0, 0 ); bool enabled = false; if ( dtw->canvas->cms_key ) { @@ -805,7 +805,7 @@ void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidge GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(dtw)); gint screenNum = gdk_screen_get_number(screen); gint monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_toplevel(GTK_WIDGET(dtw))->window); - Glib::ustring id = Inkscape::colorprofile_get_display_id( screenNum, monitor ); + Glib::ustring id = Inkscape::CMSSystem::getDisplayId( screenNum, monitor ); bool enabled = false; if ( dtw->canvas->cms_key ) { *(dtw->canvas->cms_key) = id; diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 9e5291cc4..888cc2629 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -15,9 +15,9 @@ #define noDEBUG_LCMS #if ENABLE_LCMS -#include "color-profile-fns.h" -#include "color-profile-cms-fns.h" #include "color-profile.h" +#include "cms-system.h" +#include "color-profile-cms-fns.h" #ifdef DEBUG_LCMS #include "preferences.h" @@ -259,6 +259,12 @@ void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guin tippies = tips[index]; scalies = scales[index]; } + + +void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const**& tippies, guint const*& scalies ) { + getThings( asICColorSpaceSig(prof->getColorSpace()), namers, tippies, scalies ); +} + #endif // ENABLE_LCMS diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 546f7838b..1324e0b16 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -36,11 +36,9 @@ #include "../document.h" #include "../profile-manager.h" #include "color-profile.h" -#include "color-profile-fns.h" -#if ENABLE_LCMS -//#include "lcms.h" -//#include "color-profile-cms-fns.h" -#endif // ENABLE_LCMS +#include "cms-system.h" + +using Inkscape::CMSSystem; struct SPColorNotebookTracker { const gchar* name; @@ -540,7 +538,7 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) gtk_widget_set_sensitive (_box_toomuchink, false); if (color.icc){ Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); - if ( prof && colorprofile_isPrintColorSpace(prof) ) { + if ( prof && CMSSystem::isPrintColorSpace(prof) ) { gtk_widget_show(GTK_WIDGET(_box_toomuchink)); double ink_sum = 0; for (unsigned int i=0; icolors.size(); i++){ -- cgit v1.2.3 From dd5da66df059871c546f4d09b9d2eb92e71b74b7 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 10 Jul 2011 21:40:56 +0200 Subject: Selector's toolbar: changing the dimensions of the visual bounding box of selection of multiple objects having different stroke widths has been fixed (bug #212768, #190557, ...) Fixed bugs: - https://launchpad.net/bugs/212768 - https://launchpad.net/bugs/190557 (bzr r10437.1.5) --- src/widgets/select-toolbar.cpp | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index eb9b2805d..ba32dc321 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -159,12 +159,16 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) document->ensureUpToDate (); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + Geom::OptRect bbox_vis = selection->bounds(SPItem::APPROXIMATE_BBOX); + Geom::OptRect bbox_geom = selection->bounds(SPItem::GEOMETRIC_BBOX); + int prefs_bbox = prefs->getInt("/tools/bounding_box"); - SPItem::BBoxType bbox_type = (prefs_bbox ==0)? + SPItem::BBoxType bbox_type = (prefs_bbox == 0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - Geom::OptRect bbox = selection->bounds(bbox_type); + Geom::OptRect bbox_user = selection->bounds(bbox_type); - if ( !bbox ) { + if ( !bbox_user ) { g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); return; } @@ -186,35 +190,35 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) x0 = sp_units_get_pixels (a_x->value, unit); y0 = sp_units_get_pixels (a_y->value, unit); x1 = x0 + sp_units_get_pixels (a_w->value, unit); - xrel = sp_units_get_pixels (a_w->value, unit) / bbox->dimensions()[Geom::X]; + xrel = sp_units_get_pixels (a_w->value, unit) / bbox_user->dimensions()[Geom::X]; y1 = y0 + sp_units_get_pixels (a_h->value, unit); - yrel = sp_units_get_pixels (a_h->value, unit) / bbox->dimensions()[Geom::Y]; + yrel = sp_units_get_pixels (a_h->value, unit) / bbox_user->dimensions()[Geom::Y]; } else { double const x0_propn = a_x->value * unit.unittobase; - x0 = bbox->min()[Geom::X] * x0_propn; + x0 = bbox_user->min()[Geom::X] * x0_propn; double const y0_propn = a_y->value * unit.unittobase; - y0 = y0_propn * bbox->min()[Geom::Y]; + y0 = y0_propn * bbox_user->min()[Geom::Y]; xrel = a_w->value * unit.unittobase; - x1 = x0 + xrel * bbox->dimensions()[Geom::X]; + x1 = x0 + xrel * bbox_user->dimensions()[Geom::X]; yrel = a_h->value * unit.unittobase; - y1 = y0 + yrel * bbox->dimensions()[Geom::Y]; + y1 = y0 + yrel * bbox_user->dimensions()[Geom::Y]; } // Keep proportions if lock is on GtkToggleAction *lock = GTK_TOGGLE_ACTION( g_object_get_data(G_OBJECT(spw), "lock") ); if ( gtk_toggle_action_get_active(lock) ) { if (adj == a_h) { - x1 = x0 + yrel * bbox->dimensions()[Geom::X]; + x1 = x0 + yrel * bbox_user->dimensions()[Geom::X]; } else if (adj == a_w) { - y1 = y0 + xrel * bbox->dimensions()[Geom::Y]; + y1 = y0 + xrel * bbox_user->dimensions()[Geom::Y]; } } // scales and moves, in px - double mh = fabs(x0 - bbox->min()[Geom::X]); - double sh = fabs(x1 - bbox->max()[Geom::X]); - double mv = fabs(y0 - bbox->min()[Geom::Y]); - double sv = fabs(y1 - bbox->max()[Geom::Y]); + double mh = fabs(x0 - bbox_user->min()[Geom::X]); + double sh = fabs(x1 - bbox_user->max()[Geom::X]); + double mv = fabs(y0 - bbox_user->min()[Geom::Y]); + double sv = fabs(y1 - bbox_user->max()[Geom::Y]); // unless the unit is %, convert the scales and moves to the unit if (unit.base == SP_UNIT_ABSOLUTE || unit.base == SP_UNIT_DEVICE) { @@ -244,11 +248,11 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) Geom::Affine scaler; if (bbox_type == SPItem::APPROXIMATE_BBOX) { - // get_scale_transform_with_stroke() is intended for VISUAL (or APPROXIMATE) bounding boxes, not geometrical ones! - scaler = get_scale_transform_with_stroke (*bbox, strokewidth, transform_stroke, x0, y0, x1, y1); + scaler = get_scale_transform_with_unequal_stroke (*bbox_vis, *bbox_geom, transform_stroke, x0, y0, x1, y1); } else { - // we'll trick it into using a geometrical bounding box though, by setting the stroke width to zero - scaler = get_scale_transform_with_stroke (*bbox, 0, false, x0, y0, x1, y1); + // get_scale_transform_with_stroke() is intended for VISUAL (or APPROXIMATE) bounding boxes, not geometrical ones! + // we'll trick it into using a geometric bounding box though, by setting the stroke width to zero + scaler = get_scale_transform_with_uniform_stroke (*bbox_user, 0, false, x0, y0, x1, y1); } sp_selection_apply_affine(selection, scaler); -- cgit v1.2.3