Difference between revisions of "Adding interface verbs"

From Inkscape Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 +
 +
 
First, add IDs for new verbs to verbs.h:
 
First, add IDs for new verbs to verbs.h:
  
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/verbs.h?r1=13280&r2=13309&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/verbs.h?r1=13280&r2=13309&sortby=date verbs.h]
  
 
The place of the ID in the list determines to which group it belongs
 
The place of the ID in the list determines to which group it belongs
Line 13: Line 15:
 
methods:
 
methods:
  
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/verbs.cpp?r1=13281&r2=13311&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/verbs.cpp?r1=13281&r2=13311&sortby=date verbs.cpp]
  
 
As you see, these verbs do different things depending on which tool
 
As you see, these verbs do different things depending on which tool
Line 19: Line 21:
 
files, and now we can remove that:
 
files, and now we can remove that:
  
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/node-context.cpp?r1=13296&r2=13309&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/node-context.cpp?r1=13296&r2=13309&sortby=date node-context.cpp]
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/select-context.cpp?r1=13200&r2=13309&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/select-context.cpp?r1=13200&r2=13309&sortby=date select-context.cpp]
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/draw-context.cpp?r1=13148&r2=13310&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/draw-context.cpp?r1=13148&r2=13310&sortby=date draw-context.cpp]
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/draw-context.cpp?r1=13148&r2=13310&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/draw-context.cpp?r1=13148&r2=13310&sortby=date draw-context.cpp]
  
 
(the last one required writing two functions that will be called by the
 
(the last one required writing two functions that will be called by the
Line 29: Line 31:
 
Now assign the keys to the newly created verbs:
 
Now assign the keys to the newly created verbs:
  
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/keys/inkscape.xml?r1=13302&r2=13307&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/keys/inkscape.xml?r1=13302&r2=13307&sortby=date inkscape.xml]
  
 
and then copy inkscape.xml to default.xml.
 
and then copy inkscape.xml to default.xml.
Line 48: Line 50:
 
thing according to the comments:
 
thing according to the comments:
  
http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/keys/adobe-illustrator-cs2.xml?r1=13304&r2=13308&sortby=date
+
[http://svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/keys/adobe-illustrator-cs2.xml?r1=13304&r2=13308&sortby=date adobe-illustrator-cs2.xml]
  
 
Finally update the release notes:
 
Finally update the release notes:
  
http://wiki.inkscape.org/wiki/index.php?title=ReleaseNotes045&diff=8842&oldid=8840#Even_more_improvements
+
[[ReleaseNotes]]

Revision as of 06:42, 8 November 2006


First, add IDs for new verbs to verbs.h:

verbs.h

The place of the ID in the list determines to which group it belongs (EditVerbs, FileVerbs, etc) - however, this is pretty arbitrary, so don't sweat if you can't find a perfect group for your verb, just use whichever makes most sense.

Then in verbs.cpp, fill in the verb structure with the name, description, action ID, etc; also in the same file, write the actual commands that the verb will do, in a switch case in one of ::perform methods:

verbs.cpp

As you see, these verbs do different things depending on which tool you are in. Before verbification, this was coded into tool context files, and now we can remove that:

node-context.cpp select-context.cpp draw-context.cpp draw-context.cpp

(the last one required writing two functions that will be called by the verb).

Now assign the keys to the newly created verbs:

inkscape.xml

and then copy inkscape.xml to default.xml.

Note: even if you are not assigning any key, you MUST list the new verb in inkscape.xml, using a <bind> without a key. Not only this file is a keymap, but it's also a reference for keymap writers, so it must have all verbs, assigned or not.

If you added a shortcut which didn't exist before, update also doc/keys.xml.

If you want the new verb in the menu, edit menus-skeleton.cpp and insert it there in an appropriate place.

Also review the other keymaps to see if you can assign the new verb to some key that would make sense. So in adobe-illustrator.xml, I assigned the new verbs to Alt+Ctrl+[], which seems to be the same thing according to the comments:

adobe-illustrator-cs2.xml

Finally update the release notes:

ReleaseNotes