﻿#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=prog.ico
#AutoIt3Wrapper_Outfile=Spielzeit-Timer.exe
#AutoIt3Wrapper_Res_Description=Spielzeit-Timer
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Oscar (www.autoit.de)/geändert SCCSSF
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#Region Includes
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <Sound.au3>
#include <StaticConstants.au3>
#include <Timers.au3>
#include <WinAPI.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Misc.au3>
#Include <GuiButton.au3>
#include <EditConstants.au3>
#include '_ProgressEx.au3'
#include '_DateiEx.au3'
#EndRegion Includes


#Region single
If _Singleton("Timer", 1) = 0 Then
    Exit
EndIf
#EndRegion

#Region Optionen
;#NoTrayIcon
Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 1)
Opt('GUIOnEventMode', 1)
Opt('TrayOnEventMode', 1)
#EndRegion Optionen

_GDIPlus_Startup()

#Region Konstanten deklarieren
Global Const $sAppTitle = 'Spielzeit-Timer'
Global Const $sAppVersion = '0.2.3.7'
Global Const $sAppDate = '25.02.2019'
Global Const $sAppAuthor = 'Oscar (www.autoit.de) / SCCCSF'
Global Const $sAppDir = @AppDataDir & '\SP-Timer\'
If Not FileExists($sAppDir) Then DirCreate($sAppDir)
Global Const $sInifile = $sAppDir & 'Spielzeit-Timer.ini'
Global $b7SegmentFont = _Segment7new()
Global $t7SegmentFont = DllStructCreate('byte[' & BinaryLen($b7SegmentFont) & ']')
DllStructSetData($t7SegmentFont, 1, $b7SegmentFont)
Global $h7SegmentFont = _WinAPI_AddFontMemResourceEx(DllStructGetPtr($t7SegmentFont), DllStructGetSize($t7SegmentFont))
Global $hUpBitmap = _GDIPlus_BitmapCreateFromMemory(_uppng())
Global $hDownBitmap = _GDIPlus_BitmapCreateFromMemory(_downpng())
Global $sSoundfile = @TempDir & '\glocke.mp3'
If Not FileExists($sSoundfile) Then _glocke(True, @TempDir)
Global $aSound = _SoundOpen($sSoundfile)

Global Const $iAppDPI = RegRead('HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics', 'AppliedDPI')
Global Const $iRed = 0, $iYellow = 60, $iGreen = 120, $iBlue = -150 ; Farbwerte/HUE gegenueber dem roten Standardwert (Werte von -180 bis +180 sind moeglich)
Global Const $iWidth = 240, $iHeight = 360
#EndRegion Konstanten deklarieren

#Region globale Variablen
Global $iTimerSeconds = IniRead($sInifile, 'Config', 'TimerSeconds', 600)
Global $iTimerStep = IniRead($sInifile, 'Config', 'TimerStep', 10) ; In der Inidatei kann man die Schrittweite (in Sekunden) fuer die Timereinstellung festlegen
Global $iTimerDiv = IniRead($sInifile, 'Config', 'TimerDiv', 1) ; In der Inidatei kann man die Schrittweite (in Menuten) fuer die letzte Minute festelegen
Global $iTimerPause = IniRead($sInifile, 'Config', 'TimerPause', 300) ; In der Inidatei kann man die Schrittweite (in Sekunden) fuer die Pause festlegen
Global $bTimerOn = False, $iSeconds = $iTimerSeconds
#EndRegion globale Variablen

#Region Fenster erstellen
Global $hGui = GUICreate(StringFormat('%s  v%-3.3s', $sAppTitle, $sAppVersion), $iWidth, $iHeight, -1, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, _Minimize)
GUISetOnEvent($GUI_EVENT_MINIMIZE,  _Minimize)
TraySetOnEvent(-7, "_Restore")
GUISetBkColor(0x000000)
GUISetIcon(@ScriptDir & '\stopwatch.ico', 0, $hGui)

