Warning, /graphics/kst-plot/src/plugins/HOWTO_add_a_plugin.txt is written in an unsupported language. File is not indexed.

0001 This file summarizes the steps needed to add a plugin to Kst.
0002 
0003 Note that in Kst 1.x times it was easier as one could compile a plugin outside of the source tree. At the moment, this is not possible with Kst 2.x.
0004 Kst 2.x offers more flexibility as to the way the plugin UI can be done, but it requires more code.
0005 
0006 First, some info regarding plugins:
0007 - Plugins are useful when you need to work on many samples at once (statistics, filters, etc...) because that's not possible with equations, which treat vectors one sample at a time
0008 - Plugins must implement 3 classes. Exampel for a plugin named GreatIdea:
0009         * class GreatIdeaSource : public Kst::BasicPlugin, responsible for data transfer, config loading and saving and the algorithm itself
0010         * class GreatIdeaPlugin : public QObject, public Kst::DataObjectPluginInterface, which implements the interface with the core of Kst
0011         * class ConfigWidgetGreatIdeaPlugin : public Kst::DataObjectConfigWidget, public Ui_GreatIdeaConfig which defines the configuration widget
0012 - Plugins have a type: either Filter (then they appear in the Filter context menu) or Fit (which puts them in the Fit menu) or Generic, in which case they can be created from the Create->Plugin menu. It is not possible at the moment to have more than one type, though this may change in the future. The type is set by implementing the corresponding method in the class derived, e.g.:
0013 virtual DataObjectPluginInterface::PluginTypeID pluginType() const { return Generic; }
0014 - Plugins crash the whole session if they crash, so please check all boundary conditions and corner cases.
0015 - Performance being an important feature in Kst, and some people having vectors with millions of points, try to optimize the code as much as possible.
0016 
0017 STEPS TO FOLLOW:
0018 1. Create the directory and add to CMakeLists.txt
0019 - Create a directory under the relevant subdirectory and edit src/plugins/CMakeLists.txt to add it to the list. The easiest way to initialize the plugin is to copy one that is similar (inputs/outputs) and then rename the files
0020 - If the plugin has a dependency (on an external lib for instance) you may have to add a cmake test for it. In that case take a look at the gsl example, which is required by a lot of plugins
0021 
0022 2. Edit the .desktop file
0023 This is the file that contains information displayed in the interface for the user. It is a simple text file
0024 
0025 3. Edit the configuration UI in QT Designer (using Qt Creator, just open the .ui file). Pay attention to the fact that according to how you configured the tool, it could be that you don't see the scalar or vector selectors. Use the object hierarchy to check what widgets are included in your design. Pay attention to the way you name the selector widgets; you'll use them in the code.
0026 
0027 4. Edit the .h and .cpp files, replacing the plugin name whereever appropriate and adapting to the given in/outputs. Start from the to and work your way through the file. It is somewhat tedious, but not very complicated. The core of the action goes to GreatIdeaSource::algorithm().
0028 
0029 5. Once you've reached the point where it compiles, optimize and debug as much as possible and then either commit it or send a patch to the list for review
0030 
0031 Happy hacking!