source: DASISH/t5.6/client/branches/webannotator-basic/chrome/markingcollection/content/markingcollection/treeprojectDialogOverlay.xul @ 5428

Last change on this file since 5428 was 5428, checked in by stephanie.roth@snd.gu.se, 10 years ago

Added new branch for work on schema change related client fixes.

File size: 7.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE prefwindow SYSTEM "chrome://markingcollection/locale/markingcollection.dtd">
3<overlay
4        id="treeprojectDialogOverlay"
5        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
6        xmlns:html="http://www.w3.org/1999/xhtml">
7        <script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js" />
8        <script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
9        <script type="application/x-javascript">
10        <![CDATA[
11                var defLanguageGroup;
12                var defFontFamily;
13                var defFontSize;
14                var defBackgroundColor;
15
16                function STRING() { return document.getElementById("bitsSelectDisplayTextPlainStringbundle"); }
17
18                function _treeprojectDialogOverlayInit(aEvent){
19                        var textplain_display = nsPreferences.copyUnicharPref("wiredmarker.textplain.display","usually");
20                        switch(textplain_display){
21                                case "confirm":
22                                        document.getElementById("bitsSelectDisplayTextPlainUsually").removeAttribute("selected");
23                                        document.getElementById("bitsSelectDisplayTextPlainConfirm").setAttribute("selected","true");
24                                        document.getElementById("bitsSelectDisplayTextPlainWrapping").removeAttribute("selected");
25                                        break;
26                                case "wrapping":
27                                        document.getElementById("bitsSelectDisplayTextPlainUsually").removeAttribute("selected");
28                                        document.getElementById("bitsSelectDisplayTextPlainConfirm").removeAttribute("selected");
29                                        document.getElementById("bitsSelectDisplayTextPlainWrapping").setAttribute("selected","true");
30                                        break;
31                                default:
32                                        document.getElementById("bitsSelectDisplayTextPlainUsually").setAttribute("selected","true");
33                                        document.getElementById("bitsSelectDisplayTextPlainConfirm").removeAttribute("selected");
34                                        document.getElementById("bitsSelectDisplayTextPlainWrapping").removeAttribute("selected");
35                                        break;
36                        }
37
38                        _rebuildFonts();
39                        _rebuildColor();
40                }
41
42                function _treeprojectDialogOverlayDone(aEvent){
43                }
44
45                function _SelectTextPlainCommand(aEvent){
46                        nsPreferences.setUnicharPref("wiredmarker.textplain.display", aEvent.target.value);
47                }
48
49                function _commandTextPlainFontFamily(aEvent){
50                        const prefKey = "wiredmarker.textplain.font.name";
51                        if(aEvent.target.value == defFontFamily){
52                                var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
53                                try{branch.clearUserPref(prefKey);}catch(e){}
54                        }else{
55                                nsPreferences.setUnicharPref(prefKey, aEvent.target.value);
56                        }
57                }
58
59                function _changeTextPlainFontSize(aEvent){
60                        const prefKey = "wiredmarker.textplain.font.size";
61                        if(aEvent.target.value == defFontSize){
62                                var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
63                                try{branch.clearUserPref(prefKey);}catch(e){}
64                        }else{
65                                if(aEvent.target.value>72) aEvent.target.value=72;
66                                if(aEvent.target.value<9) aEvent.target.value=9;
67                                nsPreferences.setIntPref(prefKey, aEvent.target.value);
68                        }
69                }
70
71                function _changeTextPlainBackgroundColor(aEvent){
72                        const prefKey = "wiredmarker.textplain.background_color";
73                        if(aEvent.target.color == defBackgroundColor){
74                                var branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
75                                try{branch.clearUserPref(prefKey);}catch(e){}
76                        }else{
77                                nsPreferences.setUnicharPref(prefKey, aEvent.target.color);
78                        }
79                }
80
81                function _rebuildColor(){
82                        if(!defBackgroundColor) defBackgroundColor = nsPreferences.copyUnicharPref("browser.display.background_color");
83                        var backgroundColor = nsPreferences.copyUnicharPref("wiredmarker.textplain.background_color",defBackgroundColor);
84                        document.getElementById("bitsSelectDisplayTextPlainAttrBackgroundColor").color = backgroundColor;
85                }
86
87                function _rebuildFonts(){
88                        const kFontNameFmtMonospace = "font.name.monospace.%LANG%";
89                        const kFontSizeFmtMonospace = "font.size.fixed.%LANG%";
90
91                        defLanguageGroup = STRING().getString("font.language.group");
92
93                        if(!defFontFamily) defFontFamily = nsPreferences.copyUnicharPref(kFontNameFmtMonospace.replace(/%LANG%/, defLanguageGroup));
94                        var fontFamily = nsPreferences.copyUnicharPref("wiredmarker.textplain.font.name",defFontFamily);
95
96                        if(!defFontSize) defFontSize = nsPreferences.getIntPref(kFontSizeFmtMonospace.replace(/%LANG%/, defLanguageGroup));
97                        var fontSize = nsPreferences.getIntPref("wiredmarker.textplain.font.size",defFontSize);
98
99                        var element = document.getElementById("bitsSelectDisplayTextPlainAttrFontFamily");
100                        if(element){
101                                FontBuilder.buildFontList(defLanguageGroup, "monospace", element);
102                                element.value = fontFamily;
103                        }
104                        var elementSize = document.getElementById("bitsSelectDisplayTextPlainAttrFontSize");
105                        if(elementSize){
106                                elementSize.value = fontSize;
107                        }
108                }
109
110                function _dump2(aString){
111                        var dumpString = new String(aString);
112                        var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
113                        aConsoleService.logStringMessage(dumpString);
114                        window.dump(aString+"\n");
115                }
116
117                window.addEventListener("load", _treeprojectDialogOverlayInit, false);
118                window.addEventListener("unload", _treeprojectDialogOverlayDone, false);
119        ]]>
120        </script>
121        <stringbundleset id="mcSettingStringbundleset">
122                <stringbundle id="bitsSelectDisplayTextPlainStringbundle" src="chrome://global/locale/intl.properties" />
123        </stringbundleset>
124        <tabbox id="mcSettingTabbox">
125                <tabpanels id="mcSettingTabPanels">
126                        <tabbox id="mcMenuTabbox">
127                                <tabpanels id="mcMenuTabPanels">
128                                        <tabpanel id="mcMenuTabPanel" orient="vertical" flex="1">
129                                                <hbox>
130                                                        <groupbox id="bitsSelectDisplayTextPlain" insertafter="mcMenuTabPanelRow3">
131                                                                <caption label="&markingcollection.textplain;" style="background-color:#fff;"/>
132                                                                <radiogroup id="" oncommand="_SelectTextPlainCommand(event)">
133                                                                        <radio id="bitsSelectDisplayTextPlainUsually"  value="usually"  label="&markingcollection.textplain.usually;"/>
134                                                                        <radio id="bitsSelectDisplayTextPlainConfirm"  value="confirm"  label="&markingcollection.textplain.confirm;"/>
135                                                                        <radio id="bitsSelectDisplayTextPlainWrapping" value="wrapping" label="&markingcollection.textplain.wrapping;"/>
136                                                                </radiogroup>
137                                                                <groupbox id="bitsSelectDisplayTextPlainAttr" insertafter="" orient="horizontal" align="center">
138                                                                        <caption label="&markingcollection.textplain.attr;" style="background-color:#fff;"/>
139                                                                        <hbox>
140                                                                                <grid>
141                                                                                        <columns>
142                                                                                                <column pack="end"/>
143                                                                                                <column pack="start" flex="1"/>
144                                                                                        </columns>
145                                                                                        <rows>
146                                                                                                <row align="center">
147                                                                                                        <hbox align="center"  pack="end">
148                                                                                                                <label value="&markingcollection.textplain.font-family;:" control="bitsSelectDisplayTextPlainAttrFontFamily"/>
149                                                                                                        </hbox>
150                                                                                                        <menulist id="bitsSelectDisplayTextPlainAttrFontFamily" oncommand="_commandTextPlainFontFamily(event)"/>
151                                                                                                </row>
152                                                                                                <row align="center">
153                                                                                                        <hbox align="center"  pack="end">
154                                                                                                                <label value="&markingcollection.textplain.font-size;:" control="bitsSelectDisplayTextPlainAttrFontSize"/>
155                                                                                                        </hbox>
156                                                                                                        <hbox align="center">
157                                                                                                                <textbox id="bitsSelectDisplayTextPlainAttrFontSize" maxlength="2" min="9" max="72" size="1" type="number" wraparound="false" onchange="_changeTextPlainFontSize(event)"/>
158                                                                                                                <label value="&markingcollection.textplain.background-color;:" control="bitsSelectDisplayTextPlainAttrBackgroundColor"/>
159                                                                                                                <colorpicker id="bitsSelectDisplayTextPlainAttrBackgroundColor" type="button" onchange="_changeTextPlainBackgroundColor(event)"/>
160                                                                                                        </hbox>
161                                                                                                </row>
162                                                                                        </rows>
163                                                                                </grid>
164                                                                        </hbox>
165                                                                </groupbox>
166                                                        </groupbox>
167                                                </hbox>
168                                        </tabpanel>
169                                </tabpanels>
170                        </tabbox>
171                </tabpanels>
172        </tabbox>
173</overlay>
Note: See TracBrowser for help on using the repository browser.