213 lines
6.4 KiB
Go
213 lines
6.4 KiB
Go
// Cthulhu screen reader.
|
|
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option)
|
|
// any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
// more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
|
|
|
package config
|
|
|
|
import (
|
|
"git.stormux.org/storm/cthulhu/internal/input"
|
|
)
|
|
|
|
type VoiceFamily struct {
|
|
Name string `toml:"name"`
|
|
Lang string `toml:"lang"`
|
|
Dialect string `toml:"dialect"`
|
|
Variant string `toml:"variant"`
|
|
}
|
|
|
|
type Voice struct {
|
|
Rate *float64 `toml:"rate"`
|
|
AveragePitch *float64 `toml:"average-pitch"`
|
|
Gain *float64 `toml:"gain"`
|
|
Family *VoiceFamily `toml:"family"`
|
|
}
|
|
|
|
type ReadingSettings struct {
|
|
AutomaticallyReadClipboardChanges bool
|
|
AutomaticallyReadTitleChanges bool
|
|
EnablePauseBreaks bool
|
|
SpeakNumbersAsDigits bool
|
|
SpeakMultiCaseStringsAsWords bool
|
|
EnableIndentation bool
|
|
IndentationPresentationMode string
|
|
OnlySpeakDisplayedText bool
|
|
SpeakBlankLines bool
|
|
EnableMnemonicSpeaking bool
|
|
EnablePositionSpeaking bool
|
|
EnableTutorialMessages bool
|
|
MessagesAreDetailed bool
|
|
UseColorNames bool
|
|
PresentTooltips bool
|
|
EnableMouseReview bool
|
|
SpeakMisspelledIndicator bool
|
|
SpeakContextBlockquote bool
|
|
SpeakContextList bool
|
|
SpeakContextTable bool
|
|
SpeakContextPanel bool
|
|
SpeakContextLandmark bool
|
|
SpeakContextNonLandmarkForm bool
|
|
SayAllContextBlockquote bool
|
|
SayAllContextList bool
|
|
SayAllContextTable bool
|
|
SayAllContextPanel bool
|
|
SayAllContextLandmark bool
|
|
SayAllContextNonLandmarkForm bool
|
|
ReadFullRowInGUITable bool
|
|
ReadFullRowInDocumentTable bool
|
|
ReadFullRowInSpreadSheet bool
|
|
}
|
|
|
|
type PronunciationEntry struct {
|
|
Word string `toml:"word"`
|
|
Replacement string `toml:"replacement"`
|
|
}
|
|
|
|
type TextAttributeChoice struct {
|
|
Key string `toml:"key"`
|
|
Speak bool `toml:"speak"`
|
|
Braille bool `toml:"braille"`
|
|
}
|
|
|
|
type TextAttributeSettings struct {
|
|
Choices []TextAttributeChoice
|
|
Indicator int
|
|
}
|
|
|
|
var TextAttributeKeys = [...]string{
|
|
"size", "family-name", "weight", "indent", "underline", "strikethrough",
|
|
"justification", "style", "paragraph-style", "text-spelling", "fg-color", "bg-color",
|
|
}
|
|
|
|
func DefaultTextAttributes() TextAttributeSettings {
|
|
choices := make([]TextAttributeChoice, 0, len(TextAttributeKeys))
|
|
for _, key := range TextAttributeKeys {
|
|
choices = append(choices, TextAttributeChoice{Key: key, Speak: true})
|
|
}
|
|
return TextAttributeSettings{Choices: choices}
|
|
}
|
|
|
|
// ProgressBarSettings follows NVDA's output modes and percentage thresholds.
|
|
type ProgressBarSettings struct {
|
|
OutputMode string
|
|
ReportBackground bool
|
|
BeepPercentageInterval int
|
|
SpeechPercentageInterval int
|
|
}
|
|
|
|
func DefaultProgressBarSettings() ProgressBarSettings {
|
|
return ProgressBarSettings{OutputMode: "beep", BeepPercentageInterval: 1, SpeechPercentageInterval: 10}
|
|
}
|
|
|
|
type Settings struct {
|
|
OCR OCRSettings
|
|
ProgressBar ProgressBarSettings
|
|
TimeFormat string
|
|
DateFormat string
|
|
EnableSound bool
|
|
SoundVolume float64
|
|
SoundSink string
|
|
SoundTheme string
|
|
PlaySoundForRole bool
|
|
PlaySoundForState bool
|
|
PlaySoundForPositionInSet bool
|
|
SpatializeObjectSounds bool
|
|
RoleSoundPresentation string
|
|
|
|
Path string
|
|
Loaded bool
|
|
ActiveProfile string
|
|
EnableSpeech bool
|
|
SpeechHistoryLimit int
|
|
EnableBraille bool
|
|
EnableContractedBraille bool
|
|
BrailleContractionTable string
|
|
Braille BrailleOptions
|
|
HardwareSpeechDevice string
|
|
HardwareSpeechBaudRate int
|
|
SpeechServerFactory string
|
|
SpeakDescription bool
|
|
SpeechVerbosityLevel int
|
|
SayAllStyle string
|
|
Reading ReadingSettings
|
|
Pronunciations []PronunciationEntry
|
|
TextAttributes TextAttributeSettings
|
|
VerbalizePunctuationStyle int
|
|
CapitalizationStyle string
|
|
KeyBindings []input.BindingOverride
|
|
KeyboardLayout int
|
|
CthulhuModifierKeys []string
|
|
EnableKeyEcho bool
|
|
EnableEchoByCharacter bool
|
|
EnableEchoByWord bool
|
|
EnableEchoBySentence bool
|
|
EnableAlphabeticKeys bool
|
|
EnableNumericKeys bool
|
|
EnablePunctuationKeys bool
|
|
EnableSpace bool
|
|
EnableModifierKeys bool
|
|
EnableFunctionKeys bool
|
|
EnableActionKeys bool
|
|
EnableNavigationKeys bool
|
|
EnableDiacriticalKeys bool
|
|
UseCustomEchoVoice bool
|
|
UseCustomEchoSpeechServer bool
|
|
UseCustomEchoForKey bool
|
|
UseCustomEchoForCharacter bool
|
|
UseCustomEchoForWord bool
|
|
UseCustomEchoForSentence bool
|
|
EchoVoice Voice
|
|
EchoSpeechServer string
|
|
SpeechOutputModule string
|
|
DefaultVoice Voice
|
|
UppercaseVoice Voice
|
|
HyperlinkVoice Voice
|
|
SystemVoice Voice
|
|
}
|
|
|
|
type OCRSettings struct {
|
|
Language string
|
|
Layout int
|
|
Scale int
|
|
Grayscale bool
|
|
Invert bool
|
|
BlackWhite bool
|
|
Threshold int
|
|
AutoRefresh bool
|
|
RefreshInterval int // Milliseconds.
|
|
ConfirmClick bool
|
|
CopyFirstResult bool
|
|
AutoReadAll bool
|
|
}
|
|
|
|
const (
|
|
DefaultSpeechHistoryLimit = 50
|
|
MinSpeechHistoryLimit = 1
|
|
MaxSpeechHistoryLimit = 1000
|
|
)
|
|
|
|
type BrailleOptions struct {
|
|
AbbreviateRoles bool
|
|
DisableEOL bool
|
|
WordWrap bool
|
|
Verbosity int
|
|
SelectionIndicator int
|
|
LinkIndicator int
|
|
FlashMessages bool
|
|
FlashTime int
|
|
FlashPersistent bool
|
|
FlashDetailed bool
|
|
}
|