#SingleInstance force

;------------------------------------------------------------------------------
; Read ini
;------------------------------------------------------------------------------
ini = %A_MyDocuments%\D3Ksettings.ini
/*
This is the part that reads the file to see what your settings are. Variables in the ini file are in all lowercase, variables here are CamelCase for more distinction
*/

;   User Specific things:
IniRead, racf, %ini%, USpec, RACF
IniRead, email, %ini%, USpec, Email

;   General Settings
IniRead, mansol, %ini%, Main, Mansol
IniRead, supadmin, %ini%, Main, Supadmin
IniRead, mjdpaste, %ini%, Main, MJDPaste
IniRead, caseformatter, %ini%, Main, CaseFormatter

;   Replacement
IniRead, symb, %ini%, Replacement, Symbols
IniRead, jdpn, %ini%, Replacement, JDProductNames

;   Language
IniRead, ger, %ini%, Language, German

;   Information
IniRead, vers, %ini%, Info, Version



;------------------------------------------------------------------------------
; Create GUI
;------------------------------------------------------------------------------

Gui, Add, GroupBox, x8 y2 w67 h37 , RACF
Gui, Add, Edit, x12 y15 w60 h20 vformRACF gRACF, %RACF%

Gui, Add, GroupBox, x8 y40 w207 h37 , Email Address
Gui, Add, Edit, x12 y53 w200 h20 vformEmail gEmail, %Email%

Gui, Add, GroupBox, x8 y83 w107 h135, Main
Gui, Add, CheckBox, x12 y95 w100 h30 vformMansol Checked%mansol% gMansol, ManSol
Gui, Add, CheckBox, x12 y125 w100 h30 vformSupadmin Checked%supadmin% gSupadmin, Supadmin
Gui, Add, CheckBox, x12 y155 w100 h30 vformMJDPaste Checked%mjdpaste% gMJDPaste, MJDPaste
Gui, Add, CheckBox, x12 y185 w100 h30 vformCaseFormatter Checked%caseformatter% gCaseFormatter, Case Formatter

Gui, Add, GroupBox, x128 y83 w107 h75, Text Replacement
Gui, Add, CheckBox, x132 y95 w100 h30 vformSymb Checked%symb% gSymb, Symbols
Gui, Add, CheckBox, x132 y125 w100 h30 vformJdpn Checked%jdpn% gJdpn, JD Product Names

Gui, Add, GroupBox, x128 y173 w107 h45, Language
Gui, Add, CheckBox, x132 y187 w100 h30 vformGer Checked%ger% gGer, German

Gui, Add, Text, x237 y203 w100 h20 , Version %vers%

Gui, Show, h225 w295, Settings
Return



;------------------------------------------------------------------------------
; Edit ini
;------------------------------------------------------------------------------

RACF:
Gui, Submit, NoHide
IniWrite, %formRACF%, %ini%, USpec, RACF
Return

Email:
Gui, Submit, NoHide
IniWrite, %formEmail%, %ini%, USpec, Email
Return


Mansol:
Gui, Submit, NoHide
IniWrite, %formMansol%, %ini%, Main, Mansol
Return

Supadmin:
Gui, Submit, NoHide
IniWrite, %formSupadmin%, %ini%, Main, Supadmin
Return

MJDPaste:
Gui, Submit, NoHide
IniWrite, %formMJDPaste%, %ini%, Main, MJDPaste
Return

CaseFormatter:
Gui, Submit, NoHide
IniWrite, %formCaseFormatter%, %ini%, Main, CaseFormatter
Return

Symb:
Gui, Submit, NoHide
IniWrite, %formSymb%, %ini%, Replacement, Symbols
Return

Jdpn:
Gui, Submit, NoHide
IniWrite, %formJdpn%, %ini%, Replacement, JDProductNames
Return

Ger:
Gui, Submit, NoHide
IniWrite, %formGer%, %ini%, Language, German
Return

GuiClose:
ExitApp

esc::ExitApp   ; Escape will close the settings