<!DOCTYPE rkplugin>
<document>
	<code file="plot_options.php" />
	<help file="plot_options.rkh" />
	<logic>
		<external id="xvar" default="" />
		<external id="yvar" default="" />

		<external id="default_pointtype" default="" />
		<external id="default_pointcolor" default="" />
		<external id="default_main" default="" />
		<external id="default_sub" default="" />
		<external id="default_xlab" default="" />
		<external id="default_ylab" default="" />

		<external id="allow_log" default="true" />
		<external id="allow_type" default="true" />
		<external id="allow_aspect" default="false" />
		<external id="allow_xlim" default="true" />
		<external id="allow_ylim" default="true" />

		<convert id="no_xvar" mode="equals" sources="xvar" standard="" />
		<convert id="no_yvar" mode="equals" sources="yvar" standard="" />

		<connect client="xminvalue.visible" governor="allow_xlim" />
		<connect client="xmaxvalue.visible" governor="allow_xlim" />
		<connect client="yminvalue.visible" governor="allow_ylim" />
		<connect client="ymaxvalue.visible" governor="allow_ylim" />
		<convert id="have_scale" mode="or" sources="xminvalue.visible;xmaxvalue.visible;yminvalue.visible;ymaxvalue.visible" />
		<connect client="scale.visible" governor="have_scale" />

		<!-- If we do not have an xvar specified, it is not possible to specify one xlimit but not the other -->
		<convert id="xmin_specified" mode="notequals" sources="xminvalue.text" standard="" />
		<convert id="xmax_specified" mode="notequals" sources="xmaxvalue.text" standard="" />
		<convert id="xmin_required" mode="and" sources="xmax_specified;no_xvar" />
		<convert id="xmax_required" mode="and" sources="xmin_specified;no_xvar" />
		<connect client="xminvalue.required" governor="xmin_required" />
		<connect client="xmaxvalue.required" governor="xmax_required" />
		<!-- Same for y -->
		<convert id="ymin_specified" mode="notequals" sources="yminvalue.text" standard="" />
		<convert id="ymax_specified" mode="notequals" sources="ymaxvalue.text" standard="" />
		<convert id="ymin_required" mode="and" sources="ymax_specified;no_yvar" />
		<convert id="ymax_required" mode="and" sources="ymin_specified;no_yvar" />
		<connect client="yminvalue.required" governor="ymin_required" />
		<connect client="ymaxvalue.required" governor="ymax_required" />

		<convert id="xlabfilled" mode="notequals" sources="xlab.text" standard="" />
		<connect client="xlabisquote.enabled" governor="xlabfilled" />
		<convert id="ylabfilled" mode="notequals" sources="ylab.text" standard="" />
		<connect client="ylabisquote.enabled" governor="ylabfilled" />
		<convert id="mainfilled" mode="notequals" sources="main.text" standard="" />
		<connect client="mainisquote.enabled" governor="mainfilled" />
		<convert id="subfilled" mode="notequals" sources="sub.text" standard="" />
		<connect client="subisquote.enabled" governor="subfilled" />

		<connect client="xlog.visible" governor="allow_log"/>
		<connect client="ylog.visible" governor="allow_log"/>
		<connect client="aspectratio.visible" governor="allow_aspect"/>
		<connect client="pointtypepage.visible" governor="allow_type"/>
		<connect client="pointtype.string" governor="default_pointtype" />

		<connect client="pointcolor.default_color" governor="default_pointcolor" />

		<external id="allow_grid" default="false" />
		<connect client="tab_grid.visible" governor="allow_grid"/>
		<convert id="grid_enable" sources="tab_grid.visible;add_grid.state" mode="and"/>
		<connect client="grid_options.enabled" governor="grid_enable" />
	</logic>
	<dialog label="Default plot options" >
		<tabbook>
			<tab id="titlepage" label="Title">
				<column>
					<frame label="Main title">
						<input id="main" label="Main title (on top). Leave empty for default title" />
						<checkbox id="mainisquote" label="Interpret this label as literal (quoted) string" checked="true" value="1" />
					</frame>
					<frame label="Subtitle">
						<input id="sub" label="Sub-title (at bottom). Leave empty for default title" />
						<checkbox id="subisquote" label="Interpret this label as literal (quoted) string" checked="true" value="1" />
					</frame>
					<stretch/>
				</column>
			</tab>
			<tab id="axespage" label="Axes" >
				<column>
					<frame id="axistypes" label="Axis types">
						<row>
							<checkbox id="xaxt" label="Draw X axis" checked="true" value="" value_unchecked="n" />
							<checkbox id="yaxt" label="Draw Y axis" checked="true" value="" value_unchecked="n" />
						</row>
						<row>
							<checkbox id="xlog" label="X axis logarithmic" checked="false" value="x" value_unchecked="" />
							<checkbox id="ylog" label="Y axis logarithmic" checked="false" value="y" value_unchecked="" />
						</row>
					</frame>
					<frame id="axislabels" label="Labels (leave empty for default)">
						<row>
							<input id="xlab" label="X axis label" />
							<input id="ylab" label="Y axis label" />
						</row>
						<text>Interpret these labels as literal (quoted) strings?</text>
						<row>
							<checkbox id="xlabisquote" label="interpret as string" value="1" checked="true" />
							<checkbox id="ylabisquote" label="interpret as string" value="1" checked="true" />
						</row>
					</frame>
					<frame id="scale" label="Scale (Minimum/Maximum values for X/Y). Leave blank for automatic">
						<row>
							<input id="xminvalue" label="Min X value" />
							<input id="yminvalue" label="Min Y value" />
						</row>
						<row>
							<input id="xmaxvalue" label="Max X value" />
							<input id="ymaxvalue" label="Max Y value" />
						</row>
					</frame>
					<stretch/>
				</column>
			</tab>
			<tab id="pointtypepage" label="Points / Lines">
				<dropdown id="pointtype" label="Type of points/lines" >
					<option value="" label="default" checked="true" />
					<option value="p" label="Plot individual points " />
					<option value="l" label="Plot lines " />
					<option value="b" label="Plot points connected by lines (both)" />
					<option value="o" label="Plot points overlaid by lines " />
					<option value="h" label="Plot vertical lines from points to the zero axis (high-density)" />
					<option value="s" label="Step-function plots: the left edge defines the point" />
					<option value="S" label="Step-function plots: the right edge defines the point" />
				</dropdown>
				<embed id="pointcolor" component="rkward::color_chooser" label="Color" />
				<stretch/>
			</tab>
			<tab id="aspectratio" label="Aspect ratio y/x">
				<column>
					<spinbox type="real" label="Aspect ratio" id="asp" initial="0"/>
					<text>Note that if Aspect is a finite positive value then the window is set up so that one data unit in the x direction is equal in length to asp * one data unit in the y direction.</text>
					<text>The special case Aspect == 1 produces plots where distances between points are represented accurately on screen. Values with Aspect > 1 can be used to produce more accurate maps when using latitude and longitude.</text>
					<stretch/>
				</column>
			</tab>
			<tab id="tab_grid" label="Grid">
				<checkbox id="add_grid" label="Add Grid to the plot" value="1" value_unchecked="0"/>
				<embed id="grid_options" component="rkward::x11grid"/>
			</tab>
		</tabbook>
	</dialog>
</document>
