summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2009-12-11 08:37:11 +0000
committerFelipe C. da S. Sanches <juca@members.fsf.org>2009-12-11 08:37:11 +0000
commitb13df173f8e6471ce720d45370447b9e52cd3925 (patch)
treed1735aba3e3d2a25f96967272394922f07509635 /src/ui
parentFrench translation update (diff)
downloadinkscape-b13df173f8e6471ce720d45370447b9e52cd3925.tar.gz
inkscape-b13df173f8e6471ce720d45370447b9e52cd3925.zip
- new: Print Colors Preview Dialog and rendermode
- works with shapes. I still need to make it work with gradients and imported images (bzr r8881)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/Makefile_insert2
-rw-r--r--src/ui/dialog/dialog-manager.cpp3
-rw-r--r--src/ui/dialog/print-colors-preview-dialog.cpp100
-rw-r--r--src/ui/dialog/print-colors-preview-dialog.h48
4 files changed, 153 insertions, 0 deletions
diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert
index fd1b07394..fac5bad80 100644
--- a/src/ui/dialog/Makefile_insert
+++ b/src/ui/dialog/Makefile_insert
@@ -71,6 +71,8 @@ ink_common_sources += \
ui/dialog/panel-dialog.h \
ui/dialog/print.cpp \
ui/dialog/print.h \
+ ui/dialog/print-colors-preview-dialog.cpp \
+ ui/dialog/print-colors-preview-dialog.h \
ui/dialog/scriptdialog.cpp \
ui/dialog/scriptdialog.h \
ui/dialog/spray-option.cpp \
diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp
index 7f853bedc..2116d46c3 100644
--- a/src/ui/dialog/dialog-manager.cpp
+++ b/src/ui/dialog/dialog-manager.cpp
@@ -41,6 +41,7 @@
#include "ui/dialog/floating-behavior.h"
#include "ui/dialog/dock-behavior.h"
#include "ui/dialog/spray-option.h"
+#include "ui/dialog/print-colors-preview-dialog.h"
#include "preferences.h"
#ifdef ENABLE_SVG_FONTS
@@ -102,6 +103,7 @@ DialogManager::DialogManager() {
registerFactory("LivePathEffect", &create<LivePathEffectEditor, FloatingBehavior>);
registerFactory("Memory", &create<Memory, FloatingBehavior>);
registerFactory("Messages", &create<Messages, FloatingBehavior>);
+ registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, FloatingBehavior>);
registerFactory("Script", &create<ScriptDialog, FloatingBehavior>);
#ifdef ENABLE_SVG_FONTS
registerFactory("SvgFontsDialog", &create<SvgFontsDialog, FloatingBehavior>);
@@ -129,6 +131,7 @@ DialogManager::DialogManager() {
registerFactory("LivePathEffect", &create<LivePathEffectEditor, DockBehavior>);
registerFactory("Memory", &create<Memory, DockBehavior>);
registerFactory("Messages", &create<Messages, DockBehavior>);
+ registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, DockBehavior>);
registerFactory("Script", &create<ScriptDialog, DockBehavior>);
#ifdef ENABLE_SVG_FONTS
registerFactory("SvgFontsDialog", &create<SvgFontsDialog, DockBehavior>);
diff --git a/src/ui/dialog/print-colors-preview-dialog.cpp b/src/ui/dialog/print-colors-preview-dialog.cpp
new file mode 100644
index 000000000..f4d83c271
--- /dev/null
+++ b/src/ui/dialog/print-colors-preview-dialog.cpp
@@ -0,0 +1,100 @@
+/** @file
+ * @brief Print Colors Preview dialog - implementation
+ */
+/* Authors:
+ * Felipe C. da S. Sanches <juca@members.fsf.org>
+ *
+ * Copyright (C) 2009 Authors
+ * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
+ */
+
+#include "desktop.h"
+#include "print-colors-preview-dialog.h"
+#include "preferences.h"
+#include <glibmm/i18n.h>
+
+namespace Inkscape {
+namespace UI {
+namespace Dialog {
+
+//Yes, I know we shouldn't hardcode CMYK. This class needs to be refactored
+// in order to accomodate spot colors and color components defined using
+// ICC colors. --Juca
+
+void PrintColorsPreviewDialog::toggle_cyan(){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/options/printcolorspreview/cyan", cyan->get_active());
+
+ SPDesktop *desktop = getDesktop();
+ desktop->setDisplayModePrintColorsPreview();
+}
+
+void PrintColorsPreviewDialog::toggle_magenta(){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/options/printcolorspreview/magenta", magenta->get_active());
+
+ SPDesktop *desktop = getDesktop();
+ desktop->setDisplayModePrintColorsPreview();
+}
+
+void PrintColorsPreviewDialog::toggle_yellow(){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/options/printcolorspreview/yellow", yellow->get_active());
+
+ SPDesktop *desktop = getDesktop();
+ desktop->setDisplayModePrintColorsPreview();
+}
+
+void PrintColorsPreviewDialog::toggle_black(){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/options/printcolorspreview/black", black->get_active());
+
+ SPDesktop *desktop = getDesktop();
+ desktop->setDisplayModePrintColorsPreview();
+}
+
+PrintColorsPreviewDialog::PrintColorsPreviewDialog()
+ : UI::Widget::Panel("", "/dialogs/printcolorspreview", SP_VERB_DIALOG_PRINT_COLORS_PREVIEW)
+{
+ Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox());
+
+ cyan = new Gtk::ToggleButton(_("Cyan"));
+ vbox->pack_start( *cyan, false, false );
+// tips.set_tip((*cyan), _("Render cyan separation"));
+ cyan->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_cyan) );
+
+ magenta = new Gtk::ToggleButton(_("Magenta"));
+ vbox->pack_start( *magenta, false, false );
+// tips.set_tip((*magenta), _("Render magenta separation"));
+ magenta->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_magenta) );
+
+ yellow = new Gtk::ToggleButton(_("Yellow"));
+ vbox->pack_start( *yellow, false, false );
+// tips.set_tip((*yellow), _("Render yellow separation"));
+ yellow->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_yellow) );
+
+ black = new Gtk::ToggleButton(_("Black"));
+ vbox->pack_start( *black, false, false );
+// tips.set_tip((*black), _("Render black separation"));
+ black->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_black) );
+
+ gint val;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ val = prefs->getBool("/options/printcolorspreview/cyan");
+ cyan->set_active( val != 0 );
+ val = prefs->getBool("/options/printcolorspreview/magenta");
+ magenta->set_active( val != 0 );
+ val = prefs->getBool("/options/printcolorspreview/yellow");
+ yellow->set_active( val != 0 );
+ val = prefs->getBool("/options/printcolorspreview/black");
+ black->set_active( val != 0 );
+
+ _getContents()->add(*vbox);
+ _getContents()->show_all();
+}
+
+PrintColorsPreviewDialog::~PrintColorsPreviewDialog(){}
+
+} // namespace Dialog
+} // namespace UI
+} // namespace Inkscape
diff --git a/src/ui/dialog/print-colors-preview-dialog.h b/src/ui/dialog/print-colors-preview-dialog.h
new file mode 100644
index 000000000..246908556
--- /dev/null
+++ b/src/ui/dialog/print-colors-preview-dialog.h
@@ -0,0 +1,48 @@
+/** @file
+ * @brief Print Colors Preview dialog
+ */
+/* Authors:
+ * Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
+ *
+ * Copyright (C) 2009 Authors
+ * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_UI_DIALOG_PRINT_COLORS_PREVIEW_H
+#define INKSCAPE_UI_DIALOG_PRINT_COLORS_PREVIEW_H
+
+#include "ui/widget/panel.h"
+#include "verbs.h"
+
+#include <gtkmm.h>
+#include <gtkmm/box.h>
+
+namespace Inkscape {
+namespace UI {
+namespace Dialog {
+
+class PrintColorsPreviewDialog : public UI::Widget::Panel {
+public:
+ PrintColorsPreviewDialog();
+ ~PrintColorsPreviewDialog();
+
+ static PrintColorsPreviewDialog &getInstance()
+ { return *new PrintColorsPreviewDialog(); }
+
+private:
+ void toggle_cyan();
+ void toggle_magenta();
+ void toggle_yellow();
+ void toggle_black();
+
+ Gtk::ToggleButton* cyan;
+ Gtk::ToggleButton* magenta;
+ Gtk::ToggleButton* yellow;
+ Gtk::ToggleButton* black;
+};
+
+} // namespace Dialog
+} // namespace UI
+} // namespace Inkscape
+
+#endif //#ifndef INKSCAPE_UI_PRINT_COLORS_PREVIEW_H