Skip to content

Commit

Permalink
Added class comments, minor refactorings.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldofJARcraft committed Jul 22, 2019
1 parent 13fd399 commit 7a85454
Show file tree
Hide file tree
Showing 34 changed files with 60 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
I am a user interface for managing (modifying and changing) the loaded dictionary.

Instance Variables
availableLanguages <OrderedCollection> The languages that can currently be selected.
selectedLanguage: <String> The currently selected language of the loaded dictionary
selectedLanguageIndices <Dictionary> Each value pair <Number, Boolean> describes if language with number Number is currently active.
selectedWord: <String> The currently selected word of the words added to the dictionary by the user
spellchecker: <SPCSpellChecker> The current spellchecker

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ initialize
self spellchecker: SPCSpellChecker instance.
self selectUsedLanguage.
SPCSpellChecker registerObserver: self.
"SHow currently loaded languages."
"So the list of languages is refreshed."
self changed: #loadedLanguages
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ openDownloadPageOnWindows
| aCollection |
aCollection := OrderedCollection new.
aCollection add: (SPCDictionaryManagementUI downloadPageLink).
(ExternalWindowsOSProcess programName: 'explorer' arguments: aCollection initialEnvironment: '') value.
(ExternalWindowsOSProcess programName: 'explorer' arguments: aCollection initialEnvironment: '') value
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ selectedLanguageAt: anIndex put: anObject
| languageName |
anObject ifNotNil:[
self selectedLanguageIndices at: anIndex put: anObject.
self changed: #selectedLanguage.
self changed: #selectedLanguage
].
languageName := self availableLanguages at: anIndex ifAbsent: [ SPCHunspellLanguage english languageName ].
anObject ifTrue: [
self loadLanguage: languageName.
self loadLanguage: languageName
]
ifFalse: [
self unloadLanguage: languageName.
self unloadLanguage: languageName
]

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
selectedLanguageIndices: anObject

selectedLanguageIndices := anObject.
selectedLanguageIndices := anObject
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ unloadLanguage: languageName
language affixPath: (self affixPath: languageName).
language dictionaryPath: (self dictionaryPath:languageName).
language languageName: languageName.
(self spellchecker loadedLanguages) do: [ :each | (each = language) ifTrue: [ self spellchecker removeLanguage: language ] ].

