PageRenderTime 22ms CodeModel.GetById 9ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 27var previousUnits="";
 28
 29//////////////////////////////////////////////////////////////////////////////////////////////////
 30// Called when ... button is selected
 31//////////////////////////////////////////////////////////////////////////////////////////////////
 32function onFileSave()
 33{
 34	window.location='skp:on_file_save@'+document.getElementById("svgFilename").value;
 35}
 36
 37//////////////////////////////////////////////////////////////////////////////////////////////////
 38// Called when Ok button is selected
 39//////////////////////////////////////////////////////////////////////////////////////////////////
 40function onOk()
 41{
 42	scale = "1";
 43	if (document.getElementById("templateScale").checked)		
 44		scale = "2.835";
 45		
 46	// Convert to mm
 47	if (document.getElementById("inches").selected) {
 48		window.location='skp:on_ok@'+(document.getElementById("paperBorder").value*25.4)+","+document.getElementById("svgFilename").value+","+scale+","+previousUnits;
 49	} else {	
 50		window.location='skp:on_ok@'+document.getElementById("paperBorder").value+","+document.getElementById("svgFilename").value+","+scale+","+previousUnits;
 51	}
 52}
 53
 54//////////////////////////////////////////////////////////////////////////////////////////////////
 55// Called when cancelling dlg box
 56//////////////////////////////////////////////////////////////////////////////////////////////////
 57function onCancel()
 58{
 59	window.location='skp:on_close';
 60}
 61
 62//////////////////////////////////////////////////////////////////////////////////////////////////
 63// Called when changing units
 64//////////////////////////////////////////////////////////////////////////////////////////////////
 65function changeUnits()
 66{
 67	if ((document.getElementById("inches").selected) && (previousUnits=="mm")) {	
 68		document.getElementById("paperBorder").value=document.getElementById("paperBorder").value*0.0393700787;
 69		document.getElementById("borderLabel").innerHTML="Border (in):"
 70		previousUnits	="in";
 71	} else if ((document.getElementById("millimeters").selected) && (previousUnits=="in")) {
 72		document.getElementById("paperBorder").value=document.getElementById("paperBorder").value*25.4;
 73		document.getElementById("borderLabel").innerHTML="Border (mm):"
 74		previousUnits	="mm";
 75	}
 76}
 77
 78//////////////////////////////////////////////////////////////////////////////////////////////////
 79// Called to set dlg defaults
 80//////////////////////////////////////////////////////////////////////////////////////////////////
 81function setDefaults(defaults)
 82{
 83	args = defaults.split(',');
 84	document.getElementById("svgFilename").value = args[0];
 85	document.getElementById("paperBorder").value = args[1];
 86	document.getElementById("templateScale").checked = false;
 87	if (args[2] == "true")
 88		document.getElementById("templateScale").checked = true;
 89	document.getElementById("millimeters").selected=true;
 90	document.getElementById("borderLabel").innerHTML="Border (mm):"
 91	previousUnits="mm";
 92	if (args[3] == "in") {		
 93		document.getElementById("inches").selected=true;
 94		changeUnits();
 95	}
 96}
 97
 98//////////////////////////////////////////////////////////////////////////////////////////////////
 99// Called to set new SVG filename
100//////////////////////////////////////////////////////////////////////////////////////////////////
101function setFilename(filename)
102{	
103
104	// Peculiarity for mac appends ); to filename
105	var os = navigator.appVersion.indexOf('Mac') != -1? 'Mac' : 'Win';
106	if(os == 'Mac')
107	{
108		if (filename[filename.length-1]==';')
109			filename[filename.length-1] = '\0';
110		if (filename[filename.length-1]==')'	)
111			filename[filename.length-1] = '\0';		
112		if (filename[filename.length-1]=='\'')
113			filename[filename.length-1] = '\0';			
114	}
115
116	document.getElementById("svgFilename").value = filename;
117}
118
119//////////////////////////////////////////////////////////////////////////////////////////////////
120// Sketchup functions
121//////////////////////////////////////////////////////////////////////////////////////////////////
122function sizeWindow()
123{
124	// check the screen size
125	if(window.screen.availHeight <= 600 || window.screen.availWidth <= 800)
126	{
127		window.location = "skp:small_window";
128	}
129}
130function doLoad()
131{
132    var os = navigator.appVersion.indexOf('Mac') != -1? 'Mac' : 'Win';
133    if(os == 'Win')
134	{
135		window.location='skp:onload'
136	}
137	document.getElementById("templateScale").checked = false
138}
139-->
140</script>
141<link href="./spikySawStyle.css" rel="stylesheet" type="text/css" />
142</head>
143<html>
144<body onload="doLoad()"> 
145<table style="width: 100%">
146	<tr>	
147		<td width="50px">
148			<img src="./Images/dragonfly_50.png"/>
149		</td>	
150		<td width="100%">
151			<h2>Export Faces To SVG</h2>
152		</td>
153	</tr>
154	<tr>
155		<td colspan="2">
156			<table style="width: 100%">
157				<tr>
158					<td width="20%"><p class="heading-green">Output File:</p></td>
159					<td width="70%"><input class="text" style="width: 100%" id="svgFilename" type="text" value="flightsofideas.svg"/></td>
160					<td width="10%"><input class="button" type="button" value="..." onClick="onFileSave()"/></td>			
161				</tr>
162			</table>
163			<table style="width: 100%">
164				<tr>
165					<td width="20%"></td>
166					<td width="80%"><p class="heading-green"><input type="checkbox" id="templateScale"/> Scale for Ponoko Inkscape Templates</p></td>
167				</tr>		
168			</table>			
169			<table style="width: 100%">
170				<tr>
171					<td width="20%"><p class="heading-green">Measurements:</p></td>
172					<td width="20%">
173						<select width="100%">
174							<option id="millimeters">Millimeters...</option>
175							<option id="inches">Inches...</option>
176						</select>						
177					</td>		
178					<td width="20%">
179						<input class="button" onClick="changeUnits()" type="button" value="Update Values"/>
180					</td>
181					<td width="40%"></td>					
182				</tr>		
183			</table>	
184			<table style="width: 100%">
185				<tr>
186					<td width="20%"><p class="heading-green" id="borderLabel">Border:</p></td>
187					<td width="20%"><input class="text" style="width: 100%" id="paperBorder" type="text" value="10"/></td>
188					<td width="60%"></td>
189				</tr>		
190			</table>		
191		</td>
192	</tr>
193	<tr>
194		<td colspan="2">
195			<table style="width: 100%">
196				<tr>
197					<td width="33%" align="center"><input class="button" onClick="onOk()" type="button" value="Ok"/></td>
198					<td width="33%" align="center"><input class="button" onClick="onCancel()" type="button" value="Cancel"/></td>
199				</tr>
200			   </table>
201		<td>	   
202	</tr>
203</table>	   
204</div> 
205</body>
206</html>