Difference between revisions of "Menu"

From Inkscape Wiki
Jump to navigation Jump to search
(Created page with "== Add an item to an existing menu == # Choose a short name and a place you want to put it (e.g. ''Paste as dummy...'' in ''Edit'' menu between ''Paste'' and ''Paste In Place...")
 
Line 3: Line 3:
# Choose a short name and a place you want to put it (e.g. ''Paste as dummy...'' in ''Edit'' menu between ''Paste'' and ''Paste In Place'')
# Choose a short name and a place you want to put it (e.g. ''Paste as dummy...'' in ''Edit'' menu between ''Paste'' and ''Paste In Place'')
# Code its behaviour in a function somewhere or locate an existing one (e.g. ''sp_paste_as_dummy()'' in ''sp-dummy.cpp'' and ''sp-dummy.h'')
# Code its behaviour in a function somewhere or locate an existing one (e.g. ''sp_paste_as_dummy()'' in ''sp-dummy.cpp'' and ''sp-dummy.h'')
# Deduce a [[Verb]] name which belong bt SP_VERB_ + menu name (e.g. ''SP_VERB_EDIT_PASTE_AS_DUMMY'')
# Deduce a [[Verb]] name which looks like ''SP_VERB_ + menu name'' (e.g. ''SP_VERB_EDIT_PASTE_AS_DUMMY'')
# In [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/verbs.h src/verbs.h]
# In [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/verbs.h src/verbs.h]
## Locate the big enum at the beginning
## Locate the big enum at the beginning

Revision as of 21:35, 26 March 2012

Add an item to an existing menu

  1. Choose a short name and a place you want to put it (e.g. Paste as dummy... in Edit menu between Paste and Paste In Place)
  2. Code its behaviour in a function somewhere or locate an existing one (e.g. sp_paste_as_dummy() in sp-dummy.cpp and sp-dummy.h)
  3. Deduce a Verb name which looks like SP_VERB_ + menu name (e.g. SP_VERB_EDIT_PASTE_AS_DUMMY)
  4. In src/verbs.h
    1. Locate the big enum at the beginning
    2. Add the new Verb name in the enum at the right place (e.g. after SP_VERB_EDIT_PASTE)
  5. In src/verbs.cpp
    1. Locate _base_verbs[] creation
    2. Add a new item at the right place. With this add you will set its short name (e.g. 'Paste as dummy...), description and icon (or NULL)
    3. Locate the perform(...) function of the menu (e.g. locate EditVerb::perform(...))
    4. Add a new case to deal with your feature to call your function (e.g. to call sp_paste_as_dummy())
  6. In src/menus-skeleton.h
    1. Locate menus_skeleton[] variable
    2. Edit its content to add your new feature at the right place
  7. Save all, compile and run, it should works.

Create a new menu

To be writed.