control-manager.cpp revision 8ab2991a47c99fe39f45014a19f10be449839948
/*
* Central facade for accessing and managing on-canvas controls.
*
* Author:
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright 2012 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "control-manager.h"
#include <algorithm>
#include <glib.h>
#include <glib-object.h>
#include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL
#include "display/sp-ctrlpoint.h"
#include "preferences.h"
namespace {
} // namespace
#define FILL_COLOR_NORMAL 0xffffff7f
#define FILL_COLOR_MOUSEOVER 0xff0000ff
namespace Inkscape {
class ControlManagerImpl
{
public:
~ControlManagerImpl() {}
private:
{
public:
PrefListener(ControlManagerImpl &manager) : Inkscape::Preferences::Observer("/options/grabsize/value"), _mgr(manager) {}
virtual ~PrefListener() {}
}
};
int _size;
};
_prefHook(*this),
_size(3),
_itemList(),
{
{
_sizeTable[CTRL_TYPE_UNKNOWN] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0])));
}
{
}
{
_sizeTable[CTRL_TYPE_ADJ_HANDLE] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0])));
}
{
}
{
}
}
{
{
if (*it) {
updateItem(*it);
}
}
}
}
{
setControlSize(_size, true);
}
{
}
{
if (item) {
} else {
}
}
}
{
if (data) {
}
}
{
if (wasItem)
{
{
}
}
}
// ----------------------------------------------------
_impl(new ControlManagerImpl())
{
}
{
}
{
static ControlManager instance;
return instance;
}
{
SPCanvasItem *item = 0;
switch (type)
{
case CTRL_TYPE_ADJ_HANDLE:
"shape", SP_CTRL_SHAPE_CIRCLE,
"size", 4.0,
"filled", 0,
"fill_color", 0xff00007f,
"stroked", 1,
"stroke_color", 0x0000ff7f,
NULL);
break;
case CTRL_TYPE_ANCHOR:
"size", 6.0,
"filled", 1,
"fill_color", FILL_COLOR_NORMAL,
"stroked", 1,
"stroke_color", 0x000000ff,
NULL);
break;
case CTRL_TYPE_ORIGIN:
break;
case CTRL_TYPE_UNKNOWN:
default:
}
if (item) {
}
return item;
}
{
}
{
}
{
}
} // 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 :