Logo Search packages:      
Sourcecode: inkscape version File versions

gboolean node_key ( GdkEvent *  event  ) 

Handle keypress on node; directly called.

Todo:
FIXME: this does not seem to work, the keys are stolen by tool contexts!

Definition at line 3108 of file nodepath.cpp.

References get_group0_keyval(), sp_nodepath_node_break(), sp_nodepath_node_destroy(), sp_nodepath_set_node_type(), sp_nodepath_update_repr(), and Inkscape::NodePath::Node::subpath.

{
    Inkscape::NodePath::Path *np;

    // there is no way to verify nodes so set active_node to nil when deleting!!
    if (Inkscape::NodePath::Path::active_node == NULL) return FALSE;

    if ((event->type == GDK_KEY_PRESS) && !(event->key.state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))) {
        gint ret = FALSE;
        switch (get_group0_keyval (&event->key)) {
            /// \todo FIXME: this does not seem to work, the keys are stolen by tool contexts!
            case GDK_BackSpace:
                np = Inkscape::NodePath::Path::active_node->subpath->nodepath;
                sp_nodepath_node_destroy(Inkscape::NodePath::Path::active_node);
                sp_nodepath_update_repr(np, _("Delete node"));
                Inkscape::NodePath::Path::active_node = NULL;
                ret = TRUE;
                break;
            case GDK_c:
                sp_nodepath_set_node_type(Inkscape::NodePath::Path::active_node,Inkscape::NodePath::NODE_CUSP);
                ret = TRUE;
                break;
            case GDK_s:
                sp_nodepath_set_node_type(Inkscape::NodePath::Path::active_node,Inkscape::NodePath::NODE_SMOOTH);
                ret = TRUE;
                break;
            case GDK_y:
                sp_nodepath_set_node_type(Inkscape::NodePath::Path::active_node,Inkscape::NodePath::NODE_SYMM);
                ret = TRUE;
                break;
            case GDK_b:
                sp_nodepath_node_break(Inkscape::NodePath::Path::active_node);
                ret = TRUE;
                break;
        }
        return ret;
    }
    return FALSE;
}


Generated by  Doxygen 1.6.0   Back to index