Global $Setting_Menu = GUICtrlCreateMenu("Menü")
Global $Setting_Para = GUICtrlCreateMenuItem("Einstellungen", $Setting_Menu)
GUICtrlSetOnEvent(-1, "_Settings")
Global $Setting_exit = GUICtrlCreateMenuItem("Ende", $Setting_Menu)
GUICtrlSetOnEvent(-1, "_Exit")
Global $helpmenu = GUICtrlCreateMenu("?")
Global $Info = GUICtrlCreateMenuItem("Version", $helpmenu)
GUICtrlSetOnEvent(-1, "_showInfo")

Global $idTime = GUICtrlCreateLabel(StringFormat('%02d:%02d', Int($iTimerSeconds / 60), Mod($iTimerSeconds, 60)), 20, 12, $iWidth - 60, 44, $SS_CENTER)
GUICtrlSetColor(-1, 0x22FF22)
GUICtrlSetFont(-1, 40 / $iAppDPI * 80, 400, 0, 'Segment7')
Global $hGUi1 = GUICtrlCreateLabel("Spielzeit", 30, 80, 172, 33,$SS_CENTER)
GUICtrlSetColor(-1, 0xFEFF22)
GUICtrlSetFont(-1, 20)

Global $idTime1 = GUICtrlCreateLabel(StringFormat('%02d:%02d', Int(($iTimerSeconds- $iTimerDiv*60) /60  ), Mod($iTimerSeconds, 60)), 20, 120, $iWidth - 60, 44, $SS_CENTER)
GUICtrlSetColor(-1, 0x22FF22)
GUICtrlSetFont(-1, 40 / $iAppDPI * 80, 400, 0, 'Segment7')
Global $hGUi2 = GUICtrlCreateLabel("letzte Minute", 30, 158, 172, 33,$SS_CENTER)
GUICtrlSetColor(-1, 0xFEFF22)
GUICtrlSetFont(-1, 20)

Global $idTime2 = GUICtrlCreateLabel(StringFormat('%02d:%02d', Int($iTimerPause / 60), Mod($iTimerPause, 60)), 20, 200, $iWidth - 60, 44, $SS_CENTER)
GUICtrlSetColor(-1, 0x22FF22)
GUICtrlSetFont(-1, 40 / $iAppDPI * 80, 400, 0, 'Segment7')
Global $hGUi3 = GUICtrlCreateLabel("Pause", 30, 268, 172, 33,$SS_CENTER)
GUICtrlSetColor(-1, 0xFEFF22)
GUICtrlSetFont(-1, 20)


