Difference between revisions of "Menu"
Jump to navigation
Jump to search
Romain2Boss (talk | contribs) |
Romain2Boss (talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Add an item to an existing menu == | == Main menus == | ||
=== 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'') | # 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 9: | Line 11: | ||
# In [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/verbs.cpp src/verbs.cpp] | # In [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/verbs.cpp src/verbs.cpp] | ||
## Locate ''_base_verbs[]'' creation | ## Locate ''_base_verbs[]'' creation | ||
## 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 (a GTK stock, an Inkscape | ## 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 (a GTK stock, an Inkscape icon or NULL) | ||
## Locate the ''perform(...)'' function of the menu (e.g. locate ''EditVerb::perform(...)'') | ## Locate the ''perform(...)'' function of the menu (e.g. locate ''EditVerb::perform(...)'') | ||
## Add a new case to deal with your feature to call your function (e.g. to call ''sp_paste_as_dummy()'') | ## Add a new case to deal with your feature to call your function (e.g. to call ''sp_paste_as_dummy()'') | ||
Line 17: | Line 19: | ||
# Save all, compile and run, it should works. | # Save all, compile and run, it should works. | ||
== Create a new menu == | === Create a new menu === | ||
To be written. | |||
== Context menu == | |||
See [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/interface.cpp src/interface.cpp] and [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/src/interface.h src/interface.h]. | |||
== Existing menus == | |||
* [[View Menu]] | |||
[[Category:Developer Documentation]] | [[Category:Developer Documentation]] | ||
[[Category:Needs Work]] |
Latest revision as of 08:41, 28 July 2012
- 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)
- Deduce a Verb name which looks like SP_VERB_ + menu name (e.g. SP_VERB_EDIT_PASTE_AS_DUMMY)
- In src/verbs.h
- Locate the big enum at the beginning
- Add the new Verb name in the enum at the right place (e.g. after SP_VERB_EDIT_PASTE)
- In src/verbs.cpp
- Locate _base_verbs[] creation
- 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 (a GTK stock, an Inkscape icon or NULL)
- Locate the perform(...) function of the menu (e.g. locate EditVerb::perform(...))
- Add a new case to deal with your feature to call your function (e.g. to call sp_paste_as_dummy())
- In src/menus-skeleton.h
- Locate menus_skeleton[] variable
- Edit its content to add your new feature at the right place
- Save all, compile and run, it should works.
To be written.
See src/interface.cpp and src/interface.h.