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 previewCallback();
85 //############ General items
87 Gtk::HBox mainHBox;
88 Gtk::Tooltips tips;
90 Gtk::Button *mainOkButton;
91 Gtk::Button *mainCancelButton;
93 //######## Left pannel
95 Gtk::VBox leftVBox;
97 //#### Notebook
99 Gtk::Notebook notebook;
101 //## Modes
103 Gtk::VBox modePageBox;
104 Gtk::RadioButtonGroup modeGroup;
106 //# Single scan mode
107 //brightness
108 Gtk::Frame modeBrightnessFrame;
109 Gtk::VBox modeBrightnessVBox;
110 Gtk::HBox modeBrightnessBox;
111 Gtk::RadioButton modeBrightnessRadioButton;
112 Gtk::Label modeBrightnessSpinnerLabel;
113 Gtk::SpinButton modeBrightnessSpinner;
114 //edge detection
115 Gtk::Frame modeCannyFrame;
116 Gtk::HBox modeCannyBox;
117 Gtk::VBox modeCannyVBox;
118 Gtk::RadioButton modeCannyRadioButton;
119 //Gtk::HSeparator modeCannySeparator;
120 //Gtk::Label modeCannyLoSpinnerLabel;
121 //Gtk::SpinButton modeCannyLoSpinner;
122 Gtk::Label modeCannyHiSpinnerLabel;
123 Gtk::SpinButton modeCannyHiSpinner;
124 //quantization
125 Gtk::Frame modeQuantFrame;
126 Gtk::HBox modeQuantBox;
127 Gtk::VBox modeQuantVBox;
128 Gtk::RadioButton modeQuantRadioButton;
129 Gtk::Label modeQuantNrColorLabel;
130 Gtk::SpinButton modeQuantNrColorSpinner;
131 //params
132 Gtk::CheckButton modeInvertButton;
133 Gtk::HBox modeInvertBox;
135 //# Multiple path scanning mode
136 Gtk::Frame modeMultiScanFrame;
137 Gtk::VBox modeMultiScanVBox;
138 //brightness
139 Gtk::HBox modeMultiScanHBox1;
140 Gtk::RadioButton modeMultiScanBrightnessRadioButton;
141 Gtk::SpinButton modeMultiScanNrColorSpinner;
142 //colors
143 Gtk::HBox modeMultiScanHBox2;
144 Gtk::RadioButton modeMultiScanColorRadioButton;
145 //grays
146 Gtk::HBox modeMultiScanHBox3;
147 Gtk::RadioButton modeMultiScanMonoRadioButton;
148 Gtk::Label modeMultiScanNrColorLabel;
149 //params
150 Gtk::HBox modeMultiScanHBox4;
151 Gtk::CheckButton modeMultiScanStackButton;
152 Gtk::CheckButton modeMultiScanSmoothButton;
153 Gtk::CheckButton modeMultiScanBackgroundButton;
155 //## Options
157 Gtk::VBox optionsPageBox;
159 // potrace parameters
161 Gtk::Frame optionsFrame;
162 Gtk::VBox optionsVBox;
163 Gtk::HBox optionsSpecklesBox;
164 Gtk::CheckButton optionsSpecklesButton;
165 Gtk::Label optionsSpecklesSizeLabel;
166 Gtk::SpinButton optionsSpecklesSizeSpinner;
167 Gtk::HBox optionsCornersBox;
168 Gtk::CheckButton optionsCornersButton;
169 Gtk::Label optionsCornersThresholdLabel;
170 Gtk::SpinButton optionsCornersThresholdSpinner;
171 Gtk::HBox optionsOptimBox;
172 Gtk::CheckButton optionsOptimButton;
173 Gtk::Label optionsOptimToleranceLabel;
174 Gtk::SpinButton optionsOptimToleranceSpinner;
177 //#### Credits
179 Gtk::Frame potraceCreditsFrame;
180 Gtk::VBox potraceCreditsVBox;
181 Gtk::Label potraceCreditsLabel;
183 //######## Right pannel
185 Gtk::VBox rightVBox;
187 //#### SIOX selection
189 Gtk::HBox sioxBox;
190 Gtk::CheckButton sioxButton;
192 //#### Preview
194 Gtk::Frame previewFrame;
195 Gtk::VBox previewVBox;
196 Gtk::Button previewButton;
197 Gtk::Image previewImage;
199 };
203 //#########################################################################
204 //## E V E N T S
205 //#########################################################################
207 /**
208 * This does potrace processing
209 * Only preview if do_i_trace is false
210 */
211 void TraceDialogImpl::potraceProcess(bool do_i_trace)
212 {
213 //##### Get the tracer and engine
214 Inkscape::Trace::Potrace::PotraceTracingEngine pte;
216 /* inversion */
217 bool invert = modeInvertButton.get_active();
218 pte.setInvert(invert);
220 //##### Get the preprocessor settings
221 /* siox -- performed by Tracer, and before any of the others */
222 if (sioxButton.get_active())
223 tracer.enableSiox(true);
224 else
225 tracer.enableSiox(false);
227 /* one of the following */
228 if (modeBrightnessRadioButton.get_active())
229 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
230 else if (modeMultiScanBrightnessRadioButton.get_active())
231 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS_MULTI);
232 else if (modeCannyRadioButton.get_active())
233 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_CANNY);
234 else if (modeQuantRadioButton.get_active())
235 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT);
236 else if (modeMultiScanColorRadioButton.get_active())
237 {
238 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_COLOR);
239 pte.setInvert(false);
240 }
241 else if (modeMultiScanMonoRadioButton.get_active())
242 {
243 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_MONO);
244 pte.setInvert(false);
245 }
247 /* params */
248 int paramsSpecklesSize =
249 optionsSpecklesButton.get_active() ?
250 optionsSpecklesSizeSpinner.get_value_as_int() :
251 0;
252 pte.setParamsTurdSize(paramsSpecklesSize);
253 double paramsCornersThreshold =
254 optionsCornersButton.get_active() ?
255 optionsCornersThresholdSpinner.get_value() :
256 0.;
257 pte.setParamsAlphaMax(paramsCornersThreshold);
258 bool paramsOptim = optionsOptimButton.get_active();
259 pte.setParamsOptiCurve(paramsOptim);
260 double paramsOptimTolerance = optionsOptimToleranceSpinner.get_value();
261 pte.setParamsOptTolerance(paramsOptimTolerance);
263 //##### Get the single-scan settings
264 /* brightness */
265 double brightnessThreshold = modeBrightnessSpinner.get_value();
266 pte.setBrightnessThreshold(brightnessThreshold);
267 /* canny */
268 double cannyHighThreshold = modeCannyHiSpinner.get_value();
269 pte.setCannyHighThreshold(cannyHighThreshold);
270 /* quantization */
271 int quantNrColors = modeQuantNrColorSpinner.get_value_as_int();
272 pte.setQuantizationNrColors(quantNrColors);
274 //##### Get multiple-scan settings
275 int multiScanNrColors = modeMultiScanNrColorSpinner.get_value_as_int();
276 pte.setMultiScanNrColors(multiScanNrColors);
277 bool do_i_stack = modeMultiScanStackButton.get_active();
278 pte.setMultiScanStack(do_i_stack);
279 bool do_i_smooth = modeMultiScanSmoothButton.get_active();
280 pte.setMultiScanSmooth(do_i_smooth);
281 bool do_i_remove_background = modeMultiScanBackgroundButton.get_active();
282 pte.setMultiScanRemoveBackground(do_i_remove_background);
284 //##### Get intermediate bitmap image
285 Glib::RefPtr<Gdk::Pixbuf> pixbuf = tracer.getSelectedImage();
286 if (pixbuf)
287 {
288 Glib::RefPtr<Gdk::Pixbuf> preview = pte.preview(pixbuf);
289 if (preview)
290 {
291 int width = preview->get_width();
292 int height = preview->get_height();
293 double scaleFX = 200.0 / (double)width;
294 double scaleFY = 200.0 / (double)height;
295 double scaleFactor = scaleFX > scaleFY ? scaleFY : scaleFX;
296 int newWidth = (int) (((double)width) * scaleFactor);
297 int newHeight = (int) (((double)height) * scaleFactor);
298 Glib::RefPtr<Gdk::Pixbuf> scaledPreview =
299 preview->scale_simple(newWidth, newHeight,
300 Gdk::INTERP_NEAREST);
301 //g_object_unref(preview);
302 previewImage.set(scaledPreview);
303 }
304 }
306 //##### Convert
307 if (do_i_trace)
308 {
309 if (mainCancelButton)
310 mainCancelButton->set_sensitive(true);
311 if (mainOkButton)
312 mainOkButton->set_sensitive(false);
313 tracer.trace(&pte);
314 if (mainCancelButton)
315 mainCancelButton->set_sensitive(false);
316 if (mainOkButton)
317 mainOkButton->set_sensitive(true);
318 }
320 }
323 /**
324 * Abort processing
325 */
326 void TraceDialogImpl::abort()
327 {
328 //### Do some GUI thing
330 //### Make the abort() call to the tracer
331 tracer.abort();
333 }
337 //#########################################################################
338 //## E V E N T S
339 //#########################################################################
341 /**
342 * Callback from the Preview button. Can be called from elsewhere.
343 */
344 void TraceDialogImpl::previewCallback()
345 {
346 potraceProcess(false);
347 }
349 /**
350 * Default response from the dialog. Let's intercept it
351 */
352 void TraceDialogImpl::responseCallback(int response_id)
353 {
354 if (response_id == GTK_RESPONSE_OK)
355 {
356 // for now, we assume potrace, as it's the only one we have
357 potraceProcess(true);
358 }
359 else if (response_id == GTK_RESPONSE_CANCEL)
360 {
361 abort();
362 }
363 else
364 {
365 hide();
366 return;
367 }
369 }
373 //#########################################################################
374 //## C O N S T R U C T O R / D E S T R U C T O R
375 //#########################################################################
376 /**
377 * Constructor
378 */
379 TraceDialogImpl::TraceDialogImpl()
380 {
382 Gtk::VBox *mainVBox = get_vbox();
384 #define MARGIN 2
385 //#### begin left panel
387 //### begin notebook
389 //## begin mode page
391 //# begin single scan
393 // brightness
395 modeBrightnessRadioButton.set_label(_("Brightness cutoff"));
396 modeGroup = modeBrightnessRadioButton.get_group();
397 modeBrightnessBox.pack_start(modeBrightnessRadioButton, false, false, MARGIN);
398 tips.set_tip(modeBrightnessRadioButton,
399 _("Trace by a given brightness level"));
401 modeBrightnessSpinner.set_digits(3);
402 modeBrightnessSpinner.set_increments(0.01, 0.1);
403 modeBrightnessSpinner.set_range(0.0, 1.0);
404 modeBrightnessSpinner.set_value(0.45);
405 modeBrightnessBox.pack_end(modeBrightnessSpinner, false, false, MARGIN);
406 tips.set_tip(modeBrightnessSpinner,
407 _("Brightness cutoff for black/white"));
409 modeBrightnessSpinnerLabel.set_label(_("Threshold:"));
410 modeBrightnessBox.pack_end(modeBrightnessSpinnerLabel, false, false, MARGIN);
412 modeBrightnessVBox.pack_start(modeBrightnessBox, false, false, MARGIN);
414 modeBrightnessFrame.set_label(_("Single scan: creates a path"));
416 // canny edge detection
417 // TRANSLATORS: "Canny" is the name of the inventor of this edge detection method
419 modeCannyRadioButton.set_label(_("Edge detection"));
420 modeCannyRadioButton.set_group(modeGroup);
421 modeCannyBox.pack_start(modeCannyRadioButton, false, false, MARGIN);
422 tips.set_tip(modeCannyRadioButton,
423 _("Trace with optimal edge detection by J. Canny's algorithm"));
424 /*
425 modeCannyBox.pack_start(modeCannySeparator);
426 modeCannyLoSpinnerLabel.set_label(_("Low"));
427 modeCannyBox.pack_start(modeCannyLoSpinnerLabel);
428 modeCannyLoSpinner.set_digits(5);
429 modeCannyLoSpinner.set_increments(0.01, 0.1);
430 modeCannyLoSpinner.set_range(0.0, 1.0);
431 modeCannyLoSpinner.set_value(0.1);
432 modeCannyBox.pack_start(modeCannyLoSpinner);
433 */
434 modeCannyHiSpinner.set_digits(3);
435 modeCannyHiSpinner.set_increments(0.01, 0.1);
436 modeCannyHiSpinner.set_range(0.0, 1.0);
437 modeCannyHiSpinner.set_value(0.65);
438 modeCannyBox.pack_end(modeCannyHiSpinner, false, false, MARGIN);
439 tips.set_tip(modeCannyHiSpinner,
440 _("Brightness cutoff for adjacent pixels (determines edge thickness)"));
442 modeCannyHiSpinnerLabel.set_label(_("Threshold:"));
443 modeCannyBox.pack_end(modeCannyHiSpinnerLabel, false, false, MARGIN);
445 modeBrightnessVBox.pack_start(modeCannyBox, false, false, MARGIN);
447 // quantization
448 // TRANSLATORS: Color Quantization: the process of reducing the number
449 // of colors in an image by selecting an optimized set of representative
450 // colors and then re-applying this reduced set to the original image.
452 modeQuantRadioButton.set_label(_("Color quantization"));
453 modeQuantRadioButton.set_group(modeGroup);
454 modeQuantBox.pack_start(modeQuantRadioButton, false, false, MARGIN);
455 tips.set_tip(modeQuantRadioButton,
456 _("Trace along the boundaries of reduced colors"));
458 modeQuantNrColorSpinner.set_digits(0);
459 modeQuantNrColorSpinner.set_increments(1.0, 4.0);
460 modeQuantNrColorSpinner.set_range(2.0, 64.0);
461 modeQuantNrColorSpinner.set_value(8.0);
462 modeQuantBox.pack_end(modeQuantNrColorSpinner, false, false, MARGIN);
463 tips.set_tip(modeQuantNrColorSpinner,
464 _("The number of reduced colors"));
466 modeQuantNrColorLabel.set_label(_("Colors:"));
467 modeQuantBox.pack_end(modeQuantNrColorLabel, false, false, MARGIN);
469 modeBrightnessVBox.pack_start(modeQuantBox, false, false, MARGIN);
471 // swap black and white
472 modeInvertButton.set_label(_("Invert image"));
473 modeInvertButton.set_active(false);
474 modeInvertBox.pack_start(modeInvertButton, false, false, MARGIN);
475 modeBrightnessVBox.pack_start(modeInvertBox, false, false, MARGIN);
476 tips.set_tip(modeInvertButton,
477 _("Invert black and white regions"));
479 modeBrightnessFrame.add(modeBrightnessVBox);
480 modePageBox.pack_start(modeBrightnessFrame, false, false, 0);
482 //# end single scan
484 //# begin multiple scan
486 modeMultiScanBrightnessRadioButton.set_label(_("Brightness steps"));
487 modeMultiScanBrightnessRadioButton.set_group(modeGroup);
488 modeMultiScanHBox1.pack_start(modeMultiScanBrightnessRadioButton, false, false, MARGIN);
489 tips.set_tip(modeMultiScanBrightnessRadioButton,
490 _("Trace the given number of brightness levels"));
492 modeMultiScanNrColorSpinner.set_digits(0);
493 modeMultiScanNrColorSpinner.set_increments(1.0, 4.0);
494 modeMultiScanNrColorSpinner.set_range(2.0, 256.0);
495 modeMultiScanNrColorSpinner.set_value(8.0);
496 modeMultiScanHBox1.pack_end(modeMultiScanNrColorSpinner, false, false, MARGIN);
497 modeMultiScanNrColorLabel.set_label(_("Scans:"));
498 modeMultiScanHBox1.pack_end(modeMultiScanNrColorLabel, false, false, MARGIN);
499 tips.set_tip(modeMultiScanNrColorSpinner,
500 _("The desired number of scans"));
502 modeMultiScanVBox.pack_start(modeMultiScanHBox1, false, false, MARGIN);
504 modeMultiScanColorRadioButton.set_label(_("Colors"));
505 modeMultiScanColorRadioButton.set_group(modeGroup);
506 modeMultiScanHBox2.pack_start(modeMultiScanColorRadioButton, false, false, MARGIN);
507 tips.set_tip(modeMultiScanColorRadioButton,
508 _("Trace the given number of reduced colors"));
510 modeMultiScanVBox.pack_start(modeMultiScanHBox2, false, false, MARGIN);
512 modeMultiScanMonoRadioButton.set_label(_("Grays"));
513 modeMultiScanMonoRadioButton.set_group(modeGroup);
514 modeMultiScanHBox3.pack_start(modeMultiScanMonoRadioButton, false, false, MARGIN);
515 tips.set_tip(modeMultiScanMonoRadioButton,
516 _("Same as Colors, but the result is converted to grayscale"));
518 modeMultiScanVBox.pack_start(modeMultiScanHBox3, false, false, MARGIN);
520 // TRANSLATORS: "Smooth" is a verb here
521 modeMultiScanSmoothButton.set_label(_("Smooth"));
522 modeMultiScanSmoothButton.set_active(true);
523 modeMultiScanHBox4.pack_start(modeMultiScanSmoothButton, false, false, MARGIN);
524 tips.set_tip(modeMultiScanSmoothButton,
525 _("Apply Gaussian blur to the bitmap before tracing"));
527 // TRANSLATORS: "Stack" is a verb here
528 modeMultiScanStackButton.set_label(_("Stack scans"));
529 modeMultiScanStackButton.set_active(true);
530 modeMultiScanHBox4.pack_start(modeMultiScanStackButton, false, false, MARGIN);
531 tips.set_tip(modeMultiScanStackButton, _("Stack scans on top of one another (no gaps) instead of tiling (usually with gaps)"));
534 modeMultiScanBackgroundButton.set_label(_("Remove background"));
535 modeMultiScanBackgroundButton.set_active(false);
536 modeMultiScanHBox4.pack_start(modeMultiScanBackgroundButton, false, false, MARGIN);
537 // TRANSLATORS: "Layer" refers to one of the stacked paths in the multiscan
538 tips.set_tip(modeMultiScanBackgroundButton,
539 _("Remove bottom (background) layer when done"));
541 modeMultiScanVBox.pack_start(modeMultiScanHBox4, false, false, MARGIN);
543 modeMultiScanFrame.set_label(_("Multiple scans: creates a group of paths"));
544 //modeQuantFrame.set_shadow_type(Gtk::SHADOW_NONE);
545 modeMultiScanFrame.add(modeMultiScanVBox);
546 modePageBox.pack_start(modeMultiScanFrame, false, false, 0);
548 //# end multiple scan
550 //## end mode page
552 notebook.append_page(modePageBox, _("Mode"));
554 //## begin option page
556 //# potrace parameters
558 optionsSpecklesButton.set_label(_("Suppress speckles"));
559 tips.set_tip(optionsSpecklesButton,
560 _("Ignore small spots (speckles) in the bitmap"));
561 optionsSpecklesButton.set_active(true);
562 optionsSpecklesBox.pack_start(optionsSpecklesButton, false, false, MARGIN);
563 optionsSpecklesSizeSpinner.set_digits(0);
564 optionsSpecklesSizeSpinner.set_increments(1, 10);
565 optionsSpecklesSizeSpinner.set_range(0, 1000);
566 optionsSpecklesSizeSpinner.set_value(2);
567 tips.set_tip(optionsSpecklesSizeSpinner,
568 _("Speckles of up to this many pixels will be suppressed"));
569 optionsSpecklesBox.pack_end(optionsSpecklesSizeSpinner, false, false, MARGIN);
570 optionsSpecklesSizeLabel.set_label(_("Size:"));
571 optionsSpecklesBox.pack_end(optionsSpecklesSizeLabel, false, false, MARGIN);
573 optionsCornersButton.set_label(_("Smooth corners"));
574 tips.set_tip(optionsCornersButton,
575 _("Smooth out sharp corners of the trace"));
576 optionsCornersButton.set_active(true);
577 optionsCornersBox.pack_start(optionsCornersButton, false, false, MARGIN);
578 optionsCornersThresholdSpinner.set_digits(2);
579 optionsCornersThresholdSpinner.set_increments(0.01, 0.1);
580 optionsCornersThresholdSpinner.set_range(0.0, 1.34);
581 optionsCornersThresholdSpinner.set_value(1.0);
582 optionsCornersBox.pack_end(optionsCornersThresholdSpinner, false, false, MARGIN);
583 tips.set_tip(optionsCornersThresholdSpinner,
584 _("Increase this to smooth corners more"));
585 optionsCornersThresholdLabel.set_label(_("Threshold:"));
586 optionsCornersBox.pack_end(optionsCornersThresholdLabel, false, false, MARGIN);
588 optionsOptimButton.set_label(_("Optimize paths"));
589 optionsOptimButton.set_active(true);
590 tips.set_tip(optionsOptimButton,
591 _("Try to optimize paths by joining adjacent Bezier curve segments"));
592 optionsOptimBox.pack_start(optionsOptimButton, false, false, MARGIN);
593 optionsOptimToleranceSpinner.set_digits(2);
594 optionsOptimToleranceSpinner.set_increments(0.05, 0.25);
595 optionsOptimToleranceSpinner.set_range(0.0, 5.0);
596 optionsOptimToleranceSpinner.set_value(0.2);
597 optionsOptimBox.pack_end(optionsOptimToleranceSpinner, false, false, MARGIN);
598 tips.set_tip(optionsOptimToleranceSpinner,
599 _("Increase this to reduce the number of nodes in the trace by more aggressive optimization"));
600 optionsOptimToleranceLabel.set_label(_("Tolerance:"));
601 optionsOptimBox.pack_end(optionsOptimToleranceLabel, false, false, MARGIN);
603 optionsVBox.pack_start(optionsSpecklesBox, false, false, MARGIN);
604 optionsVBox.pack_start(optionsCornersBox, false, false, MARGIN);
605 optionsVBox.pack_start(optionsOptimBox, false, false, MARGIN);
606 optionsFrame.set_label(_("Options"));
607 optionsFrame.add(optionsVBox);
608 optionsPageBox.pack_start(optionsFrame, false, false, 0);
610 //## end option page
612 notebook.append_page(optionsPageBox, _("Options"));
614 //### end notebook
616 leftVBox.pack_start(notebook, true, true, MARGIN);
618 //### credits
620 potraceCreditsLabel.set_text(_("Thanks to Peter Selinger, http://potrace.sourceforge.net"));
621 potraceCreditsVBox.pack_start(potraceCreditsLabel, false, false, MARGIN);
622 potraceCreditsFrame.set_label(_("Credits"));
623 potraceCreditsFrame.set_shadow_type(Gtk::SHADOW_NONE);
624 potraceCreditsFrame.add(potraceCreditsVBox);
626 leftVBox.pack_start(potraceCreditsFrame, false, false, 0);
628 //#### end left panel
630 mainHBox.pack_start(leftVBox);
632 //#### begin right panel
634 //## SIOX
636 sioxButton.set_label(_("SIOX foreground selection"));
637 sioxBox.pack_start(sioxButton, false, false, MARGIN);
638 tips.set_tip(sioxButton,
639 _("Cover the area you want to select as the foreground"));
640 rightVBox.pack_start(sioxBox, false, false, 0);
642 //## preview
644 previewButton.set_label(_("Update"));
645 previewButton.signal_clicked().connect(
646 sigc::mem_fun(*this, &TraceDialogImpl::previewCallback) );
647 previewVBox.pack_end(previewButton, false, false, 0);
648 // I guess it's correct to call the "intermediate bitmap" a preview of the trace
649 tips.set_tip(previewButton,
650 _("Preview the intermediate bitmap with the current settings, without actual tracing"));
651 previewImage.set_size_request(200,200);
652 //previewImage.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
653 previewVBox.pack_start(previewImage, true, true, 0);
654 previewFrame.set_label(_("Preview"));
655 //previewFrame.set_shadow_type(Gtk::SHADOW_NONE);
656 previewFrame.add(previewVBox);
658 rightVBox.pack_start(previewFrame, true, true, MARGIN);
660 //#### end right panel
662 mainHBox.pack_start(rightVBox);
664 //#### Global stuff
666 mainVBox->pack_start(mainHBox);
668 //## The OK button
669 mainCancelButton = add_button(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
670 if (mainCancelButton)
671 {
672 tips.set_tip((*mainCancelButton), _("Abort a trace in progress"));
673 mainCancelButton->set_sensitive(false);
674 }
675 mainOkButton = add_button(Gtk::Stock::OK, GTK_RESPONSE_OK);
676 tips.set_tip((*mainOkButton), _("Execute the trace"));
678 show_all_children();
680 //## Connect the signal
681 signal_response().connect(
682 sigc::mem_fun(*this, &TraceDialogImpl::responseCallback) );
683 }
685 /**
686 * Factory method. Use this to create a new TraceDialog
687 */
688 TraceDialog *TraceDialog::create()
689 {
690 TraceDialog *dialog = new TraceDialogImpl();
691 return dialog;
692 }
695 /**
696 * Constructor
697 */
698 TraceDialogImpl::~TraceDialogImpl()
699 {
701 }
704 } //namespace Dialog
705 } //namespace UI
706 } //namespace Inkscape
708 //#########################################################################
709 //## E N D O F F I L E
710 //#########################################################################