1 /** @file
2 * @brief Bitmap tracing settings dialog - implementation
3 */
4 /* Authors:
5 * Bob Jamison <rjamison@titan.com>
6 * Stéphane Gimenez <dev@gim.name>
7 * Other dudes from The Inkscape Organization
8 *
9 * Copyright (C) 2004-2006 Authors
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information
12 */
13 #ifdef HAVE_CONFIG_H
14 # include <config.h>
15 #endif
17 #include <gtkmm/notebook.h>
18 #include <gtkmm/frame.h>
19 #include <gtkmm/spinbutton.h>
20 #include <gtkmm/stock.h>
22 #include <gtk/gtkdialog.h> //for GTK_RESPONSE* types
23 #include <glibmm/i18n.h>
27 #include "tracedialog.h"
28 #include "trace/potrace/inkscape-potrace.h"
31 namespace Inkscape {
32 namespace UI {
33 namespace Dialog {
36 //#########################################################################
37 //## I M P L E M E N T A T I O N
38 //#########################################################################
40 /**
41 * A dialog for adjusting bitmap->vector tracing parameters
42 */
43 class TraceDialogImpl : public TraceDialog
44 {
46 public:
49 /**
50 * Constructor
51 */
52 TraceDialogImpl();
54 /**
55 * Destructor
56 */
57 ~TraceDialogImpl();
59 /**
60 * Callback from OK or Cancel
61 */
62 void responseCallback(int response_id);
64 private:
66 /**
67 * This is the big almighty McGuffin
68 */
69 Inkscape::Trace::Tracer tracer;
71 /**
72 * This does potrace processing
73 * Only preview if do_i_trace is false
74 */
75 void potraceProcess(bool do_i_trace);
77 /**
78 * Abort processing
79 */
80 void abort();
82 void previewCallback();
84 //############ General items
86 Gtk::HBox mainHBox;
87 Gtk::Tooltips tips;
89 Gtk::Button *mainOkButton;
90 Gtk::Button *mainCancelButton;
92 //######## Left pannel
94 Gtk::VBox leftVBox;
96 //#### Notebook
98 Gtk::Notebook notebook;
100 //## Modes
102 Gtk::VBox modePageBox;
103 Gtk::RadioButtonGroup modeGroup;
105 //# Single scan mode
106 //brightness
107 Gtk::Frame modeBrightnessFrame;
108 Gtk::VBox modeBrightnessVBox;
109 Gtk::HBox modeBrightnessBox;
110 Gtk::RadioButton modeBrightnessRadioButton;
111 Gtk::Label modeBrightnessSpinnerLabel;
112 Gtk::SpinButton modeBrightnessSpinner;
113 //edge detection
114 Gtk::Frame modeCannyFrame;
115 Gtk::HBox modeCannyBox;
116 Gtk::VBox modeCannyVBox;
117 Gtk::RadioButton modeCannyRadioButton;
118 //Gtk::HSeparator modeCannySeparator;
119 //Gtk::Label modeCannyLoSpinnerLabel;
120 //Gtk::SpinButton modeCannyLoSpinner;
121 Gtk::Label modeCannyHiSpinnerLabel;
122 Gtk::SpinButton modeCannyHiSpinner;
123 //quantization
124 Gtk::Frame modeQuantFrame;
125 Gtk::HBox modeQuantBox;
126 Gtk::VBox modeQuantVBox;
127 Gtk::RadioButton modeQuantRadioButton;
128 Gtk::Label modeQuantNrColorLabel;
129 Gtk::SpinButton modeQuantNrColorSpinner;
130 //params
131 Gtk::CheckButton modeInvertButton;
132 Gtk::HBox modeInvertBox;
134 //# Multiple path scanning mode
135 Gtk::Frame modeMultiScanFrame;
136 Gtk::VBox modeMultiScanVBox;
137 //brightness
138 Gtk::HBox modeMultiScanHBox1;
139 Gtk::RadioButton modeMultiScanBrightnessRadioButton;
140 Gtk::SpinButton modeMultiScanNrColorSpinner;
141 //colors
142 Gtk::HBox modeMultiScanHBox2;
143 Gtk::RadioButton modeMultiScanColorRadioButton;
144 //grays
145 Gtk::HBox modeMultiScanHBox3;
146 Gtk::RadioButton modeMultiScanMonoRadioButton;
147 Gtk::Label modeMultiScanNrColorLabel;
148 //params
149 Gtk::HBox modeMultiScanHBox4;
150 Gtk::CheckButton modeMultiScanStackButton;
151 Gtk::CheckButton modeMultiScanSmoothButton;
152 Gtk::CheckButton modeMultiScanBackgroundButton;
154 //## Options
156 Gtk::VBox optionsPageBox;
158 // potrace parameters
160 Gtk::Frame optionsFrame;
161 Gtk::VBox optionsVBox;
162 Gtk::HBox optionsSpecklesBox;
163 Gtk::CheckButton optionsSpecklesButton;
164 Gtk::Label optionsSpecklesSizeLabel;
165 Gtk::SpinButton optionsSpecklesSizeSpinner;
166 Gtk::HBox optionsCornersBox;
167 Gtk::CheckButton optionsCornersButton;
168 Gtk::Label optionsCornersThresholdLabel;
169 Gtk::SpinButton optionsCornersThresholdSpinner;
170 Gtk::HBox optionsOptimBox;
171 Gtk::CheckButton optionsOptimButton;
172 Gtk::Label optionsOptimToleranceLabel;
173 Gtk::SpinButton optionsOptimToleranceSpinner;
176 //#### Credits
178 Gtk::Frame potraceCreditsFrame;
179 Gtk::VBox potraceCreditsVBox;
180 Gtk::Label potraceCreditsLabel;
182 //######## Right pannel
184 Gtk::VBox rightVBox;
186 //#### SIOX selection
188 Gtk::HBox sioxBox;
189 Gtk::CheckButton sioxButton;
191 //#### Preview
193 Gtk::Frame previewFrame;
194 Gtk::VBox previewVBox;
195 Gtk::Button previewButton;
196 Gtk::Image previewImage;
198 };
202 //#########################################################################
203 //## E V E N T S
204 //#########################################################################
206 /**
207 * This does potrace processing
208 * Only preview if do_i_trace is false
209 */
210 void TraceDialogImpl::potraceProcess(bool do_i_trace)
211 {
212 //##### Get the tracer and engine
213 Inkscape::Trace::Potrace::PotraceTracingEngine pte;
215 /* inversion */
216 bool invert = modeInvertButton.get_active();
217 pte.setInvert(invert);
219 //##### Get the preprocessor settings
220 /* siox -- performed by Tracer, and before any of the others */
221 if (sioxButton.get_active())
222 tracer.enableSiox(true);
223 else
224 tracer.enableSiox(false);
226 /* one of the following */
227 if (modeBrightnessRadioButton.get_active())
228 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
229 else if (modeMultiScanBrightnessRadioButton.get_active())
230 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS_MULTI);
231 else if (modeCannyRadioButton.get_active())
232 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_CANNY);
233 else if (modeQuantRadioButton.get_active())
234 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT);
235 else if (modeMultiScanColorRadioButton.get_active())
236 {
237 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_COLOR);
238 pte.setInvert(false);
239 }
240 else if (modeMultiScanMonoRadioButton.get_active())
241 {
242 pte.setTraceType(Inkscape::Trace::Potrace::TRACE_QUANT_MONO);
243 pte.setInvert(false);
244 }
246 /* params */
247 int paramsSpecklesSize =
248 optionsSpecklesButton.get_active() ?
249 optionsSpecklesSizeSpinner.get_value_as_int() :
250 0;
251 pte.setParamsTurdSize(paramsSpecklesSize);
252 double paramsCornersThreshold =
253 optionsCornersButton.get_active() ?
254 optionsCornersThresholdSpinner.get_value() :
255 0.;
256 pte.setParamsAlphaMax(paramsCornersThreshold);
257 bool paramsOptim = optionsOptimButton.get_active();
258 pte.setParamsOptiCurve(paramsOptim);
259 double paramsOptimTolerance = optionsOptimToleranceSpinner.get_value();
260 pte.setParamsOptTolerance(paramsOptimTolerance);
262 //##### Get the single-scan settings
263 /* brightness */
264 double brightnessThreshold = modeBrightnessSpinner.get_value();
265 pte.setBrightnessThreshold(brightnessThreshold);
266 /* canny */
267 double cannyHighThreshold = modeCannyHiSpinner.get_value();
268 pte.setCannyHighThreshold(cannyHighThreshold);
269 /* quantization */
270 int quantNrColors = modeQuantNrColorSpinner.get_value_as_int();
271 pte.setQuantizationNrColors(quantNrColors);
273 //##### Get multiple-scan settings
274 int multiScanNrColors = modeMultiScanNrColorSpinner.get_value_as_int();
275 pte.setMultiScanNrColors(multiScanNrColors);
276 bool do_i_stack = modeMultiScanStackButton.get_active();
277 pte.setMultiScanStack(do_i_stack);
278 bool do_i_smooth = modeMultiScanSmoothButton.get_active();
279 pte.setMultiScanSmooth(do_i_smooth);
280 bool do_i_remove_background = modeMultiScanBackgroundButton.get_active();
281 pte.setMultiScanRemoveBackground(do_i_remove_background);
283 //##### Get intermediate bitmap image
284 Glib::RefPtr<Gdk::Pixbuf> pixbuf = tracer.getSelectedImage();
285 if (pixbuf)
286 {
287 Glib::RefPtr<Gdk::Pixbuf> preview = pte.preview(pixbuf);
288 if (preview)
289 {
290 int width = preview->get_width();
291 int height = preview->get_height();
292 double scaleFX = 200.0 / (double)width;
293 double scaleFY = 200.0 / (double)height;
294 double scaleFactor = scaleFX > scaleFY ? scaleFY : scaleFX;
295 int newWidth = (int) (((double)width) * scaleFactor);
296 int newHeight = (int) (((double)height) * scaleFactor);
297 Glib::RefPtr<Gdk::Pixbuf> scaledPreview =
298 preview->scale_simple(newWidth, newHeight,
299 Gdk::INTERP_NEAREST);
300 //g_object_unref(preview);
301 previewImage.set(scaledPreview);
302 }
303 }
305 //##### Convert
306 if (do_i_trace)
307 {
308 if (mainCancelButton)
309 mainCancelButton->set_sensitive(true);
310 if (mainOkButton)
311 mainOkButton->set_sensitive(false);
312 tracer.trace(&pte);
313 if (mainCancelButton)
314 mainCancelButton->set_sensitive(false);
315 if (mainOkButton)
316 mainOkButton->set_sensitive(true);
317 }
319 }
322 /**
323 * Abort processing
324 */
325 void TraceDialogImpl::abort()
326 {
327 //### Do some GUI thing
329 //### Make the abort() call to the tracer
330 tracer.abort();
332 }
336 //#########################################################################
337 //## E V E N T S
338 //#########################################################################
340 /**
341 * Callback from the Preview button. Can be called from elsewhere.
342 */
343 void TraceDialogImpl::previewCallback()
344 {
345 potraceProcess(false);
346 }
348 /**
349 * Default response from the dialog. Let's intercept it
350 */
351 void TraceDialogImpl::responseCallback(int response_id)
352 {
353 if (response_id == GTK_RESPONSE_OK)
354 {
355 // for now, we assume potrace, as it's the only one we have
356 potraceProcess(true);
357 }
358 else if (response_id == GTK_RESPONSE_CANCEL)
359 {
360 abort();
361 }
362 else
363 {
364 hide();
365 return;
366 }
368 }
372 //#########################################################################
373 //## C O N S T R U C T O R / D E S T R U C T O R
374 //#########################################################################
375 /**
376 * Constructor
377 */
378 TraceDialogImpl::TraceDialogImpl() :
379 TraceDialog()
380 {
382 Gtk::Box *contents = _getContents();
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 contents->pack_start(mainHBox);
668 //## The OK button
669 mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
670 if (mainCancelButton) {
671 tips.set_tip((*mainCancelButton), _("Abort a trace in progress"));
672 mainCancelButton->set_sensitive(false);
673 }
674 mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK);
675 tips.set_tip((*mainOkButton), _("Execute the trace"));
677 show_all_children();
679 //## Connect the signal
680 signalResponse().connect(
681 sigc::mem_fun(*this, &TraceDialogImpl::responseCallback));
682 }
684 /**
685 * Factory method. Use this to create a new TraceDialog
686 */
687 TraceDialog &TraceDialog::getInstance()
688 {
689 TraceDialog *dialog = new TraceDialogImpl();
690 return *dialog;
691 }
694 /**
695 * Constructor
696 */
697 TraceDialogImpl::~TraceDialogImpl()
698 {
700 }
703 } //namespace Dialog
704 } //namespace UI
705 } //namespace Inkscape
707 //#########################################################################
708 //## E N D O F F I L E
709 //#########################################################################