lpe-tool-context.cpp revision a10c87bcda5c7ca6398f254df3cc5bd60ba389ee
/*
* LPEToolContext: a context for a generic tool composed of subtools that are given by LPEs
*
* Authors:
* Maximilian Albert <maximilian.albert@gmail.com>
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1998 The Free Software Foundation
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "forward.h"
#include "pixmaps/cursor-node.xpm"
#include "pixmaps/cursor-crosshairs.xpm"
#include "desktop.h"
#include "message-context.h"
#include "prefs-utils.h"
#include "shape-editor.h"
#include "selection.h"
#include "desktop-handles.h"
#include "document.h"
#include "display/canvas-bpath.h"
#include "message-stack.h"
#include "lpe-tool-context.h"
const int num_subtools = 7;
Inkscape::LivePathEffect::INVALID_LPE, // this must be here to account for the "all inactive" action
};
static SPPenContextClass *lpetool_parent_class = 0;
{
if (!type) {
sizeof(SPLPEToolContextClass),
0, // base_init
0, // base_finalize
0, // class_finalize
0, // class_data
sizeof(SPLPEToolContext),
0, // n_preallocs
0 // value_table
};
type = g_type_register_static(SP_TYPE_PEN_CONTEXT, "SPLPEToolContext", &info, static_cast<GTypeFlags>(0));
}
return type;
}
static void
{
}
static void
{
}
static void
{
delete lc->shape_editor;
if (lc->canvas_bbox) {
}
}
static void
{
selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_lpetool_context_selection_changed), (gpointer)lc));
// TODO temp force:
ec->enableSelectionCue();
if (item) {
}
ec->enableSelectionCue();
}
}
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new nodepath and reassigns listeners to the new selected item's repr
*/
void
{
// TODO: update ShapeEditorsCollective instead
}
static void
{
// FIXME: how to set this correcly? the value from preferences-skeleton.h doesn't seem to get
// read (it wants to set drag = 1)
/**
//pass on up to parent class to handle common attributes.
if ( lpetool_parent_class->set ) {
lpetool_parent_class->set(ec, key, val);
}
**/
}
{
//g_print ("sp_lpetool_context_root_handler()\n");
bool ret = false;
if (sp_pen_context_has_waiting_LPE(lc)) {
// quit when we are waiting for a LPE to be applied
g_print ("LPETool has waiting LPE. We call the pen tool parent context and return\n");
return ret;
}
case GDK_BUTTON_PRESS:
g_print ("GDK_BUTTON_PRESS\n");
// don't do anything for now if we are inactive
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Choose a construction tool from the toolbar."));
g_print ("Flash statusbar\n");
ret = true;
break;
}
g_print (" ... (passed if construct)\n");
// save drag origin
event_context->within_tolerance = true;
using namespace Inkscape::LivePathEffect;
// save drag origin
bool over_stroke = lc->shape_editor->is_over_stroke(NR::Point(event->button.x, event->button.y), true);
// we pass the mouse click on to pen tool as the first click which it should collect
}
break;
case GDK_MOTION_NOTIFY:
{
break;
}
bool over_stroke = false;
if (over_stroke) {
} else {
}
}
break;
case GDK_BUTTON_RELEASE:
{
/**
break;
**/
}
case GDK_KEY_PRESS:
/**
switch (get_group0_keyval (&event->key)) {
}
break;
**/
case GDK_KEY_RELEASE:
/**
switch (get_group0_keyval(&event->key)) {
case GDK_Control_L:
case GDK_Control_R:
dc->_message_context->clear();
break;
default:
break;
}
**/
default:
break;
}
if (!ret) {
}
}
return ret;
}
static int
for (int i = 0; i < num_subtools; ++i) {
if (lpesubtools[i] == type) {
return i;
}
}
return -1;
}
void
{
if (index != -1) {
} else {
return;
}
}
/*
* Reads the limiting bounding box from preferences and draws it on the screen
*/
// TODO: Note that currently the bbox is not user-settable; we simply use the page borders
void
{
if (lc->canvas_bbox) {
}
return;
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(lc->canvas_bbox), 0x0000ffff, 0.8, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT, 5, 5);
}
/*
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:encoding=utf-8:textwidth=99 :