/FlightsOfIdeas/svgTemplateDialog.html

http://sketchup-svg-outline-plugin.googlecode.com/ · HTML · 206 lines · 72 code · 0 blank · 134 comment · 0 complexity · dc1f5a0c9218a61e66f4e794a8cc17a1 MD5 · raw file

  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html" />
  3. <link href="flightsOfIdeasStyle.css" rel="stylesheet" type="text/css" />
  4. <title>SVG Parameters (Flights of Ideas)</title>
  5. <script language="javascript">
  6. <!--
  7. //###########################################################
  8. //#
  9. //# Scalable Vector Graphics (SVG) from Google Sketchup Faces
  10. //# Copyright (C) 2008 Simon Beard
  11. //#
  12. //# This program is free software: you can redistribute it and/or modify
  13. //# it under the terms of the GNU General Public License as published by
  14. //# the Free Software Foundation, either version 3 of the License, or
  15. //# (at your option) any later version.
  16. //#
  17. //# This program is distributed in the hope that it will be useful,
  18. //# but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. //# GNU General Public License for more details.
  21. //#
  22. //# You should have received a copy of the GNU General Public License
  23. //# along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. //#
  25. //###########################################################
  26. var previousUnits="";
  27. //////////////////////////////////////////////////////////////////////////////////////////////////
  28. // Called when ... button is selected
  29. //////////////////////////////////////////////////////////////////////////////////////////////////
  30. function onFileSave()
  31. {
  32. window.location='skp:on_file_save@'+document.getElementById("svgFilename").value;
  33. }
  34. //////////////////////////////////////////////////////////////////////////////////////////////////
  35. // Called when Ok button is selected
  36. //////////////////////////////////////////////////////////////////////////////////////////////////
  37. function onOk()
  38. {
  39. scale = "1";
  40. if (document.getElementById("templateScale").checked)
  41. scale = "2.835";
  42. // Convert to mm
  43. if (document.getElementById("inches").selected) {
  44. window.location='skp:on_ok@'+(document.getElementById("paperBorder").value*25.4)+","+document.getElementById("svgFilename").value+","+scale+","+previousUnits;
  45. } else {
  46. window.location='skp:on_ok@'+document.getElementById("paperBorder").value+","+document.getElementById("svgFilename").value+","+scale+","+previousUnits;
  47. }
  48. }
  49. //////////////////////////////////////////////////////////////////////////////////////////////////
  50. // Called when cancelling dlg box
  51. //////////////////////////////////////////////////////////////////////////////////////////////////
  52. function onCancel()
  53. {
  54. window.location='skp:on_close';
  55. }
  56. //////////////////////////////////////////////////////////////////////////////////////////////////
  57. // Called when changing units
  58. //////////////////////////////////////////////////////////////////////////////////////////////////
  59. function changeUnits()
  60. {
  61. if ((document.getElementById("inches").selected) && (previousUnits=="mm")) {
  62. document.getElementById("paperBorder").value=document.getElementById("paperBorder").value*0.0393700787;
  63. document.getElementById("borderLabel").innerHTML="Border (in):"
  64. previousUnits ="in";
  65. } else if ((document.getElementById("millimeters").selected) && (previousUnits=="in")) {
  66. document.getElementById("paperBorder").value=document.getElementById("paperBorder").value*25.4;
  67. document.getElementById("borderLabel").innerHTML="Border (mm):"
  68. previousUnits ="mm";
  69. }
  70. }
  71. //////////////////////////////////////////////////////////////////////////////////////////////////
  72. // Called to set dlg defaults
  73. //////////////////////////////////////////////////////////////////////////////////////////////////
  74. function setDefaults(defaults)
  75. {
  76. args = defaults.split(',');
  77. document.getElementById("svgFilename").value = args[0];
  78. document.getElementById("paperBorder").value = args[1];
  79. document.getElementById("templateScale").checked = false;
  80. if (args[2] == "true")
  81. document.getElementById("templateScale").checked = true;
  82. document.getElementById("millimeters").selected=true;
  83. document.getElementById("borderLabel").innerHTML="Border (mm):"
  84. previousUnits="mm";
  85. if (args[3] == "in") {
  86. document.getElementById("inches").selected=true;
  87. changeUnits();
  88. }
  89. }
  90. //////////////////////////////////////////////////////////////////////////////////////////////////
  91. // Called to set new SVG filename
  92. //////////////////////////////////////////////////////////////////////////////////////////////////
  93. function setFilename(filename)
  94. {
  95. // Peculiarity for mac appends ); to filename
  96. var os = navigator.appVersion.indexOf('Mac') != -1? 'Mac' : 'Win';
  97. if(os == 'Mac')
  98. {
  99. if (filename[filename.length-1]==';')
  100. filename[filename.length-1] = '\0';
  101. if (filename[filename.length-1]==')' )
  102. filename[filename.length-1] = '\0';
  103. if (filename[filename.length-1]=='\'')
  104. filename[filename.length-1] = '\0';
  105. }
  106. document.getElementById("svgFilename").value = filename;
  107. }
  108. //////////////////////////////////////////////////////////////////////////////////////////////////
  109. // Sketchup functions
  110. //////////////////////////////////////////////////////////////////////////////////////////////////
  111. function sizeWindow()
  112. {
  113. // check the screen size
  114. if(window.screen.availHeight <= 600 || window.screen.availWidth <= 800)
  115. {
  116. window.location = "skp:small_window";
  117. }
  118. }
  119. function doLoad()
  120. {
  121. var os = navigator.appVersion.indexOf('Mac') != -1? 'Mac' : 'Win';
  122. if(os == 'Win')
  123. {
  124. window.location='skp:onload'
  125. }
  126. document.getElementById("templateScale").checked = false
  127. }
  128. -->
  129. </script>
  130. <link href="./spikySawStyle.css" rel="stylesheet" type="text/css" />
  131. </head>
  132. <html>
  133. <body onload="doLoad()">
  134. <table style="width: 100%">
  135. <tr>
  136. <td width="50px">
  137. <img src="./Images/dragonfly_50.png"/>
  138. </td>
  139. <td width="100%">
  140. <h2>Export Faces To SVG</h2>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td colspan="2">
  145. <table style="width: 100%">
  146. <tr>
  147. <td width="20%"><p class="heading-green">Output File:</p></td>
  148. <td width="70%"><input class="text" style="width: 100%" id="svgFilename" type="text" value="flightsofideas.svg"/></td>
  149. <td width="10%"><input class="button" type="button" value="..." onClick="onFileSave()"/></td>
  150. </tr>
  151. </table>
  152. <table style="width: 100%">
  153. <tr>
  154. <td width="20%"></td>
  155. <td width="80%"><p class="heading-green"><input type="checkbox" id="templateScale"/> Scale for Ponoko Inkscape Templates</p></td>
  156. </tr>
  157. </table>
  158. <table style="width: 100%">
  159. <tr>
  160. <td width="20%"><p class="heading-green">Measurements:</p></td>
  161. <td width="20%">
  162. <select width="100%">
  163. <option id="millimeters">Millimeters...</option>
  164. <option id="inches">Inches...</option>
  165. </select>
  166. </td>
  167. <td width="20%">
  168. <input class="button" onClick="changeUnits()" type="button" value="Update Values"/>
  169. </td>
  170. <td width="40%"></td>
  171. </tr>
  172. </table>
  173. <table style="width: 100%">
  174. <tr>
  175. <td width="20%"><p class="heading-green" id="borderLabel">Border:</p></td>
  176. <td width="20%"><input class="text" style="width: 100%" id="paperBorder" type="text" value="10"/></td>
  177. <td width="60%"></td>
  178. </tr>
  179. </table>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td colspan="2">
  184. <table style="width: 100%">
  185. <tr>
  186. <td width="33%" align="center"><input class="button" onClick="onOk()" type="button" value="Ok"/></td>
  187. <td width="33%" align="center"><input class="button" onClick="onCancel()" type="button" value="Cancel"/></td>
  188. </tr>
  189. </table>
  190. <td>
  191. </tr>
  192. </table>
  193. </div>
  194. </body>
  195. </html>