sp-color-notebook.cpp revision 233a1f180a791dbec18c48af4d6586aef6eed085
/*
* A notebook with RGB, CMYK, CMS, HSL, and Wheel pages
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
*
* This code is in public domain
*/
#define noDUMP_CHANGE_INFO
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstddef>
#include "../dialogs/dialog-events.h"
#include "../preferences.h"
#include "sp-color-notebook.h"
#include "spw-utilities.h"
#include "sp-color-scales.h"
#include "sp-color-icc-selector.h"
#include "sp-color-wheel-selector.h"
#include "svg/svg-icc-color.h"
#include "../inkscape.h"
#include "../document.h"
#include "../profile-manager.h"
#include "color-profile.h"
#include "cms-system.h"
struct SPColorNotebookTracker {
};
static SPColorSelectorClass *parent_class;
#define XPAD 4
#define YPAD 1
{
if (!type) {
sizeof(SPColorNotebookClass),
0, // base_init
0, // base_finalize
0, // class_finalize
0, // class_data
sizeof(SPColorNotebook),
0, // n_preallocs
0 // value_table
};
type = g_type_register_static(SP_TYPE_COLOR_SELECTOR, "SPColorNotebook", &info, static_cast<GTypeFlags>(0));
}
return type;
}
{
}
static void
{
if ( colorbook )
{
// remember the page we switched to
}
}
{
{
csel = getCurrentSelector();
}
{
// Temporary workaround to undo a spurious GRABBED
_released();
}
}
{
{
/* Tell calling code that we have handled this event; the buck
* stops here. */
return TRUE;
}
/* Tell calling code that we have not handled this event; pass it on. */
return FALSE;
}
{
return TRUE;
}
{
if ( entry )
{
if ( active )
{
((ColorNotebook*)(SP_COLOR_SELECTOR(entry->backPointer)->base))->addPage(entry->type, entry->submode);
}
else
{
((ColorNotebook*)(SP_COLOR_SELECTOR(entry->backPointer)->base))->removePage(entry->type, entry->submode);
}
}
}
static void
{
{
}
}
void ColorNotebook::init()
{
guint i = 0;
guint j = 0;
GType *selector_types = 0;
guint selector_type_count = 0;
/* tempory hardcoding to get types loaded */
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/* REJON: Comment out the next line to not use the normal GTK Color
wheel. */
// SP_TYPE_COLOR_GTKSELECTOR;
_btn = 0;
_popup = 0;
_trackerList = g_ptr_array_new ();
_book = gtk_notebook_new ();
for ( i = 0; i < selector_type_count; i++ )
{
{
{
for ( j = 0; j < howmany; j++ )
{
SPColorNotebookTracker *entry = reinterpret_cast< SPColorNotebookTracker* > (malloc(sizeof(SPColorNotebookTracker)));
if ( entry )
{
}
}
}
}
}
for ( i = 0; i < _trackerList->len; i++ )
{
if ( entry )
{
}
}
// restore the last active page
{
_popup = gtk_menu_new();
for ( i = 0; i < _trackerList->len; i++ )
{
SPColorNotebookTracker *entry = reinterpret_cast< SPColorNotebookTracker* > (g_ptr_array_index (_trackerList, i));
if ( entry )
{
}
}
_btn = gtk_button_new ();
// but first fix it so it remembers its settings in prefs and does not take that much space (entire vertical column!)
//gtk_table_attach (GTK_TABLE (table), align, 2, 3, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD);
g_signal_connect_swapped(G_OBJECT(_btn), "event", G_CALLBACK (sp_color_notebook_menu_handler), G_OBJECT(_csel));
if ( !found )
{
}
}
row++;
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/* Create color management icons */
GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_set_sensitive (_box_colormanaged, false);
GtkWidget *outofgamut = gtk_image_new_from_icon_name ("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_set_sensitive (_box_outofgamut, false);
GtkWidget *toomuchink = gtk_image_new_from_icon_name ("too-much-ink-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_set_sensitive (_box_toomuchink, false);
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/* Create RGBA entry and color preview */
_rgbae = gtk_entry_new ();
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//the "too much ink" icon is initially hidden
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
gtk_table_attach (GTK_TABLE (table), rgbabox, 0, 2, row, row + 1, GTK_FILL, GTK_SHRINK, XPAD, YPAD);
#ifdef SPCS_PREVIEW
#endif
_entryId = g_signal_connect (G_OBJECT (_rgbae), "changed", G_CALLBACK (ColorNotebook::_rgbaEntryChangedHook), _csel);
}
static void
{
}
{
if ( _trackerList )
{
_trackerList = 0;
}
if ( _switchId )
{
if ( _book )
{
_switchId = 0;
}
}
}
static void
{
}
static void
{
}
sp_color_notebook_new (void)
{
return GTK_WIDGET (colorbook);
}
: ColorSelector( csel )
{
}
{
if ( current_page >= 0 )
{
if ( SP_IS_COLOR_SELECTOR (widget) )
{
}
}
return csel;
}
void ColorNotebook::_colorChanged()
{
if ( cselPage )
{
}
}
{
}
{
if (_updating) return;
if (_updatingrgba) return;
if (t) {
bool changed = false;
changed = true;
// it was a standard RGB hex
}
}
if ( len < 8 ) {
}
if ( changed ) {
}
}
}
}
// TODO pass in param so as to avoid the need for SP_ACTIVE_DOCUMENT
{
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/* update color management icon*/
/* update out-of-gamut icon */
gtk_widget_set_sensitive (_box_outofgamut, false);
Inkscape::ColorProfile* target_profile = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str());
if ( target_profile )
}
/* update too-much-ink icon */
gtk_widget_set_sensitive (_box_toomuchink, false);
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
such as misalignment and poor quality of printing in general.*/
if ( ink_sum > 3.2 )
gtk_widget_set_sensitive (_box_toomuchink, true);
} else {
}
}
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if ( !_updatingrgba )
{
gchar s[32];
/* Update RGBA entry */
{
}
}
}
{
}
{
}
{
}
{
}
{
}
{
if ( page )
{
if ( submode > 0 )
{
}
// g_message( "Hitting up for tab for '%s'", str );
}
return page;
}
{
gint i = 0;
// count = gtk_notebook_get_n_pages (_book);
count = 200;
{
if ( page )
{
{
// found it.
break;
}
else
{
page = 0;
}
}
else
{
break;
}
}
return page;
}
{
if ( page )
{
if ( where >= 0 )
{
{
// getColorAlpha(_color, &_alpha);
}
}
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :