common-context.cpp revision 6ccdb18a54dcf42ccf8a0854542a6cfc973c9061
#include "common-context.h"
#include "config.h"
#include "message-context.h"
#include "streq.h"
#include "preferences.h"
#include "display/sp-canvas-item.h"
#define MIN_PRESSURE 0.0
#define MAX_PRESSURE 1.0
#define DEFAULT_PRESSURE 1.0
#define DRAG_MIN 0.0
#define DRAG_DEFAULT 1.0
#define DRAG_MAX 1.0
{
// event_context_class->setup = sp_common_context_setup;
// event_context_class->set = sp_common_context_set;
// event_context_class->root_handler = sp_common_context_root_handler;
}
this->spcommoncontext = commoncontext;
}
SPCommonContext* ctx = this;
//ctx->ccommoncontext = new CCommonContext(ctx);
//delete ctx->ceventcontext;
//ctx->ceventcontext = ctx->ccommoncontext;
ctx->ccommoncontext = 0;
ctx->_message_context = 0;
ctx->is_drawing = false;
ctx->usepressure = 0;
// ctx->cursor_shape = cursor_eraser_xpm;
// ctx->hot_x = 4;
// ctx->hot_y = 4;
ctx->accumulated = 0;
ctx->currentcurve = 0;
ctx->currentshape = 0;
/* Common values */
/* attributes */
}
{
new (ctx) SPCommonContext();
}
{
if (ctx->accumulated) {
ctx->accumulated = 0;
}
}
if (ctx->currentcurve) {
ctx->currentcurve = 0;
}
}
}
if (ctx->currentshape) {
ctx->currentshape = 0;
}
if (ctx->_message_context) {
delete ctx->_message_context;
ctx->_message_context = 0;
}
}
{
}
void CCommonContext::setup() {
// if ( SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->setup ) {
// SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->setup(ec);
// }
CEventContext::setup();
}
{
}
// ignore preset modifications
if (path == "mass") {
} else if (path == "wiggle") {
} else if (path == "angle") {
} else if (path == "width") {
} else if (path == "thinning") {
} else if (path == "tremor") {
} else if (path == "flatness") {
} else if (path == "usepressure") {
} else if (path == "usetilt") {
} else if (path == "abs_width") {
} else if (path == "cap_rounding") {
}
}
{
}
// TODO add common hanlding
if ( !ret ) {
// if ( SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->root_handler ) {
// ret = SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->root_handler(event_context, event);
// }
}
return ret;
}
/*
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 :