For enhancing CSS support in Inkscape, a Style Dialog is being developed for selection of different objects on the basis of their various style attributes. Initiating with the creation of the Style Dialog, the first step was to register the new dialog in the application.
Verbs (generally called commands) are added to verbs.h in the project. They allow implementing functionality via use of menu items. For the style dialog, I added SP_VERB_DIALOG_STYLE to verbs.h. After this, the action corresponding to the newly added verb has to be defined.
Different classes for different types of verbs have been created in verbs.cpp. Corresponding to the DialogVerb class, the function perform(SPAction *action, void *data) is referred to add a new case for the verb SP_VERB_DIALOG_STYLE.
This shows up the Style Dialog when the corresponding verb is activated in the constructor of StyleDialog class. dt which is a pointer of SPDesktop class is the current desktop of the application where dialog will show up.
Next the verb must be added to the table of statically created verbs. The following line is added to _base_verbs.
new DialogVerb(SP_VERB_DIALOG_STYLE, "DialogStyle", N_("Style Dialog..."), N_("View Style Dialog"), NULL),
Lastly, the dialog should be registered in dialog-manager.cpp. Associating the dialog to both dockable and floating behavior, it is registered in the factory as follows:
registerFactory("StyleDialog", &create<StyleDialog, FloatingBehavior>);
registerFactory("StyleDialog", &create<StyleDialog, DockBehavior>);
Also since I wanted to add the Style Dialog option to Object menu, so in menu-skeleton, I added it under the Object Option using:
<verb verb-id=\"DialogStyle\" />\n"
This registered an empty Style Dialog in the Inkscape with an option in submenu for the dialog.