diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-08-18 00:38:00 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-08-18 00:38:00 +0000 |
| commit | 0bf5619e6388466b8caaddaf490acc557804f236 (patch) | |
| tree | 5eee95e6e05bdce8ba31f607ebab9bed0f563356 /src/nodepath.cpp | |
| parent | Don't draw anchors in LPEToolContext (diff) | |
| download | inkscape-0bf5619e6388466b8caaddaf490acc557804f236.tar.gz inkscape-0bf5619e6388466b8caaddaf490acc557804f236.zip | |
Add a ShapeEditor to LPEToolContext which allows us to edit nodes (switching selections doesn't work right yet; changing the cursor would also be nice)
(bzr r6656)
Diffstat (limited to 'src/nodepath.cpp')
| -rw-r--r-- | src/nodepath.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 0f6224093..817c588c3 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -37,6 +37,7 @@ #include "message-stack.h" #include "message-context.h" #include "node-context.h" +#include "lpe-tool-context.h" #include "shape-editor.h" #include "selection-chemistry.h" #include "selection.h" @@ -836,6 +837,23 @@ static gchar *create_typestr(Inkscape::NodePath::Path *np) return typestr; } +// Returns different message contexts depending on the current context. This function should only +// be called when ec is either a SPNodeContext or SPLPEToolContext, thus we return NULL in all +// other cases. +static Inkscape::MessageContext * +get_message_context(SPEventContext *ec) +{ + Inkscape::MessageContext *mc; + if (SP_IS_NODE_CONTEXT(ec)) { + mc = SP_NODE_CONTEXT(ec)->_node_message_context; + } else if (SP_IS_LPETOOL_CONTEXT(ec)) { + mc = ec->defaultMessageContext(); + } else { + g_warning ("Nodepath should only be present in Node tool or Geometric tool."); + return NULL; + } +} + /** \brief Fills node and handle positions for three nodes, splitting line marked by end at distance t. @@ -3903,7 +3921,9 @@ static void node_handle_moved(SPKnot *knot, NR::Point *p, guint state, gpointer if (!desktop) return; SPEventContext *ec = desktop->event_context; if (!ec) return; - Inkscape::MessageContext *mc = SP_NODE_CONTEXT (ec)->_node_message_context; + g_print ("4\n"); + Inkscape::MessageContext *mc = get_message_context(ec); + g_print ("5\n"); if (!mc) return; double degrees = 180 / M_PI * rnew.a; @@ -4728,7 +4748,9 @@ sp_nodepath_update_statusbar(Inkscape::NodePath::Path *nodepath)//!!!move to Sha SPEventContext *ec = desktop->event_context; if (!ec) return; - Inkscape::MessageContext *mc = SP_NODE_CONTEXT (ec)->_node_message_context; + g_print ("6\n"); + Inkscape::MessageContext *mc = get_message_context(ec); + g_print ("7\n"); if (!mc) return; inkscape_active_desktop()->emitToolSubselectionChanged(NULL); |
