
Hi all, I have been successful in making a menu-item in the *Object* Menu of the name *Recolor Artwork*. Just as an exercise I have copied the Fill and Stroke .cpp and .h files and translated the entire dialog to under the name *RecolorArtwork* rather than *FillAndStroke*. Logically this should mean that the entire dialog box shall now be replicated under the pseudonym of * RecolorArtwork*.
To add a menu-item I edited the *menu-skeleton.h* file's variable * menus_skeleton[]. *
I added " <verb verb-id="DialogRecolorArtwork" />\n " under " <verb verb-id="DialogFillStroke" />\n " This handles the display part of the task. Now what remains is linking the action and verb. I added a enum value: *SP_VERB_DIALOG_RECOLOR_ARTWORK* in *verbs.h* and in *verbs.cpp * I added:
*new DialogVerb(SP_VERB_DIALOG_RECOLOR_ARTWORK, "DialogRecolorArtwork", N_("_Recolor Artwork..."),* * N_("Description of Recolor Artwork..."), INKSCAPE_ICON("dialog-fill-and-stroke")),
* This links the verb *SP_VERB_DIALOG_RECOLOR_ARTWORK *and * DialogRecolorArtwork. *
In the same file *verbs.cpp*, I added:
*case SP_VERB_DIALOG_RECOLOR_ARTWORK:* * dt->_dlg_mgr->showDialog("RecolorArtwork");* * break;*
in the function: * * *void DialogVerb::perform(SPAction *action, void *data) * * * which launches the appropriate dialog or rather it should. Sadly this is not the case ?
Can someone please help me point out the what am I missing out ? -demicoder
On Sun, Apr 14, 2013 at 2:10 PM, Arshdeep Singh <moduli16@...400...> wrote:
Thankyou for the information. :)
I managed to find the 'display' part of the menu-items in " menus-skeleton.h " .
SYNTAX in MENU-SKELETON.H -
" <submenu name="" N_("_Object") "">\n" " <verb verb-id="DialogFillStroke" />\n"
verb-id attaches the action to launch the menu-item. I am unable to figure out where establish this verb-id and requisite action.
It shall be really helpful if you could point me in the right direction !
On Sun, Apr 14, 2013 at 12:57 AM, Jon Cruz <jon@...18...> wrote:
On Apr 12, 2013, at 11:20 AM, Arshdeep Singh wrote:
Hi all, I have made a small widget that is populated in a page in a notebook in
a panel. Right now, for experimental purposes it contains only a GTKButton. How can I make it appear in a menu like Fill and Stroke ?
Fill and Stroke is created under Object->Fill and Stroke
(Shift+Ctrl+F).
We're trying to focus on a more logical approach, rather than physical. In that direction we set up verbs and actions then just get those placed into the menus.
Actions are a GTK+ concept https://developer.gnome.org/gtk2/stable/GtkAction.html https://developer.gnome.org/gtkmm/unstable/classGtk_1_1Action.html
Then we have a higher-level concept of a 'verb'. Verbs, aside from predating GtkAction's addition to Gtk, are not tied to a specific Gtk window but apply per document. We also have helpers that can get a gkt action from an inkscape verb.
-- Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home