Code

645ce885f24c1a9e45538aced354dacfd8da4327
[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 items
95     Gtk::VBox             potraceBox;
96     Gtk::RadioButtonGroup potraceGroup;
97     Gtk::CheckButton      potraceInvertButton;
98     Gtk::HBox             potraceInvertBox;
99     Gtk::Button           *potraceOkButton;
100     Gtk::Button           *potraceCancelButton;
102     //params
103     Gtk::Frame            potraceParamsFrame;
104     Gtk::VBox             potraceParamsVBox;
105     Gtk::HBox             potraceParamsSpecklesBox;
106     Gtk::CheckButton      potraceParamsSpecklesButton;
107     Gtk::Label            potraceParamsSpecklesSizeLabel;
108     Gtk::SpinButton       potraceParamsSpecklesSizeSpinner;
109     Gtk::HBox             potraceParamsCornersBox;
110     Gtk::CheckButton      potraceParamsCornersButton;
111     Gtk::Label            potraceParamsCornersThresholdLabel;
112     Gtk::SpinButton       potraceParamsCornersThresholdSpinner;
113     Gtk::HBox             potraceParamsOptimBox;
114     Gtk::CheckButton      potraceParamsOptimButton;
115     Gtk::Label            potraceParamsOptimToleranceLabel;
116     Gtk::SpinButton       potraceParamsOptimToleranceSpinner;
118     //brightness
119     Gtk::Frame            potraceBrightnessFrame;
120     Gtk::VBox             potraceBrightnessVBox;
121     Gtk::HBox             potraceBrightnessBox;
122     Gtk::RadioButton      potraceBrightnessRadioButton;
123     Gtk::Label            potraceBrightnessSpinnerLabel;
124     Gtk::SpinButton       potraceBrightnessSpinner;
127     //edge detection
128     Gtk::Frame            potraceCannyFrame;
129     Gtk::HBox             potraceCannyBox;
130     Gtk::VBox             potraceCannyVBox;
131     Gtk::RadioButton      potraceCannyRadioButton;
132     //Gtk::HSeparator     potraceCannySeparator;
133     //Gtk::Label          potraceCannyLoSpinnerLabel;
134     //Gtk::SpinButton     potraceCannyLoSpinner;
135     Gtk::Label            potraceCannyHiSpinnerLabel;
136     Gtk::SpinButton       potraceCannyHiSpinner;
138     //quantization
139     Gtk::Frame            potraceQuantFrame;
140     Gtk::HBox             potraceQuantBox;
141     Gtk::VBox             potraceQuantVBox;
142     Gtk::RadioButton      potraceQuantRadioButton;
143     Gtk::Label            potraceQuantNrColorLabel;
144     Gtk::SpinButton       potraceQuantNrColorSpinner;
146     //multiple path scanning
147     Gtk::Frame            potraceMultiScanFrame;
148     Gtk::VBox             potraceMultiScanVBox;
150     Gtk::HBox             potraceMultiScanHBox1;
151     Gtk::RadioButton      potraceMultiScanBrightnessRadioButton;
152     Gtk::SpinButton       potraceMultiScanNrColorSpinner;
154     Gtk::HBox             potraceMultiScanHBox2;
155     Gtk::RadioButton      potraceMultiScanColorRadioButton;
157     Gtk::HBox             potraceMultiScanHBox3;
158     Gtk::RadioButton      potraceMultiScanMonoRadioButton;
159     Gtk::Label            potraceMultiScanNrColorLabel;
161     Gtk::CheckButton      potraceMultiScanStackButton;
162     Gtk::CheckButton      potraceMultiScanSmoothButton;
163     Gtk::CheckButton      potraceMultiScanBackgroundButton;
166     //preview
167     Gtk::Frame            potracePreviewFrame;
168     Gtk::HBox             potracePreviewBox;
169     Gtk::Button           potracePreviewButton;
170     Gtk::Image            potracePreviewImage;
172     //credits
173     Gtk::Frame            potraceCreditsFrame;
174     Gtk::VBox             potraceCreditsVBox;
175     Gtk::Label            potraceCreditsLabel;
177     //########## Other items
178     Gtk::VBox             otherBox;
182 };
187 //#########################################################################
188 //## E V E N T S
189 //#########################################################################
191 /**
192  * This does potrace processing
193  * Only preview if do_i_trace is false
194  */
195 void TraceDialogImpl::potraceProcess(bool do_i_trace)
197     //##### Get the tracer and engine
198     Inkscape::Trace::Potrace::PotraceTracingEngine pte;
200     /* inversion */
201     bool invert = potraceInvertButton.get_active();
202     pte.setInvert(invert);
204     //##### Get the preprocessor settings
205     /* siox -- performed by Tracer, and before any of the others */
206     if (sioxButton.get_active())
207         tracer.enableSiox(true);
208     else
209         tracer.enableSiox(false);
211     /* one of the following */
212     if (potraceBrightnessRadioButton.get_active())
213         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
214     else if (potraceMultiScanBrightnessRadioButton.get_active())
215         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS_MULTI);
216     else if (potraceCannyRadioButton.get_active())
217         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_CANNY);
218     else if (potraceQuantRadioButton.get_active())
219         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT);
220     else if (potraceMultiScanColorRadioButton.get_active())
221         {
222         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_COLOR);
223         pte.setInvert(false);
224         }
225     else if (potraceMultiScanMonoRadioButton.get_active())
226         {
227         pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_MONO);
228         pte.setInvert(false);
229         }
231     /* params */
232     int paramsSpecklesSize =
233       potraceParamsSpecklesButton.get_active() ?
234       potraceParamsSpecklesSizeSpinner.get_value_as_int() :
235       0;
236     pte.setParamsTurdSize(paramsSpecklesSize);
237     double paramsCornersThreshold =
238       potraceParamsCornersButton.get_active() ?
239       potraceParamsCornersThresholdSpinner.get_value() :
240       0.;
241     pte.setParamsAlphaMax(paramsCornersThreshold);
242     bool paramsOptim = potraceParamsOptimButton.get_active();
243     pte.setParamsOptiCurve(paramsOptim);
244     double paramsOptimTolerance = potraceParamsOptimToleranceSpinner.get_value();
245     pte.setParamsOptTolerance(paramsOptimTolerance);
247     //##### Get the single-scan settings
249     /* brightness */
250     double brightnessThreshold = potraceBrightnessSpinner.get_value();
251     pte.setBrightnessThreshold(brightnessThreshold);
253     /* canny */
254     double cannyHighThreshold = potraceCannyHiSpinner.get_value();
255     pte.setCannyHighThreshold(cannyHighThreshold);
257     /* quantization */
258     int quantNrColors = potraceQuantNrColorSpinner.get_value_as_int();
259     pte.setQuantizationNrColors(quantNrColors);
261     //##### Get multiple-scan settings
262     int multiScanNrColors = potraceMultiScanNrColorSpinner.get_value_as_int();
263     pte.setMultiScanNrColors(multiScanNrColors);
264     bool do_i_stack = potraceMultiScanStackButton.get_active();
265     pte.setMultiScanStack(do_i_stack);
266     bool do_i_smooth = potraceMultiScanSmoothButton.get_active();
267     pte.setMultiScanSmooth(do_i_smooth);
268     bool do_i_remove_background = potraceMultiScanBackgroundButton.get_active();
269     pte.setMultiScanRemoveBackground(do_i_remove_background);
271     //##### Get intermediate bitmap image
272     Glib::RefPtr<Gdk::Pixbuf> pixbuf = tracer.getSelectedImage();
273     if (pixbuf)
274          {
275          Glib::RefPtr<Gdk::Pixbuf> preview = pte.preview(pixbuf);
276          if (preview)
277              {
278              int width  = preview->get_width();
279              int height = preview->get_height();
280              double scaleFactor = 100.0 / (double)height;
281              int newWidth  = (int) (((double)width)  * scaleFactor);
282              int newHeight = (int) (((double)height) * scaleFactor);
283              Glib::RefPtr<Gdk::Pixbuf> scaledPreview =
284                     preview->scale_simple(newWidth, newHeight,
285                        Gdk::INTERP_NEAREST);
286              //g_object_unref(preview);
287              potracePreviewImage.set(scaledPreview);
288              }
289          }
291     //##### Convert
292     if (do_i_trace)
293         {
294         if (potraceCancelButton)
295             potraceCancelButton->set_sensitive(true);
296         if (potraceOkButton)
297             potraceOkButton->set_sensitive(false);
298         tracer.trace(&pte);
299         if (potraceCancelButton)
300             potraceCancelButton->set_sensitive(false);
301         if (potraceOkButton)
302             potraceOkButton->set_sensitive(true);
303         }
308 /**
309  * Abort processing
310  */
311 void TraceDialogImpl::abort()
313     //### Do some GUI thing
315     //### Make the abort() call to the tracer
316     tracer.abort();
322 //#########################################################################
323 //## E V E N T S
324 //#########################################################################
326 /**
327  * Callback from the Preview button.  Can be called from elsewhere.
328  */
329 void TraceDialogImpl::potracePreviewCallback()
331     potraceProcess(false);
334 /**
335  * Default response from the dialog.  Let's intercept it
336  */
337 void TraceDialogImpl::responseCallback(int response_id)
340     if (response_id == GTK_RESPONSE_OK)
341         {
342         int panelNr = notebook.get_current_page();
343         //g_message("selected panel:%d\n", panelNr);
345         if (panelNr == 0)
346             {
347             potraceProcess(true);
348             }
349         }
350     else if (response_id == GTK_RESPONSE_CANCEL)
351         {
352         abort();
353         }
354     else
355         {
356         hide();
357         return;
358         }
367 //#########################################################################
368 //## C O N S T R U C T O R    /    D E S T R U C T O R
369 //#########################################################################
370 /**
371  * Constructor
372  */
373 TraceDialogImpl::TraceDialogImpl()
376     Gtk::VBox *mainVBox = get_vbox();
378 #define MARGIN 4
380     /*#### SIOX ####*/
381     //# for now, put at the top of the potrace box.  something better later
382     sioxButton.set_label(_("SIOX foreground selection"));
383     sioxBox.pack_start(sioxButton, false, false, MARGIN);
384     tips.set_tip(sioxButton, 
385         _("Cover the area you want to select as the foreground"));
386     sioxVBox.pack_start(sioxBox, false, false, MARGIN);
387     sioxFrame.set_label(_("SIOX"));
388     sioxFrame.add(sioxVBox);
389     potraceBox.pack_start(sioxFrame, false, false, 0);
392     //##Set up the Potrace panel
394     /*#### params ####*/
395     potraceParamsSpecklesButton.set_label(_("Speckles Filtering"));
396     potraceParamsSpecklesButton.set_active(true);
397     //tips.set_tip(potraceParamsSpecklesButton, _(""));
398     potraceParamsSpecklesBox.pack_start(potraceParamsSpecklesButton, false, false, MARGIN);
399     potraceParamsSpecklesSizeSpinner.set_digits(0);
400     potraceParamsSpecklesSizeSpinner.set_increments(1, 10);
401     potraceParamsSpecklesSizeSpinner.set_range(0, 1000);
402     potraceParamsSpecklesSizeSpinner.set_value(2);
403     tips.set_tip(potraceParamsSpecklesSizeSpinner,
404                  _("Suppress speckles of up to this many pixels"));
405     potraceParamsSpecklesBox.pack_end(potraceParamsSpecklesSizeSpinner, false, false, MARGIN);
406     potraceParamsSpecklesSizeLabel.set_label(_("Size:"));
407     potraceParamsSpecklesBox.pack_end(potraceParamsSpecklesSizeLabel, false, false, MARGIN);
409     potraceParamsCornersButton.set_label(_("Corner Smoothing"));
410     potraceParamsCornersButton.set_active(true);
411     //tips.set_tip(potraceParamsCornersButton, _(""));
412     potraceParamsCornersBox.pack_start(potraceParamsCornersButton, false, false, MARGIN);
413     potraceParamsCornersThresholdSpinner.set_digits(2);
414     potraceParamsCornersThresholdSpinner.set_increments(0.01, 0.1);
415     potraceParamsCornersThresholdSpinner.set_range(0.0, 1.34);
416     potraceParamsCornersThresholdSpinner.set_value(1.0);
417     potraceParamsCornersBox.pack_end(potraceParamsCornersThresholdSpinner, false, false, MARGIN);
418     tips.set_tip(potraceParamsCornersThresholdSpinner,
419                  _("The higher this value, the smoother corners will be produced"));
420     potraceParamsCornersThresholdLabel.set_label(_("Threshold:"));
421     potraceParamsCornersBox.pack_end(potraceParamsCornersThresholdLabel, false, false, MARGIN);
423     potraceParamsOptimButton.set_label(_("Curve Optimization"));
424     potraceParamsOptimButton.set_active(true);
425     tips.set_tip(potraceParamsOptimButton,
426                  _("Try to join adjacent Bezier curve segments"));
427     potraceParamsOptimBox.pack_start(potraceParamsOptimButton, false, false, MARGIN);
428     potraceParamsOptimToleranceSpinner.set_digits(2);
429     potraceParamsOptimToleranceSpinner.set_increments(0.05, 0.25);
430     potraceParamsOptimToleranceSpinner.set_range(0.0, 5.0);
431     potraceParamsOptimToleranceSpinner.set_value(0.2);
432     potraceParamsOptimBox.pack_end(potraceParamsOptimToleranceSpinner, false, false, MARGIN);
433     tips.set_tip(potraceParamsOptimToleranceSpinner,
434                  _("Set the curve optimization tolerance"));
435     potraceParamsOptimToleranceLabel.set_label(_("Tolerance:"));
436     potraceParamsOptimBox.pack_end(potraceParamsOptimToleranceLabel, false, false, MARGIN);
438     potraceParamsVBox.pack_start(potraceParamsSpecklesBox, false, false, MARGIN);
439     potraceParamsVBox.pack_start(potraceParamsCornersBox, false, false, MARGIN);
440     potraceParamsVBox.pack_start(potraceParamsOptimBox, false, false, MARGIN);
441     potraceParamsFrame.set_label(_("Parameters"));
442     potraceParamsFrame.add(potraceParamsVBox);
443     potraceBox.pack_start(potraceParamsFrame, false, false, 0);
445     /*#### brightness ####*/
446     potraceBrightnessRadioButton.set_label(_("Brightness"));
447     potraceGroup = potraceBrightnessRadioButton.get_group();
448     potraceBrightnessBox.pack_start(potraceBrightnessRadioButton, false, false, MARGIN);
449     tips.set_tip(potraceBrightnessRadioButton, _("Trace by a given brightness level"));
451     potraceBrightnessSpinner.set_digits(3);
452     potraceBrightnessSpinner.set_increments(0.01, 0.1);
453     potraceBrightnessSpinner.set_range(0.0, 1.0);
454     potraceBrightnessSpinner.set_value(0.45);
455     potraceBrightnessBox.pack_end(potraceBrightnessSpinner, false, false, MARGIN);
456     tips.set_tip(potraceBrightnessSpinner, _("Brightness cutoff for black/white"));
458     potraceBrightnessSpinnerLabel.set_label(_("Threshold:"));
459     potraceBrightnessBox.pack_end(potraceBrightnessSpinnerLabel, false, false, MARGIN);
461     potraceBrightnessVBox.pack_start(potraceBrightnessBox, false, false, MARGIN);
463     potraceBrightnessFrame.set_label(_("Image Brightness"));
464     //potraceBrightnessFrame.set_shadow_type(Gtk::SHADOW_NONE);
465     potraceBrightnessFrame.add(potraceBrightnessVBox);
466     potraceBox.pack_start(potraceBrightnessFrame, false, false, 0);
468     /*#### canny edge detection ####*/
469     // TRANSLATORS: "Canny" is the name of the inventor of this edge detection method
470     potraceCannyRadioButton.set_label(_("Optimal Edge Detection (Canny)"));
471     potraceCannyRadioButton.set_group(potraceGroup);
472     potraceCannyBox.pack_start(potraceCannyRadioButton, false, false, MARGIN);
473     tips.set_tip(potraceCannyRadioButton, _("Trace with edge detection by J. Canny's algorithm"));
474     /*
475     potraceCannyBox.pack_start(potraceCannySeparator);
476     potraceCannyLoSpinnerLabel.set_label(_("Low"));
477     potraceCannyBox.pack_start(potraceCannyLoSpinnerLabel);
478     potraceCannyLoSpinner.set_digits(5);
479     potraceCannyLoSpinner.set_increments(0.01, 0.1);
480     potraceCannyLoSpinner.set_range(0.0, 1.0);
481     potraceCannyLoSpinner.set_value(0.1);
482     potraceCannyBox.pack_start(potraceCannyLoSpinner);
483     */
484     potraceCannyHiSpinner.set_digits(3);
485     potraceCannyHiSpinner.set_increments(0.01, 0.1);
486     potraceCannyHiSpinner.set_range(0.0, 1.0);
487     potraceCannyHiSpinner.set_value(0.65);
488     potraceCannyBox.pack_end(potraceCannyHiSpinner, false, false, MARGIN);
489     tips.set_tip(potraceCannyHiSpinner, _("Brightness cutoff for adjacent pixels (determines edge thickness)"));
491     potraceCannyHiSpinnerLabel.set_label(_("Threshold:"));
492     potraceCannyBox.pack_end(potraceCannyHiSpinnerLabel, false, false, MARGIN);
494     potraceCannyVBox.pack_start(potraceCannyBox, false, false, MARGIN);
496     potraceCannyFrame.set_label(_("Edge Detection"));
497     //potraceCannyFrame.set_shadow_type(Gtk::SHADOW_NONE);
498     potraceCannyFrame.add(potraceCannyVBox);
499     potraceBox.pack_start(potraceCannyFrame, false, false, 0);
501     /*#### quantization ####*/
502     // TRANSLATORS: Color Quantization: the process of reducing the number of colors
503     //  in an image by selecting an optimized set of representative colors and then
504     //  re-applying this reduced set to the original image.
505     potraceQuantRadioButton.set_label(_("Color Quantization"));
506     potraceQuantRadioButton.set_group(potraceGroup);
507     potraceQuantBox.pack_start(potraceQuantRadioButton, false, false, MARGIN);
508     tips.set_tip(potraceQuantRadioButton, _("Trace along the boundaries of reduced colors"));
510     potraceQuantNrColorSpinner.set_digits(2);
511     potraceQuantNrColorSpinner.set_increments(1.0, 4.0);
512     potraceQuantNrColorSpinner.set_range(2.0, 64.0);
513     potraceQuantNrColorSpinner.set_value(8.0);
514     potraceQuantBox.pack_end(potraceQuantNrColorSpinner, false, false, MARGIN);
515     tips.set_tip(potraceQuantNrColorSpinner, _("The number of reduced colors"));
517     potraceQuantNrColorLabel.set_label(_("Colors:"));
518     potraceQuantBox.pack_end(potraceQuantNrColorLabel, false, false, MARGIN);
520     potraceQuantVBox.pack_start(potraceQuantBox, false, false, MARGIN);
522     potraceQuantFrame.set_label(_("Quantization / Reduction"));
523     //potraceQuantFrame.set_shadow_type(Gtk::SHADOW_NONE);
524     potraceQuantFrame.add(potraceQuantVBox);
525     potraceBox.pack_start(potraceQuantFrame, false, false, 0);
527     /*#### Multiple scanning####*/
528     //----Hbox1
529     potraceMultiScanBrightnessRadioButton.set_label(_("Brightness"));
530     potraceMultiScanBrightnessRadioButton.set_group(potraceGroup);
531     potraceMultiScanHBox1.pack_start(potraceMultiScanBrightnessRadioButton, false, false, MARGIN);
532     tips.set_tip(potraceMultiScanBrightnessRadioButton, _("Trace the given number of brightness levels"));
534     potraceMultiScanNrColorSpinner.set_digits(0);
535     potraceMultiScanNrColorSpinner.set_increments(1.0, 4.0);
536     potraceMultiScanNrColorSpinner.set_range(2.0, 256.0);
537     potraceMultiScanNrColorSpinner.set_value(8.0);
538     potraceMultiScanHBox1.pack_end(potraceMultiScanNrColorSpinner, false, false, MARGIN);
539     potraceMultiScanNrColorLabel.set_label(_("Scans:"));
540     potraceMultiScanHBox1.pack_end(potraceMultiScanNrColorLabel, false, false, MARGIN);
541     tips.set_tip(potraceMultiScanNrColorSpinner, _("The desired number of scans"));
543     potraceMultiScanVBox.pack_start(potraceMultiScanHBox1, false, false, MARGIN);
545     //----Hbox2
546     potraceMultiScanColorRadioButton.set_label(_("Color"));
547     potraceMultiScanColorRadioButton.set_group(potraceGroup);
548     potraceMultiScanHBox2.pack_start(potraceMultiScanColorRadioButton, false, false, MARGIN);
549     tips.set_tip(potraceMultiScanColorRadioButton, _("Trace the given number of reduced colors"));
552     // TRANSLATORS: "Layer" refers to one of the stacked paths in the multiscan
553     potraceMultiScanBackgroundButton.set_label(_("Remove background"));
554     potraceMultiScanBackgroundButton.set_active(false);
555     potraceMultiScanHBox2.pack_end(potraceMultiScanBackgroundButton, false, false, MARGIN);
556     tips.set_tip(potraceMultiScanBackgroundButton, _("Remove bottom (background) layer when done"));
558     potraceMultiScanVBox.pack_start(potraceMultiScanHBox2, false, false, MARGIN);
560     //---Hbox3
561     potraceMultiScanMonoRadioButton.set_label(_("Monochrome"));
562     potraceMultiScanMonoRadioButton.set_group(potraceGroup);
563     potraceMultiScanHBox3.pack_start(potraceMultiScanMonoRadioButton, false, false, MARGIN);
564     tips.set_tip(potraceMultiScanMonoRadioButton, _("Same as Color, but convert result to grayscale"));
566     // TRANSLATORS: "Stack" is a verb here
567     potraceMultiScanStackButton.set_label(_("Stack"));
568     potraceMultiScanStackButton.set_active(true);
569     potraceMultiScanHBox3.pack_end(potraceMultiScanStackButton, false, false, MARGIN);
570     tips.set_tip(potraceMultiScanStackButton, _("Stack scans vertically (no gaps) or tile horizontally (usually with gaps)"));
572     // TRANSLATORS: "Smooth" is a verb here
573     potraceMultiScanSmoothButton.set_label(_("Smooth"));
574     potraceMultiScanSmoothButton.set_active(true);
575     potraceMultiScanHBox3.pack_end(potraceMultiScanSmoothButton, false, false, MARGIN);
576     tips.set_tip(potraceMultiScanSmoothButton, _("Apply Gaussian blur to the bitmap before tracing"));
579     potraceMultiScanVBox.pack_start(potraceMultiScanHBox3, false, false, MARGIN);
581     potraceMultiScanFrame.set_label(_("Multiple Scanning"));
582     //potraceQuantFrame.set_shadow_type(Gtk::SHADOW_NONE);
583     potraceMultiScanFrame.add(potraceMultiScanVBox);
584     potraceBox.pack_start(potraceMultiScanFrame, false, false, 0);
586     /*#### Preview ####*/
587     potracePreviewButton.set_label(_("Preview"));
588     potracePreviewButton.signal_clicked().connect(
589          sigc::mem_fun(*this, &TraceDialogImpl::potracePreviewCallback) );
590     potracePreviewBox.pack_end(potracePreviewButton, false, false, 0);//do not expand
591     tips.set_tip(potracePreviewButton, _("Preview the result without actual tracing"));
594     potracePreviewImage.set_size_request(100,100);
595     //potracePreviewImage.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
596     potracePreviewBox.pack_start(potracePreviewImage, true, true, 0);
597     potracePreviewFrame.set_label(_("Preview")); // I guess it's correct to call the "intermediate bitmap" a preview of the trace
598     //potracePreviewFrame.set_shadow_type(Gtk::SHADOW_NONE);
599     potracePreviewFrame.add(potracePreviewBox);
600     potraceBox.pack_start(potracePreviewFrame, true, true, 0);
602     /*#### swap black and white ####*/
603     potraceInvertButton.set_label(_("Invert"));
604     potraceInvertButton.set_active(false);
605     potraceInvertBox.pack_end(potraceInvertButton, false, false, MARGIN);
606     potraceBox.pack_start(potraceInvertBox, false, false, MARGIN);
607     tips.set_tip(potraceInvertButton, _("Invert black and white regions for single traces"));
609     /*#### Credits ####*/
610     potraceCreditsLabel.set_text(
611                                                          _("Thanks to Peter Selinger, http://potrace.sourceforge.net")
612                          );
613     potraceCreditsVBox.pack_start(potraceCreditsLabel, false, false, MARGIN);
614     potraceCreditsFrame.set_label(_("Credits"));
615     potraceCreditsFrame.set_shadow_type(Gtk::SHADOW_NONE);
616     potraceCreditsFrame.add(potraceCreditsVBox);
617     potraceBox.pack_start(potraceCreditsFrame, false, false, 0);
619     /*done */
620     // TRANSLATORS: Potrace is an application for transforming bitmaps into
621     //  vector graphics (http://potrace.sourceforge.net/)
622     notebook.append_page(potraceBox, _("Potrace"));
624     //##Set up the Other panel
625     // This may be reenabled when we have another tracer; now an empty tab is confusing so I'm disabling it
626     //    notebook.append_page(otherBox, _("Other"));
628     //##Put the notebook on the dialog
629     mainVBox->pack_start(notebook);
631     //## The OK button
632     potraceCancelButton = add_button(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
633     if (potraceCancelButton)
634         {
635         tips.set_tip((*potraceCancelButton), _("Abort a trace in progress"));
636         potraceCancelButton->set_sensitive(false);
637         }
638     potraceOkButton     = add_button(Gtk::Stock::OK,   GTK_RESPONSE_OK);
639     tips.set_tip((*potraceOkButton), _("Execute the trace"));
641     show_all_children();
643     //## Connect the signal
644     signal_response().connect(
645          sigc::mem_fun(*this, &TraceDialogImpl::responseCallback) );
648 /**
649  * Factory method.  Use this to create a new TraceDialog
650  */
651 TraceDialog *TraceDialog::create()
653     TraceDialog *dialog = new TraceDialogImpl();
654     return dialog;
658 /**
659  * Constructor
660  */
661 TraceDialogImpl::~TraceDialogImpl()
672 } //namespace Dialog
673 } //namespace UI
674 } //namespace Inkscape
676 //#########################################################################
677 //## E N D    O F    F I L E
678 //#########################################################################