[scribus] Plugin problem
Alexandre Seki
alexseki at gmail.com
Thu Apr 16 16:27:28 CEST 2009
Hi,
I tried the quick start from the site to build my plugin but doesn't work
well. In the "Extras" doesn't apper anything new and in the
"Preferences->Plugins" too. Any idea?
Quick Start
It's not too hard to jump in and start writing a plugin. The documentation
below describes the implementation of a plugin in some detail, with
references to places where you can find out more if you need it. A "plugin
template" is provided for your use, so if you like you can get started by
making a copy of that and getting hacking. Some basic instructions are
included in the file, and if you get confused you can refer back to this
document.
We'll build the plugin as a part of Scribus. That's the easiest way to get
started, though you'll probably want to start distributing it separately
later on (see later). To start work on an Action plugin:
We use CMake <http://cmake.org/>, as support for autotools has been
deprecated and moving forward it will be the only one used in 1.3.5+
- Copy scribus/plugins/myplugin to scribus/plugins/pluginname (where
"pluginname" is what you want to call your plugin). pluginname must be a
valid C identifier - I suggest sticking to nothing but lower case
characters.
- Edit scribus/plugins/CmakeLists.txt and add "pluginname" to it by
adding the subdirectory to the others. This tells Scribus's build system to
compile your plugin.
- rename all the files in scribus/plugins/pluginname/ from myplugin to
pluginname, eg myplugin.h to pluginname.h.
- rename myplugin wherever it appears in the files to pluginname, e.g.
myplugin_getPluginAPIVersion() to pluginname_getPluginAPIVersion(). Do
the same for MyPlugin and MYPLUGIN. On UNIX, you can use this command:
sed -i -e "s/myplugin/pluginname/g" -e "s/MyPlugin/PluginName/g" -e
"s/MYPLUGIN/PLUGINNAME/g" myplugin*
(all on one line, run from scribus/plugins/pluginname/).
You're now ready to start work on your plug-in. First, you need to fill out
some information about your plug-in in pluginname.cpp:
- In PluginName::languageChange():
- Change m_actionInfo.text to the text of the menu item you want to
trigger your plugin.
- Change m_actionInfo.menu to the name of the menu you want the menu
item to go in. See *FIXME where???? FIXME* for a list of menu names.
- If you want your plugin to have a keyboard shortcut, uncomment
m_actionInfo.keySequence and set it to your preferred shortcut. The
example there should show you how that works.
- Change the name in PluginName::fullTrName() to the name of your plugin
as you want it to appear in the Help->About Plugins dialog box and in the
Plugin Manager pane in the preferences.
- If you want your plugin to have information such as author info and a
description when the user looks at it in Help->About Plugins, fill out as
much as you want of the about info by assigning members of about. You can
see what information can be provided by looking at the definition of
AboutData in scplugin.h.
You've finished setting up the plugin, and can now start programming. Your
code should go in pluginnameimpl.cpp and pluginnameimpl.h. The existing code
should display a message dialog box.
To compile the plugin, you can simply re-run cmake with your usual options. ,
and make in the top-level Scribus directory. You may need to remove
CmakeCache.txt, but this is becoming a rarer necessity in newer versions of
CMake. When the compile completes, run make install and fire up Scribus.
Your plugin should now appear in the plugin manager (in the preferences),
and should have a menu item. If you press the menu item, a dialog box should
appear.
--
Thanks,
Alexandre K. Seki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20090416/35010189/attachment.htm>
More information about the scribus
mailing list