~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to src/widgets/sp-color-notebook.cpp

  • Committer: Alex Valavanis
  • Date: 2012-02-16 09:51:14 UTC
  • mto: (63.1.1 fix-933188) (1.4.4) (2.5.4 sid)
  • mto: This revision was merged to the branch mainline in revision 64.
  • Revision ID: valavanisalex@gmail.com-20120216095114-vxo1i071bw0xxxf3
Tags: upstream-0.48.3
ImportĀ upstreamĀ versionĀ 0.48.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define __SP_COLOR_NOTEBOOK_C__
2
 
 
3
1
/*
4
2
 * A notebook with RGB, CMYK, CMS, HSL, and Wheel pages
5
3
 *
37
35
#include "../inkscape.h"
38
36
#include "../document.h"
39
37
#include "../profile-manager.h"
 
38
#include "color-profile.h"
 
39
#include "cms-system.h"
 
40
 
 
41
using Inkscape::CMSSystem;
40
42
 
41
43
struct SPColorNotebookTracker {
42
44
    const gchar* name;
81
83
    return type;
82
84
}
83
85
 
84
 
static void
85
 
sp_color_notebook_class_init (SPColorNotebookClass *klass)
 
86
static void sp_color_notebook_class_init(SPColorNotebookClass *klass)
86
87
{
87
 
    GtkObjectClass *object_class;
88
 
    GtkWidgetClass *widget_class;
89
 
    SPColorSelectorClass *selector_class;
90
 
 
91
 
    object_class = (GtkObjectClass *) klass;
92
 
    widget_class = (GtkWidgetClass *) klass;
93
 
    selector_class = SP_COLOR_SELECTOR_CLASS (klass);
94
 
 
95
 
    parent_class = SP_COLOR_SELECTOR_CLASS (g_type_class_peek_parent (klass));
 
88
    GtkObjectClass *object_class = reinterpret_cast<GtkObjectClass *>(klass);
 
89
    GtkWidgetClass *widget_class = reinterpret_cast<GtkWidgetClass *>(klass);
 
90
 
 
91
    parent_class = SP_COLOR_SELECTOR_CLASS(g_type_class_peek_parent(klass));
96
92
 
97
93
    object_class->destroy = sp_color_notebook_destroy;
98
94
 
208
204
    /* tempory hardcoding to get types loaded */
209
205
    SP_TYPE_COLOR_SCALES;
210
206
    SP_TYPE_COLOR_WHEEL_SELECTOR;
211
 
#if ENABLE_LCMS
 
207
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
212
208
    SP_TYPE_COLOR_ICC_SELECTOR;
213
 
#endif // ENABLE_LCMS
 
209
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
214
210
 
215
211
    /* REJON: Comment out the next line to not use the normal GTK Color
216
212
           wheel. */
331
327
 
332
328
    GtkWidget *rgbabox = gtk_hbox_new (FALSE, 0);
333
329
 
334
 
#if ENABLE_LCMS
 
330
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
335
331
    /* Create color management icons */
336
332
    _box_colormanaged = gtk_event_box_new ();
337
333
    GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
357
353
    gtk_widget_set_sensitive (_box_toomuchink, false);
358
354
    gtk_box_pack_start(GTK_BOX(rgbabox), _box_toomuchink, FALSE, FALSE, 2);
359
355
 
360
 
#endif //ENABLE_LCMS
 
356
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
361
357
 
362
358
    /* Create RGBA entry and color preview */
363
359
    _rgbal = gtk_label_new_with_mnemonic (_("RGBA_:"));
375
371
    sp_set_font_size_smaller (rgbabox);
376
372
    gtk_widget_show_all (rgbabox);
377
373
 
378
 
#if ENABLE_LCMS
 
374
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
379
375
    //the "too much ink" icon is initially hidden
380
376
    gtk_widget_hide(GTK_WIDGET(_box_toomuchink));
381
 
#endif //ENABLE_LCMS
 
377
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
382
378
 
383
379
    gtk_table_attach (GTK_TABLE (table), rgbabox, 0, 2, row, row + 1, GTK_FILL, GTK_SHRINK, XPAD, YPAD);
384
380
 
525
521
{
526
522
    g_return_if_fail( ( 0.0 <= alpha ) && ( alpha <= 1.0 ) );
527
523
 
528
 
#if ENABLE_LCMS
 
524
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
529
525
    /* update color management icon*/
530
526
    gtk_widget_set_sensitive (_box_colormanaged, color.icc != NULL);
531
527
 
541
537
    gtk_widget_set_sensitive (_box_toomuchink, false);
542
538
    if (color.icc){
543
539
        Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str());
544
 
        if ( prof && ( (prof->getColorSpace() == icSigCmykData) || (prof->getColorSpace() == icSigCmyData) ) ) {
 
540
        if ( prof && CMSSystem::isPrintColorSpace(prof) ) {
545
541
            gtk_widget_show(GTK_WIDGET(_box_toomuchink));
546
542
            double ink_sum = 0;
547
543
            for (unsigned int i=0; i<color.icc->colors.size(); i++){
557
553
            gtk_widget_hide(GTK_WIDGET(_box_toomuchink));
558
554
        }
559
555
    }
560
 
#endif //ENABLE_LCMS
 
556
#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
561
557
 
562
558
    if ( !_updatingrgba )
563
559
    {