tracedialog.cpp revision 77dae8b0ae204855f29e1acb5105295dcacd710e
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/** @file
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * @brief Bitmap tracing settings dialog - implementation
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/* Authors:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Bob Jamison <rjamison@titan.com>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Stéphane Gimenez <dev@gim.name>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Other dudes from The Inkscape Organization
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Copyright (C) 2004-2006 Authors
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Released under GNU GPL, read the file 'COPYING' for more information
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#ifdef HAVE_CONFIG_H
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński# include <config.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#endif
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <gtkmm/notebook.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <gtkmm/frame.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "ui/widget/spinbutton.h"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <gtkmm/stock.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <gtk/gtk.h> //for GTK_RESPONSE* types
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <glibmm/i18n.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "desktop.h"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "tracedialog.h"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "trace/potrace/inkscape-potrace.h"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskinamespace Inkscape {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskinamespace UI {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskinamespace Dialog {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//## I M P L E M E N T A T I O N
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * A dialog for adjusting bitmap->vector tracing parameters
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskiclass TraceDialogImpl : public TraceDialog
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński{
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński public:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Constructor
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński TraceDialogImpl();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Destructor
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ~TraceDialogImpl();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Callback from OK or Cancel
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński void responseCallback(int response_id);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński private:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * This is the big almighty McGuffin
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::Trace::Tracer tracer;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński * This does potrace processing
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Only preview if do_i_trace is false
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński void potraceProcess(bool do_i_trace);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Abort processing
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński void abort();
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński void previewCallback();
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński //############ General items
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński Gtk::HBox mainHBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Tooltips tips;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Button *mainOkButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Button *mainCancelButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //######## Left pannel
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox leftVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //#### Notebook
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Notebook notebook;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //## Modes
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox modePageBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::RadioButtonGroup modeGroup;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //# Single scan mode
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //brightness
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Frame modeBrightnessFrame;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox modeBrightnessVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeBrightnessBox;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::RadioButton modeBrightnessRadioButton;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::Label modeBrightnessSpinnerLabel;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Inkscape::UI::Widget::SpinButton modeBrightnessSpinner;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński //edge detection
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::Frame modeCannyFrame;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::HBox modeCannyBox;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::VBox modeCannyVBox;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::RadioButton modeCannyRadioButton;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński //Gtk::HSeparator modeCannySeparator;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński //Gtk::Label modeCannyLoSpinnerLabel;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński //Inkscape::UI::Widget::SpinButton modeCannyLoSpinner;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Gtk::Label modeCannyHiSpinnerLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton modeCannyHiSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //quantization
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Frame modeQuantFrame;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeQuantBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox modeQuantVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::RadioButton modeQuantRadioButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label modeQuantNrColorLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton modeQuantNrColorSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //params
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton modeInvertButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeInvertBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //# Multiple path scanning mode
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Frame modeMultiScanFrame;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox modeMultiScanVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //brightness
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeMultiScanHBox1;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::RadioButton modeMultiScanBrightnessRadioButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton modeMultiScanNrColorSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //colors
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeMultiScanHBox2;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::RadioButton modeMultiScanColorRadioButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //grays
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeMultiScanHBox3;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::RadioButton modeMultiScanMonoRadioButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label modeMultiScanNrColorLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //params
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox modeMultiScanHBox4;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton modeMultiScanStackButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton modeMultiScanSmoothButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton modeMultiScanBackgroundButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //## Options
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox optionsPageBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // potrace parameters
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Frame optionsFrame;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox optionsVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox optionsSpecklesBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton optionsSpecklesButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label optionsSpecklesSizeLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton optionsSpecklesSizeSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox optionsCornersBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton optionsCornersButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label optionsCornersThresholdLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton optionsCornersThresholdSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox optionsOptimBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton optionsOptimButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label optionsOptimToleranceLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::UI::Widget::SpinButton optionsOptimToleranceSpinner;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //#### Credits
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox potraceCreditsVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Label potraceCreditsLabel;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //######## Right pannel
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox rightVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //#### SIOX selection
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::HBox sioxBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::CheckButton sioxButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //#### Preview
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Frame previewFrame;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::VBox previewVBox;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Button previewButton;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gtk::Image previewImage;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński};
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//## E V E N T S
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński//#########################################################################
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński/**
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński * This does potrace processing
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński * Only preview if do_i_trace is false
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński */
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosińskivoid TraceDialogImpl::potraceProcess(bool do_i_trace)
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński{
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński SPDesktop *desktop = SP_ACTIVE_DESKTOP;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński if (desktop)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński desktop->setWaitingCursor();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Get the tracer and engine
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::Trace::Potrace::PotraceTracingEngine pte;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* inversion */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool invert = modeInvertButton.get_active();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setInvert(invert);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Get the preprocessor settings
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* siox -- performed by Tracer, and before any of the others */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (sioxButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński tracer.enableSiox(true);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński tracer.enableSiox(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* one of the following */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (modeBrightnessRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (modeMultiScanBrightnessRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS_MULTI);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (modeCannyRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_CANNY);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (modeQuantRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (modeMultiScanColorRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_COLOR);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setInvert(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (modeMultiScanMonoRadioButton.get_active())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_MONO);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setInvert(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* params */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int paramsSpecklesSize =
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński optionsSpecklesButton.get_active() ?
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński optionsSpecklesSizeSpinner.get_value_as_int() :
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński 0;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setParamsTurdSize(paramsSpecklesSize);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double paramsCornersThreshold =
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński optionsCornersButton.get_active() ?
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński optionsCornersThresholdSpinner.get_value() :
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński 0.;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setParamsAlphaMax(paramsCornersThreshold);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool paramsOptim = optionsOptimButton.get_active();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setParamsOptiCurve(paramsOptim);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double paramsOptimTolerance = optionsOptimToleranceSpinner.get_value();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setParamsOptTolerance(paramsOptimTolerance);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Get the single-scan settings
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* brightness */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double brightnessThreshold = modeBrightnessSpinner.get_value();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setBrightnessThreshold(brightnessThreshold);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* canny */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double cannyHighThreshold = modeCannyHiSpinner.get_value();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setCannyHighThreshold(cannyHighThreshold);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński /* quantization */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int quantNrColors = modeQuantNrColorSpinner.get_value_as_int();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setQuantizationNrColors(quantNrColors);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Get multiple-scan settings
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int multiScanNrColors = modeMultiScanNrColorSpinner.get_value_as_int();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setMultiScanNrColors(multiScanNrColors);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool do_i_stack = modeMultiScanStackButton.get_active();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setMultiScanStack(do_i_stack);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool do_i_smooth = modeMultiScanSmoothButton.get_active();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setMultiScanSmooth(do_i_smooth);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool do_i_remove_background = modeMultiScanBackgroundButton.get_active();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński pte.setMultiScanRemoveBackground(do_i_remove_background);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Get intermediate bitmap image
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Glib::RefPtr<Gdk::Pixbuf> pixbuf = tracer.getSelectedImage();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (pixbuf)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Glib::RefPtr<Gdk::Pixbuf> preview = pte.preview(pixbuf);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (preview)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int width = preview->get_width();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int height = preview->get_height();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double scaleFX = 200.0 / (double)width;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double scaleFY = 200.0 / (double)height;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double scaleFactor = scaleFX > scaleFY ? scaleFY : scaleFX;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int newWidth = (int) (((double)width) * scaleFactor);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński int newHeight = (int) (((double)height) * scaleFactor);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Glib::RefPtr<Gdk::Pixbuf> scaledPreview =
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński preview->scale_simple(newWidth, newHeight,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Gdk::INTERP_NEAREST);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //g_object_unref(preview);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński previewImage.set(scaledPreview);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //##### Convert
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (do_i_trace)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainCancelButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainCancelButton->set_sensitive(true);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainOkButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainOkButton->set_sensitive(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński tracer.trace(&pte);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainCancelButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainCancelButton->set_sensitive(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainOkButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainOkButton->set_sensitive(true);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (desktop)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński desktop->clearWaitingCursor();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński}
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Abort processing
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskivoid TraceDialogImpl::abort()
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński{
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPDesktop *desktop = SP_ACTIVE_DESKTOP;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (desktop)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński desktop->setWaitingCursor();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainCancelButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainCancelButton->set_sensitive(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (mainOkButton)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński mainOkButton->set_sensitive(true);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //### Make the abort() call to the tracer
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński tracer.abort();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński}
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//## E V E N T S
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Callback from the Preview button. Can be called from elsewhere.
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskivoid TraceDialogImpl::previewCallback()
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński{
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński potraceProcess(false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński}
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Default response from the dialog. Let's intercept it
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskivoid TraceDialogImpl::responseCallback(int response_id)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński{
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (response_id == GTK_RESPONSE_OK)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // for now, we assume potrace, as it's the only one we have
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński potraceProcess(true);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else if (response_id == GTK_RESPONSE_CANCEL)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński abort();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński else
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński hide();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński return;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński}
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//## C O N S T R U C T O R / D E S T R U C T O R
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński//#########################################################################
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/**
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Constructor
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof KosińskiTraceDialogImpl::TraceDialogImpl() :
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński TraceDialog()
{
Gtk::Box *contents = _getContents();
#define MARGIN 2
//#### begin left panel
//### begin notebook
//## begin mode page
//# begin single scan
// brightness
modeBrightnessRadioButton.set_label(_("_Brightness cutoff"));
modeGroup = modeBrightnessRadioButton.get_group();
modeBrightnessRadioButton.set_use_underline(true);
modeBrightnessBox.pack_start(modeBrightnessRadioButton, false, false, MARGIN);
tips.set_tip(modeBrightnessRadioButton,
_("Trace by a given brightness level"));
modeBrightnessSpinner.set_digits(3);
modeBrightnessSpinner.set_increments(0.01, 0);
modeBrightnessSpinner.set_range(0.0, 1.0);
modeBrightnessSpinner.set_value(0.45);
modeBrightnessBox.pack_end(modeBrightnessSpinner, false, false, MARGIN);
tips.set_tip(modeBrightnessSpinner,
_("Brightness cutoff for black/white"));
modeBrightnessSpinnerLabel.set_label(_("_Threshold:"));
modeBrightnessSpinnerLabel.set_use_underline(true);
modeBrightnessSpinnerLabel.set_mnemonic_widget(modeBrightnessSpinner);
modeBrightnessBox.pack_end(modeBrightnessSpinnerLabel, false, false, MARGIN);
modeBrightnessVBox.pack_start(modeBrightnessBox, false, false, MARGIN);
modeBrightnessFrame.set_label(_("Single scan: creates a path"));
// canny edge detection
// TRANSLATORS: "Canny" is the name of the inventor of this edge detection method
modeCannyRadioButton.set_label(_("_Edge detection"));
modeCannyRadioButton.set_group(modeGroup);
modeCannyRadioButton.set_use_underline(true);
modeCannyBox.pack_start(modeCannyRadioButton, false, false, MARGIN);
tips.set_tip(modeCannyRadioButton,
_("Trace with optimal edge detection by J. Canny's algorithm"));
/*
modeCannyBox.pack_start(modeCannySeparator);
modeCannyLoSpinnerLabel.set_label(_("Low"));
modeCannyBox.pack_start(modeCannyLoSpinnerLabel);
modeCannyLoSpinner.set_digits(5);
modeCannyLoSpinner.set_increments(0.01, 0);
modeCannyLoSpinner.set_range(0.0, 1.0);
modeCannyLoSpinner.set_value(0.1);
modeCannyBox.pack_start(modeCannyLoSpinner);
*/
modeCannyHiSpinner.set_digits(3);
modeCannyHiSpinner.set_increments(0.01, 0);
modeCannyHiSpinner.set_range(0.0, 1.0);
modeCannyHiSpinner.set_value(0.65);
modeCannyBox.pack_end(modeCannyHiSpinner, false, false, MARGIN);
tips.set_tip(modeCannyHiSpinner,
_("Brightness cutoff for adjacent pixels (determines edge thickness)"));
modeCannyHiSpinnerLabel.set_label(_("T_hreshold:"));
modeCannyHiSpinnerLabel.set_use_underline(true);
modeCannyHiSpinnerLabel.set_mnemonic_widget(modeCannyHiSpinner);
modeCannyBox.pack_end(modeCannyHiSpinnerLabel, false, false, MARGIN);
modeBrightnessVBox.pack_start(modeCannyBox, false, false, MARGIN);
// quantization
// TRANSLATORS: Color Quantization: the process of reducing the number
// of colors in an image by selecting an optimized set of representative
// colors and then re-applying this reduced set to the original image.
modeQuantRadioButton.set_label(_("Color _quantization"));
modeQuantRadioButton.set_group(modeGroup);
modeQuantRadioButton.set_use_underline(true);
modeQuantBox.pack_start(modeQuantRadioButton, false, false, MARGIN);
tips.set_tip(modeQuantRadioButton,
_("Trace along the boundaries of reduced colors"));
modeQuantNrColorSpinner.set_digits(0);
modeQuantNrColorSpinner.set_increments(1.0, 0);
modeQuantNrColorSpinner.set_range(2.0, 64.0);
modeQuantNrColorSpinner.set_value(8.0);
modeQuantBox.pack_end(modeQuantNrColorSpinner, false, false, MARGIN);
tips.set_tip(modeQuantNrColorSpinner,
_("The number of reduced colors"));
modeQuantNrColorLabel.set_label(_("_Colors:"));
modeQuantNrColorLabel.set_mnemonic_widget(modeQuantNrColorSpinner);
modeQuantNrColorLabel.set_use_underline(true);
modeQuantBox.pack_end(modeQuantNrColorLabel, false, false, MARGIN);
modeBrightnessVBox.pack_start(modeQuantBox, false, false, MARGIN);
// swap black and white
modeInvertButton.set_label(_("_Invert image"));
modeInvertButton.set_active(false);
modeInvertButton.set_use_underline(true);
modeInvertBox.pack_start(modeInvertButton, false, false, MARGIN);
modeBrightnessVBox.pack_start(modeInvertBox, false, false, MARGIN);
tips.set_tip(modeInvertButton,
_("Invert black and white regions"));
modeBrightnessFrame.add(modeBrightnessVBox);
modePageBox.pack_start(modeBrightnessFrame, false, false, 0);
//# end single scan
//# begin multiple scan
modeMultiScanBrightnessRadioButton.set_label(_("B_rightness steps"));
modeMultiScanBrightnessRadioButton.set_group(modeGroup);
modeMultiScanBrightnessRadioButton.set_use_underline(true);
modeMultiScanHBox1.pack_start(modeMultiScanBrightnessRadioButton, false, false, MARGIN);
tips.set_tip(modeMultiScanBrightnessRadioButton,
_("Trace the given number of brightness levels"));
modeMultiScanNrColorSpinner.set_digits(0);
modeMultiScanNrColorSpinner.set_increments(1.0, 0);
modeMultiScanNrColorSpinner.set_range(2.0, 256.0);
modeMultiScanNrColorSpinner.set_value(8.0);
modeMultiScanHBox1.pack_end(modeMultiScanNrColorSpinner, false, false, MARGIN);
modeMultiScanNrColorLabel.set_label(_("Sc_ans:"));
modeMultiScanNrColorLabel.set_use_underline(true);
modeMultiScanNrColorLabel.set_mnemonic_widget(modeMultiScanNrColorSpinner);
modeMultiScanHBox1.pack_end(modeMultiScanNrColorLabel, false, false, MARGIN);
tips.set_tip(modeMultiScanNrColorSpinner,
_("The desired number of scans"));
modeMultiScanVBox.pack_start(modeMultiScanHBox1, false, false, MARGIN);
modeMultiScanColorRadioButton.set_label(_("Co_lors"));
modeMultiScanColorRadioButton.set_group(modeGroup);
modeMultiScanColorRadioButton.set_use_underline(true);
modeMultiScanHBox2.pack_start(modeMultiScanColorRadioButton, false, false, MARGIN);
tips.set_tip(modeMultiScanColorRadioButton,
_("Trace the given number of reduced colors"));
modeMultiScanVBox.pack_start(modeMultiScanHBox2, false, false, MARGIN);
modeMultiScanMonoRadioButton.set_label(_("_Grays"));
modeMultiScanMonoRadioButton.set_group(modeGroup);
modeMultiScanMonoRadioButton.set_use_underline(true);
modeMultiScanHBox3.pack_start(modeMultiScanMonoRadioButton, false, false, MARGIN);
tips.set_tip(modeMultiScanMonoRadioButton,
_("Same as Colors, but the result is converted to grayscale"));
modeMultiScanVBox.pack_start(modeMultiScanHBox3, false, false, MARGIN);
// TRANSLATORS: "Smooth" is a verb here
modeMultiScanSmoothButton.set_label(_("S_mooth"));
modeMultiScanSmoothButton.set_use_underline(true);
modeMultiScanSmoothButton.set_active(true);
modeMultiScanHBox4.pack_start(modeMultiScanSmoothButton, false, false, MARGIN);
tips.set_tip(modeMultiScanSmoothButton,
_("Apply Gaussian blur to the bitmap before tracing"));
// TRANSLATORS: "Stack" is a verb here
modeMultiScanStackButton.set_label(_("Stac_k scans"));
modeMultiScanStackButton.set_use_underline(true);
modeMultiScanStackButton.set_active(true);
modeMultiScanHBox4.pack_start(modeMultiScanStackButton, false, false, MARGIN);
tips.set_tip(modeMultiScanStackButton, _("Stack scans on top of one another (no gaps) instead of tiling (usually with gaps)"));
modeMultiScanBackgroundButton.set_label(_("Remo_ve background"));
modeMultiScanBackgroundButton.set_use_underline(true);
modeMultiScanBackgroundButton.set_active(false);
modeMultiScanHBox4.pack_start(modeMultiScanBackgroundButton, false, false, MARGIN);
// TRANSLATORS: "Layer" refers to one of the stacked paths in the multiscan
tips.set_tip(modeMultiScanBackgroundButton,
_("Remove bottom (background) layer when done"));
modeMultiScanVBox.pack_start(modeMultiScanHBox4, false, false, MARGIN);
modeMultiScanFrame.set_label(_("Multiple scans: creates a group of paths"));
//modeQuantFrame.set_shadow_type(Gtk::SHADOW_NONE);
modeMultiScanFrame.add(modeMultiScanVBox);
modePageBox.pack_start(modeMultiScanFrame, false, false, 0);
//# end multiple scan
//## end mode page
notebook.append_page(modePageBox, _("_Mode"), true);
//## begin option page
//# potrace parameters
optionsSpecklesButton.set_label(_("Suppress _speckles"));
optionsSpecklesButton.set_use_underline(true);
tips.set_tip(optionsSpecklesButton,
_("Ignore small spots (speckles) in the bitmap"));
optionsSpecklesButton.set_active(true);
optionsSpecklesBox.pack_start(optionsSpecklesButton, false, false, MARGIN);
optionsSpecklesSizeSpinner.set_digits(0);
optionsSpecklesSizeSpinner.set_increments(1, 0);
optionsSpecklesSizeSpinner.set_range(0, 1000);
optionsSpecklesSizeSpinner.set_value(2);
tips.set_tip(optionsSpecklesSizeSpinner,
_("Speckles of up to this many pixels will be suppressed"));
optionsSpecklesBox.pack_end(optionsSpecklesSizeSpinner, false, false, MARGIN);
optionsSpecklesSizeLabel.set_label(_("S_ize:"));
optionsSpecklesSizeLabel.set_use_underline(true);
optionsSpecklesSizeLabel.set_mnemonic_widget(optionsSpecklesSizeSpinner);
optionsSpecklesBox.pack_end(optionsSpecklesSizeLabel, false, false, MARGIN);
optionsCornersButton.set_label(_("Smooth _corners"));
optionsCornersButton.set_use_underline(true);
tips.set_tip(optionsCornersButton,
_("Smooth out sharp corners of the trace"));
optionsCornersButton.set_active(true);
optionsCornersBox.pack_start(optionsCornersButton, false, false, MARGIN);
optionsCornersThresholdSpinner.set_digits(2);
optionsCornersThresholdSpinner.set_increments(0.01, 0);
optionsCornersThresholdSpinner.set_range(0.0, 1.34);
optionsCornersThresholdSpinner.set_value(1.0);
optionsCornersBox.pack_end(optionsCornersThresholdSpinner, false, false, MARGIN);
tips.set_tip(optionsCornersThresholdSpinner,
_("Increase this to smooth corners more"));
optionsCornersThresholdLabel.set_label(_("_Threshold:"));
optionsCornersThresholdLabel.set_use_underline(true);
optionsCornersThresholdLabel.set_mnemonic_widget(optionsCornersThresholdSpinner);
optionsCornersBox.pack_end(optionsCornersThresholdLabel, false, false, MARGIN);
optionsOptimButton.set_label(_("Optimize p_aths"));
optionsOptimButton.set_use_underline(true);
optionsOptimButton.set_active(true);
tips.set_tip(optionsOptimButton,
_("Try to optimize paths by joining adjacent Bezier curve segments"));
optionsOptimBox.pack_start(optionsOptimButton, false, false, MARGIN);
optionsOptimToleranceSpinner.set_digits(2);
optionsOptimToleranceSpinner.set_increments(0.05, 0);
optionsOptimToleranceSpinner.set_range(0.0, 5.0);
optionsOptimToleranceSpinner.set_value(0.2);
optionsOptimBox.pack_end(optionsOptimToleranceSpinner, false, false, MARGIN);
tips.set_tip(optionsOptimToleranceSpinner,
_("Increase this to reduce the number of nodes in the trace by more aggressive optimization"));
optionsOptimToleranceLabel.set_label(_("To_lerance:"));
optionsOptimToleranceLabel.set_use_underline(true);
optionsOptimToleranceLabel.set_mnemonic_widget(optionsOptimToleranceSpinner);
optionsOptimBox.pack_end(optionsOptimToleranceLabel, false, false, MARGIN);
optionsVBox.pack_start(optionsSpecklesBox, false, false, MARGIN);
optionsVBox.pack_start(optionsCornersBox, false, false, MARGIN);
optionsVBox.pack_start(optionsOptimBox, false, false, MARGIN);
optionsFrame.set_label(_("Options"));
optionsFrame.add(optionsVBox);
optionsPageBox.pack_start(optionsFrame, false, false, 0);
//## end option page
notebook.append_page(optionsPageBox, _("O_ptions"), true);
//### credits
potraceCreditsLabel.set_text(_("Inkscape bitmap tracing\nis based on Potrace,\ncreated by Peter Selinger\n\nhttp://potrace.sourceforge.net"));
potraceCreditsVBox.pack_start(potraceCreditsLabel, false, false, MARGIN);
notebook.append_page(potraceCreditsVBox, _("Credits"));
//### end notebook
leftVBox.pack_start(notebook, true, true, MARGIN);
//#### end left panel
mainHBox.pack_start(leftVBox);
//#### begin right panel
//## SIOX
sioxButton.set_label(_("SIOX _foreground selection"));
sioxButton.set_use_underline(true);
sioxBox.pack_start(sioxButton, false, false, MARGIN);
tips.set_tip(sioxButton,
_("Cover the area you want to select as the foreground"));
rightVBox.pack_start(sioxBox, false, false, 0);
//## preview
previewButton.set_label(_("_Update"));
previewButton.set_use_underline(true);
previewButton.signal_clicked().connect(
sigc::mem_fun(*this, &TraceDialogImpl::previewCallback) );
previewVBox.pack_end(previewButton, false, false, 0);
// I guess it's correct to call the "intermediate bitmap" a preview of the trace
tips.set_tip(previewButton,
_("Preview the intermediate bitmap with the current settings, without actual tracing"));
previewImage.set_size_request(200,200);
//previewImage.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
previewVBox.pack_start(previewImage, true, true, 0);
previewFrame.set_label(_("Preview"));
//previewFrame.set_shadow_type(Gtk::SHADOW_NONE);
previewFrame.add(previewVBox);
rightVBox.pack_start(previewFrame, true, true, MARGIN);
//#### end right panel
mainHBox.pack_start(rightVBox);
//#### Global stuff
contents->pack_start(mainHBox);
//## The OK button
mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
if (mainCancelButton) {
tips.set_tip((*mainCancelButton), _("Abort a trace in progress"));
mainCancelButton->set_sensitive(false);
}
mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK);
tips.set_tip((*mainOkButton), _("Execute the trace"));
show_all_children();
//## Connect the signal
signalResponse().connect(
sigc::mem_fun(*this, &TraceDialogImpl::responseCallback));
}
/**
* Factory method. Use this to create a new TraceDialog
*/
TraceDialog &TraceDialog::getInstance()
{
TraceDialog *dialog = new TraceDialogImpl();
return *dialog;
}
/**
* Constructor
*/
TraceDialogImpl::~TraceDialogImpl()
{
}
} //namespace Dialog
} //namespace UI
} //namespace Inkscape
//#########################################################################
//## E N D O F F I L E
//#########################################################################