--- /dev/null
+////////////////////////////////////////////////////\r
+// controlWindow object\r
+////////////////////////////////////////////////////\r
+function controlWindow( controlForm ) {\r
+ // private properties\r
+ this._form = controlForm;\r
+\r
+ // public properties\r
+ this.windowType = "controlWindow";\r
+// this.noSuggestionSelection = "- No suggestions -"; // by FredCK\r
+ this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ;\r
+ // set up the properties for elements of the given control form\r
+ this.suggestionList = this._form.sugg;\r
+ this.evaluatedText = this._form.misword;\r
+ this.replacementText = this._form.txtsugg;\r
+ this.undoButton = this._form.btnUndo;\r
+\r
+ // public methods\r
+ this.addSuggestion = addSuggestion;\r
+ this.clearSuggestions = clearSuggestions;\r
+ this.selectDefaultSuggestion = selectDefaultSuggestion;\r
+ this.resetForm = resetForm;\r
+ this.setSuggestedText = setSuggestedText;\r
+ this.enableUndo = enableUndo;\r
+ this.disableUndo = disableUndo;\r
+}\r
+\r
+function resetForm() {\r
+ if( this._form ) {\r
+ this._form.reset();\r
+ }\r
+}\r
+\r
+function setSuggestedText() {\r
+ var slct = this.suggestionList;\r
+ var txt = this.replacementText;\r
+ var str = "";\r
+ if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) {\r
+ str = slct.options[slct.selectedIndex].text;\r
+ }\r
+ txt.value = str;\r
+}\r
+\r
+function selectDefaultSuggestion() {\r
+ var slct = this.suggestionList;\r
+ var txt = this.replacementText;\r
+ if( slct.options.length == 0 ) {\r
+ this.addSuggestion( this.noSuggestionSelection );\r
+ } else {\r
+ slct.options[0].selected = true;\r
+ }\r
+ this.setSuggestedText();\r
+}\r
+\r
+function addSuggestion( sugg_text ) {\r
+ var slct = this.suggestionList;\r
+ if( sugg_text ) {\r
+ var i = slct.options.length;\r
+ var newOption = new Option( sugg_text, 'sugg_text'+i );\r
+ slct.options[i] = newOption;\r
+ }\r
+}\r
+\r
+function clearSuggestions() {\r
+ var slct = this.suggestionList;\r
+ for( var j = slct.length - 1; j > -1; j-- ) {\r
+ if( slct.options[j] ) {\r
+ slct.options[j] = null;\r
+ }\r
+ }\r
+}\r
+\r
+function enableUndo() {\r
+ if( this.undoButton ) {\r
+ if( this.undoButton.disabled == true ) {\r
+ this.undoButton.disabled = false;\r
+ }\r
+ }\r
+}\r
+\r
+function disableUndo() {\r
+ if( this.undoButton ) {\r
+ if( this.undoButton.disabled == false ) {\r
+ this.undoButton.disabled = true;\r
+ }\r
+ }\r
+}\r