/*   

*******************************************************

                      WWSpell

          A Multilanguage SpellChecker for 
          Wordworth 6 by Andreas Ericsson 
      (hb96anez@kamelen.hedbergska.sundsvall.se)

            Version 1.0  - 96.11.25

*******************************************************

*/

OPTIONS RESULTS


/* !!!!!!!!!!!!!!!!! Your Personal Settings !!!!!!!!!!!!!!!!!!!!!! */

language="Swedish"
alphaspelldrawer="c:"
dictionarydrawer="work:ord/misc/dict/"

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */


/* Copy some files to ram: */
ADDRESS COMMAND "makedir ram:spell quiet"
ADDRESS COMMAND "copy "alphaspelldrawer"alphaspell to ram:spell force quiet"
ADDRESS COMMAND "copy "dictionarydrawer"#? to ram:spell force quiet"
ADDRESS COMMAND "copy c:delete to ram:spell force quiet"

/* Go to the beginning of the file */
POSITION SOF

/* Get the word */
ALTDOWN
SHIFTDOWN
CURSOR RIGHT			/* Mark the word */
GETTEXT				/* Get the marked word */
unspelled=result                /* Put the word in 'unspelled' */


ALPHASPELL:
/* Checks the word and sets the env-variable ok. */
CALL CLOSE(envar)
ADDRESS COMMAND "ram:spell/delete ENV:ok force quiet"
ADDRESS COMMAND "ram:spell/AlphaSpell -o ENV:ok -Tw "unspelled"-d ram:spell/ User.??[!x] "language".??[!x]"

/* Open the file ENV:ok and read it */
IF ~OPEN(envar, 'ENV:ok', 'Read') THEN DO
   RequestNotify 'Cannot open ENV:ok'
   EXIT
   END

correct=READCH(envar, 1)

if correct='0' then
	WizardReq TITLE "WWSpell request" LABEL unspelled"wasn't found in the dictionary" Textbox 1 "_Change:" BUTTON 2 "_Ignore" BUTTON 1 "_Change" BUTTON "-1" "_Abort" CONTENTS unspelled
	buttonpressed=result

	/* Abort */
	IF buttonpressed = -1 THEN 
	SIGNAL QUIT

	/* Ignore */
	IF buttonppressed = 2 Then
	SIGNAL NEXT_WORD

	/* Change */
	IF buttonpressed = 1 then do
	cha=1
	WIZARD_GETTEXTBOX 1
	newspelled=result
	TEXT newspelled" "
	end	

NEXT_WORD:

/* Go to next word */
ALTUP
SHIFTUP
CURSOR RIGHT
If cha='1' then Cursor left
cha=0

/* Get the word */
ALTDOWN
SHIFTDOWN
CURSOR RIGHT			/* Mark the word */
GETTEXT				/* Get the marked word */
unspelled=result                /* Put the word in 'unspelled' */

SIGNAL ALPHASPELL

QUIT:
ADDRESS COMMAND "delete ram:spell all force quiet"
ALTUP
SHIFTUP
CURSOR RIGHT
CURSOR LEFT
exit