Global $idUp = GUICtrlCreatePic('', $iWidth - 34, 6, 24, 24)
GUICtrlSetOnEvent(-1, '_ChangeTimerSeconds')
Global $hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hUpBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($idUp, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
_WinAPI_DeleteObject($hBMP)

Global $idDown = GUICtrlCreatePic('', $iWidth - 34, 34, 24, 24)
GUICtrlSetOnEvent(-1, '_ChangeTimerSeconds')
Global $hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hDownBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($idDown, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
_WinAPI_DeleteObject($hBMP)

Global $idUpP = GUICtrlCreatePic('', $iWidth - 34, 197, 24, 24)
GUICtrlSetOnEvent(-1, '_ChangeTimerPauseSeconds')
Global $hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hUpBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($idUpP, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
_WinAPI_DeleteObject($hBMP)

Global $idDownP = GUICtrlCreatePic('', $iWidth - 34, 225, 24, 24)
GUICtrlSetOnEvent(-1, '_ChangeTimerPauseSeconds')
Global $hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hDownBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($idDownP, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
_WinAPI_DeleteObject($hBMP)

Global $aProgress1 = _ProgressEx_Create(10, 60, $iWidth - 20, 15, $PE_NOTEXT)
_ProgressEx_SetData($aProgress1, 100, $iGreen)

Global $aProgress2 = _ProgressEx_Create(10, 250, $iWidth - 20, 15, $PE_NOTEXT)
_ProgressEx_SetData($aProgress2, 100, -0)

Global $idReset = GUICtrlCreateButton('Reset', 10, 310, 50, 25)
GUICtrlSetFont(-1, 12 / $iAppDPI * 96, 600, 0, 'Tahoma')
GUICtrlSetOnEvent(-1, '_ResetTimer')

Global $idStop = GUICtrlCreateButton('Stop', 65, 310, 50, 25)
GUICtrlSetFont(-1, 12 / $iAppDPI * 96, 600, 0, 'Tahoma')
GUICtrlSetOnEvent(-1, '_StopTimer')
GUICtrlSetState($idStop, $GUI_DISABLE)

Global $idStart = GUICtrlCreateButton('Start', $iWidth - 120, 310, 110, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetFont(-1, 12 / $iAppDPI * 96, 600, 0, 'Tahoma')
GUICtrlSetOnEvent(-1, '_StartTimer')
#EndRegion Fenster erstellen

#Region Fenster anzeigen und auf das Schliessen warten (der Rest ist funktionsgesteuert)
Global $aAccelKeys[2][2] = [['{UP}', $idUp], ['{DOWN}', $idDown]]
GUISetAccelerators($aAccelKeys)
GUISetState(@SW_SHOW)
;GUIRegisterMsg($WM_MOUSEWHEEL, '_WM_MOUSEWHEEL')
_Timer_SetTimer($hGui, 1000, '_ChangeTimer')
WinWaitClose($hGui)
Exit
#EndRegion Fenster anzeigen und auf das Schliessen warten (der Rest ist funktionsgesteuert)

#Region Funktionen
Func _CloseMainGui()
    _Timer_KillAllTimers($hGui)
    _WinAPI_RemoveFontMemResourceEx($h7SegmentFont)
    $t7SegmentFont = 0
    _GDIPlus_BitmapDispose($hUpBitmap)
    _GDIPlus_BitmapDispose($hDownBitmap)
    _GDIPlus_Shutdown()
    _SoundClose($aSound)
    GUIDelete($hGui)
EndFunc   ;==>_CloseMainGui

Func _ChangeTimer($hWnd, $iMsg, $iIDTimer, $iTime, $idTime1, $idTime2)
    If Not $bTimerOn Then Return
    $iSeconds -= 1
        GUICtrlSetData($idTime, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))

    If (($iSeconds -$iTimerDiv*60) /60) > 0 Then
        GUICtrlSetData($idTime1, StringFormat('%02d:%02d', Int(($iSeconds- $iTimerDiv*60) / 60), Mod($iSeconds, 60)))
    Else
        GUICtrlSetData($idTime1, '00:00')
    EndIf

    _ProgressEx_SetData($aProgress1, 100 / $iTimerSeconds * $iSeconds, $iGreen)
    If (($iSeconds -$iTimerDiv*60) /60) = 0 Then
        _SoundPlay($aSound)
    EndIf
    If $iSeconds = 0 Then
        $bTimerOn = False
        _SoundPlay($aSound)
        #MsgBox($MB_OK + $MB_ICONINFORMATION, $sAppTitle, 'Die eingestellte Zeit ist abgelaufen.', 0, $hGui)
        #_ResetTimer()
    EndIf
EndFunc   ;==>_ChangeTimer

Func _ChangeTimerPause($hWnd, $iMsg, $iIDTimer, $iTime, $idTime1, $idTime2)
    If Not $bTimerOnPause Then Return
    $iSecondsPause -= 1
        GUICtrlSetData($idTimePause, StringFormat('%02d:%02d', Int($iTimerPause / 60), Mod($iTimerPause, 60)))

    If (($iSecondsPause -$iTimerDiv*60) /60) > 0 Then
    GUICtrlSetData($idTime2, StringFormat('%02d:%02d', Int($iTimerPause / 60), Mod($iTimerPause, 60)))
    Else
        GUICtrlSetData($idTime2, '00:00')
    EndIf

    
    _ProgressEx_SetData($aProgress2, 100 / $iTimerSeconds * $iTimerPause, $iGreen)
    If (($iTimerPause -$iTimerDiv*60) /60) = 0 Then
        _SoundPlay($aSound)
    EndIf
    If $iTimerPause = 0 Then
        $bTimerOn = False
        _SoundPlay($aSound)
        #MsgBox($MB_OK + $MB_ICONINFORMATION, $sAppTitle, 'Die eingestellte Zeit ist abgelaufen.', 0, $hGui)
        #_ResetTimer()
    EndIf
EndFunc   ;==>_ChangeTimerPause

;~ Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)
;~     Local $iWheel = _WinAPI_HiWord($wParam) / 120 ; down = -1, up = 1
;~     Local $aGuiInfo = GUIGetCursorInfo($hGui)
;~     Switch $aGuiInfo[4]
;~         Case $idTime
;~             If $bTimerOn Then Return
;~             $iTimerSeconds += $iWheel * $iTimerStep
;~             If $iTimerSeconds < $iTimerStep Then $iTimerSeconds = 6000 - $iTimerStep
;~             If $iTimerSeconds > 6000 - $iTimerStep Then $iTimerSeconds = $iTimerStep
;~             $iSeconds = $iTimerSeconds
;~             GUICtrlSetData($idTime, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))
;~             Return
;~         Case Else
;~             Return $GUI_RUNDEFMSG
;~     EndSwitch
;~     Return $GUI_RUNDEFMSG
;~ EndFunc   ;==>_WM_MOUSEWHEEL

Func _ChangeTimerSeconds()
    If $bTimerOn Then Return
    $iTimerSeconds += (@GUI_CtrlId = $idUp ? 1 : -1) * $iTimerStep
    If $iTimerSeconds < $iTimerStep Then $iTimerSeconds = 6000 - $iTimerStep
    If $iTimerSeconds > 6000 - $iTimerStep Then $iTimerSeconds = $iTimerStep
    $iSeconds = $iTimerSeconds
    GUICtrlSetData($idTime, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))
    GUICtrlSetData($idTime1, StringFormat('%02d:%02d', Int(($iSeconds- $iTimerDiv*60) / 60), Mod($iSeconds, 60)))
    
EndFunc   ;==>_ChangeTimerSeconds

Func _ChangeTimerPauseSeconds()
    If $bTimerOn Then Return
    $iTimerSeconds += (@GUI_CtrlId = $idUpP ? 1 : -1) * $iTimerStep
    If $iTimerSeconds < $iTimerStep Then $iTimerSeconds = 6000 - $iTimerStep
    If $iTimerSeconds > 6000 - $iTimerStep Then $iTimerSeconds = $iTimerStep
    $iSeconds = $iTimerSeconds
    GUICtrlSetData($idTime2, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))

