[rkward-cvs] SF.net SVN: rkward: [1416] trunk/rkward/rkward/plugins
kapatp at users.sourceforge.net
kapatp at users.sourceforge.net
Tue Feb 20 05:23:08 UTC 2007
Revision: 1416
http://svn.sourceforge.net/rkward/?rev=1416&view=rev
Author: kapatp
Date: 2007-02-19 21:23:08 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
A new (incomplete) export plugin (using dev.print) under X11 device.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/under_development.pluginmap
Added Paths:
-----------
trunk/rkward/rkward/plugins/x11device/export_new.php
trunk/rkward/rkward/plugins/x11device/export_new.rkh
trunk/rkward/rkward/plugins/x11device/export_new.xml
Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap 2007-02-20 05:15:00 UTC (rev 1415)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap 2007-02-20 05:23:08 UTC (rev 1416)
@@ -2,6 +2,7 @@
<document base_prefix="" namespace="rkward">
<components>
+ <component type="standard" id="export_x11_device_new" file="x11device/export_new.xml" label="Export (new)" />
<component type="standard" id="setworkdir" file="00saveload/setworkdir.xml" label="Set Working Directory" />
</components>
@@ -24,5 +25,11 @@
<menu id="distributions" label="Distributions" index="7">
</menu>
</hierarchy>
+
+ <context id="x11">
+ <menu id="device" label="device" index="1">
+ <entry component="export_x11_device_new" />
+ </menu>
+ </context>
</document>
Added: trunk/rkward/rkward/plugins/x11device/export_new.php
===================================================================
--- trunk/rkward/rkward/plugins/x11device/export_new.php (rev 0)
+++ trunk/rkward/rkward/plugins/x11device/export_new.php 2007-02-20 05:23:08 UTC (rev 1416)
@@ -0,0 +1,34 @@
+<?php
+function preprocess () {
+}
+
+function calculate () {
+ $type = getRK_val ("format");
+ $file = getRK_val ("file");
+ if (getRK_val ("autoextension")) {
+ if ($type == "jpeg") $ext = ".jpg";
+ elseif ($type == "postscript") $ext = ".ps";
+ else $ext = "." . $type;
+ $possible_ext = substr($file, -4);
+ if (strcasecmp($ext, $possible_ext) != 0) $file .= $ext;
+ }
+ $options = "";
+ if (!getRK_val ("autowidth")) $options .= ", width=" . getRK_val ("width");
+ if (!getRK_val ("autoheight")) $options .= ", height=" . getRK_val ("height");
+ if (!getRK_val ("autopointsize")) $options .= ", pointsize=" . getRK_val ("pointsize");
+ if (($type == "jpeg") & (!getRK_val ("autoquality"))) $options .= ", quality=" . getRK_val ("quality");
+ if (!getRK_val ("autobg")) $options .= ", bg=\"" . getRK_val ("bg") . "\"";
+ if (!getRK_val ("autores")) $options .= ", res=" . getRK_val ("resolution");
+?>
+dev.set (<? getRK ("devnum"); ?>)
+dev.print (device=<? echo ($type); ?>, file="<? echo ($file); ?>"<? echo ($options); ?>)
+<?
+}
+
+function printout () {
+}
+
+function cleanup () {
+?><?
+}
+?>
\ No newline at end of file
Added: trunk/rkward/rkward/plugins/x11device/export_new.rkh
===================================================================
--- trunk/rkward/rkward/plugins/x11device/export_new.rkh (rev 0)
+++ trunk/rkward/rkward/plugins/x11device/export_new.rkh 2007-02-20 05:23:08 UTC (rev 1416)
@@ -0,0 +1,40 @@
+<!DOCTYPE rkhelp>
+<document>
+ <summary>
+ Export the current contents of a graphics device to a postscript/pdf/png/jpeg file. [postscript and pdf exports are yet to be implemented]
+ </summary>
+ <usage>
+ Chose a filename and filetype to save to. Additional options for size and resolution etc. are also available. Exporting is done using dev.print. Most of the exporting parameters are directly sent to the exporting function (postscript or pdf of png or jpeg) by dev.print.
+
+ This plugin is only available in the context of a graphics device.
+ </usage>
+ <settings>
+ <caption id="file_and_type"/>
+ <setting id="file">The filename to save to. After checking for file extension, this is the <i>file</i> parameter to dev.print.</setting>
+ <setting id="autoextension">Check this box to let RKWard detect the file extension automatically. If the filename specified in the filename box already has the relevant extension, then nothing is done, that is, the entire filename is used. Otherwise the relevant extension is appended to the filename above to construct the full filename.</setting>
+ <setting id="format">Choose whether to use postscript or pdf or png or jpeg for exporting the file. This is the <i>device</i> parameter to dev.print.</setting>
+ <caption id="pngjpeg_options"/>
+ <setting id="autowidth">Should the width be determined automatically? If yes, R will decide the appropriate width from the graphics device.</setting>
+ <setting id="width">Width in pixels. Uncheck the option above to use this. This is the <i>width</i> parameter to dev.print.</setting>
+ <setting id="autoheight">See width options above.</setting>
+ <setting id="height">See width options above. This is the <i>height</i> parameter to dev.print.</setting>
+ <setting id="autobg">Should the default background color be used? If yes, this is "white".</setting>
+ <setting id="bg">Background color for exporting the device. The "transparent" choice works only for exporting to png. Unceck the above option to use this. This is the <i>bg</i> parameter to dev.print.</setting>
+ <setting id="pointsize">This is the <i>pointsize</i> parameter to dev.print.</setting>
+ <setting id="resolution">This is the <i>res</i> parameter to dev.print.</setting>
+ <setting id="quality">Set the quality for exporting to JPEG. This options is disabled for exporting to PNG. This is the <i>quality</i> parameter to dev.print.</setting>
+ <caption id="pdf_options"/>
+ <caption id="ps_options"/>
+ <caption id="x11_options"/>
+ </settings>
+ <related>
+ <ul>
+ <li><link href="rkward://rhelp/dev.print"/></li>
+ <li><link href="rkward://rhelp/postscript"/></li>
+ <li><link href="rkward://rhelp/pdf"/></li>
+ <li><link href="rkward://rhelp/png"/></li>
+ <li><link href="rkward://rhelp/jpeg"/></li>
+ </ul>
+ </related>
+</document>
+
Added: trunk/rkward/rkward/plugins/x11device/export_new.xml
===================================================================
--- trunk/rkward/rkward/plugins/x11device/export_new.xml (rev 0)
+++ trunk/rkward/rkward/plugins/x11device/export_new.xml 2007-02-20 05:23:08 UTC (rev 1416)
@@ -0,0 +1,197 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="export_new.php" />
+ <help file="export_new.rkh" />
+ <logic>
+ <external id="devnum"/>
+
+ <convert id="isPS" mode="equals" sources="format.string" standard="postscript" />
+ <convert id="isPDF" mode="equals" sources="format.string" standard="pdf" />
+ <convert id="isJPEG" mode="equals" sources="format.string" standard="jpeg" />
+ <convert id="isPNG" mode="equals" sources="format.string" standard="png" />
+ <convert id="isJPEGPNG" mode="or" sources="isPNG;isJPEG" />
+
+ <connect client="pngjpeg_options.enabled" governor="isJPEGPNG" />
+ <connect client="pdf_options.enabled" governor="isPDF" />
+
+
+ <connect client="quality.enabled" governor="isJPEG" />
+ <connect client="autoquality.enabled" governor="isJPEG" />
+
+ <convert id="userwidth0" mode="equals" sources="autowidth.state" standard="0" />
+ <convert id="userwidth" mode="and" sources="userwidth0;isJPEGPNG" />
+ <connect client="width.enabled" governor="userwidth"/>
+
+ <convert id="userheight0" mode="equals" sources="autoheight.state" standard="0" />
+ <convert id="userheight" mode="and" sources="userheight0;isJPEGPNG" />
+ <connect client="height.enabled" governor="userheight"/>
+
+ <convert id="userpointsize0" mode="equals" sources="autopointsize.state" standard="0" />
+ <convert id="userpointsize" mode="and" sources="userpointsize0;isJPEGPNG" />
+ <connect client="pointsize.enabled" governor="userpointsize"/>
+
+ <convert id="userres0" mode="equals" sources="autores.state" standard="0" />
+ <convert id="userres" mode="and" sources="userres0;isJPEGPNG" />
+ <connect client="resolution.enabled" governor="userres"/>
+
+ <convert id="userbg0" mode="equals" sources="autobg.state" standard="0" />
+ <convert id="userbg" mode="and" sources="userbg0;isJPEGPNG" />
+ <connect client="bg.enabled" governor="userbg"/>
+
+ <convert id="userquality0" mode="equals" sources="autoquality.state" standard="0" />
+ <convert id="userquality" mode="and" sources="userquality0;autoquality.enabled" />
+ <connect client="quality.enabled" governor="userquality"/>
+ </logic>
+ <dialog label="Export contents of graphics device to png/jpeg format">
+ <tabbook>
+ <tab id="file_and_type" label="Filename/Type">
+ <row>
+ <column>
+<!-- <frame> -->
+ <browser size="medium" id="file" label="File name" initial="Rplot" />
+ <checkbox id="autoextension" value="1" value_unchecked="0" checked="true" label="Automatic File extension"/>
+<!-- </frame> -->
+ </column>
+ <column>
+ <radio id="format" label="Output format" >
+ <option value="postscript" label="Postscript" />
+ <option value="pdf" label="PDF" />
+ <option value="png" label="PNG" />
+ <option value="jpeg" label="JPEG" />
+ </radio>
+ </column>
+ <stretch/>
+ </row>
+ <stretch/>
+ </tab>
+ <tab id="pngjpeg_options" label="PNG/JPEG">
+ <row>
+ <frame>
+ <row>
+ <column>
+ <checkbox id="autowidth" value="1" value_unchecked="0" checked="true" label="Automatic Width"/>
+ <spinbox id="width" label="Width in pixels" min="20" initial="480" default_precision="1"/>
+ <!-- </frame> -->
+ </column>
+ <column>
+ <!-- <frame> -->
+ <checkbox id="autoheight" value="1" value_unchecked="0" checked="true" label="Automatic Height"/>
+ <spinbox id="height" label="Height in pixels" min="20" initial="480" default_precision="1" />
+ </column>
+ </row>
+ </frame>
+ <column>
+ <frame>
+ <checkbox id="autobg" value="1" value_unchecked="0" checked="true" label="Default Background"/>
+ <dropdown id="bg" label="Background">
+ <option value="transparent" label="Transparent" />
+ <option value="azure" label="Azure" />
+ <option value="black" label="Black" />
+ <option value="blue" label="Blue" />
+ <option value="blue1" label="Blue1" />
+ <option value="blue2" label="Blue2" />
+ <option value="blue3" label="Blue3" />
+ <option value="blue4" label="Blue4" />
+ <option value="brown" label="Brown" />
+ <option value="cyan" label="Cyan" />
+ <option value="darkviolet" label="Darkviolet" />
+ <option value="gold" label="Gold" />
+ <option value="gray" label="Gray" />
+ <option value="gray1" label="Gray1" />
+ <option value="gray2" label="Gray2" />
+ <option value="gray3" label="Gray3" />
+ <option value="gray4" label="Gray4" />
+ <option value="green" label="Green" />
+ <option value="green1" label="Green1" />
+ <option value="green2" label="Green2" />
+ <option value="green3" label="Green3" />
+ <option value="green4" label="Green4" />
+ <option value="grey" label="Grey" />
+ <option value="grey1" label="Grey1" />
+ <option value="grey2" label="Grey2" />
+ <option value="grey3" label="Grey3" />
+ <option value="grey4" label="Grey4" />
+ <option value="lawngreen" label="Lawngreen" />
+ <option value="limegreen" label="Limegreen" />
+ <option value="linen" label="Linen" />
+ <option value="magenta" label="Magenta" />
+ <option value="magenta1" label="Magenta1" />
+ <option value="magenta2" label="Magenta2" />
+ <option value="magenta3" label="Magenta3" />
+ <option value="magenta4" label="Magenta4" />
+ <option value="mintcream" label="Mintcream" />
+ <option value="mistyrose" label="Mistyrose" />
+ <option value="navajowhite" label="Navajowhite" />
+ <option value="orange" label="Orange" />
+ <option value="orchid" label="Orchid" />
+ <option value="palegreen" label="Palegreen" />
+ <option value="papayawhip" label="Papayawhip" />
+ <option value="peachpuff" label="Peachpuff" />
+ <option value="pink" label="Pink" />
+ <option value="red" label="Red" />
+ <option value="red1" label="Red1" />
+ <option value="red2" label="Red1" />
+ <option value="red3" label="Red3" />
+ <option value="red4" label="Red4" />
+ <option value="royalblue" label="Royalblue" />
+ <option value="salmon" label="Salmon" />
+ <option value="sandybrown" label="Sandybrown" />
+ <option value="seagreen" label="Seagreen" />
+ <option value="sienna" label="Sienna" />
+ <option value="skyblue" label="Skyblue" />
+ <option value="slategrey" label="Slategrey" />
+ <option value="snow" label="Snow" />
+ <option value="springgreen" label="Springgreen" />
+ <option value="steelblue" label="Steelblue" />
+ <option value="tan" label="Tan" />
+ <option value="thistle" label="Thistle" />
+ <option value="tomato" label="Tomato" />
+ <option value="violet" label="Violet" />
+ <option value="violetred1" label="Violetred1" />
+ <option value="violetred2" label="Violetred2" />
+ <option value="violetred3" label="Violetred3" />
+ <option value="violetred4" label="Violetred4" />
+ <option value="wheat" label="Wheat" />
+ <option value="white" label="White" checked="true" />
+ <option value="yellow" label="Yellow" />
+ <option value="yellow1" label="Yellow1" />
+ <option value="yellow2" label="Yellow2" />
+ <option value="yellow3" label="Yellow3" />
+ <option value="yellow4" label="Yellow4" />
+ <option value="yellowgreen" label="Yellowgreen" />
+ </dropdown>
+ <!-- <input id="bg" label="Background" size="medium" initial="'white'"/> -->
+ </frame>
+ </column>
+ </row>
+<!-- <row> -->
+ <frame><row>
+ <column>
+ <checkbox id="autopointsize" value="1" value_unchecked="0" checked="true" label="Default Font size"/>
+ <spinbox id="pointsize" label="Point size" min="0" initial="12" default_precision="1"/>
+ </column>
+ <column>
+ <checkbox id="autores" value="1" value_unchecked="0" checked="true" label="Default Resolution"/>
+ <spinbox id="resolution" label="Resolution (dpi)" min="0" initial="72" default_precision="1"/>
+ </column>
+ <column>
+ <checkbox id="autoquality" value="1" value_unchecked="0" checked="true" label="Default Quality"/>
+ <spinbox label="JPEG Quality" id="quality" min="0" max="100" initial="75" default_precision="1"/>
+ </column>
+ </row></frame>
+<!-- </row> -->
+ </tab>
+
+ <tab id="pdf_options" label="PDF">
+ <text>Not yet implemented!</text>
+ </tab>
+ <tab id="ps_options" label="Postscript">
+ <text>Not yet implemented!</text>
+ </tab>
+ <tab id="x11_options" label="X11">
+ <text>Not yet implemented!</text>
+ </tab>
+
+ </tabbook>
+ </dialog>
+</document>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list