annotate xul/content/dialog_originalsize.js @ 252:59250ea2ad55

servlet version 1.19b5 - filename and dpi in request - filename and dpi in dlInfo-*
author robcast
date Wed, 25 Aug 2004 01:06:30 +0200
parents bf945fcf9105
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
203
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
1 /*
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
2 Copyright (C) 2003 WTWG, Uni Bern
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
3
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
4 This program is free software; you can redistribute it and/or
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
5 modify it under the terms of the GNU General Public License
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
6 as published by the Free Software Foundation; either version 2
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
7 of the License, or (at your option) any later version.
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
8
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
12 GNU General Public License for more details.
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
13
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
15 along with this program; if not, write to the Free Software
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
17
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
18 Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
19 */
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
20
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
21 var VERTICAL_PIXELS = 500;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
22 var HORIZONTAL_PIXELS = 500;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
23
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
24 function getCurrentOriginalSize() {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
25
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
26 var v_value = getSetting('originalsize_v_value');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
27 var v_unit = getSetting('originalsize_v_unit');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
28 var h_value = getSetting('originalsize_h_value');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
29 var h_unit = getSetting('originalsize_h_unit');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
30
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
31 document.getElementById('vertical_value').setAttribute('value', v_value);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
32 document.getElementById('horizontal_value').setAttribute('value', h_value);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
33
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
34 var items = document.getElementById('vertical_unit_popup').childNodes;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
35
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
36 for ( i = 0; i <items.length; i++ ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
37 if ( items[i].getAttribute('value') == v_unit ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
38 document.getElementById('vertical_unit_list').selectedItem = items[i];
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
39 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
40 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
41
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
42 items = document.getElementById('horizontal_unit_popup').childNodes;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
43
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
44 for ( i = 0; i <items.length; i++ ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
45 if ( items[i].getAttribute('value') == h_unit ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
46 document.getElementById('horizontal_unit_list').selectedItem = items[i];
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
47 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
48 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
49
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
50 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
51
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
52
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
53 function apply() {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
54
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
55 var v_value = document.getElementById('vertical_value').value;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
56 var h_value = document.getElementById('horizontal_value').value;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
57
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
58 var v_unit;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
59 var h_unit;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
60
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
61 var items = document.getElementById('vertical_unit_popup').childNodes;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
62
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
63 for ( i = 0; i <items.length; i++ ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
64 if ( items[i].getAttribute('selected') == 'true' ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
65 v_unit = items[i].getAttribute('value');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
66 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
67 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
68
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
69 items = document.getElementById('vertical_unit_popup').childNodes;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
70
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
71 for ( i = 0; i <items.length; i++ ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
72 if ( items[i].getAttribute('selected') == 'true' ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
73 h_unit = items[i].getAttribute('value');
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
74 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
75 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
76
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
77 if ( (parseFloat(v_value) == v_value) &&
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
78 (parseFloat(h_value) == h_value) ) {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
79
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
80 saveSetting('originalsize_v_value', v_value);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
81 saveSetting('originalsize_v_unit', v_unit);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
82 saveSetting('originalsize_h_value', h_value);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
83 saveSetting('originalsize_h_unit', h_unit);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
84
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
85 var dpi_v = (v_unit == "inch") ? VERTICAL_PIXELS / v_value :
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
86 (v_unit == "cm") ? VERTICAL_PIXELS / (v_value/2.54) :
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
87 v_value;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
88
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
89 var dpi_h = (h_unit == "inch") ? VERTICAL_PIXELS / h_value :
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
90 (h_unit == "cm") ? VERTICAL_PIXELS / (h_value/2.54) :
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
91 h_value;
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
92
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
93 opener.content.originalSize(dpi_v, dpi_h);
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
94
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
95 close();
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
96
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
97 } else {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
98 alert("Illegal value(s)!");
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
99 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
100
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
101 }
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
102
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
103
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
104 function cancel() {
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
105
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
106 close();
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
107
bf945fcf9105 restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff changeset
108 }