sp-color-notebook.cpp revision 73433c28659cc79c3d2afde123b6f2fd84f3ec4c
/*
* 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"
#include "tools-switch.h"
#include "ui/tools/tool-base.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 )
{
(dynamic_cast<ColorNotebook*>(SP_COLOR_SELECTOR(entry->backPointer)->base))->addPage(entry->type, entry->submode);
}
else
{
(dynamic_cast<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 ();
// Dont show the notebook tabs, use radiobuttons instead
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 GTK_CHECK_VERSION(3,0,0)
#else
#endif
for ( i = 0; i < _available_pages.size(); i++ )
{
_addPage(_available_pages[i]);
}
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
#if GTK_CHECK_VERSION(3,0,0)
#else
static_cast<GtkAttachOptions>(0),
#endif
row++;
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
// 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!)
g_signal_connect_swapped(G_OBJECT(_btn), "event", G_CALLBACK (sp_color_notebook_menu_handler), G_OBJECT(_csel));
if ( !found )
{
}
}
row++;
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
#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)
/* Color picker */
_btn_picker = gtk_button_new ();
g_signal_connect(G_OBJECT(_btn_picker), "clicked", G_CALLBACK(ColorNotebook::_picker_clicked), _csel);
/* 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)
#if GTK_CHECK_VERSION(3,0,0)
#else
gtk_table_attach (GTK_TABLE (table), rgbabox, 0, 2, row, row + 1, GTK_FILL, GTK_SHRINK, XPAD, YPAD);
#endif
#ifdef SPCS_PREVIEW
#endif
_entryId = g_signal_connect (G_OBJECT (_rgbae), "changed", G_CALLBACK (ColorNotebook::_rgbaEntryChangedHook), _csel);
}
{
}
{
if ( _trackerList )
{
_trackerList = 0;
}
if ( _switchId )
{
if ( _book )
{
_switchId = 0;
}
}
if ( _buttons )
{
delete [] _buttons;
_buttons = 0;
}
}
static void
{
}
{
}
{
return GTK_WIDGET(colorbook);
}
: ColorSelector( csel )
{
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#endif
}
{
if ( current_page >= 0 )
{
if ( SP_IS_COLOR_SELECTOR (widget) )
{
}
}
return csel;
}
{
}
void ColorNotebook::_colorChanged()
{
if ( cselPage )
{
}
}
{
// Set the dropper into a "one click" mode, so it reverts to the previous tool after a click
}
{
}
{
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 */
{
}
}
}
void ColorNotebook::_setCurrentPage(int i)
{
}
}
{
return;
}
}
}
}
{
}
{
}
{
}
{
}
{
}
{
if ( page )
{
if ( submode > 0 )
{
}
// g_message( "Hitting up for tab for '%s'", str );
// Add a button for each page
if (pageNum > 0) {
}
}
return page;
}
if (selector_widget) {
selector_widget->show();
gint page_num = gtk_notebook_append_page( GTK_NOTEBOOK(_book), selector_widget->gobj(), tab_label->gobj());
if (page_num > 0) {
}
//Connect glib signals of non-refactored widgets
}
return selector_widget->gobj();
}
{
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 :