sp-color-notebook.cpp revision 99f8079bc0a32aef279e4af06de4cbf4bd853563
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm * A notebook with RGB, CMYK, CMS, HSL, and Wheel pages
5c45bb188ab729e501e48732842cb9de6a9813beAlex Valavanis * Lauris Kaplinski <lauris@kaplinski.com>
eb4caa8f4cdc2955b58dcd2de06fe770533414c8Jon A. Cruz * bulia byak <buliabyak@users.sf.net>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm * Copyright (C) 2001-2002 Lauris Kaplinski
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm * This code is in public domain
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include "../document.h"
cef9e2c431b417aea98429860c6021849f099fcfKris De Gussemstatic void sp_color_notebook_class_init (SPColorNotebookClass *klass);
cef9e2c431b417aea98429860c6021849f099fcfKris De Gussemstatic void sp_color_notebook_init (SPColorNotebook *colorbook);
c11199b2b0b6b7fbfe61f562566e0cd15604cc43Liam P. Whitestatic void sp_color_notebook_destroy (GtkObject *object);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic void sp_color_notebook_show_all (GtkWidget *widget);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic void sp_color_notebook_hide_all (GtkWidget *widget);
ea3e4fdbdbf0a48ae887b096d301549da77d5707Johan Engelen 0, // base_init
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm 0, // base_finalize
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm 0, // class_finalize
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm 0, // class_data
106bf69f0520ef3b349214008cc1f91c68e69daaJabiertxof 0, // n_preallocs
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm 0 // value_table
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm type = g_type_register_static(SP_TYPE_COLOR_SELECTOR, "SPColorNotebook", &info, static_cast<GTypeFlags>(0));
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic void
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmsp_color_notebook_class_init (SPColorNotebookClass *klass)
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm parent_class = SP_COLOR_SELECTOR_CLASS (g_type_class_peek_parent (klass));
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic void
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm ColorNotebook* nb = (ColorNotebook*)(SP_COLOR_SELECTOR(colorbook)->base);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm // remember the page we seitched to
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm Inkscape::Preferences *prefs = Inkscape::Preferences::get();
f83dd38ed9c631b7644b7c82c821fa9fbbb82352Liam P. White if ( gtk_notebook_get_current_page (GTK_NOTEBOOK (_book)) >= 0 )
f83dd38ed9c631b7644b7c82c821fa9fbbb82352Liam P. White widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (_book), page_num);
f83dd38ed9c631b7644b7c82c821fa9fbbb82352Liam P. White if ( widget && SP_IS_COLOR_SELECTOR (widget) )
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm // Temporary workaround to undo a spurious GRABBED
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic gint sp_color_notebook_menu_handler( GtkWidget *widget, GdkEvent *event )
106bf69f0520ef3b349214008cc1f91c68e69daaJabiertxof /* Tell calling code that we have handled this event; the buck
106bf69f0520ef3b349214008cc1f91c68e69daaJabiertxof * stops here. */
106bf69f0520ef3b349214008cc1f91c68e69daaJabiertxof /* Tell calling code that we have not handled this event; pass it on. */
c2057a738f9ea8cb7acdeb1feb69cef5b0d4bc56johanengelengint ColorNotebook::menuHandler( GdkEvent* event )
c2057a738f9ea8cb7acdeb1feb69cef5b0d4bc56johanengelen GdkEventButton *bevent = (GdkEventButton *) event;
c2057a738f9ea8cb7acdeb1feb69cef5b0d4bc56johanengelen gtk_menu_popup (GTK_MENU( _popup ), NULL, NULL, NULL, NULL,
ea3e4fdbdbf0a48ae887b096d301549da77d5707Johan Engelenstatic void sp_color_notebook_menuitem_response (GtkMenuItem *menuitem, gpointer user_data)
c2057a738f9ea8cb7acdeb1feb69cef5b0d4bc56johanengelen active = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem));
106bf69f0520ef3b349214008cc1f91c68e69daaJabiertxof SPColorNotebookTracker *entry = reinterpret_cast< SPColorNotebookTracker* > (user_data);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm ((ColorNotebook*)(SP_COLOR_SELECTOR(entry->backPointer)->base))->addPage(entry->type, entry->submode);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm ((ColorNotebook*)(SP_COLOR_SELECTOR(entry->backPointer)->base))->removePage(entry->type, entry->submode);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmstatic void
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm SP_COLOR_SELECTOR(colorbook)->base = new ColorNotebook( SP_COLOR_SELECTOR(colorbook) );
#if ENABLE_LCMS
_btn = 0;
_popup = 0;
for ( i = 0; i < selector_type_count; i++ )
for ( j = 0; j < howmany; j++ )
SPColorNotebookTracker *entry = reinterpret_cast< SPColorNotebookTracker* > (malloc(sizeof(SPColorNotebookTracker)));
if ( entry )
if ( entry )
SPColorNotebookTracker *entry = reinterpret_cast< SPColorNotebookTracker* > (g_ptr_array_index (_trackerList, i));
if ( entry )
// but first fix it so it remembers its settings in prefs and does not take that much space (entire vertical column!)
gtk_signal_connect_object(GTK_OBJECT(_btn), "event", GTK_SIGNAL_FUNC (sp_color_notebook_menu_handler), GTK_OBJECT(_csel));
if ( !found )
row++;
#if ENABLE_LCMS
GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
GtkWidget *outofgamut = gtk_image_new_from_icon_name ("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
GtkWidget *toomuchink = gtk_image_new_from_icon_name ("too-much-ink-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
#if ENABLE_LCMS
gtk_table_attach (GTK_TABLE (table), rgbabox, 0, 2, row, row + 1, GTK_FILL, GTK_SHRINK, XPAD, YPAD);
#ifdef SPCS_PREVIEW
_entryId = gtk_signal_connect (GTK_OBJECT (_rgbae), "changed", GTK_SIGNAL_FUNC (ColorNotebook::_rgbaEntryChangedHook), _csel);
if ( _trackerList )
_trackerList = 0;
if ( _switchId )
if ( _book )
_switchId = 0;
sp_color_notebook_new (void)
if ( current_page >= 0 )
return csel;
if ( cselPage )
if (_updating) return;
if (_updatingrgba) return;
bool changed = false;
changed = true;
if ( changed ) {
#if ENABLE_LCMS
Inkscape::ColorProfile* target_profile = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str());
if ( target_profile )
Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str());
double ink_sum = 0;
/* Some literature states that when the sum of paint values exceed 320%, it is considered to be a satured color,
which means the paper can get too wet due to an excessive ammount of ink. This may lead to several issues
if ( !_updatingrgba )
if ( page )
if ( submode > 0 )
return page;
gint i = 0;
if ( page )
page = 0;
return page;
if ( page )
if ( where >= 0 )