Graphicslab manuals

Creating a Plugin

TODO

Adding an empty plugin

  sampleplugin.cpp
  sampleplugin.h
  

The two files are in the download folder under sampleplugin_base TODO: in the parameters for ::run(): what is QString target? TODO: describe briefly the content of the two files

Showing a dialog when the plugin runs

Adding your actions

The real code will be in the class named after the plugin name. In the SampleDialog class you will then connect the events from the dialog with the single actions. If the plugin is not trivial you may want to split the logic in multiple classes, which you will load from your main plugin class (in our case the Sample class)

In the constructur, you will often want to pass the current document as a parameter.

Accessing the Scribus API

Scribus does not really have an API for plugins: You can access any functionality in Scribus from a plugin, but you have to take care that the code you're using is compiled before your own code. "Notamment", if you want to use functionality defined in the Scribus class (defined in the scribuscore.h file) you will have to add the dependincy to the main executable file at the end of the plugins' CMakeLists file:

ADD_DEPENDENCIES(${SCRIBUS_EXPORTEPUB_PLUGIN} ${EXE_NAME})

Using an "Options" structure to pass around the values from the dialog

Adding a progress bar