1 /** @file
2 * @brief Print Colors Preview dialog - implementation
3 */
4 /* Authors:
5 * Felipe C. da S. Sanches <juca@members.fsf.org>
6 *
7 * Copyright (C) 2009 Authors
8 * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
9 */
10 /*
11 #include "desktop.h"
12 #include "print-colors-preview-dialog.h"
13 #include "preferences.h"
14 #include <glibmm/i18n.h>
16 namespace Inkscape {
17 namespace UI {
18 namespace Dialog {
20 //Yes, I know we shouldn't hardcode CMYK. This class needs to be refactored
21 // in order to accomodate spot colors and color components defined using
22 // ICC colors. --Juca
24 void PrintColorsPreviewDialog::toggle_cyan(){
25 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
26 prefs->setBool("/options/printcolorspreview/cyan", cyan->get_active());
28 SPDesktop *desktop = getDesktop();
29 desktop->setDisplayModePrintColorsPreview();
30 }
32 void PrintColorsPreviewDialog::toggle_magenta(){
33 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
34 prefs->setBool("/options/printcolorspreview/magenta", magenta->get_active());
36 SPDesktop *desktop = getDesktop();
37 desktop->setDisplayModePrintColorsPreview();
38 }
40 void PrintColorsPreviewDialog::toggle_yellow(){
41 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
42 prefs->setBool("/options/printcolorspreview/yellow", yellow->get_active());
44 SPDesktop *desktop = getDesktop();
45 desktop->setDisplayModePrintColorsPreview();
46 }
48 void PrintColorsPreviewDialog::toggle_black(){
49 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
50 prefs->setBool("/options/printcolorspreview/black", black->get_active());
52 SPDesktop *desktop = getDesktop();
53 desktop->setDisplayModePrintColorsPreview();
54 }
56 PrintColorsPreviewDialog::PrintColorsPreviewDialog()
57 : UI::Widget::Panel("", "/dialogs/printcolorspreview", SP_VERB_DIALOG_PRINT_COLORS_PREVIEW)
58 {
59 Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox());
61 cyan = new Gtk::ToggleButton(_("Cyan"));
62 vbox->pack_start( *cyan, false, false );
63 // tips.set_tip((*cyan), _("Render cyan separation"));
64 cyan->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_cyan) );
66 magenta = new Gtk::ToggleButton(_("Magenta"));
67 vbox->pack_start( *magenta, false, false );
68 // tips.set_tip((*magenta), _("Render magenta separation"));
69 magenta->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_magenta) );
71 yellow = new Gtk::ToggleButton(_("Yellow"));
72 vbox->pack_start( *yellow, false, false );
73 // tips.set_tip((*yellow), _("Render yellow separation"));
74 yellow->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_yellow) );
76 black = new Gtk::ToggleButton(_("Black"));
77 vbox->pack_start( *black, false, false );
78 // tips.set_tip((*black), _("Render black separation"));
79 black->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_black) );
81 gint val;
82 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
83 val = prefs->getBool("/options/printcolorspreview/cyan");
84 cyan->set_active( val != 0 );
85 val = prefs->getBool("/options/printcolorspreview/magenta");
86 magenta->set_active( val != 0 );
87 val = prefs->getBool("/options/printcolorspreview/yellow");
88 yellow->set_active( val != 0 );
89 val = prefs->getBool("/options/printcolorspreview/black");
90 black->set_active( val != 0 );
92 _getContents()->add(*vbox);
93 _getContents()->show_all();
94 }
96 PrintColorsPreviewDialog::~PrintColorsPreviewDialog(){}
98 } // namespace Dialog
99 } // namespace UI
100 } // namespace Inkscape
101 */