From 58a0c58cd7b4bd9b7e4403e68ae37794832ad4b2 Mon Sep 17 00:00:00 2001 From: Milosz Derezynski Date: Thu, 18 May 2006 14:56:08 +0000 Subject: * Properly deal with setting the style using the text toolbar (bzr r874) --- src/verbs.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index a046372fc..bec08fe55 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -333,6 +333,24 @@ public: { } }; /* TutorialVerb class */ +/** \brief A class to encompass all of the verbs which deal with + text operations. */ +class TextVerb : public Verb { +private: + static void perform(SPAction *action, void *mydata, void *otherdata); + static SPActionEventVector vector; +protected: + virtual SPAction *make_action(Inkscape::UI::View::View *view); +public: + /** \brief Use the Verb initializer with the same parameters. */ + TextVerb(unsigned int const code, + gchar const *id, + gchar const *name, + gchar const *tip, + gchar const *image) : + Verb(code, id, name, tip, image) + { } +}; //TextVerb : public Verb Verb::VerbTable Verb::_verbs; Verb::VerbIDTable Verb::_verb_ids; @@ -509,6 +527,18 @@ TutorialVerb::make_action(Inkscape::UI::View::View *view) return make_action_helper(view, &vector); } +/** \brief Create an action for a \c TextVerb + \param view Which view the action should be created for + \return The built action. + + Calls \c make_action_helper with the \c vector. +*/ +SPAction * +TextVerb::make_action(Inkscape::UI::View::View *view) +{ + return make_action_helper(view, &vector); +} + /** \brief A quick little convience function to make building actions a little bit easier. \param view Which view the action should be created for. @@ -1367,6 +1397,18 @@ ContextVerb::perform(SPAction *action, void *data, void *pdata) } // end of sp_verb_action_ctx_perform() +/** \brief Decode the verb code and take appropriate action */ +void +TextVerb::perform(SPAction *action, void *data, void *pdata) +{ + SPDesktop *dt = static_cast(sp_action_get_view(action)); + if (!dt) + return; + + SPDocument *doc = sp_desktop_document(dt); + Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview); +} + /** \brief Decode the verb code and take appropriate action */ void ZoomVerb::perform(SPAction *action, void *data, void *pdata) @@ -1783,6 +1825,14 @@ SPActionEventVector HelpVerb::vector = SPActionEventVector TutorialVerb::vector = {{NULL},TutorialVerb::perform, NULL, NULL, NULL}; +/** + * Action vector to define functions called if a staticly defined tutorial verb + * is called + */ +SPActionEventVector TextVerb::vector = + {{NULL},TextVerb::perform, NULL, NULL, NULL}; + + /* *********** Effect Last ********** */ /** \brief A class to represent the last effect issued */ @@ -2359,7 +2409,13 @@ Verb *Verb::_base_verbs[] = { N_("Fit the canvas to the drawing"), NULL), new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Canvas to Selection or Drawing"), N_("Fit the canvas to the current selection or the drawing if there is no selection"), NULL), - + +#if 0 + //Text + new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Canvas to Selection or Drawing"), + N_("Fit the canvas to the current selection or the drawing if there is no selection"), NULL), +#endif + /* Footer */ new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL) }; -- cgit v1.2.3