pixelartdialog.cpp revision 7ce488b008fdcce15cb50e593e2423088e0d8a44
/**
* @file
* Pixel art tracing settings dialog - implementation.
*/
/* Authors:
* Bob Jamison <rjamison@titan.com>
* Stéphane Gimenez <dev@gim.name>
* VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com>
* Other dudes from The Inkscape Organization
*
* Copyright (C) 2004-2013 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef GLIBMM_DISABLE_DEPRECATED
# include <glibmm/dispatcher.h>
# define GLIBMM_DISABLE_DEPRECATED 1
#else // GLIBMM_DISABLE_DEPRECATED
# include <glibmm/dispatcher.h>
#endif // GLIBMM_DISABLE_DEPRECATED
#include "pixelartdialog.h"
#include <gtkmm/radiobutton.h>
#include <gtkmm/messagedialog.h>
#include "ui/widget/spinbutton.h"
#include "desktop.h"
#include "desktop-tracker.h"
#include "message-stack.h"
#include "selection.h"
#include "preferences.h"
#include "sp-image.h"
#include "display/cairo-utils.h"
#include "libdepixelize/kopftracer2011.h"
#include <algorithm>
#include "document.h"
#include "xml/document.h"
#include "svg/svg-color.h"
#include "color.h"
#include "svg/css-ostringstream.h"
#include "document-undo.h"
#ifdef HAVE_OPENMP
#include <omp.h>
#endif // HAVE_OPENMP
namespace Inkscape {
namespace UI {
namespace Dialog {
/**
* A dialog for adjusting pixel art -> vector tracing parameters
*/
class PixelArtDialogImpl : public PixelArtDialog
{
public:
private:
struct Input
{
SVGLength x;
SVGLength y;
};
struct Output
{
{}
SVGLength x;
SVGLength y;
};
//############ Events
void responseCallback(int response_id);
//############ UI Logic
void vectorize();
void setDefaults();
void updatePreview();
bool ignorePreview;
bool pendingPreview;
//############ UI
#endif // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
//############ UI Logic data
//############ Threads
void workerThread();
void onWorkerThreadFinished();
};
{
}
{
}
ignorePreview(false),
pendingPreview(false)
{
// Heuristics
{
{
char const *str = _("Favors connections that are part of foreground color");
}
{
char const *str = _("The heuristic computed vote will be multiplied by this value");
}
}
// Output
{
#endif // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
}
// Buttons
{
//## The OK button
if (mainCancelButton) {
mainCancelButton->set_sensitive(false);
}
}
setDefaults();
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &PixelArtDialogImpl::setTargetDesktop) );
}
{
if (response_id == GTK_RESPONSE_OK) {
vectorize();
} else if (response_id == GTK_RESPONSE_CANCEL) {
// libdepixelize's interface need to be extended to allow aborts
g_atomic_int_set(&abortThread, true);
} else if (response_id == GTK_RESPONSE_HELP) {
setDefaults();
} else {
hide();
return;
}
}
{
#else // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
#endif // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
#ifdef HAVE_OPENMP
#else
1,
#endif // HAVE_OPENMP
1, 256);
return options;
}
void PixelArtDialogImpl::vectorize()
{
char *msg = _("Select an <b>image</b> to trace");
return;
}
continue;
char *msg = _("Image looks too big. Process may take a while and is"
" wise to save your document before continue."
"\n\nContinue the procedure (without saving)?");
Gtk::BUTTONS_OK_CANCEL, true);
continue;
}
}
char *msg = _("Select an <b>image</b> to trace");
return;
}
mainCancelButton->set_sensitive(true);
mainOkButton->set_sensitive(false);
lastOptions = options();
g_atomic_int_set(&abortThread, false);
}
{
if ( voronoiRadioButton.get_active() ) {
} else {
}
}
{
{
{
gchar b[64];
sp_svg_write_color(b, sizeof(b),
}
{
}
}
}
{
+ ')').c_str());
}
_("Trace pixel art"));
// Flush pending updates
}
void PixelArtDialogImpl::setDefaults()
{
ignorePreview = true;
#else // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
#endif // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
ignorePreview = false;
if ( pendingPreview )
}
void PixelArtDialogImpl::updatePreview()
{
if ( ignorePreview ) {
pendingPreview = true;
return;
}
// TODO: update preview
pendingPreview = false;
}
void PixelArtDialogImpl::workerThread()
{
}
dispatcher();
}
{
importOutput(*it);
}
mainCancelButton->set_sensitive(false);
mainOkButton->set_sensitive(true);
}
/**
* Factory method. Use this to create a new PixelArtDialog
*/
{
return *dialog;
}
{
}
} //namespace Dialog
} //namespace UI
} //namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :