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