summaryrefslogtreecommitdiffstats
path: root/src/verbs.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-09-27 14:17:45 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-09-27 14:17:45 +0000
commitfa9bd6393f316dab9303569b28f6b5d179fedd61 (patch)
tree33df00632f850a6f117978c36145feeac05f1a4c /src/verbs.cpp
parentUpdate to experimental r13527 (diff)
downloadinkscape-fa9bd6393f316dab9303569b28f6b5d179fedd61.tar.gz
inkscape-fa9bd6393f316dab9303569b28f6b5d179fedd61.zip
Update to experimental r13565
(bzr r13341.5.16)
Diffstat (limited to 'src/verbs.cpp')
-rw-r--r--src/verbs.cpp93
1 files changed, 92 insertions, 1 deletions
diff --git a/src/verbs.cpp b/src/verbs.cpp
index cfda87bb6..be5f0f4f1 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -64,6 +64,7 @@
#include "seltrans.h"
#include "shape-editor.h"
#include "shortcuts.h"
+#include "sp-defs.h"
#include "sp-flowtext.h"
#include "sp-guide.h"
#include "splivarot.h"
@@ -215,6 +216,25 @@ public:
}; // ObjectVerb class
/**
+ * A class to encompass all of the verbs which deal with operations related to tags.
+ */
+class TagVerb : public Verb {
+private:
+ static void perform(SPAction *action, void *mydata);
+protected:
+ virtual SPAction *make_action(Inkscape::ActionContext const & context);
+public:
+ /** Use the Verb initializer with the same parameters. */
+ TagVerb(unsigned int const code,
+ gchar const *id,
+ gchar const *name,
+ gchar const *tip,
+ gchar const *image) :
+ Verb(code, id, name, tip, image, _("Tag"))
+ { }
+}; // TagVerb class
+
+/**
* A class to encompass all of the verbs which deal with operations relative to context.
*/
class ContextVerb : public Verb {
@@ -460,6 +480,19 @@ SPAction *ObjectVerb::make_action(Inkscape::ActionContext const & context)
}
/**
+ * Create an action for a \c TagVerb.
+ *
+ * Calls \c make_action_helper with the \c vector.
+ *
+ * @param view Which view the action should be created for.
+ * @return The built action.
+ */
+SPAction *TagVerb::make_action(Inkscape::ActionContext const & context)
+{
+ return make_action_helper(context, &perform);
+}
+
+/**
* Create an action for a \c ContextVerb.
*
* Calls \c make_action_helper with the \c vector.
@@ -1535,6 +1568,9 @@ void ObjectVerb::perform( SPAction *action, void *data)
case SP_VERB_OBJECT_SET_CLIPPATH:
sp_selection_set_mask(dt, true, false);
break;
+ case SP_VERB_OBJECT_CREATE_CLIP_GROUP:
+ sp_selection_set_clipgroup(dt);
+ break;
case SP_VERB_OBJECT_EDIT_CLIPPATH:
sp_selection_edit_clip_or_mask(dt, true);
break;
@@ -1550,6 +1586,47 @@ void ObjectVerb::perform( SPAction *action, void *data)
/**
* Decode the verb code and take appropriate action.
*/
+void TagVerb::perform( SPAction *action, void *data)
+{
+ SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
+ if (!dt)
+ return;
+
+ //Inkscape::UI::Tools::ToolBase *ec = dt->event_context;
+
+ Inkscape::Selection *sel = sp_desktop_selection(dt);
+
+ Inkscape::XML::Document * doc;
+ Inkscape::XML::Node * repr;
+ gchar *id;
+
+ switch (reinterpret_cast<std::size_t>(data)) {
+ case SP_VERB_TAG_NEW:
+ static int tag_suffix=1;
+ id=NULL;
+ do {
+ g_free(id);
+ id = g_strdup_printf("Set %d", tag_suffix++);
+ } while (dt->doc()->getObjectById(id));
+
+ doc = dt->doc()->getReprDoc();
+ repr = doc->createElement("inkscape:tag");
+ repr->setAttribute("id", id);
+ g_free(id);
+
+ dt->doc()->getDefs()->addChild(repr, NULL);
+ Inkscape::DocumentUndo::done(dt->doc(), SP_VERB_DIALOG_TAGS, _("Create new selection set"));
+ break;
+ default:
+ break;
+ }
+
+} // end of sp_verb_action_tag_perform()
+
+
+/**
+ * Decode the verb code and take appropriate action.
+ */
void ContextVerb::perform(SPAction *action, void *data)
{
SPDesktop *dt;
@@ -2037,6 +2114,12 @@ void DialogVerb::perform(SPAction *action, void *data)
case SP_VERB_DIALOG_LAYERS:
dt->_dlg_mgr->showDialog("LayersPanel");
break;
+ case SP_VERB_DIALOG_OBJECTS:
+ dt->_dlg_mgr->showDialog("ObjectsPanel");
+ break;
+ case SP_VERB_DIALOG_TAGS:
+ dt->_dlg_mgr->showDialog("TagsPanel");
+ break;
case SP_VERB_DIALOG_LIVE_PATH_EFFECT:
dt->_dlg_mgr->showDialog("LivePathEffect");
break;
@@ -2637,11 +2720,15 @@ Verb *Verb::_base_verbs[] = {
N_("Remove mask from selection"), NULL),
new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
+ new ObjectVerb(SP_VERB_OBJECT_CREATE_CLIP_GROUP, "ObjectCreateClipGroup", N_("Create Cl_ip Group"),
+ N_("Creates a clip group using the selected objects as a base"), NULL),
new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"),
N_("Edit clipping path"), INKSCAPE_ICON("path-clip-edit")),
new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
N_("Remove clipping path from selection"), NULL),
-
+ // Tag
+ new TagVerb(SP_VERB_TAG_NEW, "TagNew", N_("_New"),
+ N_("Create new selection set"), NULL),
// Tools
new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", NC_("ContextVerb", "Select"),
N_("Select and transform objects"), INKSCAPE_ICON("tool-pointer")),
@@ -2854,6 +2941,10 @@ Verb *Verb::_base_verbs[] = {
N_("Query information about extensions"), NULL),
new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
N_("View Layers"), INKSCAPE_ICON("dialog-layers")),
+ new DialogVerb(SP_VERB_DIALOG_OBJECTS, "DialogObjects", N_("Object_s..."),
+ N_("View Objects"), INKSCAPE_ICON("dialog-layers")),
+ new DialogVerb(SP_VERB_DIALOG_TAGS, "DialogTags", N_("Selection se_ts..."),
+ N_("View Tags"), INKSCAPE_ICON("edit-select-all-layers")),
new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffects ..."),
N_("Manage, edit, and apply path effects"), NULL),
new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter _Editor..."),