EndFunc   ;==>_Ch
Func _ResetTimer()
    $iSeconds = $iTimerSeconds
    GUICtrlSetData($idTime, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))
    GUICtrlSetData($idTime1, StringFormat('%02d:%02d', Int(($iSeconds- $iTimerDiv*60) / 60 ), Mod($iSeconds, 60)))
    GUICtrlSetData($idTime2, StringFormat('%02d:%02d', Int($iSeconds / 60), Mod($iSeconds, 60)))

    $bTimerOn = False
    GUICtrlSetState($idStart, $GUI_ENABLE)
    GUICtrlSetState($idStop, $GUI_DISABLE)
    
    _ProgressEx_SetData($aProgress1, 100, $iGreen)
EndFunc   ;==>_ResetTimer

Func _StopTimer()
        $bTimerOn = False
    GUICtrlSetState($idStart, $GUI_ENABLE)
    GUICtrlSetState($idStop, $GUI_DISABLE)
    GUICtrlSetState($idReset, $GUI_ENABLE)
    GUICtrlSetState($Setting_Para, $GUI_ENABLE)
    
EndFunc   ;==>_StopTimer

Func _StartTimer()
    $bTimerOn = True
    GUICtrlSetState($idStart, $GUI_DISABLE)
    GUICtrlSetState($idReset, $GUI_DISABLE)
    GUICtrlSetState($Setting_Para, $GUI_DISABLE)
    GUICtrlSetState($idStop, $GUI_ENABLE)
