Code

redesign the dialog into 3 tabs, rewrite most texts, increase preview size
[inkscape.git] / src / ui / dialog / tracedialog.cpp
1 /*
2  * A simple dialog for setting the parameters for autotracing a
3  * bitmap <image> into an svg <path>
4  *
5  * Authors:
6  *   Bob Jamison <rjamison@titan.com>
7  *   Stéphane Gimenez <dev@gim.name>
8  *   Other dudes from The Inkscape Organization
9  *
10  * Copyright (C) 2004-2006 Authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
14 #ifdef HAVE_CONFIG_H
15 # include <config.h>
16 #endif
18 #include <gtkmm/notebook.h>
19 #include <gtkmm/frame.h>
20 #include <gtkmm/spinbutton.h>
21 #include <gtkmm/stock.h>
23 #include <gtk/gtkdialog.h> //for GTK_RESPONSE* types
24 #include <glibmm/i18n.h>
28 #include "tracedialog.h"
29 #include "trace/potrace/inkscape-potrace.h"
32 namespace Inkscape {
33 namespace UI {
34 namespace Dialog {
37 //#########################################################################
38 //## I M P L E M E N T A T I O N
39 //#########################################################################
41 /**
42  * A dialog for adjusting bitmap->vector tracing parameters
43  */
44 class TraceDialogImpl : public TraceDialog
45 {
47     public:
50     /**
51      * Constructor
52      */
53     TraceDialogImpl();
55     /**
56      * Destructor
57      */
58     ~TraceDialogImpl();
60     /**
61      * Callback from OK or Cancel
62      */
63     void responseCallback(int response_id);
65     private:
67     /**
68      * This is the big almighty McGuffin
69      */
70     Inkscape::Trace::Tracer tracer;
72     /**
73      * This does potrace processing
74      * Only preview if do_i_trace is false
75      */
76     void potraceProcess(bool do_i_trace);
78     /**
79      * Abort processing
80      */
81     void abort();
83     void potracePreviewCallback();
85     Gtk::Notebook   notebook;
86     Gtk::Tooltips   tips;
88     //########## General items
89     Gtk::Frame            sioxFrame;
90     Gtk::VBox             sioxVBox;
91     Gtk::HBox             sioxBox;
92     Gtk::CheckButton      sioxButton;
94     //########## Potrace pages
95     Gtk::VBox             potraceModePageBox;
96     Gtk::VBox             potraceParamsPageBox;
97     Gtk::VBox             potracePreviewPageBox;
99     Gtk::RadioButtonGroup potraceGroup;
100     Gtk::CheckButton      potraceInvertButton;
101     Gtk::HBox             potraceInvertBox;
102     Gtk::Button           *potraceOkButton;
103     Gtk::Button           *potraceCancelButton;
105     //params
106     Gtk::Frame            potraceParamsFrame;
107     Gtk::VBox             potraceParamsVBox;
108     Gtk::HBox             potraceParamsSpecklesBox;
109     Gtk::CheckButton      potraceParamsSpecklesButton;
110     Gtk::Label            potraceParamsSpecklesSizeLabel;
111     Gtk::SpinButton       potraceParamsSpecklesSizeSpinner;
112     Gtk::HBox             potraceParamsCornersBox;
113     Gtk::CheckButton      potraceParamsCornersButton;
114     Gtk::Label            potraceParamsCornersThresholdLabel;
115     Gtk::SpinButton       potraceParamsCornersThresholdSpinner;
116     Gtk::HBox             potraceParamsOptimBox;
117     Gtk::CheckButton      potraceParamsOptimButton;
118     Gtk::Label            potraceParamsOptimToleranceLabel;
119     Gtk::SpinButton       potraceParamsOptimToleranceSpinner;
121     //brightness
122     Gtk::Frame            potraceBrightnessFrame;
123     Gtk::VBox             potraceBrightnessVBox;
124     Gtk::HBox             potraceBrightnessBox;
125     Gtk::RadioButton      potraceBrightnessRadioButton;
126     Gtk::Label            potraceBrightnessSpinnerLabel;
127     Gtk::SpinButton       potraceBrightnessSpinner;
130     //edge detection
131     Gtk::Frame            potraceCannyFrame;
132     Gtk::HBox             potraceCannyBox;
133     Gtk::VBox             potraceCannyVBox;
134     Gtk::RadioButton      potraceCannyRadioButton;
135     //Gtk::HSeparator     potraceCannySeparator;
136     //Gtk::Label          potraceCannyLoSpinnerLabel;
137     //Gtk::SpinButton     potraceCannyLoSpinner;
138     Gtk::Label            potraceCannyHiSpinnerLabel;
139     Gtk::SpinButton       potraceCannyHiSpinner;
141     //quantization
142     Gtk::Frame            potraceQuantFrame;
143     Gtk::HBox             potraceQuantBox;
144     Gtk::VBox             potraceQuantVBox;
145     Gtk::RadioButton      potraceQuantRadioButton;
146     Gtk::Label            potraceQuantNrColorLabel;
147     Gtk::SpinButton       potraceQuantNrColorSpinner;
149     //multiple path scanning
150     Gtk::Frame            potraceMultiScanFrame;
151     Gtk::VBox             potraceMultiScanVBox;
153     Gtk::HBox             potraceMultiScanHBox1;
154     Gtk::RadioButton      potraceMultiScanBrightnessRadioButton;
155     Gtk::SpinButton       potraceMultiScanNrColorSpinner;
157     Gtk::HBox             potraceMultiScanHBox2;
158     Gtk::RadioButton      potraceMultiScanColorRadioButton;
160     Gtk::HBox             potraceMultiScanHBox3;
161     Gtk::RadioButton      potraceMultiScanMonoRadioButton;
162     Gtk::Label            potraceMultiScanNrColorLabel;
164     Gtk::HBox             potraceMultiScanHBox4;
165     Gtk::CheckButton      potraceMultiScanStackButton;
166     Gtk::CheckButton      potraceMultiScanSmoothButton;
167     Gtk::CheckButton      potraceMultiScanBackgroundButton;
170     //preview
171     Gtk::Frame            potracePreviewFrame;
172     Gtk::VBox             potracePreviewBox;
173     Gtk::Button           potracePreviewButton;
174     Gtk::Image            potracePreviewImage;
176     //credits
177     Gtk::Frame            potraceCreditsFrame;
178     Gtk::VBox             potraceCreditsVBox;
179     Gtk::Label            potraceCreditsLabel;
181     //########## Other items
182     Gtk::VBox             otherBox;
186 };
191 //#########################################################################
192 //## E V E N T S
193 //#########################################################################
195 /**
196  * This does potrace processing
197  * Only preview if do_i_trace is false
198  */
199 void TraceDialogImpl::potraceProcess(bool do_i_trace)
201     //##### Get the tracer and engine
202     Inkscape::Trace::Potrace::PotraceTracingEngine pte;
204     /* inversion */
205     bool invert = potraceInvertButton.get_active();
206     pte.setInvert(invert);
208     //##### Get the preprocessor settings
209     /* siox -- performed by Tracer, and before any of the others */
210     if (sioxButton.get_active())
211         tracer.enableSiox(true);
212     else
213         tracer.enableSiox(false);
215     /* one of the following */
216     if (potraceBrightnessRadioButton.get_active())
217         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
218     else if (potraceMultiScanBrightnessRadioButton.get_active())
219         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS_MULTI);
220     else if (potraceCannyRadioButton.get_active())
221         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_CANNY);
222     else if (potraceQuantRadioButton.get_active())
223         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT);
224     else if (potraceMultiScanColorRadioButton.get_active())
225         {
226         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_COLOR);
227         pte.setInvert(false);
228         }
229     else if (potraceMultiScanMonoRadioButton.get_active())
230         {
231         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_MONO);
232         pte.setInvert(false);
233         }
235     /* params */
236     int paramsSpecklesSize =
237       potraceParamsSpecklesButton.get_active() ?
238       potraceParamsSpecklesSizeSpinner.get_value_as_int() :
239       0;
240     pte.setParamsTurdSize(paramsSpecklesSize);
241     double paramsCornersThreshold =
242       potraceParamsCornersButton.get_active() ?
243       potraceParamsCornersThresholdSpinner.get_value() :
244       0.;
245     pte.setParamsAlphaMax(paramsCornersThreshold);
246     bool paramsOptim = potraceParamsOptimButton.get_active();
247     pte.setParamsOptiCurve(paramsOptim);
248     double paramsOptimTolerance = potraceParamsOptimToleranceSpinner.get_value();
249     pte.setParamsOptTolerance(paramsOptimTolerance);
251     //##### Get the single-scan settings
253     /* brightness */
254     double brightnessThreshold = potraceBrightnessSpinner.get_value();
255     pte.setBrightnessThreshold(brightnessThreshold);
257     /* canny */
258     double cannyHighThreshold = potraceCannyHiSpinner.get_value();
259     pte.setCannyHighThreshold(cannyHighThreshold);
261     /* quantization */
262     int quantNrColors = potraceQuantNrColorSpinner.get_value_as_int();
263     pte.setQuantizationNrColors(quantNrColors);
265     //##### Get multiple-scan settings
266     int multiScanNrColors = potraceMultiScanNrColorSpinner.get_value_as_int();
267     pte.setMultiScanNrColors(multiScanNrColors);
268     bool do_i_stack = potraceMultiScanStackButton.get_active();
269     pte.setMultiScanStack(do_i_stack);
270     bool do_i_smooth = potraceMultiScanSmoothButton.get_active();
271     pte.setMultiScanSmooth(do_i_smooth);
272     bool do_i_remove_background = potraceMultiScanBackgroundButton.get_active();
273     pte.setMultiScanRemoveBackground(do_i_remove_background);
275     //##### Get intermediate bitmap image
276     Glib::RefPtr<Gdk::Pixbuf> pixbuf = tracer.getSelectedImage();
277     if (pixbuf)
278          {
279          Glib::RefPtr<Gdk::Pixbuf> preview = pte.preview(pixbuf);
280          if (preview)
281              {
282              int width  = preview->get_width();
283              int height = preview->get_height();
284              double scaleFactor = 200.0 / (double)height;
285              int newWidth  = (int) (((double)width)  * scaleFactor);
286              int newHeight = (int) (((double)height) * scaleFactor);
287              Glib::RefPtr<Gdk::Pixbuf> scaledPreview =
288                     preview->scale_simple(newWidth, newHeight,
289                        Gdk::INTERP_NEAREST);
290              //g_object_unref(preview);
291              potracePreviewImage.set(scaledPreview);
292              }
293          }
295     //##### Convert
296     if (do_i_trace)
297         {
298         if (potraceCancelButton)
299             potraceCancelButton->set_sensitive(true);
300         if (potraceOkButton)
301             potraceOkButton->set_sensitive(false);
302         tracer.trace(&pte);
303         if (potraceCancelButton)
304             potraceCancelButton->set_sensitive(false);
305         if (potraceOkButton)
306             potraceOkButton->set_sensitive(true);
307         }
312 /**
313  * Abort processing
314  */
315 void TraceDialogImpl::abort()
317     //### Do some GUI thing
319     //### Make the abort() call to the tracer
320     tracer.abort();
326 //#########################################################################
327 //## E V E N T S
328 //#########################################################################
330 /**
331  * Callback from the Preview button.  Can be called from elsewhere.
332  */
333 void TraceDialogImpl::potracePreviewCallback()
335     potraceProcess(false);
338 /**
339  * Default response from the dialog.  Let's intercept it
340  */
341 void TraceDialogImpl::responseCallback(int response_id)
344     if (response_id == GTK_RESPONSE_OK)
345         {
346                 // for now, we assume potrace, as it's the only one we have
347             potraceProcess(true);
348         }
349     else if (response_id == GTK_RESPONSE_CANCEL)
350         {
351         abort();
352         }
353     else
354         {
355         hide();
356         return;
357         }
363 //#########################################################################
364 //## C O N S T R U C T O R    /    D E S T R U C T O R
365 //#########################################################################
366 /**
367  * Constructor
368  */
369 TraceDialogImpl::TraceDialogImpl()
372     Gtk::VBox *mainVBox = get_vbox();
374 #define MARGIN 3
376     /*#### brightness ####*/
377     potraceBrightnessRadioButton.set_label(_("Brightness cutoff"));
378     potraceGroup = potraceBrightnessRadioButton.get_group();
379     potraceBrightnessBox.pack_start(potraceBrightnessRadioButton, false, false, MARGIN);
380     tips.set_tip(potraceBrightnessRadioButton, _("Trace by a given brightness level"));
382     potraceBrightnessSpinner.set_digits(3);
383     potraceBrightnessSpinner.set_increments(0.01, 0.1);
384     potraceBrightnessSpinner.set_range(0.0, 1.0);
385     potraceBrightnessSpinner.set_value(0.45);
386     potraceBrightnessBox.pack_end(potraceBrightnessSpinner, false, false, MARGIN);
387     tips.set_tip(potraceBrightnessSpinner, _("Brightness cutoff for black/white"));
389     potraceBrightnessSpinnerLabel.set_label(_("Threshold:"));
390     potraceBrightnessBox.pack_end(potraceBrightnessSpinnerLabel, false, false, MARGIN);
392     potraceBrightnessVBox.pack_start(potraceBrightnessBox, false, false, MARGIN);
394     potraceBrightnessFrame.set_label(_("Single scan: creates a path"));
396     /*#### canny edge detection ####*/
397     // TRANSLATORS: "Canny" is the name of the inventor of this edge detection method
398     potraceCannyRadioButton.set_label(_("Edge detection"));
399     potraceCannyRadioButton.set_group(potraceGroup);
400     potraceCannyBox.pack_start(potraceCannyRadioButton, false, false, MARGIN);
401     tips.set_tip(potraceCannyRadioButton, _("Trace with optimal edge detection by J. Canny's algorithm"));
402     /*
403     potraceCannyBox.pack_start(potraceCannySeparator);
404     potraceCannyLoSpinnerLabel.set_label(_("Low"));
405     potraceCannyBox.pack_start(potraceCannyLoSpinnerLabel);
406     potraceCannyLoSpinner.set_digits(5);
407     potraceCannyLoSpinner.set_increments(0.01, 0.1);
408     potraceCannyLoSpinner.set_range(0.0, 1.0);
409     potraceCannyLoSpinner.set_value(0.1);
410     potraceCannyBox.pack_start(potraceCannyLoSpinner);
411     */
412     potraceCannyHiSpinner.set_digits(3);
413     potraceCannyHiSpinner.set_increments(0.01, 0.1);
414     potraceCannyHiSpinner.set_range(0.0, 1.0);
415     potraceCannyHiSpinner.set_value(0.65);
416     potraceCannyBox.pack_end(potraceCannyHiSpinner, false, false, MARGIN);
417     tips.set_tip(potraceCannyHiSpinner, _("Brightness cutoff for adjacent pixels (determines edge thickness)"));
419     potraceCannyHiSpinnerLabel.set_label(_("Threshold:"));
420     potraceCannyBox.pack_end(potraceCannyHiSpinnerLabel, false, false, MARGIN);
422     potraceBrightnessVBox.pack_start(potraceCannyBox, false, false, MARGIN);
424     /*#### quantization ####*/
425     // TRANSLATORS: Color Quantization: the process of reducing the number of colors
426     //  in an image by selecting an optimized set of representative colors and then
427     //  re-applying this reduced set to the original image.
428     potraceQuantRadioButton.set_label(_("Color quantization"));
429     potraceQuantRadioButton.set_group(potraceGroup);
430     potraceQuantBox.pack_start(potraceQuantRadioButton, false, false, MARGIN);
431     tips.set_tip(potraceQuantRadioButton, _("Trace along the boundaries of reduced colors"));
433     potraceQuantNrColorSpinner.set_digits(0);
434     potraceQuantNrColorSpinner.set_increments(1.0, 4.0);
435     potraceQuantNrColorSpinner.set_range(2.0, 64.0);
436     potraceQuantNrColorSpinner.set_value(8.0);
437     potraceQuantBox.pack_end(potraceQuantNrColorSpinner, false, false, MARGIN);
438     tips.set_tip(potraceQuantNrColorSpinner, _("The number of reduced colors"));
440     potraceQuantNrColorLabel.set_label(_("Colors:"));
441     potraceQuantBox.pack_end(potraceQuantNrColorLabel, false, false, MARGIN);
443     potraceBrightnessVBox.pack_start(potraceQuantBox, false, false, MARGIN);
445     /*#### swap black and white ####*/
446     potraceInvertButton.set_label(_("Invert image"));
447     potraceInvertButton.set_active(false);
448     potraceInvertBox.pack_start(potraceInvertButton, false, false, MARGIN);
449     potraceBrightnessVBox.pack_start(potraceInvertBox, false, false, MARGIN);
450     tips.set_tip(potraceInvertButton, _("Invert black and white regions"));
452     potraceBrightnessFrame.add(potraceBrightnessVBox);
453     potraceModePageBox.pack_start(potraceBrightnessFrame, false, false, 0);
456     /*#### Multiple scanning####*/
457     //----Hbox1
458     potraceMultiScanBrightnessRadioButton.set_label(_("Brightness steps"));
459     potraceMultiScanBrightnessRadioButton.set_group(potraceGroup);
460     potraceMultiScanHBox1.pack_start(potraceMultiScanBrightnessRadioButton, false, false, MARGIN);
461     tips.set_tip(potraceMultiScanBrightnessRadioButton, _("Trace the given number of brightness levels"));
463     potraceMultiScanNrColorSpinner.set_digits(0);
464     potraceMultiScanNrColorSpinner.set_increments(1.0, 4.0);
465     potraceMultiScanNrColorSpinner.set_range(2.0, 256.0);
466     potraceMultiScanNrColorSpinner.set_value(8.0);
467     potraceMultiScanHBox1.pack_end(potraceMultiScanNrColorSpinner, false, false, MARGIN);
468     potraceMultiScanNrColorLabel.set_label(_("Scans:"));
469     potraceMultiScanHBox1.pack_end(potraceMultiScanNrColorLabel, false, false, MARGIN);
470     tips.set_tip(potraceMultiScanNrColorSpinner, _("The desired number of scans"));
472     potraceMultiScanVBox.pack_start(potraceMultiScanHBox1, false, false, MARGIN);
474     //----Hbox2
475     potraceMultiScanColorRadioButton.set_label(_("Colors"));
476     potraceMultiScanColorRadioButton.set_group(potraceGroup);
477     potraceMultiScanHBox2.pack_start(potraceMultiScanColorRadioButton, false, false, MARGIN);
478     tips.set_tip(potraceMultiScanColorRadioButton, _("Trace the given number of reduced colors"));
480     potraceMultiScanVBox.pack_start(potraceMultiScanHBox2, false, false, MARGIN);
482     //---Hbox3
483     potraceMultiScanMonoRadioButton.set_label(_("Grays"));
484     potraceMultiScanMonoRadioButton.set_group(potraceGroup);
485     potraceMultiScanHBox3.pack_start(potraceMultiScanMonoRadioButton, false, false, MARGIN);
486     tips.set_tip(potraceMultiScanMonoRadioButton, _("Same as Colors, but the result is converted to grayscale"));
488     potraceMultiScanVBox.pack_start(potraceMultiScanHBox3, false, false, MARGIN);
490     // TRANSLATORS: "Smooth" is a verb here
491     potraceMultiScanSmoothButton.set_label(_("Smooth"));
492     potraceMultiScanSmoothButton.set_active(true);
493     potraceMultiScanHBox4.pack_start(potraceMultiScanSmoothButton, false, false, MARGIN);
494     tips.set_tip(potraceMultiScanSmoothButton, _("Apply Gaussian blur to the bitmap before tracing"));
496     // TRANSLATORS: "Stack" is a verb here
497     potraceMultiScanStackButton.set_label(_("Stack scans"));
498     potraceMultiScanStackButton.set_active(true);
499     potraceMultiScanHBox4.pack_start(potraceMultiScanStackButton, false, false, MARGIN);
500     tips.set_tip(potraceMultiScanStackButton, _("Stack scans on top of one another (no gaps) instead of or tiling (usually with gaps)"));
502     // TRANSLATORS: "Layer" refers to one of the stacked paths in the multiscan
503     potraceMultiScanBackgroundButton.set_label(_("Remove background"));
504     potraceMultiScanBackgroundButton.set_active(false);
505     potraceMultiScanHBox4.pack_start(potraceMultiScanBackgroundButton, false, false, MARGIN);
506     tips.set_tip(potraceMultiScanBackgroundButton, _("Remove bottom (background) layer when done"));
508     potraceMultiScanVBox.pack_start(potraceMultiScanHBox4, false, false, MARGIN);
510     potraceMultiScanFrame.set_label(_("Multiple scans: creates a group of paths"));
511     //potraceQuantFrame.set_shadow_type(Gtk::SHADOW_NONE);
512     potraceMultiScanFrame.add(potraceMultiScanVBox);
513     potraceModePageBox.pack_start(potraceMultiScanFrame, false, false, 0);
515     notebook.append_page(potraceModePageBox, _("Mode"));
519     /*#### params ####*/
520     potraceParamsSpecklesButton.set_label(_("Suppress speckles"));
521     tips.set_tip(potraceParamsSpecklesButton,
522                  _("Ignore small spots (speckles) in the bitmap"));
523     potraceParamsSpecklesButton.set_active(true);
524     //tips.set_tip(potraceParamsSpecklesButton, _(""));
525     potraceParamsSpecklesBox.pack_start(potraceParamsSpecklesButton, false, false, MARGIN);
526     potraceParamsSpecklesSizeSpinner.set_digits(0);
527     potraceParamsSpecklesSizeSpinner.set_increments(1, 10);
528     potraceParamsSpecklesSizeSpinner.set_range(0, 1000);
529     potraceParamsSpecklesSizeSpinner.set_value(2);
530     tips.set_tip(potraceParamsSpecklesSizeSpinner,
531                  _("Speckles of up to this many pixels will be suppressed"));
532     potraceParamsSpecklesBox.pack_end(potraceParamsSpecklesSizeSpinner, false, false, MARGIN);
533     potraceParamsSpecklesSizeLabel.set_label(_("Size:"));
534     potraceParamsSpecklesBox.pack_end(potraceParamsSpecklesSizeLabel, false, false, MARGIN);
536     potraceParamsCornersButton.set_label(_("Smooth corners"));
537     tips.set_tip(potraceParamsCornersButton,
538                  _("Smooth out sharp corners of the trace"));
539     potraceParamsCornersButton.set_active(true);
540     //tips.set_tip(potraceParamsCornersButton, _(""));
541     potraceParamsCornersBox.pack_start(potraceParamsCornersButton, false, false, MARGIN);
542     potraceParamsCornersThresholdSpinner.set_digits(2);
543     potraceParamsCornersThresholdSpinner.set_increments(0.01, 0.1);
544     potraceParamsCornersThresholdSpinner.set_range(0.0, 1.34);
545     potraceParamsCornersThresholdSpinner.set_value(1.0);
546     potraceParamsCornersBox.pack_end(potraceParamsCornersThresholdSpinner, false, false, MARGIN);
547     tips.set_tip(potraceParamsCornersThresholdSpinner,
548                  _("Increase this to smooth corners more"));
549     potraceParamsCornersThresholdLabel.set_label(_("Threshold:"));
550     potraceParamsCornersBox.pack_end(potraceParamsCornersThresholdLabel, false, false, MARGIN);
552     potraceParamsOptimButton.set_label(_("Optimize paths"));
553     potraceParamsOptimButton.set_active(true);
554     tips.set_tip(potraceParamsOptimButton,
555                  _("Try to optimize paths by joining adjacent Bezier curve segments"));
556     potraceParamsOptimBox.pack_start(potraceParamsOptimButton, false, false, MARGIN);
557     potraceParamsOptimToleranceSpinner.set_digits(2);
558     potraceParamsOptimToleranceSpinner.set_increments(0.05, 0.25);
559     potraceParamsOptimToleranceSpinner.set_range(0.0, 5.0);
560     potraceParamsOptimToleranceSpinner.set_value(0.2);
561     potraceParamsOptimBox.pack_end(potraceParamsOptimToleranceSpinner, false, false, MARGIN);
562     tips.set_tip(potraceParamsOptimToleranceSpinner,
563                  _("Increase this to reduce the number of nodes in the trace by more aggressive optimization"));
564     potraceParamsOptimToleranceLabel.set_label(_("Tolerance:"));
565     potraceParamsOptimBox.pack_end(potraceParamsOptimToleranceLabel, false, false, MARGIN);
567     potraceParamsVBox.pack_start(potraceParamsSpecklesBox, false, false, MARGIN);
568     potraceParamsVBox.pack_start(potraceParamsCornersBox, false, false, MARGIN);
569     potraceParamsVBox.pack_start(potraceParamsOptimBox, false, false, MARGIN);
570     potraceParamsFrame.set_label(_("Parameters"));
571     potraceParamsFrame.add(potraceParamsVBox);
572     potraceParamsPageBox.pack_start(potraceParamsFrame, false, false, 0);
574     /*#### SIOX ####*/
575     //# for now, put at the top of the potrace box.  something better later
576     sioxButton.set_label(_("SIOX foreground selection"));
577     sioxBox.pack_start(sioxButton, false, false, MARGIN);
578     tips.set_tip(sioxButton, 
579         _("Cover the area you want to select as the foreground"));
580     sioxVBox.pack_start(sioxBox, false, false, MARGIN);
581     sioxFrame.set_label(_("SIOX"));
582     sioxFrame.add(sioxVBox);
583     potraceParamsPageBox.pack_start(sioxFrame, false, false, 0);
585     notebook.append_page(potraceParamsPageBox, _("Parameters"));
588     /*#### Preview ####*/
589     potracePreviewButton.set_label(_("Update"));
590     potracePreviewButton.signal_clicked().connect(
591          sigc::mem_fun(*this, &TraceDialogImpl::potracePreviewCallback) );
592     potracePreviewBox.pack_end(potracePreviewButton, true, true, 0);
593     tips.set_tip(potracePreviewButton, _("Preview the intermediate bitmap with the current settings, without actual tracing"));
595     potracePreviewImage.set_size_request(200,200);
596     //potracePreviewImage.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
597     potracePreviewBox.pack_start(potracePreviewImage, true, true, 0);
598     potracePreviewFrame.set_label(_("Preview")); // I guess it's correct to call the "intermediate bitmap" a preview of the trace
599     //potracePreviewFrame.set_shadow_type(Gtk::SHADOW_NONE);
600     potracePreviewFrame.add(potracePreviewBox);
601     potracePreviewPageBox.pack_start(potracePreviewFrame, true, true, 0);
603     /*#### Credits ####*/
604     potraceCreditsLabel.set_text(
605                                                          _("Thanks to Peter Selinger, http://potrace.sourceforge.net")
606                          );
607     potraceCreditsVBox.pack_start(potraceCreditsLabel, false, false, MARGIN);
608     potraceCreditsFrame.set_label(_("Credits"));
609     potraceCreditsFrame.set_shadow_type(Gtk::SHADOW_NONE);
610     potraceCreditsFrame.add(potraceCreditsVBox);
611     potracePreviewPageBox.pack_start(potraceCreditsFrame, false, false, 0);
613     notebook.append_page(potracePreviewPageBox, _("Preview"));
617     //##Put the notebook on the dialog
618     mainVBox->pack_start(notebook);
620     //## The OK button
621     potraceCancelButton = add_button(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
622     if (potraceCancelButton)
623         {
624         tips.set_tip((*potraceCancelButton), _("Abort a trace in progress"));
625         potraceCancelButton->set_sensitive(false);
626         }
627     potraceOkButton     = add_button(Gtk::Stock::OK,   GTK_RESPONSE_OK);
628     tips.set_tip((*potraceOkButton), _("Execute the trace"));
630     show_all_children();
632     //## Connect the signal
633     signal_response().connect(
634          sigc::mem_fun(*this, &TraceDialogImpl::responseCallback) );
637 /**
638  * Factory method.  Use this to create a new TraceDialog
639  */
640 TraceDialog *TraceDialog::create()
642     TraceDialog *dialog = new TraceDialogImpl();
643     return dialog;
647 /**
648  * Constructor
649  */
650 TraceDialogImpl::~TraceDialogImpl()
656 } //namespace Dialog
657 } //namespace UI
658 } //namespace Inkscape
660 //#########################################################################
661 //## E N D    O F    F I L E
662 //#########################################################################