[Developers] Creation of plugins
Bert Bril
bert at opendtect.org
Fri Nov 20 11:48:55 CET 2009
Hi all,
Satyaki and I made a plugin that shows a few uses of DataPointSet and
surrounding objects. It's in 4.1.0: the uiDPSDemo plugin. To activate
it, simply move the *.tut.alo from the 'disabled' directory in
plugins/platform_dir into the plugins/platform_dir itself.
I have 'recorded' what I did to create this plugin (on Linux):
1) Copied the 'uiHello' plugin directory to uiDPSDemo
- rename uihellopi.cc to uidpsdemo.cc
- edit Makefile, change uihellopi.cc to uidpsdemopi.cc, remove the
'PLAN_A' stuff
2) Edit uidpsdemopi.cc
- Find all 'Hello', replace (mostly with 'DPSDemo')
- Edit the plugin info
- Rename the callback function to uiDPSDemoMgr::doIt.
At this point in time, do nothing (just a uiMSG().error)
- Remove everything but the bare necessities
- Add menu item to 'Analysis' menu.
3) Make and use the plugin
- 'make' creates libuiDPSDemo.so
- link the plugin's .so to the libs directory in plugins/lux64
- in plugins/lux64, create odmain.dpsdemo.alo with only one line:
uiDPSDemo
(Note: in the release, we added a uiDPSDemo line to the tut .alo
files, but this is how you normally do it).
- Run OpendTect. Analysis menu now contains 'DataPointSet demo'.
- Add everything to CVS
I saved this state; you can fetch it at:
ftp://ftp.opendtect.org/pub/src/uidpsdemo_1.tgz
4) Make real 'payload'
- Copied a .h and .cc file with a uiDialog (used uiTools/uiselsimple)
to uidpsdemo.h and uidpsdemo.cc
- edit the files; make an almost empty dialog with a uiLabel
- edit uidpsdemopi.cc to include uidpsdemo.h and use uiDPSDemoDlg.
made plugin info comment variable to show how to do that.
- Copy an icon in data/icons.Default to dpsdemo.png, and change it
using kolourpaint.
- now use it for menu and toolbar.
- make, and start OpendTect to see this working
- add uidpsdemo.* and icon to CVS, and check in the lot
Saved to:
ftp://ftp.opendtect.org/pub/src/uidpsdemo_2.tgz
(icon must go into data/icons.Default)
... and then the real implementation started ...
I'll explain a few things about the DPS demo plugin, later.
Bert
--
-- Bert Bril / OpendTect developer at dGB
-- mailto:Bert.Bril at opendtect.org , http://opendtect.org
More information about the Developers
mailing list