Author Topic: Spellchecker changes  (Read 368 times)

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Spellchecker changes
« on: November 27, 2011, 06:55:03 am »
Okay 0.5.8 is out...so a few notes on the changed spellchecker.

The installing instructions for the dictionary didn't change:
First you will need a dictionary. You can use the openOffice.org dicts for that. Either get one here or just use the en_US one. Now go in your PlaneShift installation directory to the "data" directory and create a new "dict" folder. In that new folder unzip the dictionary (spellchecker looks for planeshift/data/dict/<dict>.dic and planeshift/data/dict/<dict>.aff).

No need anymore to edit any config files as the spellchecker got a config gui in game now.

The real important change (for users) is that it now works for every "pawsEditTextBox" and "pawsMultilineEditTextBox". But by default it's turned off for any of those. In the default skin spellchecking is only done for the chat window input box and for books (title and text). But it's really no problem to have char description, quest notes, private and public notes in guild and a lot more spellchecked as well. Giving an example for the char description here...but works the same for almost everything else (And this is for the default elves skin...for other skins you have to edit the files contained in that skin):

First you need to find the xml file that defines the gui for the char description. That's not that hard...just go to "<planeshift-install-dir>/data/gui". In that folder is a file called "chardescwindow.xml". Open that file in your preferred text editor:
Code: [Select]
vim chardescwindow.xml

Now you have to find the part that defines the Edit box for editing the char description. Again not very hard as there is only one EditBox in this file...just search for "pawsMultilineEditTextBox". You should find a part looking like this:
Code: [Select]
...
        <pawsMultilineEditTextBox name="Description">
            <frame x="25" y="30" width="270" height="185" border="no" />
            <attachpoints>
                <attach point="PROPORTIONAL_RIGHT" />
                <attach point="PROPORTIONAL_TOP" />
                <attach point="PROPORTIONAL_LEFT" />
                <attach point="PROPORTIONAL_BOTTOM" />
            </attachpoints>
        </pawsMultilineEditTextBox>
...

Now all you have to do is add a "<spellChecker enable="true" r="255" g="0" b="0"/>" line to that "pawsMultilineEditTextBox" so it looks like this (position doesn't matter...could as well be put as the first line under <pawsMultilineEditTextBox>:
Code: [Select]
...
        <pawsMultilineEditTextBox name="Description">
            <frame x="25" y="30" width="270" height="185" border="no" />
            <attachpoints>
                <attach point="PROPORTIONAL_RIGHT" />
                <attach point="PROPORTIONAL_TOP" />
                <attach point="PROPORTIONAL_LEFT" />
                <attach point="PROPORTIONAL_BOTTOM" />
            </attachpoints>
            <spellChecker enable="true" r="255" g="0" b="0"/>
        </pawsMultilineEditTextBox>
...

The "enable" in that line turns on the spellchecker. In case you only want to turn it off but keep that line for easier changing it later again just set it to "false". The "r", "g," and "b" values define the color of the typos (range 0-255). In the example I simply use red (Use http://www.colorpicker.com/ to figuring out what values you want). That's about it.

Oh..and of course the spellchecker is only used in case it's available. It's no problem to turn it on in the xml files even on the windows client which doesn't have it...it just doesn't change anything then. Same if no dictionary could be found...the widget will just act as if the spellchecker is turned off.

A last notice on the gui.xml files. The pawsEditTextBox and pawsMultilineEditTextBox come in two versions there: "<pawsMultilineEditTextBox name="Description">" as in the example or "<widget name="body" factory="pawsMultilineEditTextBox" style="textinput">" (example for that in "bookwriting.xml"). For the spellchecker that makes no difference. Just add the one line and fine.

Further infos in http://bugs.hydlaaplaza.com/flyspray/index.php?task_id=4922.

derula

  • Hydlaa Citizen
  • *
  • Posts: 405
  • My main: Jamona Shikon
    • View Profile
    • Ugly Horst Tld.
Re: Spellchecker changes
« Reply #1 on: November 27, 2011, 07:14:26 am »
Code: [Select]
vim chardescwindow.xml

Ph! Vim! That's a vimsical excuse for a text editor! Real men use ed!

Thanks for the instructions!

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Re: Spellchecker changes
« Reply #2 on: November 27, 2011, 07:19:35 am »
true..ed is fine...everything is better than emacs.

* Aiwendil runs and grabs some popcorn for the upcoming flamewar.

miomo

  • Hydlaa Resident
  • *
  • Posts: 125
    • View Profile
Re: Spellchecker changes
« Reply #3 on: November 27, 2011, 07:24:31 am »
Awesome, another Vim user.  :thumbup:

And thanks for these instructions. I might have to try turning on the speling cheker.
Miomai is currently sane.

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Spellchecker changes
« Reply #4 on: November 27, 2011, 08:27:46 am »
:D miomo: The Apache (webserver) module "mod_speling" is misnamed exactly on this purpose.

vim? ed? Darned nerds. ;)

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

derula

  • Hydlaa Citizen
  • *
  • Posts: 405
  • My main: Jamona Shikon
    • View Profile
    • Ugly Horst Tld.
Re: Spellchecker changes
« Reply #5 on: November 27, 2011, 09:10:16 am »
vim? ed? Darned nerds. ;)