self spellchecker reloadHunspellHandle.
(self spellchecker loadedLanguages) do: [ :each | (each = language) ifTrue: [ self spellchecker removeLanguage: language ] ]

Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
"dictionaryFileName:" : "ea 6/13/2019 09:44",
"dictionaryPath:" : "ea 6/13/2019 11:22",
"importDictionary" : "mka 7/16/2019 16:53",
"initialize" : "ea 6/17/2019 14:52",
"initialize" : "ea 7/22/2019 09:23",
"loadLanguage:" : "mka 7/16/2019 16:53",
"loadedLanguages" : "ow 7/12/2018 16:41",
"open" : "RS 7/22/2018 20:56",
"openDownloadPage" : "mka 7/16/2019 16:53",
"openDownloadPageOnMacOS" : "mka 7/8/2019 14:42",
"openDownloadPageOnUnix" : "mka 7/8/2019 14:42",
"openDownloadPageOnWindows" : "mka 7/8/2019 14:49",
"openDownloadPageOnWindows" : "ea 7/22/2019 09:24",
"removeFromIgnoredWords" : "ea3 6/18/2019 18:33",
"selectUsedLanguage" : "ea 6/17/2019 15:58",
"selectedLanguageAt:" : "ea3 6/18/2019 18:22",
"selectedLanguageAt:put:" : "ea 7/1/2019 14:26",
"selectedLanguageAt:put:" : "ea 7/22/2019 09:24",
"selectedLanguageDirectoryPath" : "ow 7/12/2018 16:56",
"selectedLanguageDirectoryPath:" : "ea 6/13/2019 09:42",
"selectedLanguageIndices" : "ea 6/13/2019 10:41",
"selectedLanguageIndices:" : "ea 6/13/2019 10:41",
"selectedLanguageIndices:" : "ea 7/22/2019 09:23",
"selectedWord" : "ow 7/5/2018 17:05",
"selectedWord:" : "RS 7/22/2018 20:52",
"spellchecker" : "ow 7/25/2018 20:11",
"spellchecker:" : "ow 7/25/2018 20:11",
"unloadLanguage:" : "mka 7/2/2019 15:52",
"unloadLanguage:" : "ea 7/22/2019 09:24",
"usedLanguage" : "ea 6/13/2019 12:20" } }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "ow 7/25/2018 20:14",
"commentStamp" : "ea 7/22/2019 09:08",
"instvars" : [
"selectedWord",
"availableLanguages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ I provide simple access to the hunspell library for spellchecking.
Instance Variables
apiHandle: <void*> This is needed by the c-library for function calls and obtained
by calling apiCreateHandle: dPath:
dictionaryPath: <String> Path to the dictionary of the loaded language.
affixPath: <String> Path to the grammar / affix file of the loaded language.


Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Instance" ],
"classvars" : [
"DisableDownload" ],
"commentStamp" : "ow 7/21/2018 17:23",
"commentStamp" : "ea 7/22/2019 09:09",
"instvars" : [
"apiHandle",
"dictionaryPath",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
I collect all currently active languages.

Instance Variables
alertOnError: <Boolean> Flag that controls if error dialogs should appear.
instances: <OrderedCollection> A collection of Hunspell instances which spell-check the current language.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library
systemArchitecture

^ Smalltalk image wordSize * 8.
^ Smalltalk image wordSize * 8
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ addWordToDictionary: aString
"Make sure there is a word number in the input file."
currentLines at: 1 ifAbsentPut: 0.
(wordAlreadyKnown) ifFalse: [
wordCount := (((currentLines at: 1 ifAbsent: 0) asInteger) + 1) asString.
wordCount := (((currentLines at: 1) asInteger) + 1) asString.
newStream := (FileStream forceNewFileNamed: SPCSpellChecker defaultCustomDictionaryPath ).
newStream nextPutAll: wordCount.
currentLines add: aString.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"moduleName" : "mka 7/1/2019 13:23",
"ressourceDirectory" : "mka 7/1/2019 13:22",
"selectFileMessage:" : "mka 6/13/2019 10:27",
"systemArchitecture" : "mka 7/1/2019 13:22",
"systemArchitecture" : "ea 7/22/2019 09:31",
"vmDirectory" : "mka 7/1/2019 13:22" },
"instance" : {
"addDictionary:" : "ea 6/7/2019 16:02",
"addDictionary:andAffix:" : "ea 6/7/2019 15:57",
"addWordToDictionary:" : "ea 7/22/2019 08:41",
"addWordToDictionary:" : "ea 7/22/2019 09:25",
"alertOnError" : "ea 6/25/2019 19:31",
"alertOnError:" : "ea 6/25/2019 19:31",
"calculateLevenshteinDistance:toString:" : "ea 6/24/2019 14:34",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
"DisableDownload" ],
"commentStamp" : "",
"commentStamp" : "ea 7/22/2019 09:10",
"instvars" : [
"instances",
"alertOnError" ],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
I replace SPCHunspellDecorator if spellchecking is disabled to prevent any errors.

Instance Variables
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "",
"commentStamp" : "ea 7/22/2019 09:11",
"instvars" : [
],
"name" : "SPCHunspellAPINullObject",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
I represent a language for Hunspell.

Instance Variables
affixPath: <String> Path to the Hunspell affix / grammar file of this language.
dictionaryPath: <String> Path to the dictionary file of this language.
languageName: <String> Which name is displayed for this language.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
as yet unclassified
default
^ ({ SPCHunspellLanguage english . SPCHunspellLanguage squeak . SPCHunspellLanguage custom } asSet)
"^ SPCHunspellLanguage english"
^ ({ SPCHunspellLanguage english . SPCHunspellLanguage squeak . SPCHunspellLanguage custom } asSet)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"class" : {
"custom" : "mka 7/2/2019 12:08",
"default" : "mka 7/2/2019 12:08",
"default" : "ea 7/22/2019 09:31",
"english" : "ea 6/17/2019 10:11",
"german" : "ea 6/17/2019 10:11",
"squeak" : "ea 6/17/2019 10:11" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "",
"commentStamp" : "ea 7/22/2019 09:13",
"instvars" : [
"dictionaryPath",
"affixPath",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I show methods with spelling errors.
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
as yet unclassified
openWith: methods

ToolBuilder open: ( SPCMethodTextViewer messageList: (methods collect: [ :m | m value methodReference] ) ).


"TODO: Wie stellt man das Highlighting nur für dieses Menü an?"
"SPCTextStyler spellCheckingEnabled: spllcheckingStylerIsOn"
ToolBuilder open: ( SPCMethodTextViewer messageList: (methods collect: [ :m | m value methodReference] ) )
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"openWith:" : "ea 5/28/2019 14:55" },
"openWith:" : "ea 7/22/2019 09:27" },
"instance" : {
"addCodeProvenanceButtonTo:using:" : "pre 5/23/2019 11:26",
"buildWith:" : "pre 5/23/2019 11:40",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "",
"commentStamp" : "ea 7/22/2019 09:14",
"instvars" : [
],
"name" : "SPCMethodTextViewer",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
I provide spellchecking functionalities such as checking single words, getting all mistakes in a string, adding and removing words from the dictionary, getting suggestions for a wrong written word. I am a singleton.

Instance Variables
affixPath: <FilePath> The path to the current loaded affix file
dictionaryPath: <FilePath> The path to the current loaded dictionary file
hunspell: <SPCHunspellAPI> Used for making calls into the hunspell library
loadedLanguages: <OrderedCollection> A Collection of HunspellLanguages that represent the currently active languages.
hunspell: <SPCHunspellAPIDecorator> Used for making calls into the hunspell library and managing languages.
parser: <SPCTextParser> Used for separating a string into its single words


Class Variables
AddedWords <Set> Stores all the words that were added to the dictionary
Instance <SPCSpellChecker> Holds the current instance (this class is a singleton)
Observers <OrderedCollection> Holds all Classes that are notified if properties of this class change.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ misspelledWordsIn: aString
| wrongWords |

wrongWords := IdentityDictionary new.
"Else the VM will crash."
self hunspell isNilObject ifFalse: [
(self parser parseText: aString) keysAndValuesDo: [ :start :end |
(self hunspell isWordCorrect: (aString copyFrom: start to: end))
ifFalse: [wrongWords at: start put: end]].
].
^ wrongWords
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"loadLanguage:" : "ea 7/1/2019 14:17",
"loadedLanguages" : "ea 6/17/2019 14:00",
"loadedLanguages:" : "mka 6/24/2019 14:38",
"misspelledWordsIn:" : "ea 5/11/2019 15:27",
"misspelledWordsIn:" : "ea 7/22/2019 09:27",
"parser" : "ow 7/14/2018 14:26",
"parser:" : "ow 7/25/2018 20:15",
"reloadAddedWords" : "mka 7/2/2019 14:04",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
"AddedWords",
"Instance",
"Observers" ],
"commentStamp" : "ow 7/25/2018 19:57",
"commentStamp" : "ea 7/22/2019 09:17",
"instvars" : [
"hunspell",
"parser",
"dictionaryPaths",
"affixPaths",
"loadedLanguages" ],
"name" : "SPCSpellChecker",
"pools" : [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
I add functionality to the squeak browser.
- checking all Methods of a class for correctly spelled literals.

Instance Variables:
informAboutErrors: <Boolean> True if error messages should be displayed to the user.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "ea 5/18/2019 14:26",
"commentStamp" : "ea 7/22/2019 09:18",
"instvars" : [
"informAboutErrors" ],
"name" : "SPCSystemBrowser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ Instance Variables
loopVariable <Integer> The loop variable of the main parsing loop
startOfCurrentWord <Integer> The start index of the current considered word inside the whole string
endOfCurrentWord <Integer> The end index of the current considered word inside the whole string
parseStringsOnly <Boolean> True if this instance should only parse String literals and comments in the given text.
isInString <Boolean> True if currently a String Literal is parsed.
isInComment <Boolean> True if currently a Comment is parsed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"parseStringsOnly" ],
"classvars" : [
],
"commentStamp" : "ow 7/23/2018 18:15",
"commentStamp" : "ea 7/22/2019 09:21",
"instvars" : [
"parsedWords",
"parseStringsOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/Spellcheck-Core.package/monticello.meta/version

Large diffs are not rendered by default.

0 comments on commit 7a85454

Please sign in to comment.