EndFunc   ;==>_StartTimer

Func _IniWrite()
    IniWrite($sInifile, 'Config', 'TimerSeconds', $iTimerSeconds)
    IniWrite($sInifile, 'Config', 'TimerStep', $iTimerStep)
    IniWrite($sInifile, 'Config', 'TimerDiv', $iTimerDiv)
EndFunc    ;==>_IniWrite
#EndRegion Funktionen

#Region Setting Menue
Func _settings()
    GuiSETState(@SW_HIDE, $hGui)

    Global $sound1 = IniRead($sInifile, 'Sound', 'Spielanfang', "")
    Global $sound2 = IniRead($sInifile, 'Sound', 'Spielende', "")
    Global $sound3 = IniRead($sInifile, 'Sound', 'Pause', "")
    Global $idTime1E = IniRead($sInifile, 'Config', 'TimerSeconds', "600")
    Global $idTime2E = IniRead($sInifile, 'Config', 'TimerPause', "300") ; In der Inidatei kann man die Schrittweite (in Sekunden) fuer die Pausenzeit festlegen
     Global $idTime3E = IniRead($sInifile, 'Config', 'TimerStep', "10") ; In der Inidatei kann man die Schrittweite (in Sekunden) fuer die Timereinstellung festlegen
    
    Global $SettingGui = GUICreate(StringFormat('%s  v%-3.3s', "Einstellungen", $sAppVersion), 450, 360, -1, -1, -1)    
    ;==>_Sound 1
    Global $Label1 = GUICtrlCreateLabel("Sound-Spielanfang", 8, 15, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste1speichern = GUICtrlCreateInput($Sound1, 8, 40, 350, 21)
    Global $Datein1 = GUICtrlCreateButton("...", 370, 40, 25, 21)
    GUICtrlSetOnEvent(-1, "_settings_d1")
    
    ;==>_Sound 2
    Global $Label2 = GUICtrlCreateLabel("Sound-Spielende", 8, 70, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste2speichern = GUICtrlCreateInput($Sound2, 8, 95, 350, 21)
    Global $Datein2 = GUICtrlCreateButton("...", 370, 95, 25, 21)
    GUICtrlSetOnEvent(-1, "_settings_d2")
    
    ;==>_Sound 3
    Global $Label3 = GUICtrlCreateLabel("Sound-Pause", 8, 125, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste3speichern = GUICtrlCreateInput($Sound3, 8, 150, 350, 21)
    Global $Datein3 = GUICtrlCreateButton("...", 370, 150, 25, 21)
    GUICtrlSetOnEvent(-1, "_settings_d3")
    
    ;==>_Spielzeit (Voreinstellung)
    Global $Label4 = GUICtrlCreateLabel("Spielzeit", 8, 180, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste4speichern =  GUICtrlCreateInput($idTime1E,8,205,53,21,BitOr($ES_CENTER,$ES_NUMBER),$WS_EX_CLIENTEDGE)
        GUICtrlCreateLabel("in Sekunden",86,205,100,15,-1,-1)
            GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    GUICtrlSetOnEvent(-1, "_settings_d3")
    
    ;==>_Pausenzeit (Voreinstellung)
    Global $Label5 = GUICtrlCreateLabel("Pausenzeit", 8, 230, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste5speichern =  GUICtrlCreateInput($idTime2E,8,255,53,21,BitOr($ES_CENTER,$ES_NUMBER),$WS_EX_CLIENTEDGE)
        GUICtrlCreateLabel("in Sekunden",86,255,100,15,-1,-1)
            GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    GUICtrlSetOnEvent(-1, "_settings_d3")
    
    ;==>Verstellung (Voreinstellung)
    Global $Label6 = GUICtrlCreateLabel("Verstellung", 8, 280, 150)
        GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    Global $Liste6speichern =  GUICtrlCreateInput($idTime3E,8,305,53,21,BitOr($ES_CENTER,$ES_NUMBER),$WS_EX_CLIENTEDGE)
        GUICtrlCreateLabel("in Sekunden",86,305,100,15,-1,-1)
            GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS")
    GUICtrlSetOnEvent(-1, "_settings_d3")
    
    ;==>_Speichern/Abbrechen
    Global $Speichern1 = GUICtrlCreateButton("Speichern", 250, 310, 65, 25)
    GUICtrlSetOnEvent(-1, "_settings_save")
    Global $Abbrechen = GUICtrlCreateButton("Abbrechen", 330, 310, 65, 25)
    GUICtrlSetOnEvent(-1, "_settings_end")
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_settings_end')
    
EndFunc   ;==>_settings

Func _settings_d1()
    global $Datei_d1 = FileOpenDialog("Bitte Sound Wählen", "c:\", "Sound (*.mp3)", 1 + 2) ;=>Datei auswählen
    GUICtrlSetData($Liste1speichern, $Datei_d1) ;=> Datei Anzeigen
EndFunc   ;==>_settings_d1

Func _settings_d2()
    global $Datei_d2 = FileOpenDialog("Bitte Sound Wählen", "c:\", "Sound (*.mp3)", 1 + 2) ;=>Datei auswählen
    GUICtrlSetData($Liste2speichern, $Datei_d2) ;=> Datei Anzeigen
EndFunc   ;==>_settings_d2

Func _settings_d3()
    global $Datei_d3 = FileOpenDialog("Bitte Sound Wählen", "c:\", "Sound (*.mp3)", 1 + 2) ;=>Datei auswählen
    GUICtrlSetData($Liste3speichern, $Datei_d3) ;=> Datei Anzeigen
EndFunc   ;==>_settings_d3

Func _settings_end()
    GUIDelete($SettingGui)
    GUISetState(@SW_SHOW, $hGui)
EndFunc   ;==>_settings_end

Func _settings_save()
    IniWrite($sInifile, 'Sound', 'Spielanfang',GUICtrlRead($Liste1speichern))
    IniWrite($sInifile, 'Sound', 'Spielende',GUICtrlRead($Liste2speichern))
    IniWrite($sInifile, 'Sound', 'Pause',GUICtrlRead($Liste3speichern))
    IniWrite($sInifile, 'Config', 'TimerSeconds',GUICtrlRead($Liste4speichern))
    IniWrite($sInifile, 'Config', 'TimerPause',GUICtrlRead($Liste5speichern))
    IniWrite($sInifile, 'Config', 'TimerStep',GUICtrlRead($Liste6speichern))
    
    Global $sound1 = IniRead($sInifile, 'Sound', 'Spielanfang', "")
    Global $sound2 = IniRead($sInifile, 'Sound', 'Spielende', "")
    Global $sound3 = IniRead($sInifile, 'Sound', 'Pause', "")
    Global $iTimerSeconds = IniRead($sInifile, 'Config', 'TimerSeconds', "")
    Global $iTimerPause= IniRead($sInifile, 'Config', 'TimerPause', "")
    Global $iTimerStep = IniRead($sInifile, 'Config', 'TimerStep', "")
    
    GUIDelete($SettingGui)
    GUISetState(@SW_SHOWnormal, $hGui)
    _ResetTimer()
EndFunc   ;==>_settings_save
#EndRegion setting menue

#Region Menue
Func _Showinfo()
    MsgBox(0, "Info", "Version "& $sAppVersion & @CRLF & $sAppDate  & @CRLF & $sAppAuthor)
EndFunc   ;==>_Showinfo

Func _Exit()
    _CloseMainGui()
EndFunc   ;==>_Exit

Func _Minimize()
    TraySetState(4)
    GUISetState(@SW_HIDE)
EndFunc   ;==>_Minimize

Func _Restore()
    TraySetState(8)
    GUISetState(@SW_SHOW)
EndFunc   ;==>_Restore
#EndRegion menue