Actually, I just said ed because these kind of arguments are usually about vim, ed, and emacs. Personally, I prefer to edit text files only with echo and cat.

BoevenF

  • Hydlaa Notable
  • *
  • Posts: 543
  • Amdeneir citizen, mostly travelling
    • View Profile
    • The Doømed Ones SVG
Re: Spellchecker changes
« Reply #6 on: November 27, 2011, 01:14:51 pm »
mmmh, nobody still using midnight commander? oh gawd.

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Spellchecker changes
« Reply #7 on: November 27, 2011, 03:13:27 pm »
Nerds I said -- because there are only Linux users talking among each other. Not even expecting any other OS.

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Re: Spellchecker changes
« Reply #8 on: November 27, 2011, 03:17:04 pm »
Hey...it's not my fault the windows client has no spellchecker yet. It -should- work there.

And as far as I know it works on macs.

bilbous

  • Guest
Re: Spellchecker changes
« Reply #9 on: November 27, 2011, 05:00:56 pm »
I'm not sure why you say you no longer need to edit any files and then go on to tell us how to edit files.

By the way, I linked my browser spell check files as they are the ones I add to the most. I'm not sure a symlink will work but I think it ought to.

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Re: Spellchecker changes
« Reply #10 on: November 27, 2011, 05:05:02 pm »
I'm not sure why you say you no longer need to edit any files and then go on to tell us how to edit files.
Because that is how it worked before this version...you had to edit the config files to enable the spellchecker. The editing I explain here is more for people creating their own themes. For all others I think it's enough if they have the spellchecker enabled in books and chatwindow in the default theme.


By the way, I linked my browser spell check files as they are the ones I add to the most. I'm not sure a symlink will work but I think it ought to.
Good question...would be interested if that works. I think it should...but no clue how the VFS from CS handles symlinks.

bilbous

  • Guest
Re: Spellchecker changes
« Reply #11 on: November 27, 2011, 05:25:34 pm »
So I put the links in the directory and enabled the spellchecker and it seems to be working as words turn red but is there a way to get tab completion or to add words to the dictionary or is it just informative? Also do I need to enter the filenames in the spellchecker options?

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Re: Spellchecker changes
« Reply #12 on: November 27, 2011, 05:28:54 pm »
No tab-completion for misspelled words. It's only informative as you call it. To add new words not in your dictionary yet use options->spellchecker.

bilbous

  • Guest
Re: Spellchecker changes
« Reply #13 on: November 27, 2011, 06:29:43 pm »
OK. is that what the entry field is in the spellchecker options? I thought it was where you specify the data files.