1 ////////////////////////////////////////////////////
\r
2 // controlWindow object
\r
3 ////////////////////////////////////////////////////
\r
4 function controlWindow( controlForm ) {
\r
5 // private properties
\r
6 this._form = controlForm;
\r
9 this.windowType = "controlWindow";
\r
10 // this.noSuggestionSelection = "- No suggestions -"; // by FredCK
\r
11 this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ;
\r
12 // set up the properties for elements of the given control form
\r
13 this.suggestionList = this._form.sugg;
\r
14 this.evaluatedText = this._form.misword;
\r
15 this.replacementText = this._form.txtsugg;
\r
16 this.undoButton = this._form.btnUndo;
\r
19 this.addSuggestion = addSuggestion;
\r
20 this.clearSuggestions = clearSuggestions;
\r
21 this.selectDefaultSuggestion = selectDefaultSuggestion;
\r
22 this.resetForm = resetForm;
\r
23 this.setSuggestedText = setSuggestedText;
\r
24 this.enableUndo = enableUndo;
\r
25 this.disableUndo = disableUndo;
\r
28 function resetForm() {
\r
34 function setSuggestedText() {
\r
35 var slct = this.suggestionList;
\r
36 var txt = this.replacementText;
\r
38 if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) {
\r
39 str = slct.options[slct.selectedIndex].text;
\r
44 function selectDefaultSuggestion() {
\r
45 var slct = this.suggestionList;
\r
46 var txt = this.replacementText;
\r
47 if( slct.options.length == 0 ) {
\r
48 this.addSuggestion( this.noSuggestionSelection );
\r
50 slct.options[0].selected = true;
\r
52 this.setSuggestedText();
\r
55 function addSuggestion( sugg_text ) {
\r
56 var slct = this.suggestionList;
\r
58 var i = slct.options.length;
\r
59 var newOption = new Option( sugg_text, 'sugg_text'+i );
\r
60 slct.options[i] = newOption;
\r
64 function clearSuggestions() {
\r
65 var slct = this.suggestionList;
\r
66 for( var j = slct.length - 1; j > -1; j-- ) {
\r
67 if( slct.options[j] ) {
\r
68 slct.options[j] = null;
\r
73 function enableUndo() {
\r
74 if( this.undoButton ) {
\r
75 if( this.undoButton.disabled == true ) {
\r
76 this.undoButton.disabled = false;
\r
81 function disableUndo() {
\r
82 if( this.undoButton ) {
\r
83 if( this.undoButton.disabled == false ) {
\r
84 this.undoButton.disabled = true;
\r