Embedding/defining incomplete plugins

Some plugins -- and as a matter of fact, the plot_options used as an example above, is one of them -- are not complete by themselves. They simply do not have the GUI elements to select some important values. They are meant to be used only embedded into other plugins.

In how far is the plot_options plugin incomplete? Well, for some option settings, it needs to know the name of the objects/expressions for the x and y axes (actually it will do fine if it only has either, but it needs at least one to function properly). However, it does not have a mechanism of selecting those objects, or entering them any other way. So how does it know about them?

In the logic section of the plot_options plugin there are two additional lines, not covered, yet:

	<logic>
		<external id="xvar" />
		<external id="yvar" />

		[...]
	</logic>
	

This defines two additional properties in the plot_options plugin, whose sole purpose is to be connected to some (yet unknown) properties of the embedding plugin. In the plot_options plugin those two properties are simply used like any other, and for instance there are calls to getString("xvar") in the plot_options JS template.

Now, for the incomplete plugin there is no way of knowing, where it will be embedded, and what the relevant settings in the embedding plugin will be called. So we need to add two additional lines in the embedding plugin's logic section as well:

	<logic>
		[...]

		<connect client="plotoptions.xvar" governor="xvarslot.available" />
		<connect client="plotoptions.yvar" governor="yvarslot.available" />
	</logic>
	

This is nothing new in principle, we have covered <connect> statements in the chapter of GUI logic. You simply connect the values in two varlots (called "xvarslot" and "yvarslot" in this example) to the receiving external properties of the embedded plugin. That is it. Everything else is taken care of automatically.