annotate xul/content/dialog_originalsize.js @ 383:b160385efafe

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