FotoSort2017/FotoSort2017.au3

3476 lines
199 KiB
Plaintext

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=FotoSortNeu.ico
#AutoIt3Wrapper_Res_Comment=2017 BLinz
#AutoIt3Wrapper_Res_Description=FotoSort2017.exe
#AutoIt3Wrapper_Res_Fileversion=1.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n
#AutoIt3Wrapper_Res_LegalCopyright=Public Domain
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <AutoItConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Crypt.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <GDIPlus.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <GuiStatusBar.au3>
#include <Misc.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
#include <WinAPIConstants.au3>
#include <WinAPISys.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
; lokale UDF
#include "GIFAnimation.au3"
#include "xResources.au3"
AutoItSetOption("MustDeclareVars", 1)
AutoItSetOption("GUIOnEventMode", 1)
; Dieses Programm ist eine alternative Version von Oscars FotoSort.au3
; https://autoit.de/index.php/Thread/39572-FotoSort/
; So ein Programm fehlte mir. Die neue Version habe ich geschrieben um es an meine HD-Monitore anzupassen (und ein paar andere Dinge die mir fehlten
#Region Variablen
; #####################################################################################
; ## ## ### ######## #### ### ######## ## ######## ## ##
; ## ## ## ## ## ## ## ## ## ## ## ## ## ### ##
; ## ## ## ## ## ## ## ## ## ## ## ## ## #### ##
; ## ## ## ## ######## ## ## ## ######## ## ###### ## ## ##
; ## ## ######### ## ## ## ######### ## ## ## ## ## ####
; ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###
; ### ## ## ## ## #### ## ## ######## ######## ######## ## ##
;~ ####################################################################################
; Variablen für globale Voreinstellungen
Global Const $s_ProgramTitle = "FotoSort2017"
Global Const $s_ProgramVersion = "v1.1"
;~ Global Const $s_ProgramVersion = "v" & FileGetVersion(@ScriptFullPath)
Global Const $s_FontNameForm = "Calibri"
Global Const $s_FontSizeForm = 12
Global Const $s_FontNameInputs = "Consolas"
Global Const $s_FontSizeInputs = 12
; Variablen für die GUI
Global $h_FormFotoSort2017
Global $id_GroupTargetDirectories
Global $id_GroupFileFormats
Global $id_GroupFileExists, $id_RadioOverwrite, $id_RadioAddSuffix, $id_InputSuffix, $id_RadioAskOverwrite, $id_CheckboxDoubleFiles, $id_LabelCountingNumber
Global $id_GroupTools
Global $id_GroupQuellverzeichnis, $id_InputSourceDirectory, $id_ButtonSelectSourceDirectory, $id_CheckboxScanFolderRecursive
Global $id_Picture, $id_ButtonPicBack100, $id_ButtonPicBack10, $id_ButtonPicBack1, $id_ButtonPicForward1, $id_ButtonPicForward10, $id_ButtonPicForward100, $id_ButtonPicGoToFirst, $id_ButtonPicGoToLast, $id_InputPicNumber, $id_CheckboxPictureFitSize
Global $id_StatusBar
Global $id_ButtonSelected1, $id_ButtonSelected2, $hex_SignalColor = 0xE10096
Global $id_ToolSelected1, $id_ToolSelected2, $id_ProfilesDummy
Global $id_ButtonAddTargetDirectory, $id_ButtonRemoveTargetDirectory
Global $id_LabelBehindPicture1, $id_LabelBehindPicture2, $id_LabelBehindPicture3, $id_Background = 0
; Die Zielverzeichnisse - die Anzahl ist variabel, also als Array
Global $a_id_TargetDirectories[2][5] ; [0][0] = Anzahl
; [x][1] = Button kopieren
; [x][2] = Butten verschieben
; [x][3] = Input
; [x][4] = Pfadauswahl
Global $i_Distance = 44 ; Abstand zwischen den Zeilen der Verzeichnisse
Global $i_ButtonPicYfromTop = 650 ; Beginn der Zeile mit den Bild vor/zurück Buttons
Global $id_LabelPictureName ; Label unter dem Bild in dem der Bildname steht
; Control das Markierung nach einer Aktion zeigt (Farbiger Rahmen um den Button)
Global $id_ThisOne1, $id_ThisOne2, $i_Timeout = 1000, $i_TimerThisOne = 0, $i_TimerSelectCurrentPicture = 0
Global $_a_ButtonCopy ; Hier wird regelmäßig die Position des untersten "Kopieren" Buttons der Zeilverzeichnisse abgelegt (=Button ganz links)
Global $_a_ButtonSelectFolder ; ; dito nur der Button für die Verzechnisauswahl (= ganz rechts). Beides wird benötigt für den Rahmen der bei einer Aktion aufblitzt
; Tasten zu Buttonzuweisungen - fast alles lässt sich per Tastendruck steuern
Global $a_AcceleratorKeys[1][2]
; Werkzeugeleite. Auch als Array. Wenn hier die Namen vrtauscht werden, vertauscht sich auch die Reihenfolge
Global $a_id_Tools[8][2] = [ [ "DEL", 0 ], [ "Rename", 0 ], [ "RELOAD", 0 ], [ "Filenames", 0 ], [ "Profiles", 0 ], [ "BKG", 0 ], [ "RESET", 0 ], [ "Hilfe", 0 ] ]
; DEL : Bild löschen
; Rename : Bild umbennnen
; RELOAD : Bild neu laden
; Filenames : Erstellt eine Textdatei mit allen Bildnamen
; BKG : Hintergrundfarbe ändern
; Hilfe : Blendet eine zusätzliches Fenster mit Informationen ein
; RESET : Alle Ordner leeren
; Icons die auf den Werkzeug-Buttons angezeigt werden
Global $_Resources_FotoSort2017ico, $_Resources_Burnpng, $_Resources_Colorpng, $_Resources_CopyDocpng, $_Resources_Editpng, $_Resources_Refreshpng
Global $_Resources_TrashFullpng, $_Resources_Helppng, $_Resources_Cancelico, $_Resources_Overwriteico, $_Resources_CheckOffico2, $_Resources_Profilespng
; Fenstergröße sichern / Variablen für erlaubte Größen. Wir geben später eine minimale und Maximale Fenstergröße vor
Global $a_FormFotoSortNew_Size
Global $i_FormFotoSortNew_SizeMinWidth, $i_FormFotoSortNew_SizeMinHeight, $i_FormFotoSortNew_SizeMaxWidth, $i_FormFotoSortNew_SizeMaxHeight
Global $b_FormIsMaximized = False
Global Const $WIN_STATE_MAXIMIZED = 32
Global $b_GIF = False
; Für DPI-Anpassungen gemäß https://autoit.de/index.php/Thread/85260-Kleines-Desktop-Spiel-ChipHunter/?postID=682546#post682546
Global $i_AppliedDPI = Int(RegRead("HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "AppliedDPI")) / 96
; Auf Eis geleget, Windows 10 zoomte die GUI einfach so groß
$i_AppliedDPI = 1
; Für die aktuell angezeigte Vorschau
Global $d_CurrentPicture, $h_Resources_PicTestBildpngGlobal, $d_Resources_PicTestBildpngGlobal
Global $a_CurrentPictureFilename[2] = [ "", "" ] ; aktueller Bildname (ohne Pfad), getrennt nach Name und Erweiterung
Global $b_Upscale = True ; Ob kleine Bilder vergrößert werden sollen
Global $b_Use_GuiCtrlSetImageEx = False ; Wenn True sorgt die :GUICtrlSetImageEx Funktion für die Vorschaudarstellung
Global $d_BackgroundColor_ARGB = 0xFF000000
Global $b_FirstPicture = True ; Wenn dieser Wert True ist wird das Pic-Control vor der Darstellung einmal gelöscht und neu erstellt
Global $i_CurrentPictureSavedFromregistry ; Hier speichern wir das letzte Bild das dargestellt wurde zwischen. Wird nur für Startup benötigt
; Array für Bildmaße, wird jeweils von _GUICtrlSetImageEx_Modified() zurück gegeben
Global $a_CurrentPictureMetrics[5] ; 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
; Array mit den Dateinamen der Bilder, wird von ReadFileList() gefüllt
Global $a_s_PictureFilenames[1] = [ 0 ]
Global $i_CurrentFilename = 0
; Array für doppelte Dateien (wird auf den Zielordner ausgeführt
Global $a_s_FilesInTarget[1] = [ 0 ]
Global $a_i_FileSizesInTarget[1] = [ 0 ]
; Für Doppelklick-Erkennung
Global $i_DoubleClickTimer = 0
; Speicherung der Einstellungen in der Registry unter diesem Pfad
Global $s_RegistryKeyname = "HKEY_CURRENT_USER\Software\znil.net\FotoSort2017"
; Array für die Profile:
Global $a_Profiles[1] ; [0] = Anzahl
; [x] = Name
Global $i_ProfileActive = 1
Global $s_ProfileActive = "Standart"
; Die Icons in der Statusbar
Global $_Resources_Warningico, $h_IconWarning, $_Resources_Pictureico, $h_IconPicture, $_Resources_CheckOffico, $h_IconCheckOff, $_Resources_Infoico, $h_IconInfo, $h_IconOverwrite, $h_IconCancel, $_Resources_Profilesico, $h_IconProfiles
; GDIPlus
Global $aGDIPlusDecoders, $a_id_CheckboxFileformat[1] ; Die möglichen Dateifromate sind in GDIPlus eingebaut. Wir fragen was geht und das bieten wir dann an. Deshalb Array da ja dynamisch
Global $s_SearchPattern ; Hier steht der Suchstring drin für die Dateisuche
#EndRegion Variablen
#Region Funktionen
; ###############################################################################################################################################################################################
; ######## ## ## ## ## ## ## ######## #### ####### ## ## ######## ## ##
; ## ## ## ### ## ## ## ## ## ## ## ### ## ## ### ##
; ## ## ## #### ## ## ## ## ## ## ## #### ## ## #### ##
; ###### ## ## ## ## ## ##### ## ## ## ## ## ## ## ###### ## ## ##
; ## ## ## ## #### ## ## ## ## ## ## ## #### ## ## ####
; ## ## ## ## ### ## ## ## ## ## ## ## ### ## ## ###
; ## ####### ## ## ## ## ## #### ####### ## ## ######## ## ##
; ###############################################################################################################################################################################################
;~ _ _ _ _ __ _ _ _
;~ / \ ___ ___ ___| | ___ _ __ __ _| |_ ___ _ __| |/ /___ _ _ / \ __| | __| |
;~ / _ \ / __/ __/ _ \ |/ _ \ '__/ _` | __/ _ \| '__| ' // _ \ | | | / _ \ / _` |/ _` |
;~ / ___ \ (_| (_| __/ | __/ | | (_| | || (_) | | | . \ __/ |_| |/ ___ \ (_| | (_| |
;~ ____/_/ \_\___\___\___|_|\___|_| \__,_|\__\___/|_| |_|\_\___|\__, /_/ \_\__,_|\__,_|
;~ |_____| |___/
; Um beim Programmieren flexibler zu sein kann man jederzeit eine Tastenkombination hinzufügen
; $_s_Key = Taste im Send() Format
; $_id_OfControl = ID des Controls deren Funktion aufgerufen werden soll
Func _AcceleratorKeyAdd($_s_Key, $_id_OfControl)
_ArrayAdd($a_AcceleratorKeys, $_s_Key) ; Array erweitern (und gleichzeitig Taste in den neuen Wert schreiben)
$a_AcceleratorKeys[ UBound($a_AcceleratorKeys) - 1 ][1] = $_id_OfControl ; und noch die Control-Id hinzufügen
GUISetAccelerators($a_AcceleratorKeys, $h_FormFotoSort2017) ; Änderungen übermitteln
EndFunc
; ###############################################################################################################################################################################################
;~ _ _ _ _ __ ____ _ _
;~ / \ ___ ___ ___| | ___ _ __ __ _| |_ ___ _ __| |/ /___ _ _| _ \ ___| | ___| |_ ___
;~ / _ \ / __/ __/ _ \ |/ _ \ '__/ _` | __/ _ \| '__| ' // _ \ | | | | | |/ _ \ |/ _ \ __/ _ \
;~ / ___ \ (_| (_| __/ | __/ | | (_| | || (_) | | | . \ __/ |_| | |_| | __/ | __/ || __/
;~ ____/_/ \_\___\___\___|_|\___|_| \__,_|\__\___/|_| |_|\_\___|\__, |____/ \___|_|\___|\__\___|
;~ |_____| |___/
; Gegenstück zur Add Funktion, sucht anhand der Control-Id alle Einträge und löscht diese aus dem Array
; Funktion ruft sich so lange selbst auf bis alle Id's gefunden sind. Da wir ständig Einträge mittendrin löschen kommt $a nämlich aus dem Tritt
Func _AcceleratorKeyDelete($_id_OfControl)
For $a = 0 To (UBound($a_AcceleratorKeys) - 1) Step 1
If $_id_OfControl = $a_AcceleratorKeys[$a][1] Then
_ArrayDelete($a_AcceleratorKeys, $a) ; Eintrag löschen
_AcceleratorKeyDelete($_id_OfControl) ; und selbst noch einmal aufrufen (Einmal!!)
ExitLoop ; Und damit sind wir nach dem ersten Treffer raus
EndIf
Next
GUISetAccelerators($a_AcceleratorKeys, $h_FormFotoSort2017)
EndFunc
; ###############################################################################################################################################################################################
;~ _ ____ ____ ____ ____ ____ ____ ____
;~ / \ | _ \ / ___| __ ) |___ \ | _ \ / ___| __ )
;~ / _ \ | |_) | | _| _ \ __) | | |_) | | _| _ \
;~ / ___ \| _ <| |_| | |_) | / __/ | _ <| |_| | |_) |
;~ ____/_/ \_\_| \_\\____|____/___|_____|___|_| \_\\____|____/
;~ |_____| |_____| |_____|
; Wandelt einen ARGB Farbwert wieder in einen RGB Wert um
; https://autoit.de/index.php/Thread/85339-AutoIt-Heise-Newsticker/?postID=683482#post683482
Func _ARGB_2_RGB($_hex_color)
Return BitAnd($_hex_color,0xFFFFFF)
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____ _
;~ | __ ) _ _| |_| |_ ___ _ __ | _ \(_) ___ ___
;~ | _ \| | | | __| __/ _ \| '_ \| |_) | |/ __/ __|
;~ | |_) | |_| | |_| || (_) | | | | __/| | (__\__ \
;~ ____|____/ \__,_|\__|\__\___/|_| |_|_| |_|\___|___/
;~ |_____|
; Wird aufgerufen wenn auf einer der Buttons unterhalb der Vorschau geklickt wird (oder das Input genutzt wird)
Func _ButtonPics()
Local $_a_ButtonPos
; na wenn wir gar keine Bilder haben gleich wieder raus
If $a_s_PictureFilenames[0] = 0 Then
Return 1
EndIf
; Den farbigen Rahmen positionieren der anzeigt was wir ausgelöst haben
If @GUI_CtrlId <> $id_InputPicNumber And @GUI_CtrlId <> $id_CheckboxPictureFitSize Then
$_a_ButtonPos = ControlGetPos($h_FormFotoSort2017, "", @GUI_CtrlId)
GUICtrlSetPos($id_ButtonSelected1, $_a_ButtonPos[0] - 1, $_a_ButtonPos[1] - 1)
GUICtrlSetPos($id_ButtonSelected2, $_a_ButtonPos[0] - 2, $_a_ButtonPos[1] - 2)
GUICtrlSetColor($id_ButtonSelected1, $hex_SignalColor)
GUICtrlSetColor($id_ButtonSelected2, $hex_SignalColor)
$i_Timeout = 250
_ThisOne() ; wird den Rahmen nach 250ms wieder auf die Hintergrundfarbe setzen = unsichtbar
EndIf
; Na, welcher Button war es denn?
Switch @GUI_CtrlId
Case $id_ButtonPicGoToFirst
_SelectCurrentPicture(1)
Case $id_ButtonPicBack100
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) - 100)
Case $id_ButtonPicBack10
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) - 10)
Case $id_ButtonPicBack1
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) - 1)
Case $id_ButtonPicForward1
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) + 1)
Case $id_ButtonPicForward10
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) + 10)
Case $id_ButtonPicForward100
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber) + 100)
Case $id_ButtonPicGoToLast
_SelectCurrentPicture($a_s_PictureFilenames[0])
Case $id_CheckboxPictureFitSize
_SettingsWrite("$id_CheckboxPictureFitSize", GUICtrlRead($id_CheckboxPictureFitSize))
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber))
Case $id_InputPicNumber
GUICtrlSetData($id_InputPicNumber, Int(GUICtrlRead($id_InputPicNumber))) ; Da wir schlau sind wandeln wir alles aus dem Feld per Int() in eine Zahl. Bei Müll kommt da 0 raus
; Die Zahlentasten sind mit kopieren belegt. Die Funktion WM_COMMAND schaltet das ab solange der Cursor im Input ist
; Um das wieder einzuschalten wechseln wir den Focus auf ein anderes Control
ControlFocus($h_FormFotoSort2017, "", $id_Picture)
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber))
Case Else
; Diese Meldung sollte nie jemand lesen ...
MsgBox(16, "Fehler", "_ButtonPics(): War kein $id_ButtonPic!")
EndSwitch
; Wenn wir nicht gerade im PicNumber Input waren den Focus auf die letzte Auswahl legen. Bei Mausklick ist er da sowieso, bei Tastendruck ist er es dann
If @GUI_CtrlId <> $id_InputPicNumber Then
ControlFocus($h_FormFotoSort2017, "", @GUI_CtrlId)
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____ _ ____ _ _ _____ _ _ ____ _ _ _
;~ | __ ) _ _| |_| |_ ___ _ __ | _ \(_) ___ ___ / ___| |__ ___ ___| | _| ____|_ __ __ _| |__ | | ___| _ \(_)___ __ _| |__ | | ___
;~ | _ \| | | | __| __/ _ \| '_ \| |_) | |/ __/ __| | | '_ \ / _ \/ __| |/ / _| | '_ \ / _` | '_ \| |/ _ \ | | | / __|/ _` | '_ \| |/ _ \
;~ | |_) | |_| | |_| || (_) | | | | __/| | (__\__ \ |___| | | | __/ (__| <| |___| | | | (_| | |_) | | __/ |_| | \__ \ (_| | |_) | | __/
;~ ____|____/ \__,_|\__|\__\___/|_| |_|_| |_|\___|___/\____|_| |_|\___|\___|_|\_\_____|_| |_|\__,_|_.__/|_|\___|____/|_|___/\__,_|_.__/|_|\___|
;~ |_____|
; Aktiviert oder desktiviert die Schaltflächen für die Bildauswahl je nach Anzahl der Bilder
Func _ButtonPicsCheckEnableDisable()
Local $_i_PicNumber = GUICtrlRead($id_InputPicNumber) ; Zwischenspeichern damit wir das nur einmal für die Vergleiche abrufen
; Wenn die Liste leer ist - alles aus!
If $a_s_PictureFilenames[0] = 0 Then
GUICtrlSetState($id_ButtonPicGoToFirst, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicBack100, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicBack10, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicBack1, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicForward1, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicForward10, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicForward100, $GUI_DISABLE)
GUICtrlSetState($id_ButtonPicGoToLast, $GUI_DISABLE)
Return 0 ; und raus aus der Funktion
EndIf
; Ab hier Button für Button prüfen :-)
If $_i_PicNumber = 1 Then
GUICtrlSetState($id_ButtonPicGoToFirst, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonPicGoToFirst, $GUI_ENABLE)
EndIf
If $_i_PicNumber > 100 Then
GUICtrlSetState($id_ButtonPicBack100, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicBack100, $GUI_DISABLE)
EndIf
If $_i_PicNumber > 10 Then
GUICtrlSetState($id_ButtonPicBack10, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicBack10, $GUI_DISABLE)
EndIf
If $_i_PicNumber > 1 Then
GUICtrlSetState($id_ButtonPicBack1, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicBack1, $GUI_DISABLE)
EndIf
If ($a_s_PictureFilenames[0] - $_i_PicNumber) > 0 Then
GUICtrlSetState($id_ButtonPicForward1, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicForward1, $GUI_DISABLE)
EndIf
If ($a_s_PictureFilenames[0] - $_i_PicNumber) > 9 Then
GUICtrlSetState($id_ButtonPicForward10, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicForward10, $GUI_DISABLE)
EndIf
If ($a_s_PictureFilenames[0] - $_i_PicNumber) > 99 Then
GUICtrlSetState($id_ButtonPicForward100, $GUI_ENABLE)
Else
GUICtrlSetState($id_ButtonPicForward100, $GUI_DISABLE)
EndIf
If $a_s_PictureFilenames[0] = $_i_PicNumber Then
GUICtrlSetState($id_ButtonPicGoToLast, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonPicGoToLast, $GUI_ENABLE)
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ ____ __ __ _
;~ | __ ) _ _| |_ ___/ ___| _ _ / _|/ _(_)_ __
;~ | _ \| | | | __/ _ \___ \| | | | |_| |_| \ \/ /
;~ | |_) | |_| | || __/___) | |_| | _| _| |> <
;~ ____|____/ \__, |\__\___|____/ \__,_|_| |_| |_/_/\_\
;~ |_____| |___/
; Stammt 1:1 aus der Hilfe zu FileGetSize()
; Damit überstetzen wir die Rückgaben der Bildgrößen in "für Menschen lesbar" Angaben
Func _ByteSuffix($iBytes)
Local $iIndex = 0, $aArray = [' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB']
While $iBytes > 1023
$iIndex += 1
$iBytes /= 1024
WEnd
Return Round($iBytes) & $aArray[$iIndex]
EndFunc ;==>ByteSuffix
; ###############################################################################################################################################################################################
;~ ____ _ _ _ _____ _ _ __ _
;~ / ___| |__ ___ ___| | _| |__ _____ _| ___(_) | ___ / _| ___ _ __ _ __ ___ __ _| |_
;~ | | | '_ \ / _ \/ __| |/ / '_ \ / _ \ \/ / |_ | | |/ _ \ |_ / _ \| '__| '_ ` _ \ / _` | __|
;~ | |___| | | | __/ (__| <| |_) | (_) > <| _| | | | __/ _| (_) | | | | | | | | (_| | |_
;~ ____\____|_| |_|\___|\___|_|\_\_.__/ \___/_/\_\_| |_|_|\___|_| \___/|_| |_| |_| |_|\__,_|\__|
;~ |_____|
; Springt an sobald irgendeine der Checkboxen für die Bildformate angeklickt wurde
Func _CheckboxFileformat()
; Prüfen ob der Haken bei "Alle" gesetzt oder entfernt wurde
If @GUI_CtrlId = $a_id_CheckboxFileformat[0] Then
; laut Hilfe darf man den Wert von GUICtrlRead() bei Checkboxen direkt nutzen!
Local $i_CheckedOrNot = GUICtrlRead($a_id_CheckboxFileformat[0])
For $i = 1 To (UBound($a_id_CheckboxFileformat) - 1) Step 1
GUICtrlSetState($a_id_CheckboxFileformat[$i], $i_CheckedOrNot)
Next
; Was wurde da gemacht? Wir setzen einfach alle Checkboxen auf den gleichen Wert wie den von $a_id_CheckboxFileformat[0]
; Ist die angehakt so wird der Haken überall gesetzt, wird er entfernt wird er wieder überall gelöscht
Else
; Ok, es war eine der anderen Checkboxen. Wenn auch nur eine von denen nicht aktiviert ist muss der haken bei alle wieder raus
; sind alle gesetzt soll der Haken aber rein. Wir setzen ihn erst rein und schauen dann ob er raus muss
GUICtrlSetState($a_id_CheckboxFileformat[0], $GUI_CHECKED)
For $i = 1 To (UBound($a_id_CheckboxFileformat) - 1) Step 1
If GUICtrlRead($a_id_CheckboxFileformat[$i]) = $GUI_UNCHECKED Then
GUICtrlSetState($a_id_CheckboxFileformat[0], $GUI_UNCHECKED)
ExitLoop
EndIf
Next
EndIf
_CheckboxFileformatCreatePattern() ; Erzeugt das für die _RecursiveFileListToArray() Funktion notwendige Pattern
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _ _____ _ _ __ _ ____ _ ____ _ _
;~ / ___| |__ ___ ___| | _| |__ _____ _| ___(_) | ___ / _| ___ _ __ _ __ ___ __ _| |_ / ___|_ __ ___ __ _| |_ ___| _ \ __ _| |_| |_ ___ _ __ _ __
;~ | | | '_ \ / _ \/ __| |/ / '_ \ / _ \ \/ / |_ | | |/ _ \ |_ / _ \| '__| '_ ` _ \ / _` | __| | | '__/ _ \/ _` | __/ _ \ |_) / _` | __| __/ _ \ '__| '_ \
;~ | |___| | | | __/ (__| <| |_) | (_) > <| _| | | | __/ _| (_) | | | | | | | | (_| | |_| |___| | | __/ (_| | || __/ __/ (_| | |_| || __/ | | | | |
;~ ____\____|_| |_|\___|\___|_|\_\_.__/ \___/_/\_\_| |_|_|\___|_| \___/|_| |_| |_| |_|\__,_|\__|\____|_| \___|\__,_|\__\___|_| \__,_|\__|\__\___|_| |_| |_|
;~ |_____|
; Erzeugt das für die _RecursiveFileListToArray() Funktion notwendige Pattern
Func _CheckboxFileformatCreatePattern()
; Und wieder bei Oscor aus der FotoSort.au3 abgeschaut - bereitet das Suchpattern passend für seine _RecursiveFileListToArray() Funktion auf
Local $s_SaveFileFormat = ""
$s_SearchPattern = ""
For $i = 1 To $aGDIPlusDecoders[0][0] Step 1
If GUICtrlRead($a_id_CheckboxFileformat[$i]) = $GUI_CHECKED Then
$s_SaveFileFormat = $s_SaveFileFormat & $aGDIPlusDecoders[$i][5] & "|"
$s_SearchPattern = $s_SearchPattern & StringRegExpReplace(StringReplace($aGDIPlusDecoders[$i][6], "*.", ""), ";", "|") & "|"
EndIf
Next
$s_SearchPattern = StringTrimRight($s_SearchPattern, 1)
_ReadFileList()
; Und die Einstellungen noch sichern
For $i = 0 To (UBound($a_id_CheckboxFileformat) - 1) Step 1
_SettingsWrite("$a_id_CheckboxFileformat[" & $i & "]", GUICtrlRead($a_id_CheckboxFileformat[$i]))
Next
EndFunc
; ###############################################################################################################################################################################################
;~ _____ _ _ _ _ _
;~ | ___|__ | | __| | ___ _ __ / \ __| | __| |
;~ | |_ / _ \| |/ _` |/ _ \ '__| / _ \ / _` |/ _` |
;~ | _| (_) | | (_| | __/ | / ___ \ (_| | (_| |
;~ ____|_| \___/|_|\__,_|\___|_|___/_/ \_\__,_|\__,_|
;~ |_____| |_____|
Func _Folder_Add()
; Es wurde auf das + geklickt und der Anwender will eine Zeile mehr bekommen
; Der Abstand zwischen den Zeilen wurde oben bei den Variablen festgelegt: $i_Distance
; Wie groß ist die Group im Moment überhaupt ?
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
; Platzbedarf: Pro Zeile $i_Distance Abstand mal die Anzahl der Zeilen
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
; Da ist kein Platz mehr! Also nichts zu tun und raus hier
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Return 1
EndIf
; Array mit den Controls um 1 vergrößern
$a_id_TargetDirectories[0][0] = $a_id_TargetDirectories[0][0] + 1
ReDim $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] + 1 ][5]
; Platz schaffen, die Buttons mit + und - eine Zeile tiefer setzen
Local $a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] - 1][1])
GUICtrlSetPos($id_ButtonAddTargetDirectory, $a_ControlPos[0], 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
GUICtrlSetPos($id_ButtonRemoveTargetDirectory, $a_ControlPos[0] + 32, 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
; Und die neuen Buttons und Input bauen:
; Die Position der Zeile darüber holen
$a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] - 1 ][1])
; Den Button für kopieren
$a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1] = GUICtrlCreateButton($a_id_TargetDirectories[0][0], $a_ControlPos[0], 200 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance), 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1], "_Picture_Copy")
; Diesen und die nachfolgenden Buttons heften wir Rechts und oben an, Größe ist fix
GUICtrlSetResizing($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1], "Taste: [" & $a_id_TargetDirectories[0][0] & "]" & @CRLF & "Datei kopieren")
; Tasten zuweisen, jeweils die Zahlen über den Buchstaben + Nummernblock
If $a_id_TargetDirectories[0][0] < 10 Then ; 2 bis 9
_AcceleratorKeyAdd($a_id_TargetDirectories[0][0], $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
_AcceleratorKeyAdd("{NUMPAD" & $a_id_TargetDirectories[0][0] & "}", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
EndIf
If $a_id_TargetDirectories[0][0] = 10 Then ; und die 10 bekommt die 0
_AcceleratorKeyAdd("0", $a_id_TargetDirectories[10][1])
_AcceleratorKeyAdd("{NUMPAD0}", $a_id_TargetDirectories[10][1])
EndIf
; Den Button für verschieben
$a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][2] = GUICtrlCreateButton("»", $a_ControlPos[0] + 32, 200 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance), 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][2], "_Picture_Move")
GUICtrlSetResizing($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][2], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][2], "Taste: [Alt] + [" & $a_id_TargetDirectories[0][0] & "]" & @CRLF & "Datei verschieben")
; gleiche Zahlen, nur in Kombination mit [ALT]
If $a_id_TargetDirectories[0][0] < 10 Then
_AcceleratorKeyAdd("!" & $a_id_TargetDirectories[0][0], $a_id_TargetDirectories[1][2])
_AcceleratorKeyAdd("!{NUMPAD" & $a_id_TargetDirectories[0][0] & "}", $a_id_TargetDirectories[1][2])
EndIf
If $a_id_TargetDirectories[0][0] = 10 Then
_AcceleratorKeyAdd("!0", $a_id_TargetDirectories[10][2])
_AcceleratorKeyAdd("!{NUMPAD0}", $a_id_TargetDirectories[10][2])
EndIf
; Das Input mit dem Pfad
$a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3] = GUICtrlCreateInput("", $a_ControlPos[0] + 67, 200 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance), 354, 25, BitOR($ES_READONLY,$ES_LEFT, $ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_ACCEPTFILES))
GUICtrlSetFont($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], $s_FontSizeInputs * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetBkColor($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], 0xFFFFE1)
GUICtrlSetResizing($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Damit das Feld Drag'n Drop annimmt (muss zusätzlich zum Extended-Style gesetzt werden)
GUICtrlSetState($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], $GUI_DROPACCEPTED)
; Und noch der Button für die Pfadauswahl
$a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][4] = GUICtrlCreateButton("...", $a_ControlPos[0] + 424, 200 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance), 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][4], "_Folder_Select")
GUICtrlSetResizing($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][4], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][4], "Pfad wählen")
; Ggf den + Button deaktivieren:
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_ENABLE)
EndIf
; Den - Button aktivieren (wir sind bei mindestens 2 Zeilen)
GUICtrlSetState($id_ButtonRemoveTargetDirectory, $GUI_ENABLE)
; Titel der Group anpassen
GUICtrlSetData($id_GroupTargetDirectories, " Zielverzeichnisse (1.." & $a_id_TargetDirectories[0][0] & "): ")
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive , 2)
; Anzahl der Ordner sichern
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
EndFunc
; ###############################################################################################################################################################################################
;~ _____ _ _ ____
;~ | ___|__ | | __| | ___ _ __ | _ \ ___ _ __ ___ _____ _____
;~ | |_ / _ \| |/ _` |/ _ \ '__|| |_) / _ \ '_ ` _ \ / _ \ \ / / _ \
;~ | _| (_) | | (_| | __/ | | _ < __/ | | | | | (_) \ V / __/
;~ ____|_| \___/|_|\__,_|\___|_|___|_| \_\___|_| |_| |_|\___/ \_/ \___|
;~ |_____| |_____|
Func _Folder_Remove()
; Und wieder weg mit der letzten Zeile
; Falls es die letzte Zeile = Zeile 1 ist gleich wieder raus
If $a_id_TargetDirectories[0][0] = 1 Then
GUICtrlSetState($id_ButtonRemoveTargetDirectory, $GUI_DISABLE)
Return 1
EndIf
; Und löschen - erst die Tastenzuweisungen
_AcceleratorKeyDelete($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
_AcceleratorKeyDelete($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][2])
; Registry-Schlüssel mit Pfad dazu (also was gesichert wurde)
;~ RegDelete($s_RegistryKeyname, "$a_id_TargetDirectories[" & $a_id_TargetDirectories[0][0] & "][3]" & "-" & $s_ProfileActive)
; Die 4 Controls
For $i = 1 To 4 Step 1
GUICtrlDelete($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][$i])
$a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][$i] = ""
Next
; Array wieder verkleinern
$a_id_TargetDirectories[0][0] = $a_id_TargetDirectories[0][0] - 1
ReDim $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] + 1 ][5]
; Die + und - Schaltfläche wieder hochrücken:
Local $a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
GUICtrlSetPos($id_ButtonAddTargetDirectory, $a_ControlPos[0], 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
GUICtrlSetPos($id_ButtonRemoveTargetDirectory, $a_ControlPos[0] + 32, 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
; Sind wir nun die letzte Zeile?
If $a_id_TargetDirectories[0][0] = 1 Then
GUICtrlSetState($id_ButtonRemoveTargetDirectory, $GUI_DISABLE)
Return 1
EndIf
; Ggf den + Button wieder aktivieren:
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_ENABLE)
EndIf
; Titel der Group anpassen
GUICtrlSetData($id_GroupTargetDirectories, " Zielverzeichnisse (1.." & $a_id_TargetDirectories[0][0] & "): ")
; Anzahl der Ordner sichern (jetzt einer weniger)
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
EndFunc
; ###############################################################################################################################################################################################
;~ _____ _ _ ____ _ _
;~ | ___|__ | | __| | ___ _ __ / ___| ___| | ___ ___| |_
;~ | |_ / _ \| |/ _` |/ _ \ '__|\___ \ / _ \ |/ _ \/ __| __|
;~ | _| (_) | | (_| | __/ | ___) | __/ | __/ (__| |_
;~ ____|_| \___/|_|\__,_|\___|_|___|____/ \___|_|\___|\___|\__|
;~ |_____| |_____|
; Wird aktiv wenn der ... Button neben den Quellordner oder einer der Zielordner geklickt wurde
Func _Folder_Select()
Local $_s_Folder ; Da kommt die Rückgabe aus dem FileSelectFolder() Dialog rein
If @GUI_CtrlId = $id_ButtonSelectSourceDirectory Then ; Ist für den Quellpfad
$_s_Folder = FileSelectFolder("Quellordner auswählen", GUICtrlRead($id_InputSourceDirectory), 0, "", $h_FormFotoSort2017)
If $_s_Folder <> "" Then
GUICtrlSetData($id_InputSourceDirectory, $_s_Folder)
_SettingsWrite("$id_InputSourceDirectory", $_s_Folder)
_ReadFileList()
;~ Else
; Es wurde abgebrochen
; Standard vom Anfang wiederherstellen. Also so lassen. Also Nix tun
EndIf
Return 0
EndIf
; Und hier die Auswahl der anderen Ordner...
For $i = 1 To $a_id_TargetDirectories[0][0] Step 1
If @GUI_CtrlId = $a_id_TargetDirectories[$i][4] Then
$_s_Folder = FileSelectFolder("Zielordner " & $i & " auswählen", GUICtrlRead($a_id_TargetDirectories[$i][3]), 1, "", $h_FormFotoSort2017)
If $_s_Folder <> "" Then
GUICtrlSetData($a_id_TargetDirectories[$i][3], $_s_Folder)
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
_SettingsWrite("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive, $_s_Folder)
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
;~ Else
; Abbruch ... nix machen oder löschen?
;GUICtrlSetData($a_id_TargetDirectories[$i][3], "")
EndIf
ExitLoop
EndIf
Next
EndFunc
; ###############################################################################################################################################################################################
Func _GDIPlus_ScaleImage2($hImage, $iNewWidth, $iNewHeight, $iBGColor = 0xFFF0F0F0, $bBGClear = True, $iInterpolationMode = 7) ;coded by UEZ 2012
Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
Local $iHeight = _GDIPlus_ImageGetHeight($hImage)
Local $iW, $iH, $f, $fRatio
If $iWidth > $iHeight Then
$f = $iWidth / $iNewWidth
Else
$f = $iHeight / $iNewHeight
EndIf
$iW = Int($iWidth / $f)
$iH = Int($iHeight / $f)
If $iW > $iNewWidth Then
$fRatio = $iNewWidth / $iW
$iW = Int($iW * $fRatio)
$iH = Int($iH * $fRatio)
ElseIf $iH > $iNewHeight Then
$fRatio = $iNewHeight / $iH
$iW = Int($iW * $fRatio)
$iH = Int($iH * $fRatio)
EndIf
Local $hBitmap = DllCall($__g_hGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
If @error Then Return SetError(3, 0, 0)
$hBitmap = $hBitmap[6]
Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
If $bBGClear Then _GDIPlus_GraphicsClear($hBmpCtxt, $iBGColor)
DllCall($__g_hGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hBmpCtxt, "int", $iInterpolationMode)
_GDIPlus_GraphicsDrawImageRect($hBmpCtxt, $hImage, 0, 0, $iW, $iH)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hBmpCtxt)
Return $hBitmap
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _ _ _____ _ _ _ _
;~ / ___| ___| |_| | | |_ __ (_) __ _ _ _ ___| ___(_) | ___| \ | | __ _ _ __ ___ ___
;~ | | _ / _ \ __| | | | '_ \| |/ _` | | | |/ _ \ |_ | | |/ _ \ \| |/ _` | '_ ` _ \ / _ \
;~ | |_| | __/ |_| |_| | | | | | (_| | |_| | __/ _| | | | __/ |\ | (_| | | | | | | __/
;~ ____\____|\___|\__|\___/|_| |_|_|\__, |\__,_|\___|_| |_|_|\___|_| \_|\__,_|_| |_| |_|\___|
;~ |_____| |_|
; Wir benötigt falls ein Suffix für das Umbenennen angehängt werden soll
; Oscar hat einfach ein (Zahl) angehängt. Das finde ich beim Windows Explorer schon doof
; Man kan im Input hierzu etwas beliebiges angeben, jedes # daraus wird durch die Zahl ersetzt.
; bei mehreren #### wird mit führenden Nullen aufgefüllt
; sind es zu wenig # wird trotzdem die nächst höhere Zahl gesetzt => ### steht und 1000 wäre dran - kein Problem!
Func _GetUniqueFileName($_s_Filename, $_s_Extension)
Local $_s_NewFilename ; Da kommt der neuen Name rein
Local $_s_NumberString = GUICtrlRead($id_InputSuffix) ; Was für ein Suffix darf es denn sein
Local $_i_NumberOfHash = StringReplace($_s_NumberString, "#", "") ; Zählen wir mal die #m steht dann in @extended
$_i_NumberOfHash = @extended
If $_i_NumberOfHash < 1 Then ; ein # muss schon sein. Fällt erste bei der 2. Datei auf
MsgBox(16, "FEHLER:", "Das anzuhängende Suffic muss mindestens einmal das # enthalten!")
Return -1
EndIf
Local $_s_ResultStringFormat ; falls wir mit 0 auffüllen müssen kommt hier die passende Zahl rein
Local $_s_Replacement = "" ; oben haben wir die Anzahl der # gezählt. diese werden wir durch die # ersetzten. Wer _#__##_# schreibt hat Pech gehabt
For $y = 1 To $_i_NumberOfHash Step 1
$_s_Replacement = $_s_Replacement & "#"
Next
Local $_i_Counter = 0 ; ist die Zahl die angehängt wird
While 1
$_i_Counter = $_i_Counter + 1
If $_i_NumberOfHash < StringLen(String($_i_Counter)) Then
; zu wenig # ! Also ignorieren und nur die Zahl nehmen
$_s_ResultStringFormat = $_i_Counter
Else
; Zahl mit führenden 0en erstellen
$_s_ResultStringFormat = StringFormat("%0" & $_i_NumberOfHash & "d", $_i_Counter)
EndIf
; Und den neuen Dateinamen zusammenbauen
$_s_NewFilename = $_s_Filename & StringReplace($_s_NumberString, $_s_Replacement, $_s_ResultStringFormat) & $_s_Extension
; So, neuen namen zusammengebaut, Testen ob es die Datei schon gibt
If FileExists($_s_NewFilename) = 0 Then
; Gibt es noch nicht! $_s_NewFilename enthält einen passenden Dateinamen! Raus hier!
ExitLoop
EndIf
; Den Namen gab es wohl auch schon - also noch einmal von vorne!
WEnd
Return $_s_NewFilename ; und den Dateinamen zurück geben
EndFunc
; ###############################################################################################################################################################################################
; Modifizierte Version der original _GUICtrlSetGIF() aus der GIFAnimation.au3 von trancexx, angepasst an das was in diesem Programm benötigt wird
Func _GUICtrlSetGIF_Mod($iControld, $vGIF, $fUpscale = True, $vAdditionalData = Default, $iRenderingStyle = Default, $iForcedARGB = Default)
Local $iScalefactor = 1
Local $iImgWidth, $iImgHeight, $fDebugInfo = False, $iFactorW, $iFactorH, $iScaleWidth, $iScaleHeight
; Erst einmal die Größe des GIF ermitteln:
Local $_a_PictureMetrics[5] ; 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
Local $_a_GIF_Size = _GIF_GetDimension($vGIF)
$_a_PictureMetrics[0] = $_a_GIF_Size[0]
$_a_PictureMetrics[1] = $_a_GIF_Size[1]
$_a_PictureMetrics[2] = "8 Bit"
$_a_PictureMetrics[4] = _ByteSuffix(FileGetSize($vGIF))
Local $_a_LabelBehindPicture1 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture1)
Local $_a_LabelBehindPicture2 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture2)
; Die eigentliche Funktion
;~ Local $aCtrlPos = WinGetPos(GUICtrlGetHandle($iControld))
Local $aCtrlPos = ControlGetPos($h_FormFotoSort2017, "", $iControld)
If @error Then Return SetError(6, 0, False)
If $vAdditionalData = Default Then $vAdditionalData = ""
If $aCtrlPos[2] = 0 Then $aCtrlPos[2] = Default
If $aCtrlPos[3] = 0 Then $aCtrlPos[3] = Default
; So, es wurde sich die Größe des PicControls geholt - und im normalfall wird das Gif einfach in der Größe erstellt.
; Anpassung: Wir holen uns die Größe von dem schwarzen Rahmen umzu. Der skaliert nämlich sauber mit
$aCtrlPos[0] = $_a_LabelBehindPicture1[0] + 2
$aCtrlPos[1] = $_a_LabelBehindPicture1[1] + 2
$aCtrlPos[2] = $_a_LabelBehindPicture1[2] - 4
$aCtrlPos[3] = $_a_LabelBehindPicture2[3] - 4
If $id_Background = 0 Then
$id_Background = GUICtrlCreateGraphic($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
GUICtrlSetGraphic($id_Background, $GUI_GR_COLOR, "0x" & Hex(_RGB_2_ARGB($d_BackgroundColor_ARGB), 6), "0x" & Hex(_RGB_2_ARGB($d_BackgroundColor_ARGB),6))
GUICtrlSetGraphic($id_Background, $GUI_GR_RECT, 0, 0, $aCtrlPos[2], $aCtrlPos[3])
GUICtrlSetState($id_Background, $GUI_DROPACCEPTED)
EndIf
; Wir passen es mit den richtigen Seitenverhältnissen an:
$iImgWidth = $_a_PictureMetrics[0] ; die Breite der Grafikdatei holen
$iImgHeight = $_a_PictureMetrics[1] ; die Höhe der Grafikdatei holen
; Testen ob wir größer sind:
$iFactorW = $aCtrlPos[2] / $iImgWidth
$iFactorH = $aCtrlPos[3] / $iImgHeight
If $iImgWidth > $aCtrlPos[2] Or $iImgHeight > $aCtrlPos[3] Then
; Ok, wir müssen verkleinern! Was ist denn zu groß? X, Y oder beides?
If $iFactorW > $iFactorH Then
$iScalefactor = $iFactorH
Else
$iScalefactor = $iFactorW
EndIf
Else
; Testen ob wir kleiner sind
If $iImgWidth < $aCtrlPos[2] Or $iImgHeight < $aCtrlPos[3] Then
; Vergrößern!
If $b_Upscale = True Then
If $iFactorW > $iFactorH Then
$iScalefactor = $iFactorH
Else
$iScalefactor = $iFactorW
EndIf
Else
$iScalefactor = 1
EndIf
EndIf
EndIf
Local $iScaleWidth = Int($iImgWidth * $iScalefactor) ; die Breite der skalierten Grafikdatei berechnen
Local $iScaleHeight = Int($iImgHeight * $iScalefactor) ; die Höhe der skalierten Grafikdatei berechnen
$_a_PictureMetrics[3] = Int($iScalefactor * 100) & "%"
_GIF_ExitAnimation($iControld)
_GIF_DeleteGIF($iControld, True)
; V1: oben links und entsprechend kleiner nach rechts und unten
;~ _GUICtrlCreateGIF($vGIF, $vAdditionalData, $aCtrlPos[0], $aCtrlPos[1], $iScaleWidth, $iScaleHeight, $iRenderingStyle, $iForcedARGB, $iControld)
; V2: Zentrieren. Also tiefer bzw. nach rechts versetzt
$iFactorW = Int(($aCtrlPos[2] - $iScaleWidth) / 2)
$iFactorH = Int(($aCtrlPos[3] - $iScaleHeight) / 2)
$iControld = _GUICtrlCreateGIF($vGIF, $vAdditionalData, $aCtrlPos[0] + $iFactorW, $aCtrlPos[1] + $iFactorH, $iScaleWidth, $iScaleHeight)
;~ _GUICtrlCreateGIF($vGIF, $vAdditionalData, $aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3], $iRenderingStyle, $iForcedARGB, $iControld)
SetError(@error, @extended, Not @error)
Return $_a_PictureMetrics
EndFunc ;==>_GUICtrlSetGIF_Mod
; ###############################################################################################################################################################################################
;~ ____ _ ____ _ _ ____ _ ___ _____
;~ / ___|_ _(_)/ ___| |_ _ __| / ___| ___| |_|_ _|_ __ ___ __ _ __ _ ___| ____|_ __
;~ | | _| | | | | | | __| '__| \___ \ / _ \ __|| || '_ ` _ \ / _` |/ _` |/ _ \ _| \ \/ /
;~ | |_| | |_| | | |___| |_| | | |___) | __/ |_ | || | | | | | (_| | (_| | __/ |___ > <
;~ ____\____|\__,_|_|\____|\__|_| |_|____/ \___|\__|___|_| |_| |_|\__,_|\__, |\___|_____/_/\_\
;~ |_____| |___/
;===============================================================================
; Name: : _GuiCtrlSetImageEx
; Description: : Funktion zum laden von Grafikdateien (alle die GDI+ unterstützt) in ein Pic-Control
; Dabei werden die Grafikdateien proportional in das Pic-Control eingepasst (skaliert)
; Die Grafikdatei darf auch als Variable mit Binärdaten übergeben werden.
; Syntax: : _GuiCtrlSetImageEx([$idPic][, $sImgFile][, $fUpscale][, $iBkColor][, $fDebugInfo])
; Parameter(s): : $idPic = ID des Pic-Control (kann auch "Default" oder "-1" sein)
; $sImgFile = der Pfad und Dateiname der Grafikdatei oder die Grafikdatei als Variable mit Binärdaten
; $fUpscale = falls TRUE, wird die Grafikdatei auf die Maße des Pic-Control hochscaliert
; $iBkColor = Hintergrundfarbe (Format: ARGB) für das Pic-Control
; $fDebugInfo = falls TRUE, werden ein paar Debugdaten in der Console angezeigt
; Requirement: : oben stehende Includes und AutoIt-Version >= v3.3.12.0
; Return Value(s): : Im Erfolgsfall wird TRUE zurückgegeben (@error = 0). Ansonsten:
; @error = 1 wenn das Pic-Control nicht existiert
; @error = 2 wenn die Abmessungen des Pic-Control nicht gelesen werden konnten
; @error = 3 wenn die Grafikdatei nicht geladen werden konnte
; Author(s): : Oscar (www.autoit.de)
; Version / Date: : 1.1.0.0 / 14.07.2015
;===============================================================================
; Das original von Oscar. Macht die ganze Arbeit im Skript. Hat er als Antwort auf die Frage geschickt wie man die Vorschau dynamisch an die GUI-Größe anpassen kann
; https://autoit.de/index.php/Thread/85338-GUI-Fenster-Gr%C3%B6%C3%9Fen%C3%A4nderung-wie-geht-das-mit-GDIPlus-Elementen/?postID=683416#post683416
; Funktioniert 1a - Nutze ich abgewandelt (siehe nächste Funktion)
Func _GuiCtrlSetImageEx($idPic = Default, $sImgFile = '', $fUpscale = False, $iBkColor = 0x00000000, $fDebugInfo = False)
Local $hPic, $hParent, $aPos, $hGfx, $hImage, $hBitmap, $hGfxCtxt, $iImgWidth, $iImgHeight, $hBitmapScaled, $hBMP
Local $iScalefactor = 1, $iFactorW, $iFactorH, $iScaleWidth, $iScaleHeight, $iError = 0
If $idPic = Default Or $idPic <= 0 Then $idPic = _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($idPic))
$hPic = GUICtrlGetHandle($idPic) ; das Handle vom Pic-Control holen
If Not IsHWnd($hPic) Then Return SetError(1, 0, 0) ; wenn kein Handle, dann Funktion mit Fehlermeldung verlassen
$hParent = _WinAPI_GetParent($hPic) ; das Fenster des Pic-Controls ermitteln
$aPos = ControlGetPos($hParent, '', $idPic) ; die Koordinaten und Abmessungen des Pic-Control ermitteln
_GDIPlus_Startup() ; GDI-Plus starten
$hBitmap = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3]) ; Eine Bitmap erstellen
$hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; Graphic-Context der Bitmap holen
_GDIPlus_GraphicsSetInterpolationMode($hGfxCtxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC)
_GDIPlus_GraphicsClear($hGfxCtxt, $iBkColor) ; Die Bitmap mit der Hintergrundfarbe füllen
If IsBinary($sImgFile) Then ; wenn die Grafikdatei als Binärdaten übergeben wurde, dann...
$hImage = _GDIPlus_BitmapCreateFromMemory($sImgFile) ; die Grafikdatei aus den Binärdaten laden
If @error Then $iError = 3 ; wenn das laden der Binärdaten fehlgeschlagen ist, dann Errorcode speichern
Else ; sonst (Grafikdatei befindet sich auf Datenträger)...
$hImage = _GDIPlus_BitmapCreateFromFile($sImgFile) ; die Grafikdatei laden
If @error Then $iError = 3 ; wenn das laden der Datei fehlgeschlagen ist, dann Errorcode speichern
EndIf
If Not $iError Then ; wenn kein Fehler aufgetreten ist, dann...
$iImgWidth = _GDIPlus_ImageGetWidth($hImage) ; die Breite der Grafikdatei holen
$iImgHeight = _GDIPlus_ImageGetHeight($hImage) ; die Höhe der Grafikdatei holen
; wenn die Größe des Pic-Controls kleiner als die Grafikdatei ist oder $fUpscale = True,
; dann muss die Grafikdatei skaliert werden (Scalefactor berechnen):
If ($aPos[2] < $iImgWidth Or $aPos[3] < $iImgHeight) Or ($fUpscale = True) Then
$iFactorW = $aPos[2] / $iImgWidth
$iFactorH = $aPos[3] / $iImgHeight
$iScalefactor = ($iFactorW > $iFactorH ? $iFactorH : $iFactorW)
EndIf
$iScaleWidth = Int($iImgWidth * $iScalefactor) ; die Breite der skalierten Grafikdatei berechnen
$iScaleHeight = Int($iImgHeight * $iScalefactor) ; die Höhe der skalierten Grafikdatei berechnen
If $fDebugInfo Then ; Debuginformationen ausgeben, wenn gewünscht:
ConsoleWrite(StringFormat('Ctrl-Size: %i x %i\n', $aPos[2], $aPos[3]))
ConsoleWrite(StringFormat('Img-Size: %i x %i\n', $iImgWidth, $iImgHeight))
ConsoleWrite(StringFormat('Scale-Factor: %f\n', $iScalefactor))
ConsoleWrite(StringFormat('Scale-Size: %i x %i\n\n', $iScaleWidth, $iScaleHeight))
EndIf
$hBitmapScaled = _GDIPlus_ImageResize($hImage, $iScaleWidth, $iScaleHeight) ; die Grafikdatei skalieren
; und zentriert in die Bitmap zeichnen:
_GDIPlus_GraphicsDrawImageRect($hGfxCtxt, $hBitmapScaled, ($aPos[2] - $iScaleWidth) / 2, ($aPos[3] - $iScaleHeight) / 2, $iScaleWidth, $iScaleHeight)
EndIf
_WinAPI_LockWindowUpdate($hParent)
$hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) ; HBitmap von der Bitmap erstellen
_WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP)) ; und an das Pic-Control senden
_WinAPI_LockWindowUpdate(0)
; zum Schluss noch aufräumen...
_WinAPI_DeleteObject($hBMP)
_GDIPlus_BitmapDispose($hBitmapScaled)
_GDIPlus_GraphicsDispose($hGfxCtxt)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_Shutdown()
Return SetError($iError, 0, $iError = 0)
EndFunc ;==>_GuiCtrlSetImageEx
; ###############################################################################################################################################################################################
;~ ____ _ ____ _ _ ____ _ ___ _____ __ __ _ _ __ _ _
;~ / ___|_ _(_)/ ___| |_ _ __| / ___| ___| |_|_ _|_ __ ___ __ _ __ _ ___| ____|_ __ | \/ | ___ __| (_)/ _(_) ___ __| |
;~ | | _| | | | | | | __| '__| \___ \ / _ \ __|| || '_ ` _ \ / _` |/ _` |/ _ \ _| \ \/ / | |\/| |/ _ \ / _` | | |_| |/ _ \/ _` |
;~ | |_| | |_| | | |___| |_| | | |___) | __/ |_ | || | | | | | (_| | (_| | __/ |___ > < | | | | (_) | (_| | | _| | __/ (_| |
;~ ____\____|\__,_|_|\____|\__|_| |_|____/ \___|\__|___|_| |_| |_|\__,_|\__, |\___|_____/_/\_\___|_| |_|\___/ \__,_|_|_| |_|\___|\__,_|
;~ |_____| |___/ |_____|
; Die Funktion wie zuvor, jedoch abgeändert für dieses Programm
; Änderung 1: Gibt die Bildmaße als Array zurück: $_a_PictureMetrics[5] ; 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
; also alle Zeilen welche dieses Array enthalten sind neu
Func _GuiCtrlSetImageEx_Modified($idPic = Default, $sImgFile = '', $fUpscale = False, $iBkColor = 0x00000000, $fDebugInfo = False)
Local $_a_PictureMetrics[5] ; 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
Local $hPic, $hParent, $aPos, $hGfx, $hImage, $hBitmap, $hGfxCtxt, $iImgWidth, $iImgHeight, $hBitmapScaled, $hBMP, $aPixelFormat
Local $iScalefactor = 1, $iFactorW, $iFactorH, $iScaleWidth, $iScaleHeight, $iError = 0
If $idPic = Default Or $idPic <= 0 Then $idPic = _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($idPic))
$hPic = GUICtrlGetHandle($idPic) ; das Handle vom Pic-Control holen
If Not IsHWnd($hPic) Then
SetError(1, 0, 0) ; wenn kein Handle, dann Funktion mit Fehlermeldung verlassen
Return $_a_PictureMetrics
EndIf
$hParent = _WinAPI_GetParent($hPic) ; das Fenster des Pic-Controls ermitteln
$aPos = ControlGetPos($hParent, '', $idPic) ; die Koordinaten und Abmessungen des Pic-Control ermitteln
_GDIPlus_Startup() ; GDI-Plus starten
$hBitmap = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3]) ; Eine Bitmap erstellen
$hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; Graphic-Context der Bitmap holen
_GDIPlus_GraphicsSetInterpolationMode($hGfxCtxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC)
_GDIPlus_GraphicsClear($hGfxCtxt, $iBkColor) ; Die Bitmap mit der Hintergrundfarbe füllen
If IsBinary($sImgFile) Then ; wenn die Grafikdatei als Binärdaten übergeben wurde, dann...
$hImage = _GDIPlus_BitmapCreateFromMemory($sImgFile) ; die Grafikdatei aus den Binärdaten laden
If @error Then $iError = 3 ; wenn das laden der Binärdaten fehlgeschlagen ist, dann Errorcode speichern
Else ; sonst (Grafikdatei befindet sich auf Datenträger)...
$hImage = _GDIPlus_BitmapCreateFromFile($sImgFile) ; die Grafikdatei laden
If @error Then
$iError = 3 ; wenn das laden der Datei fehlgeschlagen ist, dann Errorcode speichern
Else
; Dateigröße holen
$_a_PictureMetrics[4] = _ByteSuffix(FileGetSize($sImgFile))
EndIf
EndIf
If Not $iError Then ; wenn kein Fehler aufgetreten ist, dann...
$iImgWidth = _GDIPlus_ImageGetWidth($hImage) ; die Breite der Grafikdatei holen
$iImgHeight = _GDIPlus_ImageGetHeight($hImage) ; die Höhe der Grafikdatei holen
$_a_PictureMetrics[0] = $iImgWidth
$_a_PictureMetrics[1] = $iImgHeight
$aPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage) ; Daten zu Farbtiefe, dpi etc holen
$_a_PictureMetrics[2] = StringFormat("%i Bit", $aPixelFormat[1])
;~ MsgBox(0, "$aPixelFormat", "$aPixelFormat[0]: " & $aPixelFormat[0] & @CRLF & "$aPixelFormat[1]: " & $_a_PictureMetrics[2])
; wenn die Größe des Pic-Controls kleiner als die Grafikdatei ist oder $fUpscale = True,
; dann muss die Grafikdatei skaliert werden (Scalefactor berechnen):
If ($aPos[2] < $iImgWidth Or $aPos[3] < $iImgHeight) Or ($fUpscale = True) Then
$iFactorW = $aPos[2] / $iImgWidth
$iFactorH = $aPos[3] / $iImgHeight
$iScalefactor = ($iFactorW > $iFactorH ? $iFactorH : $iFactorW)
EndIf
$iScaleWidth = Int($iImgWidth * $iScalefactor) ; die Breite der skalierten Grafikdatei berechnen
$iScaleHeight = Int($iImgHeight * $iScalefactor) ; die Höhe der skalierten Grafikdatei berechnen
;~ $fDebugInfo = True
If $fDebugInfo Then ; Debuginformationen ausgeben, wenn gewünscht:
ConsoleWrite(StringFormat('Ctrl-Size: %i x %i\n', $aPos[2], $aPos[3]))
ConsoleWrite(StringFormat('Img-Size: %i x %i\n', $iImgWidth, $iImgHeight))
ConsoleWrite(StringFormat('Scale-Factor: %f\n', $iScalefactor))
ConsoleWrite(StringFormat('Scale-Size: %i x %i\n\n', $iScaleWidth, $iScaleHeight))
EndIf
$_a_PictureMetrics[3] = Int($iScalefactor * 100) & "%"
$hBitmapScaled = _GDIPlus_ImageResize($hImage, $iScaleWidth, $iScaleHeight) ; die Grafikdatei skalieren
; und zentriert in die Bitmap zeichnen:
_GDIPlus_GraphicsDrawImageRect($hGfxCtxt, $hBitmapScaled, ($aPos[2] - $iScaleWidth) / 2, ($aPos[3] - $iScaleHeight) / 2, $iScaleWidth, $iScaleHeight)
EndIf
_WinAPI_LockWindowUpdate($hParent)
$hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) ; HBitmap von der Bitmap erstellen
_WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP)) ; und an das Pic-Control senden
_WinAPI_LockWindowUpdate(0)
; zum Schluss noch aufräumen...
_WinAPI_DeleteObject($hBMP)
_GDIPlus_BitmapDispose($hBitmapScaled)
_GDIPlus_GraphicsDispose($hGfxCtxt)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_Shutdown()
SetError($iError, 0, $iError = 0)
Return $_a_PictureMetrics
EndFunc ;==>_GuiCtrlSetImageEx
; ###############################################################################################################################################################################################
;~ _ _ _
;~ | | | | ___| |_ __
;~ | |_| |/ _ \ | '_ \
;~ | _ | __/ | |_) |
;~ ____|_| |_|\___|_| .__/
;~ |_____| |_|
Func _Help()
; Transparentes Overlay als Hilfe über dem Fenster - Schritt für Schritt die Bedienelemente
Local $_a_MousePos
; Drag'n Drop auf die Vorschau und den Quellpfad
Local $_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_DragNDrop1png())
Local $_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
Local $_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
Local $_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
Local $_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $id_InputSourceDirectory)
Local $_i_TargetX = $_a_ControlPos[0] + Int($_i_Width1 / 2) - 100
Local $_i_TargetY = $_a_ControlPos[1]
Local $_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
Local $_help_ButtonOK = _GDIPlus_BitmapCreateFromMemory(_Help_ButtonOK())
Local $_help_h_ButtonOK = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_ButtonOK)
Local $_i_Width2 = _GDIPlus_ImageGetWidth($_help_ButtonOK)
Local $_i_Height2 = _GDIPlus_ImageGetHeight($_help_ButtonOK)
Local $_help_h_FormOK = GUICreate("FotoSort2017 Hilfe OK", $_i_Width2, $_i_Height2, $_i_TargetX + $_i_Width1, $_i_TargetY + Int($_i_Height1 / 2 - $_i_Height2 / 2), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormOK)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_ButtonOK, $_help_h_FormOK, $_i_Width2, $_i_Height2)
AutoItSetOption("GUIOnEventMode", 0)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
Local $_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Navigieren
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_Navigationpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $id_InputPicNumber)
$_i_TargetX = $_a_ControlPos[0] - 115
$_i_TargetY = $_a_ControlPos[1] - 358
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX , $_i_TargetY - 200)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Kopieren oder verschieben
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_CopyMovepng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_TargetDirectories[1][1])
$_i_TargetX = $_a_ControlPos[0] - 205
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 15
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX + 100, $_i_TargetY + 300)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Zielverzeichnis hinzufügen
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_AddTargetDirectoriespng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $id_ButtonAddTargetDirectory)
$_i_TargetX = $_a_ControlPos[0] - $_i_Width1 + 10
$_i_TargetY = $_a_ControlPos[1] - Int($_i_Height1 / 2) + Int($_a_ControlPos[3] / 2)
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX + 50, $_i_TargetY + 200)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Kopieren oder verschieben
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_CopyMovepng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_TargetDirectories[1][1])
$_i_TargetX = $_a_ControlPos[0] - 205
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 15
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX + 100, $_i_TargetY + 300)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Zielverzeichnis wählen
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_DragNDrop2png())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_TargetDirectories[1][3])
$_i_TargetX = $_a_ControlPos[0] - 50
$_i_TargetY = $_a_ControlPos[1]
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX + 75, $_i_TargetY + 240)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Button Löschen
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_BildLoeschenpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "DEL" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 50
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Button Umbennen
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_Umbennenpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "Rename" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 50
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Button Reload
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_Reloadpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "RELOAD" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 55
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Button Dateiliste
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_FileListpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "Filenames" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 55
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Button Hintergrundfarbe
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_Backgroundpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "BKG" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 55
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Reset
$_help_Bitmap = _GDIPlus_BitmapCreateFromMemory(_Help_Resetpng())
$_help_h_Bitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_help_Bitmap)
$_i_Width1 = _GDIPlus_ImageGetWidth($_help_Bitmap)
$_i_Height1 = _GDIPlus_ImageGetHeight($_help_Bitmap)
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If $a_id_Tools[$i][0] = "RESET" Then
$_a_ControlPos = _WinAPI_ControlGetPosEx($h_FormFotoSort2017, $a_id_Tools[$i][1])
ExitLoop
EndIf
Next
$_i_TargetX = $_a_ControlPos[0] - 55
$_i_TargetY = $_a_ControlPos[1] - $_i_Height1 + 6
$_help_h_FormHint = GUICreate("FotoSort2017 Hilfe Pfeile", $_i_Width1, $_i_Height1, $_i_TargetX, $_i_TargetY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW, $_help_h_FormHint)
_WinAPI_DisplayTransparentBitmapInGUI($_help_h_Bitmap, $_help_h_FormHint, $_i_Width1, $_i_Height1)
WinMove($_help_h_FormOK, "", $_i_TargetX - $_i_Width2 - 20 , $_i_TargetY)
GUISetState(@SW_SHOW, $_help_h_FormOK)
While 1
$_a_MousePos = MouseGetPos()
ToolTip("Abbruch der Hilfe mit rechter Maustaste!", $_a_MousePos[0] + 15, $_a_MousePos[1], "Hinweis:")
Sleep(100)
$_n_Msg = GUIGetMsg(1)
Switch $_n_Msg[0]
Case $GUI_EVENT_PRIMARYDOWN
If $_n_Msg[1] = $_help_h_FormOK Then
GUISetState(@SW_HIDE, $_help_h_FormOK)
Sleep(250)
ExitLoop
EndIf
Case $GUI_EVENT_SECONDARYDOWN
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
Return 1
EndSwitch
WEnd
_GDIPlus_BitmapDispose($_help_Bitmap)
GUIDelete($_help_h_FormHint)
; Hilfe ist Fertig!
_GDIPlus_BitmapDispose($_help_ButtonOK)
GUIDelete($_help_h_FormOK)
AutoItSetOption("GUIOnEventMode", 1)
ToolTip("")
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _ _ ___ _ _ ____ ____ _ _
;~ | _ \(_) ___| |_ _ _ _ __ ___ / \ ___| | __/ _ \__ _____ _ ____ ___ __(_) |_ ___| _ \ ___ _ __ __ _ _ __ ___ ___| _ \(_) __ _| | ___ __ _
;~ | |_) | |/ __| __| | | | '__/ _ \ / _ \ / __| |/ / | | \ \ / / _ \ '__\ \ /\ / / '__| | __/ _ \ |_) / _ \ '_ \ / _` | '_ ` _ \ / _ \ | | | |/ _` | |/ _ \ / _` |
;~ | __/| | (__| |_| |_| | | | __// ___ \\__ \ <| |_| |\ V / __/ | \ V V /| | | | || __/ _ < __/ | | | (_| | | | | | | __/ |_| | | (_| | | (_) | (_| |
;~ ____|_| |_|\___|\__|\__,_|_| \___/_/ \_\___/_|\_\\___/ \_/ \___|_| \_/\_/ |_| |_|\__\___|_| \_\___|_| |_|\__,_|_| |_| |_|\___|____/|_|\__,_|_|\___/ \__, |
;~ |_____| |___/
; Falls es die Zieldatei schon gibt kann man neben Überschreiben und Suffix auch "Nachfragen" auswählen.
; Da kommt jetzt ein neues Fenster welches Quelle und Ziel nebeneinander zeigt und man zwischen 3 Optionen wählen kann
Func _PictureAskOverwriteRenameDialog($_s_PicSourceFile, $_s_PicTargetFile, $_s_Headline = "Bild ist schon im Zielordner vorhanden:", $_b_Overwrite = True, $_b_Rename = True, $_b_Cancel = True)
GUISetState(@SW_DISABLE, $h_FormFotoSort2017) ; Das Hauptfenster reagiert ab jetzt auf nichts mehr
Local $_s_empty = ""
Local $_a_SourceFile = _PathSplit($_s_PicSourceFile, $_s_empty, $_s_empty, $_s_empty, $_s_empty)
Local $_a_TargetFile = _PathSplit($_s_PicTargetFile, $_s_empty, $_s_empty, $_s_empty, $_s_empty)
Local $_Sub1_h_FormAskOverwriteRename = GUICreate("Überschreiben oder Umbenennen", 1072, 733, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $h_FormFotoSort2017)
GUISetFont($s_FontSizeForm * $i_AppliedDPI, 400, 0, "$s_FontNameForm")
GUISetBkColor(0x000000)
Local $_Sub1_id_Label1 = GUICtrlCreateLabel($_s_Headline, 0, 4, 1072, 28, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont($_Sub1_id_Label1, 20 * $i_AppliedDPI, 400, 0, "$s_FontNameForm")
GUICtrlSetColor($_Sub1_id_Label1, 0xC0C0C0)
Local $_Sub1_id_PictureSource = GUICtrlCreatePic("", 5, 40, 514, 530)
Local $_Sub1_id_PictureTarget = GUICtrlCreatePic("", 549, 40, 514, 530)
Local $_Sub1_id_LabelSource = GUICtrlCreateLabel("", 5, 576, 514, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))
Local $_Sub1_id_LabelSourceName = GUICtrlCreateLabel($_a_SourceFile[3] & $_a_SourceFile[4], 5, 606, 514, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetColor($_Sub1_id_LabelSource, 0xC0C0C0)
GUICtrlSetColor($_Sub1_id_LabelSourceName, 0xC0C0C0)
Local $_Sub1_id_LabelTarget = GUICtrlCreateLabel("", 549, 576, 514, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))
Local $_Sub1_id_LabelTargetName = GUICtrlCreateLabel($_a_TargetFile[3] & $_a_TargetFile[4], 549, 606, 514, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetColor($_Sub1_id_LabelTarget, 0xC0C0C0)
GUICtrlSetColor($_Sub1_id_LabelTargetName, 0xC0C0C0)
Local $_Sub1_id_ButtonOverwrite = GUICtrlCreateButton(" A Überschreiben", 406, 638, 234, 30, $BS_LEFT)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($_Sub1_id_ButtonOverwrite), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Overwriteico))
If $_b_Overwrite = False Then
GUICtrlSetState($_Sub1_id_ButtonOverwrite, $GUI_DISABLE)
EndIf
Local $_Sub1_id_ButtonRename = GUICtrlCreateButton(" B Umbenennen", 406, 670, 234, 30, $BS_LEFT)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($_Sub1_id_ButtonRename), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_CheckOffico2))
If $_b_Rename = False Then
GUICtrlSetState($_Sub1_id_ButtonRename, $GUI_DISABLE)
EndIf
Local $_Sub1_id_ButtonCancel = GUICtrlCreateButton(" C Abbrechen", 406, 702, 234, 30, $BS_LEFT)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($_Sub1_id_ButtonCancel), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Cancelico))
If $_b_Cancel = False Then
GUICtrlSetState($_Sub1_id_ButtonCancel, $GUI_DISABLE)
EndIf
; Auch hier natürlich mit Tastendruck möglich. Da es nur 4 sind legen wir die eben händisch an
Local $_a_AccKeys[4][2] = [ [ "a", $_Sub1_id_ButtonOverwrite ], [ "b", $_Sub1_id_ButtonRename ], [ "c", $_Sub1_id_ButtonCancel ], [ "{ESC}", $_Sub1_id_ButtonCancel ] ]
GUISetState(@SW_SHOW, $_Sub1_h_FormAskOverwriteRename)
GUISetAccelerators($_a_AccKeys, $_Sub1_h_FormAskOverwriteRename)
; $_Sub1_a_PicMetrics1: 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
Local $_Sub1_a_PicMetrics1 = _GuiCtrlSetImageEx_Modified($_Sub1_id_PictureSource, $_s_PicSourceFile, $b_Upscale, 0xFF00AA00, False)
Local $_Sub1_a_PicMetrics2 = _GuiCtrlSetImageEx_Modified($_Sub1_id_PictureTarget, $_s_PicTargetFile, $b_Upscale, 0xFFAA0000, False)
GUICtrlSetData($_Sub1_id_LabelSource, $_Sub1_a_PicMetrics1[0] & " x " & $_Sub1_a_PicMetrics1[1] & " px - " & $_Sub1_a_PicMetrics1[2] & " - " & $_Sub1_a_PicMetrics1[4])
GUICtrlSetData($_Sub1_id_LabelTarget, $_Sub1_a_PicMetrics2[0] & " x " & $_Sub1_a_PicMetrics2[1] & " px - " & $_Sub1_a_PicMetrics2[2] & " - " & $_Sub1_a_PicMetrics2[4])
; Ich wollte das jetzt nicht in das Hauptprogramm einbauen. Der Benutzer darf jetzt schon so lange in dieser Funktion bleiben bis er sich entschieden hat
; Also klassisch mit einer endlos While 1 Schleife bis ein Button gewählt wurde, Der GUIOnEventMode kommt solange aus (sonst funktioniert GUIGetMsg() nicht)
AutoItSetOption("GUIOnEventMode", 0)
While 1
Local $_n_Msg = GUIGetMsg()
Switch $_n_Msg
Case $_Sub1_id_ButtonCancel
GUIDelete($_Sub1_h_FormAskOverwriteRename) ; Dialog löschen
AutoItSetOption("GUIOnEventMode", 1) ; GUIOnEventMode wieder an
GUISetState(@SW_ENABLE, $h_FormFotoSort2017) ; Hauptprogramm wieder bedienbar
WinActivate($h_FormFotoSort2017)
If @Compiled = 0 Then
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_ONTOP)
Sleep(250)
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_NOONTOP)
EndIf
Return "Cancel" ; Ergebnis der Frag zurück geben
Case $_Sub1_id_ButtonOverwrite
GUIDelete($_Sub1_h_FormAskOverwriteRename)
AutoItSetOption("GUIOnEventMode", 1)
GUISetState(@SW_ENABLE, $h_FormFotoSort2017)
WinActivate($h_FormFotoSort2017)
If @Compiled = 0 Then
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_ONTOP)
Sleep(250)
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_NOONTOP)
EndIf
Return "Overwrite"
Case $_Sub1_id_ButtonRename
GUIDelete($_Sub1_h_FormAskOverwriteRename)
AutoItSetOption("GUIOnEventMode", 1)
GUISetState(@SW_ENABLE, $h_FormFotoSort2017)
WinActivate($h_FormFotoSort2017)
If @Compiled = 0 Then
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_ONTOP)
Sleep(250)
WinSetOnTop($h_FormFotoSort2017, "", $WINDOWS_NOONTOP)
EndIf
Return "Rename"
EndSwitch
WEnd
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____
;~ | _ \(_) ___| |_ _ _ _ __ ___ / ___|___ _ __ _ _
;~ | |_) | |/ __| __| | | | '__/ _ \ | | / _ \| '_ \| | | |
;~ | __/| | (__| |_| |_| | | | __/ | |__| (_) | |_) | |_| |
;~ ____|_| |_|\___|\__|\__,_|_| \___|___\____\___/| .__/ \__, |
;~ |_____| |_____| |_| |___/
; Kopiert das Bild in den Zielordner
Func _Picture_Copy()
For $i = 1 to $a_id_TargetDirectories[0][0] Step 1
If @GUI_CtrlId = $a_id_TargetDirectories[$i][1] Then
; Den eigentlichen Vorgang habe ich ausgelagert da sonst in _Picture_Copy() und _Picture_Move() ganz viel doppelt stehen würde
_Picture_WorkerModule($i, False) ; False = kopieren
ExitLoop
EndIf
Next
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____ _ _
;~ | _ \(_) ___| |_ _ _ _ __ ___ | _ \ ___| | ___| |_ ___
;~ | |_) | |/ __| __| | | | '__/ _ \ | | | |/ _ \ |/ _ \ __/ _ \
;~ | __/| | (__| |_| |_| | | | __/ | |_| | __/ | __/ || __/
;~ ____|_| |_|\___|\__|\__,_|_| \___|___|____/ \___|_|\___|\__\___|
;~ |_____| |_____|
; Löscht das aktuelle Bild. Wenn es nicht klappt bekommt der Benutzer es "wieder" angezeigt
Func _Picture_Delete()
Local $_i_PicNumber = GUICtrlRead($id_InputPicNumber)
If FileRecycle($a_s_PictureFilenames[ $_i_PicNumber ]) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Datei gelöscht: " & $a_s_PictureFilenames[ $_i_PicNumber ], 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "Konnte nicht gelöscht werden: " & $a_s_PictureFilenames[ $_i_PicNumber ], 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
Return 1
EndIf
_ArrayDelete($a_s_PictureFilenames, $_i_PicNumber)
$a_s_PictureFilenames[0] = $a_s_PictureFilenames[0] - 1
;~ _ReadFileList()
_SelectCurrentPicture($_i_PicNumber)
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ __ __
;~ | _ \(_) ___| |_ _ _ _ __ ___ | \/ | _____ _____
;~ | |_) | |/ __| __| | | | '__/ _ \ | |\/| |/ _ \ \ / / _ \
;~ | __/| | (__| |_| |_| | | | __/ | | | | (_) \ V / __/
;~ ____|_| |_|\___|\__|\__,_|_| \___|___|_| |_|\___/ \_/ \___|
;~ |_____| |_____|
; Verschiebt das Bild. Nein macht es nicht. Bild wird kopiert - und wenn das geklappt hat wird das Original gelöscht
Func _Picture_Move()
For $i = 1 to $a_id_TargetDirectories[0][0] Step 1
If @GUI_CtrlId = $a_id_TargetDirectories[$i][2] Then
; Den eigentlichen Vorgang habe ich ausgelagert da sonst in _Picture_Copy() und _Picture_Move() ganz viel doppelt stehen würde
_Picture_WorkerModule($i, True) ; True = "verschieben"
ExitLoop
EndIf
Next
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ __ __ _ __ __ _ _
;~ | _ \(_) ___| |_ _ _ _ __ ___ \ \ / /__ _ __| | _____ _ __| \/ | ___ __| |_ _| | ___
;~ | |_) | |/ __| __| | | | '__/ _ \ \ \ /\ / / _ \| '__| |/ / _ \ '__| |\/| |/ _ \ / _` | | | | |/ _ \
;~ | __/| | (__| |_| |_| | | | __/ \ V V / (_) | | | < __/ | | | | | (_) | (_| | |_| | | __/
;~ ____|_| |_|\___|\__|\__,_|_| \___|___\_/\_/ \___/|_| |_|\_\___|_| |_| |_|\___/ \__,_|\__,_|_|\___|
;~ |_____| |_____|
Func _Picture_WorkerModule($_i_NumberTargetDirectory, $_b_Move = False)
Local $_b_Error = False ; Zum auswerten ob es Fehler gab. In dem Fall löschen wir nix
Local $_b_FindDoubleFiles = False
If BitAND(GUICtrlRead($id_CheckboxDoubleFiles), $GUI_CHECKED) = $GUI_CHECKED Then
$_b_FindDoubleFiles = True
EndIf
If $_b_Move = False Then
ControlFocus($h_FormFotoSort2017, "", $a_id_TargetDirectories[$_i_NumberTargetDirectory][1]) ; Focus auf den Button Kopieren der Zeile
Else
ControlFocus($h_FormFotoSort2017, "", $a_id_TargetDirectories[$_i_NumberTargetDirectory][2]) ; Focus auf den Button verschieben der Zeile
EndIf
; Positon vorne / hinten der Zeile holen um unseren Rahmen zu plazieren
$_a_ButtonCopy = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[$_i_NumberTargetDirectory][1])
$_a_ButtonSelectFolder = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[$_i_NumberTargetDirectory][4])
; Und den Rahmen verschieben
ControlMove($h_FormFotoSort2017, "", $id_ThisOne1, $_a_ButtonCopy[0] - 2, $_a_ButtonCopy[1] - 2)
ControlMove($h_FormFotoSort2017, "", $id_ThisOne2, $_a_ButtonCopy[0] - 3, $_a_ButtonCopy[1] - 3)
; Und einfärben - erst einmal rot
GUICtrlSetColor($id_ThisOne1, 0xFF0000) ; rot
GUICtrlSetColor($id_ThisOne2, 0xFF0000) ; rot
If GUICtrlRead($a_id_TargetDirectories[$_i_NumberTargetDirectory][3]) <> "" And Int(GUICtrlRead($id_InputPicNumber)) > 0 Then
; Der Check mit den doppelten Dateien
If $_b_FindDoubleFiles = True Then
Local $_i_SizeSourceFile = FileGetSize($a_s_PictureFilenames[ Int(GUICtrlRead($id_InputPicNumber)) ])
_Crypt_Startup()
Local $_md5_SourceFile = _Crypt_HashFile($a_s_PictureFilenames[ Int(GUICtrlRead($id_InputPicNumber)) ], $CALG_MD5)
$a_s_FilesInTarget = _RecursiveFileListToArray(GUICtrlRead($a_id_TargetDirectories[$_i_NumberTargetDirectory][3]), '(?m)(?i).+\.(' & $s_SearchPattern & ')$', 1, 1, False)
If IsArray($a_s_FilesInTarget) Then
ReDim $a_i_FileSizesInTarget[ $a_s_FilesInTarget[0] + 1 ]
$a_i_FileSizesInTarget[0] = $a_s_FilesInTarget[0]
_GUICtrlStatusBar_SetText($id_StatusBar, "Prüfe " & $a_s_FilesInTarget[0] & " Dateien ...", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
For $z = 1 To $a_s_FilesInTarget[0] Step 1
$a_i_FileSizesInTarget[$z] = FileGetSize($a_s_FilesInTarget[$z])
If $a_i_FileSizesInTarget[$z] = $_i_SizeSourceFile Then
If _Crypt_HashFile($a_s_FilesInTarget[$z], $CALG_MD5) = $_md5_SourceFile Then
_PictureAskOverwriteRenameDialog($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $a_s_FilesInTarget[$z], "Identische Datei (gleiche Prüfsumme)", False, False, True)
$i_Timeout = 1000
_ThisOne() ; setzt den Rahmen von alleine wieder auf unsichtbar
Return
EndIf
EndIf
Next
EndIf
_Crypt_Shutdown()
EndIf
; Es gibt schon mal einen Zielordner
; Wir bauen uns den Zielnahmen zusammen
Local $_s_TargetFilename = GUICtrlRead($a_id_TargetDirectories[$_i_NumberTargetDirectory][3]) & "\" & $a_CurrentPictureFilename[0] & $a_CurrentPictureFilename[1]
If FileExists($_s_TargetFilename) = 0 Then ; Zieldatei gibt es nicht, weiter!
If FileCopy($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename, $FC_NOOVERWRITE ) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Kopiert nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "FEHLER beim Kopieren nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$_b_Error = True ; Es gab einen Fehler - den merken wir uns falls noch gelöscht werden soll
EndIf
Else
; Einfach kopieren ging nicht, die Zieldatei gibt es schon
If BitAND(GUICtrlRead($id_RadioOverwrite), $GUI_CHECKED) = $GUI_CHECKED Then
; Aber wir wollen einfach überschreiben!
If FileCopy($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename, $FC_OVERWRITE) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Überschrieben: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "FEHLER beim Überschreiben von: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$_b_Error = True
EndIf
EndIf
If BitAND(GUICtrlRead($id_RadioAddSuffix), $GUI_CHECKED) = $GUI_CHECKED Then
; Wir wollen ein Suffix anhängen!
$_s_TargetFilename = _GetUniqueFileName(GUICtrlRead($a_id_TargetDirectories[$_i_NumberTargetDirectory][3]) & "\" & $a_CurrentPictureFilename[0], $a_CurrentPictureFilename[1])
If $_s_TargetFilename = -1 Then
;Es gab einen eindeutigen neuen Dateinamen zurück. Passiert wenn im Suffix-Feld keine # stehen
Return 1
EndIf
If FileCopy($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename, $FC_NOOVERWRITE) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Kopiert nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "FEHLER beim Kopieren nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$_b_Error = True
EndIf
EndIf
If BitAND(GUICtrlRead($id_RadioAskOverwrite), $GUI_CHECKED) = $GUI_CHECKED Then
; Wir wollen gefragt werden! Also den Dialog mit den beiden Bildern nebeneinander einblenden und das Ergebnis auswerten
Local $_s_Answer = _PictureAskOverwriteRenameDialog($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename)
Switch $_s_Answer
Case "Overwrite"
If FileCopy($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename, $FC_OVERWRITE) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Überschrieben: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "FEHLER beim Überschreiben von: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$_b_Error = True
EndIf
Case "Rename"
$_s_TargetFilename = _GetUniqueFileName(GUICtrlRead($a_id_TargetDirectories[$_i_NumberTargetDirectory][3]) & "\" & $a_CurrentPictureFilename[0], $a_CurrentPictureFilename[1])
If $_s_TargetFilename = -1 Then
Return 1
EndIf
If FileCopy($a_s_PictureFilenames[ GUICtrlRead($id_InputPicNumber) ], $_s_TargetFilename, $FC_NOOVERWRITE) = 1 Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Kopiert nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconCheckOff)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "FEHLER beim Kopieren nach: " & $_s_TargetFilename, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$_b_Error = True
EndIf
EndSwitch
EndIf
EndIf
Else
If Int(GUICtrlRead($id_InputPicNumber)) < 1 Then
; Der Zähler ist auf 0
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein Bild vorhanden!", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
Else
; Das Feld mit dem Zielordner ist leer
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Zielverzeichnis " & $_i_NumberTargetDirectory & " ist nicht gesetzt", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
EndIf
$_b_Error = True
EndIf
If $_b_Error = False And $_b_Move = True Then
; Es gab keine Fehler und es soll "verschoben" werden - na dann löschen wir das Original
_Picture_Delete()
EndIf
; Rahmen auf grün setzen
Sleep(250)
GUICtrlSetColor($id_ThisOne1, 0x00FF00) ; grün
GUICtrlSetColor($id_ThisOne2, 0x00FF00) ; grün
$i_Timeout = 1000
_ThisOne() ; setzt den Rahmen von alleine wieder auf unsichtbar
EndFunc
; ###############################################################################################################################################################################################
Func _PrimaryDown()
Local $_a_MouseCursorInfo = GUIGetCursorInfo($h_FormFotoSort2017)
If $_a_MouseCursorInfo[4] = $id_Picture Then
Local $_i_DoubleClickSpeed = RegRead('HKCU\Control Panel\Mouse', 'DoubleClickSpeed')
If TimerDiff($i_DoubleClickTimer) < $_i_DoubleClickSpeed Then
ShellExecute($a_s_PictureFilenames[Int(GUICtrlRead($id_InputPicNumber))])
;~ MsgBox(64, "", $a_s_PictureFilenames[$i_CurrentFilename])
$i_DoubleClickTimer = TimerInit()
EndIf
EndIf
$i_DoubleClickTimer = TimerInit()
EndFunc
; ###############################################################################################################################################################################################
;~ ____ __ _ _ _____ _ _ _
;~ | _ \ _ __ ___ / _(_) | ___ ___ | ____|_ ____ _| |_ _ __ _| |_(_) ___ _ __
;~ | |_) | '__/ _ \| |_| | |/ _ \/ __| | _| \ \ / / _` | | | | |/ _` | __| |/ _ \| '_ \
;~ | __/| | | (_) | _| | | __/\__ \ | |___ \ V / (_| | | |_| | (_| | |_| | (_) | | | |
;~ ____|_| |_| \___/|_| |_|_|\___||___/___|_____| \_/ \__,_|_|\__,_|\__,_|\__|_|\___/|_| |_|
;~ |_____| |_____|
Func _Profiles_Evaluation($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $lParam
Local $_i_Selection = Dec(StringTrimLeft($wParam,2)) - 1000
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "")
Switch $_i_Selection
Case 101
; Speichern
;~ MsgBox(0,"","Speichern unter neuen Namen!")
_Profiles_SaveNew()
Case 102
; Umbennen
;~ MsgBox(0,"","Umbennen!")
_Profiles_Rename()
Case 103
; Umbennen
;~ MsgBox(0,"","Löschen!")
_Profiles_Delete()
Case 104
; Leeren
_Profiles_Empty()
Case 1 To 100
Local $i_Folders = $a_id_TargetDirectories[0][0] ; Anzahl des gerade noch aktiven Profiles sichern - denn _Folder_Remove() zählt runter
; Alle Ordner löschen
For $z = 2 To $a_id_TargetDirectories[0][0] Step 1
_Folder_Remove()
Next
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $i_Folders) ; Gesicherte Anzahl wieder setzen - und jetzt wechseln wir zum neuen Profil
$i_ProfileActive = $_i_Selection
$s_ProfileActive = $a_Profiles[$_i_Selection]
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
GUICtrlSetData($a_id_TargetDirectories[1][3], _SettingsRead("$a_id_TargetDirectories[1][3]" & "-" & $s_ProfileActive))
For $i = 2 To Int(_SettingsRead("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive)) Step 1 ; gibt es den Wert nicht so ist er 0 - und die Schleife wird nie gestartet
_Folder_Add()
GUICtrlSetData($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], _SettingsRead("$a_id_TargetDirectories[" & $a_id_TargetDirectories[0][0] & "][3]" & "-" & $s_ProfileActive))
Next
; Manchmal - warum auch immer - sitzen nach einem Programmstart und einem WinMove die + und - Schaltflächen nicht richtig. Also Sicherheitshalber noch mal die Korrektur laufen lassen
Local $a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
GUICtrlSetPos($id_ButtonAddTargetDirectory, $a_ControlPos[0], 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
GUICtrlSetPos($id_ButtonRemoveTargetDirectory, $a_ControlPos[0] + 32, 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
_GUICtrlStatusBar_SetText($id_StatusBar, 'zu Profil "' & $s_ProfileActive & '" gewechselt!', 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive, 2)
EndSwitch
EndFunc ;==>WM_COMMAND
; ###############################################################################################################################################################################################
;~ ____ __ _ _ ____ __ __
;~ | _ \ _ __ ___ / _(_) | ___ ___ | _ \ ___ _ __ _ _ _ __ | \/ | ___ _ __ _ _
;~ | |_) | '__/ _ \| |_| | |/ _ \/ __| | |_) / _ \| '_ \| | | | '_ \| |\/| |/ _ \ '_ \| | | |
;~ | __/| | | (_) | _| | | __/\__ \ | __/ (_) | |_) | |_| | |_) | | | | __/ | | | |_| |
;~ ____|_| |_| \___/|_| |_|_|\___||___/___|_| \___/| .__/ \__,_| .__/|_| |_|\___|_| |_|\__,_|
;~ |_____| |_____| |_| |_|
Func _Profiles_PopupMenu($hWnd, $iMsg, $wParam, $lParam)
; Wird beim Klick auf die Profile-Schaltfläche geöffnet
; Handle WM_CONTEXTMENU messages
#forceref $hWnd, $iMsg, $lParam
Local $_h_Menu, $_i_Index
$_h_Menu = _GUICtrlMenu_CreatePopup()
;~ $hMenu = _GUICtrlMenu_CreatePopup($MNS_NOCHECK )
For $i = 1 To $a_Profiles[0] Step 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $i - 1, $a_Profiles[$i], (1000 + $i))
If $a_Profiles[$i] = $s_ProfileActive Then
_GUICtrlMenu_CheckMenuItem($_h_Menu, $i - 1, True)
EndIf
$_i_Index = $i - 1
Next
$_i_Index = $_i_Index + 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $_i_Index, "")
$_i_Index = $_i_Index + 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $_i_Index, "Speichern unter neuen Namen", (1101))
$_i_Index = $_i_Index + 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $_i_Index, "Umbennen", (1102))
$_i_Index = $_i_Index + 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $_i_Index, "Leeren", (1104))
$_i_Index = $_i_Index + 1
_GUICtrlMenu_InsertMenuItem($_h_Menu, $_i_Index, "Löschen", (1103))
_GUICtrlMenu_TrackPopupMenu($_h_Menu, $wParam)
_GUICtrlMenu_DestroyMenu($_h_Menu)
Return True
EndFunc ;==>_Profiles_PopupMenu
; ###############################################################################################################################################################################################
Func _Profiles_Delete()
Local $_s_ProfileToDelete = $s_ProfileActive
If $a_Profiles[0] > 1 Then
For $i = 1 To $a_Profiles[0]
If $a_Profiles[$i] = $s_ProfileActive Then
_ArrayDelete($a_Profiles, $i)
ExitLoop
EndIf
Next
$a_Profiles[0] = $a_Profiles[0] - 1
For $i = 1 To 50 Step 1
RegDelete($s_RegistryKeyname, "$a_Profiles[" & $i & "]")
Next
For $i = 1 To $a_Profiles[0] Step 1
_SettingsWrite("$a_Profiles[" & $i & "]", $a_Profiles[$i])
Next
_SettingsWrite("$a_Profiles[0]", $a_Profiles[0])
; Und Zielordner neu aufbauen
; Alle Ordner löschen
For $z = 2 To $a_id_TargetDirectories[0][0] Step 1
_Folder_Remove()
Next
For $i = 1 To 30 Step 1
RegDelete($s_RegistryKeyname, "$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive)
Next
RegDelete($s_RegistryKeyname, "$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive)
$i_ProfileActive = 1
$s_ProfileActive = $a_Profiles[1]
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
;~ _SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
GUICtrlSetData($a_id_TargetDirectories[1][3], _SettingsRead("$a_id_TargetDirectories[1][3]" & "-" & $s_ProfileActive))
For $i = 2 To Int(_SettingsRead("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive)) Step 1 ; gibt es den Wert nicht so ist er 0 - und die Schleife wird nie gestartet
_Folder_Add()
GUICtrlSetData($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], _SettingsRead("$a_id_TargetDirectories[" & $a_id_TargetDirectories[0][0] & "][3]" & "-" & $s_ProfileActive))
Next
; Manchmal - warum auch immer - sitzen nach einem Programmstart und einem WinMove die + und - Schaltflächen nicht richtig. Also Sicherheitshalber noch mal die Korrektur laufen lassen
;~ Local $a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
;~ GUICtrlSetPos($id_ButtonAddTargetDirectory, $a_ControlPos[0], 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
;~ GUICtrlSetPos($id_ButtonRemoveTargetDirectory, $a_ControlPos[0] + 32, 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
_GUICtrlStatusBar_SetText($id_StatusBar, "Profil gelöscht: " & $_s_ProfileToDelete, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive, 2)
EndIf
EndFunc
; ###############################################################################################################################################################################################
Func _Profiles_Empty()
For $z = 1 To $a_id_TargetDirectories[0][0] Step 1
GUICtrlSetData($a_id_TargetDirectories[$z][3], "")
_SettingsWrite("$a_id_TargetDirectories[" & $z & "][3]" & "-" & $s_ProfileActive, "")
Next
_GUICtrlStatusBar_SetText($id_StatusBar, "Zielpfade geleert!", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
EndFunc
; ###############################################################################################################################################################################################
Func _Profiles_Rename()
Local $_s_InputBoxAnswer = InputBox("Profil umbennen","Neuer Name des Profiles:", $a_Profiles[$i_ProfileActive] ," ","-1 ","-1", Default, Default,"300", $h_FormFotoSort2017)
If $_s_InputBoxAnswer <> "" Then
For $i = 1 To $a_id_TargetDirectories[0][0] Step 1 ; Pfade unter altem Profilnamen löschen
RegDelete($s_RegistryKeyname, "$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive)
Next
$a_Profiles[$i_ProfileActive] = $_s_InputBoxAnswer
_ArraySort($a_Profiles, 0, 1)
For $i = 1 To $a_Profiles[0] Step 1
_SettingsWrite("$a_Profiles[" & $i & "]", $a_Profiles[$i])
If $a_Profiles[$i] = $_s_InputBoxAnswer Then
$i_ProfileActive = $i
EndIf
Next
$s_ProfileActive = $_s_InputBoxAnswer
_SettingsWrite("$a_Profiles[0]", $a_Profiles[0])
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
For $i = 1 To $a_id_TargetDirectories[0][0] Step 1 ; Pfade unter neuen Profilnamen wieder schreiben
_SettingsWrite("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive, GUICtrlRead($a_id_TargetDirectories[$i][3]))
Next
_GUICtrlStatusBar_SetText($id_StatusBar, "Profil umbenannt: " & $s_ProfileActive, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive, 2)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein neuer Profilname angegeben", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
EndIf
EndFunc
; ###############################################################################################################################################################################################
Func _Profiles_SaveNew()
Local $_s_InputBoxAnswer = InputBox("Profil speichern","Name des neuen Profiles:", "" ," ","-1 ","-1", Default, Default,"300", $h_FormFotoSort2017)
If $_s_InputBoxAnswer <> "" Then
$i_ProfileActive = 1
$a_Profiles[0] = $a_Profiles[0] + 1
ReDim $a_Profiles[ $a_Profiles[0] + 1]
$a_Profiles[ $a_Profiles[0] ] = $_s_InputBoxAnswer
_ArraySort($a_Profiles, 0, 1)
For $i = 1 To $a_Profiles[0] Step 1
_SettingsWrite("$a_Profiles[" & $i & "]", $a_Profiles[$i])
If $a_Profiles[$i] = $_s_InputBoxAnswer Then
$i_ProfileActive = $i
EndIf
Next
$s_ProfileActive = $_s_InputBoxAnswer
For $i = 1 To $a_id_TargetDirectories[0][0]
_SettingsWrite("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive, GUICtrlRead($a_id_TargetDirectories[$i][3]))
Next
_SettingsWrite("$a_Profiles[0]", $a_Profiles[0])
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0])
_GUICtrlStatusBar_SetText($id_StatusBar, "Profil gespeichert: " & $s_ProfileActive, 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive, 2)
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein Profilname angegeben", 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
EndIf
EndFunc
; ###############################################################################################################################################################################################
Func _Profiles_Switch2Next()
; Überarbeitet: Nicht alle Ordner löschen und wieder neu einrichten sondern Unterschiede in der Anzahl ermitteln und nur die neuen Namen eintragen
Local $_s_ProfileOld, $_i_ProfileOld, $_s_ProfileNew, $_i_ProfileNew
$_s_ProfileOld = $s_ProfileActive
$i_ProfileActive = $i_ProfileActive + 1
If $i_ProfileActive > $a_Profiles[0] Then
$i_ProfileActive = 1
EndIf
$s_ProfileActive = $a_Profiles[$i_ProfileActive]
$_s_ProfileNew = $a_Profiles[$i_ProfileActive]
$_i_ProfileOld = Int(_SettingsRead("$a_id_TargetDirectories[0][0]" & "-" & $_s_ProfileOld))
$_i_ProfileNew = Int(_SettingsRead("$a_id_TargetDirectories[0][0]" & "-" & $_s_ProfileNew))
;~ MsgBox(0, "$i_ProfileActive", "$i_ProfileActive: " & $i_ProfileActive)
If $_i_ProfileOld > $_i_ProfileNew Then
For $z = 1 To ($_i_ProfileOld - $_i_ProfileNew) Step 1
_Folder_Remove()
Next
EndIf
If $_i_ProfileOld < $_i_ProfileNew Then
For $z = 1 To ($_i_ProfileNew - $_i_ProfileOld) Step 1
_Folder_Add()
Next
EndIf
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $_s_ProfileOld, $_i_ProfileOld) ; Gesicherte Anzahl wieder setzen (_Folder_Remove() setzt den Zähler herunter, löscht aber nicht)
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
For $i = 1 To $_i_ProfileNew
GUICtrlSetData($a_id_TargetDirectories[$i][3], _SettingsRead("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $_s_ProfileNew))
Next
_GUICtrlStatusBar_SetText($id_StatusBar, 'zu Profil "' & $s_ProfileActive & '" gewechselt!', 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive, 2)
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _____ _ _ _____ _ _
;~ | _ \ __ _ __| (_) ___ | ___(_) | ___| ____|_ _(_)___| |_ ___
;~ | |_) / _` |/ _` | |/ _ \| |_ | | |/ _ \ _| \ \/ / / __| __/ __|
;~ | _ < (_| | (_| | | (_) | _| | | | __/ |___ > <| \__ \ |_\__ \
;~ ____|_| \_\__,_|\__,_|_|\___/|_| |_|_|\___|_____/_/\_\_|___/\__|___/
;~ |_____|
; Die Optione was bei doppelten Dateien passieren soll. Wenn da was geklickt wird in der Registry abspeichern
Func _RadioFileExists()
_SettingsWrite("$id_RadioOverwrite", GUICtrlRead($id_RadioOverwrite))
_SettingsWrite("$id_RadioAddSuffix", GUICtrlRead($id_RadioAddSuffix))
_SettingsWrite("$id_RadioAskOverwrite", GUICtrlRead($id_RadioAskOverwrite))
_SettingsWrite("$id_InputSuffix", GUICtrlRead($id_InputSuffix))
_SettingsWrite("$id_CheckboxDoubleFiles", GUICtrlRead($id_CheckboxDoubleFiles))
If @GUI_CtrlId = $id_InputSuffix Then
; Das gleiche wie beim Input für die Bildnummer. Sobald der Cursor in einem Input steht sind alle Tastenbedienungen aus.
; Damit die wieder angehen müssen wir den Focus verschieben
ControlFocus($h_FormFotoSort2017, "", $id_Picture)
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _____ _ _ _ _ _
;~ | _ \ ___ __ _ __| | ___(_) | ___| | (_)___| |_
;~ | |_) / _ \/ _` |/ _` | |_ | | |/ _ \ | | / __| __|
;~ | _ < __/ (_| | (_| | _| | | | __/ |___| \__ \ |_
;~ ____|_| \_\___|\__,_|\__,_|_| |_|_|\___|_____|_|___/\__|
;~ |_____|
; Sorgt dafür das die aktuelle Liste der Dateien erstellt wird
Func _ReadFileList()
Local $_a_dummy[1] = [ 0 ], $_a_LabelBehindPicture1, $_a_LabelBehindPicture2, $_a_PicControlPos
If $s_SearchPattern = "" Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein Grafikformat ausgewählt" , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$a_s_PictureFilenames = $_a_dummy
Return 1
EndIf
If GUICtrlRead($id_InputSourceDirectory) = "" Then
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein Quellpfad ausgewählt" , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$a_s_PictureFilenames = $_a_dummy
Return 1
EndIf
If FileExists(GUICtrlRead($id_InputSourceDirectory)) = 0 then
GUICtrlSetData($id_InputSourceDirectory, "")
_SettingsWrite("$id_InputSourceDirectory", "")
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Quellpfad existiert nicht" , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
$a_s_PictureFilenames = $_a_dummy
Return 1
Else
_GUICtrlStatusBar_SetText($id_StatusBar, "Lese Bilderliste ein ..." , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconInfo)
EndIf
If BitAND(GUICtrlRead($id_CheckboxScanFolderRecursive), $GUI_CHECKED) = $GUI_CHECKED Then
Local $_b_ScanFolderRecursive = True
Else
Local $_b_ScanFolderRecursive = False
EndIf
_SettingsWrite("$_b_ScanFolderRecursive", $_b_ScanFolderRecursive) ; an dieser Stelle speichern wir ob wir rekurisv suchen oder nicht
$a_s_PictureFilenames = _RecursiveFileListToArray(GUICtrlRead($id_InputSourceDirectory), '(?m)(?i).+\.(' & $s_SearchPattern & ')$', 1, 1, $_b_ScanFolderRecursive)
If IsArray($a_s_PictureFilenames) = 0 Then
$a_s_PictureFilenames = $_a_dummy
EndIf
;~ $a_s_PictureFilenames = _RecursiveFileListToArray(GUICtrlRead($id_InputSourceDirectory), '(?i).+\.(' & $s_SearchPattern & ')', 1, 1, $_b_ScanFolderRecursive)
; Im gegensatz zu Oscar möchte ich meine Dateiliste alphabetisch sortiert
_ArraySort($a_s_PictureFilenames, 0, 1)
If $a_s_PictureFilenames[0] > 0 Then ; und wenn was in der Liste ist das erste Bild auswählen
_SelectCurrentPicture(1)
$i_CurrentFilename = 1
Else
$_a_LabelBehindPicture1 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture1)
$_a_LabelBehindPicture2 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture2)
$_a_PicControlPos = ControlGetPos($h_FormFotoSort2017, "", $id_Picture) ; aktuelle Position sichern
$_a_PicControlPos[0] = $_a_LabelBehindPicture1[0] + 2
$_a_PicControlPos[1] = $_a_LabelBehindPicture1[1] + 2
$_a_PicControlPos[2] = $_a_LabelBehindPicture1[2] - 4
$_a_PicControlPos[3] = $_a_LabelBehindPicture2[3] - 4
If $b_GIF = True Then
If $id_Background <> 0 Then
GUICtrlDelete($id_Background)
$id_Background = 0
EndIf
_GIF_DeleteGIF($id_Picture)
$id_Picture = GUICtrlCreatePic("", $_a_PicControlPos[0], $_a_PicControlPos[1], $_a_PicControlPos[2], $_a_PicControlPos[3])
GUICtrlSetResizing($id_Picture, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetStyle($id_Picture, "", $WS_EX_TOPMOST)
GUICtrlSetState($id_Picture, $GUI_DROPACCEPTED)
$b_GIF = False
EndIf
;~ -Global $h_test = _GDIPlus_ScaleImage2($d_Resources_PicTestBildpngGlobal, $_a_PicControlPos[2], $_a_PicControlPos[3], $d_BackgroundColor_ARGB, True, 7)
;~ _GDIPlus_ImageScale
_GuiCtrlSetImageEx($id_Picture, $d_Resources_PicTestBildpngGlobal, False, $d_BackgroundColor_ARGB, False)
;~ ControlMove($h_FormFotoSort2017, "", $id_Picture, 7, 90, 510, 526)
;~ Sleep(50)
;~ _WinAPI_DeleteObject(GUICtrlSendMsg($id_Picture, $STM_SETIMAGE, $IMAGE_BITMAP, $h_Resources_PicTestBildpngGlobal))
;~ Sleep(250)
;~ ControlMove($h_FormFotoSort2017, "", $id_Picture, $_a_PicControlPos[0], $_a_PicControlPos[1], $_a_PicControlPos[2], $_a_PicControlPos[3])
$b_Use_GuiCtrlSetImageEx = False
GUICtrlSetData($id_LabelPictureName, "")
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Keine Bilder gefunden" , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _____ _ _ _ _ _ _____ _
;~ | _ \ ___ ___ _ _ _ __ ___(_)_ _____| ___(_) | ___| | (_)___| ||_ _|__ / \ _ __ _ __ __ _ _ _
;~ | |_) / _ \/ __| | | | '__/ __| \ \ / / _ \ |_ | | |/ _ \ | | / __| __|| |/ _ \ / _ \ | '__| '__/ _` | | | |
;~ | _ < __/ (__| |_| | | \__ \ |\ V / __/ _| | | | __/ |___| \__ \ |_ | | (_) / ___ \| | | | | (_| | |_| |
;~ ____|_| \_\___|\___|\__,_|_| |___/_| \_/ \___|_| |_|_|\___|_____|_|___/\__||_|\___/_/ \_\_| |_| \__,_|\__, |
;~ |_____| |___/
;===============================================================================
; Function Name: _RecursiveFileListToArray($sPath[, $sPattern][, $iFlag][, $iFormat][, $fRecursion][, $sDelim])
; Description:: gibt Verzeichnisse (rekursiv) und/oder Dateien zurück, die einem RegExp-Pattern entsprechen
; Parameter(s): $sPath = Startverzeichnis
; $sPattern = ein beliebiges RexExp-Pattern für die Auswahl
; $iFlag = Auswahl
; 0 = Dateien & Verzeichnisse
; 1 = nur Dateien
; 2 = nur Verzeichnisse
; $iFormat = Rückgabeformat
; 0 = String
; 1 = Array mit [0] = Anzahl
; 2 = Nullbasiertes Array
; $fRecursion = Verzeichnisse rekursiv durchsuchen
; False = Nein
; True = Ja
; $sDelim = Trennzeichen für die String-Rückgabe
; Requirement(s): AutoIt 3.3.0.0
; Return Value(s): Array/String mit den gefundenen Dateien/Verzeichnissen
; Author(s): Oscar (www.autoit.de)
; Anregungen von: bernd670 (www.autoit.de)
; und: AspirinJunkie (www.autoit.de)
;===============================================================================
; Oscars Funktion ist 4x schneller als das was ich sonst benutzt habe (bei 6000 Dateien statt 2 sec nur 0,05 sec)
Func _RecursiveFileListToArray($sPath, $sPattern = '', $iFlag = 0, $iFormat = 1, $fRecursion = True, $sDelim = @CRLF, $fOpenDLL = True)
Local $hSearch, $sFile, $sReturn = '', $aD
Local Static $hDll
If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
$hSearch = FileFindFirstFile($sPath & '*')
If @error Or $hSearch = -1 Then Return SetError(1, 0, $sReturn)
If $fOpenDLL Then $hDll = DllOpen('kernel32.dll')
While True
$sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If @extended Then
$aD = DllCall($hDll, 'dword', 'GetFileAttributesW', 'wstr', $sPath & $sFile)
If @error Or BitAND($aD[0], 0x400) Then ContinueLoop
If StringRegExp($sPath & $sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 2) Then $sReturn &= $sPath & $sFile & '\' & $sDelim
If $fRecursion Then $sReturn &= _RecursiveFileListToArray($sPath & $sFile & '\', $sPattern, $iFlag, 0, True, $sDelim, False)
ContinueLoop
EndIf
If StringRegExp($sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 1) Then $sReturn &= $sPath & $sFile & $sDelim
WEnd
FileClose($hSearch)
If $fOpenDLL Then DllClose($hDll)
If $iFormat And $sReturn = '' Then Return SetError(0, 1, StringSplit($sReturn, '', $iFormat))
If $iFormat Then Return SetError(0, 2, StringSplit(StringTrimRight($sReturn, StringLen($sDelim)), $sDelim, $iFormat))
Return $sReturn
EndFunc ;==>_RecursiveFileListToArray
; ###############################################################################################################################################################################################
;~ ____ ____ ____ ____ _ ____ ____ ____
;~ | _ \ / ___| __ ) |___ \ / \ | _ \ / ___| __ )
;~ | |_) | | _| _ \ __) | / _ \ | |_) | | _| _ \
;~ | _ <| |_| | |_) | / __/ / ___ \| _ <| |_| | |_) |
;~ ____|_| \_\\____|____/___|_____|___/_/ \_\_| \_\\____|____/
;~ |_____| |_____| |_____|
Func _RGB_2_ARGB($d_RGB)
; Wandelt "normale" RGB-Werte im Format 0XRRGGBB in ARGB-Werte um
; https://www.autoitscript.com/forum/topic/167489-converting-hexcolor-to-argb/?do=findComment&comment=1225875
Local $_Blue = BitAND($d_RGB, 0xFF)
Local $_Green = BitAND(BitShift($d_RGB, 8), 0xFF)
Local $_Red = BitAND(BitShift($d_RGB, 16), 0xFF)
Return (0xFF000000 + $_Red * 0x10000 + $_Green * 0x100 + $_Blue)
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____ _ ____ _ _
;~ / ___| ___| | ___ ___| |_ / ___| _ _ __ _ __ ___ _ __ | |_| _ \(_) ___| |_ _ _ _ __ ___
;~ \___ \ / _ \ |/ _ \/ __| __| | | | | | '__| '__/ _ \ '_ \| __| |_) | |/ __| __| | | | '__/ _ \
;~ ___) | __/ | __/ (__| |_| |__| |_| | | | | | __/ | | | |_| __/| | (__| |_| |_| | | | __/
;~ ____|____/ \___|_|\___|\___|\__|\____\__,_|_| |_| \___|_| |_|\__|_| |_|\___|\__|\__,_|_| \___|
;~ |_____|
; Der Funktion übergibt man das gewünschte Bild - und diese sorgt dafür das es angezeigt wird
Func _SelectCurrentPicture($_i_PicNumber = 1)
Local $_a_PicControlPos, $_a_LabelBehindPicture1, $_a_LabelBehindPicture2
; Ersteinmal prüfen ob es ein gültiger Wert war, ggf. setzen wir auf das erste oder letzte Bild
If $a_s_PictureFilenames[0] > 0 Then
If $_i_PicNumber < 1 Then
$_i_PicNumber = 1
EndIf
If $_i_PicNumber > $a_s_PictureFilenames[0] Then
$_i_PicNumber = $a_s_PictureFilenames[0]
EndIf
_GUICtrlStatusBar_SetText($id_StatusBar, "Bild " & $_i_PicNumber & " von " & $a_s_PictureFilenames[0], 1)
GUICtrlSetData($id_InputPicNumber, $_i_PicNumber)
Else
; Keine gültige Nummer möglich, raus hier
_GUICtrlStatusBar_SetText($id_StatusBar, "", 1)
_GUICtrlStatusBar_SetText($id_StatusBar, "", 3)
GUICtrlSetData($id_InputPicNumber, 0)
WinSetTitle($h_FormFotoSort2017, "", $s_ProgramTitle & " " & $s_ProgramVersion)
Return 1
EndIf
$d_CurrentPicture = $a_s_PictureFilenames[$_i_PicNumber] ; Noch mal extra in eine Variable - weil wir das in der Funktion WM_SIZE etc. auch noch brauchen
Local $_s_empty = ""
; Wir dröseln den Pfad des Bildes auseinander
Local $_a_PathSplit = _PathSplit($a_s_PictureFilenames[$_i_PicNumber], $_s_empty, $_s_empty, $_s_empty, $_s_empty)
$a_CurrentPictureFilename[0] = $_a_PathSplit[3] ; Dateiname
$a_CurrentPictureFilename[1] = $_a_PathSplit[4] ; Endung
; Den Namen tragen wir in der Gui ein:
_GUICtrlStatusBar_SetText($id_StatusBar, $_a_PathSplit[3] & $_a_PathSplit[4], 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconPicture)
GUICtrlSetData($id_LabelPictureName, $_a_PathSplit[3] & $_a_PathSplit[4])
GUICtrlSetTip($id_LabelPictureName, $_a_PathSplit[3] & $_a_PathSplit[4])
$_a_LabelBehindPicture1 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture1)
$_a_LabelBehindPicture2 = ControlGetPos($h_FormFotoSort2017, "", $id_LabelBehindPicture2)
If $b_FirstPicture = True Then
; Sonderlocke erstes Bild. Da wird das PicControl einmal gelöscht und neu erstellt
; Nutzen wir auch ggf. zur Fehlerbehebung beim Maximieren / Restore
$_a_PicControlPos = ControlGetPos($h_FormFotoSort2017, "", $id_Picture) ; aktuelle Position sichern
GUICtrlDelete($id_Picture) ; löschen
$_a_PicControlPos[0] = $_a_LabelBehindPicture1[0] + 2
$_a_PicControlPos[1] = $_a_LabelBehindPicture1[1] + 2
$_a_PicControlPos[2] = $_a_LabelBehindPicture1[2] - 4
$_a_PicControlPos[3] = $_a_LabelBehindPicture2[3] - 4
; Wieder neu erstellen
$id_Picture = GUICtrlCreatePic("", $_a_PicControlPos[0], $_a_PicControlPos[1], $_a_PicControlPos[2], $_a_PicControlPos[3])
GUICtrlSetResizing($id_Picture, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetStyle($id_Picture, "", $WS_EX_TOPMOST)
GUICtrlSetState($id_Picture, $GUI_DROPACCEPTED)
$b_FirstPicture = False
$b_Use_GuiCtrlSetImageEx = True
EndIf
; Auswerten ob kleinere Bilder gezoomt werden
If BitAND(GUICtrlRead($id_CheckboxPictureFitSize), $GUI_CHECKED) = $GUI_CHECKED Then
$b_Upscale = True
Else
$b_Upscale = False
EndIf
; $a_CurrentPictureMetrics; 0 = X / 1 = Y / 2 = Farbtiefe / 3 = Darstellungsgröße in % / 4 = Dateigröße
; Jetzt wird das Bild geladen / gezeichnet
If $a_CurrentPictureFilename[1] = ".gif" Then
$a_CurrentPictureMetrics = _GUICtrlSetGIF_Mod($id_Picture, $d_CurrentPicture, $b_Upscale)
$b_GIF = True
GUICtrlSetState($id_Picture, $GUI_DROPACCEPTED)
Else
If $b_GIF = True Then
If $id_Background <> 0 Then
GUICtrlDelete($id_Background)
$id_Background = 0
EndIf
$_a_PicControlPos = ControlGetPos($h_FormFotoSort2017, "", $id_Picture) ; aktuelle Position sichern
$_a_PicControlPos[0] = $_a_LabelBehindPicture1[0] + 2
$_a_PicControlPos[1] = $_a_LabelBehindPicture1[1] + 2
$_a_PicControlPos[2] = $_a_LabelBehindPicture1[2] - 4
$_a_PicControlPos[3] = $_a_LabelBehindPicture2[3] - 4
_GIF_DeleteGIF($id_Picture)
$id_Picture = GUICtrlCreatePic("", $_a_PicControlPos[0], $_a_PicControlPos[1], $_a_PicControlPos[2], $_a_PicControlPos[3])
GUICtrlSetResizing($id_Picture, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetStyle($id_Picture, "", $WS_EX_TOPMOST)
GUICtrlSetState($id_Picture, $GUI_DROPACCEPTED)
$b_GIF = False
EndIf
$a_CurrentPictureMetrics = _GuiCtrlSetImageEx_Modified($id_Picture, $d_CurrentPicture, $b_Upscale, $d_BackgroundColor_ARGB, False)
EndIf
; Das letzte Bild in der Registry merken
_SettingsWrite("$id_InputPicNumber", GUICtrlRead($id_InputPicNumber))
_SettingsWrite("$id_CheckboxPictureFitSize", GUICtrlRead($id_CheckboxPictureFitSize))
_GUICtrlStatusBar_SetText($id_StatusBar, $a_CurrentPictureMetrics[0] & " x " & $a_CurrentPictureMetrics[1] & "px - " & $a_CurrentPictureMetrics[2] & " (" & $a_CurrentPictureMetrics[4] & ")", 3)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 3, $h_IconPicture)
WinSetTitle($h_FormFotoSort2017, "", $s_ProgramTitle & " " & $s_ProgramVersion & " " & $a_CurrentPictureMetrics[0] & " x " & $a_CurrentPictureMetrics[1] & " (" & $a_CurrentPictureMetrics[3] & ")")
; Und die Navigationbuttons überprüfen
_ButtonPicsCheckEnableDisable()
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ____ _ ____ _ _ _____ _
;~ / ___| ___| | ___ ___| |_ / ___| _ _ __ _ __ ___ _ __ | |_| _ \(_) ___| |_ _ _ _ __ __|_ _(_)_ __ ___ ___ _ __
;~ \___ \ / _ \ |/ _ \/ __| __| | | | | | '__| '__/ _ \ '_ \| __| |_) | |/ __| __| | | | '__/ _ \| | | | '_ ` _ \ / _ \ '__|
;~ ___) | __/ | __/ (__| |_| |__| |_| | | | | | __/ | | | |_| __/| | (__| |_| |_| | | | __/| | | | | | | | | __/ |
;~ ____|____/ \___|_|\___|\___|\__|\____\__,_|_| |_| \___|_| |_|\__|_| |_|\___|\__|\__,_|_| \___||_| |_|_| |_| |_|\___|_|
;~ |_____|
; Wenn die GUI maximiert oder restored wird stimmen die Bildpropertionen meist nicht mehr
; Die einfache Lösung ist in diesem Fall das PictureControl neu zu erstellen
; Das hatte ich erst in den Funktionen id_FormFotoSort2017Maximize() und id_FormFotoSort2017Restore() eingebaut.
; Aber nach irgendeiner Änderung ging das nicht mehr. Die beiden werden jetzt schon aufgerufen bevor die Controls ihre neue Größe haben,
; Die Vorschau bleibt also zu klein oder zu groß.
; Die Lösung war diese Funktion die man einmal anstößt - und dann 250ms später das ganze erledigt
Func _SelectCurrentPictureTimer()
If $i_TimerSelectCurrentPicture = 0 Then
; Erster Aufruf, wir starten den Timer und AdlibRegister'n uns selbst
$i_TimerSelectCurrentPicture = TimerInit()
AdlibRegister("_SelectCurrentPictureTimer", 250)
Return 0
EndIf
; Der 2. oder n. Aufruf:
If TimerDiff($i_TimerSelectCurrentPicture) > 250 Then
AdlibUnRegister("_SelectCurrentPictureTimer")
$i_TimerSelectCurrentPicture = 0
If Int(GUICtrlRead($id_InputPicNumber)) > 0 Then
$b_FirstPicture = True
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber))
EndIf
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _ __ __ _ _
;~ / ___| ___| |_| |_(_)_ __ __ _ __\ \ / / __(_) |_ ___
;~ \___ \ / _ \ __| __| | '_ \ / _` / __\ \ /\ / / '__| | __/ _ \
;~ ___) | __/ |_| |_| | | | | (_| \__ \\ V V /| | | | || __/
;~ ____|____/ \___|\__|\__|_|_| |_|\__, |___/ \_/\_/ |_| |_|\__\___|
;~ |_____| |___/
;Schreibt Einstellungen in die Registry, Kürzel um nicht jedesmal das komplette RegWrite zu schreiben
Func _SettingsWrite($_s_Valuename, $_s_Value)
Return RegWrite($s_RegistryKeyname, $_s_Valuename, "REG_SZ", $_s_Value)
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ _ ____ _
;~ / ___| ___| |_| |_(_)_ __ __ _ ___| _ \ ___ __ _ __| |
;~ \___ \ / _ \ __| __| | '_ \ / _` / __| |_) / _ \/ _` |/ _` |
;~ ___) | __/ |_| |_| | | | | (_| \__ \ _ < __/ (_| | (_| |
;~ ____|____/ \___|\__|\__|_|_| |_|\__, |___/_| \_\___|\__,_|\__,_|
;~ |_____| |___/
; Wie zuvor, jedoch auslesen
Func _SettingsRead($_s_Valuename)
Return RegRead($s_RegistryKeyname, $_s_Valuename)
EndFunc
; ###############################################################################################################################################################################################
;~ _____ _ _ ___
;~ |_ _| |__ (_)___ / _ \ _ __ ___
;~ | | | '_ \| / __| | | | '_ \ / _ \
;~ | | | | | | \__ \ |_| | | | | __/
;~ ____|_| |_| |_|_|___/\___/|_| |_|\___|
;~ |_____|
; Um die Buttons leuchte immer ein Rahmen auf wenn die Funktion gewählt wurde.
; Diese Funktion macht den wieder unsichtbar - nach der eingestellten Wartezeit
Func _ThisOne()
If $i_TimerThisOne = 0 Then
$i_TimerThisOne = TimerInit()
AdlibRegister("_ThisOne", 100)
Return 0
EndIf
If TimerDiff($i_TimerThisOne) > $i_Timeout Then
AdlibUnRegister("_ThisOne")
; Eine Funktion für alle!
GUICtrlSetColor($id_ThisOne1, 0xC8C8C8)
GUICtrlSetColor($id_ThisOne2, 0xC8C8C8)
GUICtrlSetColor($id_ButtonSelected1, 0xC8C8C8)
GUICtrlSetColor($id_ButtonSelected2, 0xC8C8C8)
GUICtrlSetColor($id_ToolSelected1, 0xC8C8C8)
GUICtrlSetColor($id_ToolSelected2, 0xC8C8C8)
$i_TimerThisOne = 0
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ _____ _
;~ |_ _|__ ___ | |___
;~ | |/ _ \ / _ \| / __|
;~ | | (_) | (_) | \__ \
;~ ____|_|\___/ \___/|_|___/
;~ |_____|
; Verarbeitet die Klicks auf die Tools Button
Func _Tools()
Local $_a_ButtonPos, $_i_PicNumber
$_a_ButtonPos = ControlGetPos($h_FormFotoSort2017, "", @GUI_CtrlId)
GUICtrlSetPos($id_ToolSelected1, $_a_ButtonPos[0] - 1, $_a_ButtonPos[1] - 1)
GUICtrlSetPos($id_ToolSelected2, $_a_ButtonPos[0] - 2, $_a_ButtonPos[1] - 2)
GUICtrlSetColor($id_ToolSelected1, $hex_SignalColor)
GUICtrlSetColor($id_ToolSelected2, $hex_SignalColor)
$i_Timeout = 250
_ThisOne()
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
If @GUI_CtrlId = $a_id_Tools[$i][1] Then
Switch $a_id_Tools[$i][0]
Case "RESET"
; Alles auf 0
; Verzeichnisse
GUICtrlSetData($id_InputSourceDirectory, "")
GUICtrlSetData($a_id_TargetDirectories[1][3], "")
For $z = 2 To $a_id_TargetDirectories[0][0] Step 1
_Folder_Remove()
Next
ReDim $a_Profiles[2]
$a_Profiles[0] = 1
$a_Profiles[1] = "Standard"
$i_ProfileActive = 1
; GUI
$a_FormFotoSortNew_Size[0] = Int((@DesktopWidth - $i_FormFotoSortNew_SizeMinWidth) / 2)
$a_FormFotoSortNew_Size[1] = Int((@DesktopHeight - $i_FormFotoSortNew_SizeMinHeight) / 2)
$a_FormFotoSortNew_Size[2] = $i_FormFotoSortNew_SizeMinWidth
$a_FormFotoSortNew_Size[3] = $i_FormFotoSortNew_SizeMinHeight
WinMove($h_FormFotoSort2017, "", $a_FormFotoSortNew_Size[0], $a_FormFotoSortNew_Size[1], $a_FormFotoSortNew_Size[2], $a_FormFotoSortNew_Size[3])
; Vorschau
_WinAPI_DeleteObject(GUICtrlSendMsg($id_Picture, $STM_SETIMAGE, $IMAGE_BITMAP, $h_Resources_PicTestBildpngGlobal))
$b_Use_GuiCtrlSetImageEx = False
GUICtrlSetData($id_LabelPictureName, "")
GUICtrlSetTip($id_LabelPictureName, "")
$d_BackgroundColor_ARGB = 0xFF000000
_GUICtrlStatusBar_SetText($id_StatusBar, "Fehler: Kein Quellpfad ausgewählt" , 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconWarning)
_GUICtrlStatusBar_SetText($id_StatusBar, "" , 1)
_GUICtrlStatusBar_SetText($id_StatusBar, "" , 3)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 3, -1)
WinSetTitle($h_FormFotoSort2017, "", $s_ProgramTitle & " " & $s_ProgramVersion)
Redim $a_s_PictureFilenames[1]
$a_s_PictureFilenames[0] = 0
GUICtrlSetData($id_InputPicNumber, 0)
_ButtonPicsCheckEnableDisable()
RegDelete($s_RegistryKeyname)
Case "Filenames"
; Textdatei mit Dateinamen erstellen
If $a_s_PictureFilenames[0] > 0 Then
Local $_s_FilenamesTXT = @TempDir & "\" & StringReplace(StringReplace(GUICtrlRead($id_InputSourceDirectory), "\", "-"), ":", "-") & ".txt"
Local $_h_FilenamesTXT = FileOpen($_s_FilenamesTXT, 2 + 256)
For $z = 1 To $a_s_PictureFilenames[0] Step 1
FileWriteLine($_h_FilenamesTXT, $a_s_PictureFilenames[$z])
Next
FileClose($_h_FilenamesTXT)
ShellExecute($_s_FilenamesTXT)
EndIf
Case "DEL"
_Picture_Delete()
Case "RELOAD"
; Quellordner neu einlesen, wenn möglich das letzte Bild wieder auswählen
$_i_PicNumber = GUICtrlRead($id_InputPicNumber)
_ReadFileList()
_SelectCurrentPicture($_i_PicNumber)
Case "Rename"
$_i_PicNumber = GUICtrlRead($id_InputPicNumber)
Local $_s_InputBoxAnswer = InputBox("Bild umbennen","Neuer Name für die Datei:" & @CRLF & @CRLF & $a_CurrentPictureFilename[0] & $a_CurrentPictureFilename[1] & @CRLF & @CRLF & "(Ohne Dateiendung!)", $a_CurrentPictureFilename[0] ," ","-1 ","-1", Default, Default,"300", $h_FormFotoSort2017)
Local $_s_TargetFilename = StringReplace($a_s_PictureFilenames[ $_i_PicNumber ], $a_CurrentPictureFilename[0] & $a_CurrentPictureFilename[1], $_s_InputBoxAnswer & $a_CurrentPictureFilename[1])
If $_s_InputBoxAnswer <> "" Then
FileMove($a_s_PictureFilenames[ $_i_PicNumber ], $_s_TargetFilename, $FC_NOOVERWRITE)
$a_s_PictureFilenames[ $_i_PicNumber ] = $_s_TargetFilename
GUICtrlSetData($id_LabelPictureName, $_s_InputBoxAnswer & $a_CurrentPictureFilename[1])
_GUICtrlStatusBar_SetText($id_StatusBar, $_s_InputBoxAnswer & $a_CurrentPictureFilename[1], 0)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 0, $h_IconPicture)
EndIf
Case "BKG"
; Hintergrundfarbe ändern
; Die aktuelle steht in $d_BackgroundColor_ARGB
Local $hex_NewColor = _ChooseColor(2, _ARGB_2_RGB($d_BackgroundColor_ARGB), 2, $h_FormFotoSort2017)
If $hex_NewColor <> -1 Then
$d_BackgroundColor_ARGB = _RGB_2_ARGB($hex_NewColor)
_SelectCurrentPicture(GUICtrlRead($id_InputPicNumber))
_SettingsWrite("$d_BackgroundColor_ARGB", $d_BackgroundColor_ARGB)
EndIf
Case "Hilfe"
_Help()
Case "Profiles"
; Unsichtbare GUI erstellen um dieser das Popup anzuheften
Local $h_PopupGUI = GUICreate("", 0, 0, 0, 0)
GUISetState(@SW_SHOW, $h_PopupGUI)
; Register message handlers
GUIRegisterMsg($WM_COMMAND, "_Profiles_evaluation")
GUIRegisterMsg($WM_CONTEXTMENU, "_Profiles_PopupMenu")
;~ Sleep(250)
ControlClick($h_PopupGUI, "", "", "right")
GUIDelete($h_PopupGUI)
Case Else
MsgBox(64, "Tools", "Tool gestartet: " & $a_id_Tools[$i][0])
EndSwitch
ExitLoop
EndIf
Next
EndFunc
; ###############################################################################################################################################################################################
;~ __ ___ _ ____ ___ ____ _ _ ____ _ ____ _____
;~ \ \ / (_)_ __ / \ | _ \_ _| / ___|___ _ __ | |_ _ __ ___ | |/ ___| ___| |_| _ \ ___ ___| ____|_ __
;~ \ \ /\ / /| | '_ \ / _ \ | |_) | | | | / _ \| '_ \| __| '__/ _ \| | | _ / _ \ __| |_) / _ \/ __| _| \ \/ /
;~ \ V V / | | | | |/ ___ \| __/| | | |__| (_) | | | | |_| | | (_) | | |_| | __/ |_| __/ (_) \__ \ |___ > <
;~ ____\_/\_/ |_|_| |_/_/ \_\_| |___|___\____\___/|_| |_|\__|_| \___/|_|\____|\___|\__|_| \___/|___/_____/_/\_\
;~ |_____| |_____|
; Gibt die Position eines Controls auf den ganzen Bildschirm bezogen zurück
; Abgeleitet aus https://www.autoitscript.com/forum/topic/115616-get-position-of-control-to-the-screen/
Func _WinAPI_ControlGetPosEx($_h_Form, $_id_OfControl)
Local $_a_Pos = ControlGetPos($_h_Form, "", $_id_OfControl)
;~ MsgBox(0, "Position", "Relative to GUI:" & @CRLF & $aPos[0] & " - " & $aPos[1])
Local $_t_Point = DllStructCreate("int X;int Y")
DllStructSetData($_t_Point, "X", $_a_Pos[0])
DllStructSetData($_t_Point, "Y", $_a_Pos[1])
_WinAPI_ClientToScreen($_h_Form, $_t_Point)
Local $_a_Return[4]
$_a_Return[0] = DllStructGetData($_t_Point, "X")
$_a_Return[1] = DllStructGetData($_t_Point, "Y")
$_a_Return[2] = $_a_Pos[2]
$_a_Return[3] = $_a_Pos[3]
;~ MsgBox(0, "Position", "Relative to Screen:" & @CRLF & DllStructGetData($_t_Point, "X") & " - " & DllStructGetData($_t_Point, "Y"))
Return $_a_Return
EndFunc
; ###############################################################################################################################################################################################
;~ __ ___ _ ____ ___ ____ _ _ _____ _ ____ _ _ ___ ____ _ _ ___
;~ \ \ / (_)_ __ / \ | _ \_ _| | _ \(_)___ _ __ | | __ _ _ |_ _| __ __ _ _ __ ___ _ __ __ _ _ __ ___ _ __ | |_| __ )(_) |_ _ __ ___ __ _ _ __|_ _|_ __ / ___| | | |_ _|
;~ \ \ /\ / /| | '_ \ / _ \ | |_) | | | | | | / __| '_ \| |/ _` | | | || || '__/ _` | '_ \/ __| '_ \ / _` | '__/ _ \ '_ \| __| _ \| | __| '_ ` _ \ / _` | '_ \| || '_ \| | _| | | || |
;~ \ V V / | | | | |/ ___ \| __/| | | |_| | \__ \ |_) | | (_| | |_| || || | | (_| | | | \__ \ |_) | (_| | | | __/ | | | |_| |_) | | |_| | | | | | (_| | |_) | || | | | |_| | |_| || |
;~ ____\_/\_/ |_|_| |_/_/ \_\_| |___|___|____/|_|___/ .__/|_|\__,_|\__, ||_||_| \__,_|_| |_|___/ .__/ \__,_|_| \___|_| |_|\__|____/|_|\__|_| |_| |_|\__,_| .__/___|_| |_|\____|\___/|___|
;~ |_____| |_____| |_| |___/ |_| |_|
; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_DisplayTransparentBitmapInGUI
; Description ...:
; Syntax ........: _WinAPI_DisplayTransparentBitmapInGUI($hHBitmap, $hGUI, $iW, $iH[, $iOpacity = 0xFF])
; Parameters ....: $hHBitmap - a handle to the bitmap
; $hGUI - a handle to the GUI
; $iW - width of bitmap
; $iH - height of bitmap
; $iOpacity - [optional] a hex value for Opacity. Default is 0xFF (255) = total transparent
; Return values .: None
; ===============================================================================================================================
Func _WinAPI_DisplayTransparentBitmapInGUI($hHBitmap, $hGUI,$iW ,$iH, $iOpacity = 0xFF)
If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0)
Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap)
Local $tSize = DllStructCreate($tagSIZE)
$tSize.X = $iW
$tSize.Y = $iH
Local $tSource = DllStructCreate($tagPOINT)
Local $tBlend = DllStructCreate($tagBLENDFUNCTION)
$tBlend.Alpha = $iOpacity
$tBlend.Format = 1
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hHBitmap)
_WinAPI_DeleteDC($hMemDC)
Return True
EndFunc
; ###############################################################################################################################################################################################
;======================================================================================
; Function Name: _WinAPI_SetWindowTitleIcon
; Description: Loads an image, scales it to desired width or height and creates and icon handle
;
; Parameters: $sFile: image file to be loaded or bitmap handle
; $hWnd: GUI handle where the new icon should be displayed
; $iW: new image (icon) width. Default values is 32
; $iH: new image (icon) height. Default values is 32
;
; Requirement(s): GDIPlus.au3, _WinAPI_GetClassLongEx() and _WinAPI_SetClassLongEx()
; Return Value(s): Success: HICON handle, Error: 0 (see below)
; Error codes: 1: Code is running as x64 - not supported yet
; 2: $sFile value is empty
; 3: $hWnd is not a windows handle
; 4: filename doesn't exist or $sFile is not a valid bitmap handle
; 5: unable to create image from file
; 6: unable to create thumbnail from image handle
; 7: unable to create HICON from bitmap handle
; 8: unable to set ClassLongEx from GUI handle
;
; Limitation: only x86 compatible currently
;
; Author(s): UEZ, Yashied for _WinAPI_GetClassLongEx() and _WinAPI_SetClassLongEx()
; Version: v0.98 Build 2016-11-21 Beta
;
; Remarks: When finished release icon with _WinAPI_DestroyIcon()
;=======================================================================================
Func _WinAPI_SetWindowTitleIcon($sFile, $hWnd, $iW = 16, $iH = 16)
If @AutoItX64 Then Return SetError(1, 0, 0)
If $sFile = "" Then Return SetError(2, 0, 0)
If Not IsHWnd($hWnd) Then Return SetError(3, 0, 0)
;~ Local Const $GCL_HICON = -14, $GCL_HICONSM = -34
Local $hImage, $bExtHandle = False
If Not FileExists($sFile) Then
If _GDIPlus_ImageGetType($sFile) = -1 Then Return SetError(4, @error, 0)
$hImage = $sFile ;interpret $sFile as a bitmap handle
$bExtHandle = True
Else
$hImage = _GDIPlus_ImageLoadFromFile($sFile)
If @error Then Return SetError(5, @error, 0)
EndIf
Local Const $hImageScaled = _GDIPlus_ImageScale($hImage, $iW, $iH)
If @error Then Return SetError(6, @error, 0)
If Not $bExtHandle Then _GDIPlus_ImageDispose($hImage)
Local Const $hIconNew = _GDIPlus_HICONCreateFromBitmap($hImageScaled)
If @error Then
_GDIPlus_ImageDispose($hImageScaled)
Return SetError(7, @error, 0)
EndIf
;~ _WinAPI_SetClassLongEx($hWnd, $GCL_HICONSM, $hIconNew)
_SendMessage($hWnd, $WM_SETICON, 1, $hIconNew)
If @error Then
_GDIPlus_ImageDispose($hImageScaled)
Return SetError(8, @error, 0)
EndIf
_GDIPlus_ImageDispose($hImageScaled)
Return $hIconNew
EndFunc ;==>_WinAPI_SetWindowTitleIcon
; ###############################################################################################################################################################################################
;~ _ _ _____ _____ _ ____ _ _ _ ____ _
;~ (_) __| | | ___|__ _ __ _ __ ___ | ___|__ | |_ ___/ ___| ___ _ __| |_| \ | | ___ _ _ / ___| | ___ ___ ___
;~ | |/ _` | | |_ / _ \| '__| '_ ` _ \| |_ / _ \| __/ _ \___ \ / _ \| '__| __| \| |/ _ \ | | | | | |/ _ \/ __|/ _ \
;~ | | (_| | | _| (_) | | | | | | | | _| (_) | || (_) |__) | (_) | | | |_| |\ | __/ |_| | |___| | (_) \__ \ __/
;~ |_|\__,_|___|_| \___/|_| |_| |_| |_|_| \___/ \__\___/____/ \___/|_| \__|_| \_|\___|\__,_|\____|_|\___/|___/\___|
;~ |_____|
; Wird aufgerufen wenn jemand auf das rote X oben rechts klickt oder ESC drückt (siehe in der Hilfe beim Befehl AutoItSetOption("GUICloseOnESC"))
Func id_FormFotoSort2017Close()
;~ If $h_FormFotoSort2017 Then _WinAPI_DeleteObject($h_FormFotoSort2017)
_WinAPI_DestroyIcon($_Resources_FotoSort2017ico)
_WinAPI_DestroyIcon($_Resources_Burnpng)
_WinAPI_DestroyIcon($_Resources_Colorpng)
_WinAPI_DestroyIcon($_Resources_CopyDocpng)
_WinAPI_DestroyIcon($_Resources_Editpng)
_WinAPI_DestroyIcon($_Resources_Refreshpng)
_WinAPI_DestroyIcon($_Resources_TrashFullpng)
_WinAPI_DestroyIcon($_Resources_Helppng)
_WinAPI_DestroyIcon($h_IconCheckOff)
_WinAPI_DestroyIcon($h_IconPicture)
_WinAPI_DestroyIcon($h_IconWarning)
_WinAPI_DestroyIcon($h_IconInfo)
_GDIPlus_Shutdown()
GUIDelete($h_FormFotoSort2017)
Exit
EndFunc
; ###############################################################################################################################################################################################
;~ _ _ _____ _____ _ ____ _ _ _ __ __ _ _
;~ (_) __| | | ___|__ _ __ _ __ ___ | ___|__ | |_ ___/ ___| ___ _ __| |_| \ | | ___ _ _| \/ | __ ___ _(_)_ __ ___ (_)_______
;~ | |/ _` | | |_ / _ \| '__| '_ ` _ \| |_ / _ \| __/ _ \___ \ / _ \| '__| __| \| |/ _ \ | | | |\/| |/ _` \ \/ / | '_ ` _ \| |_ / _ \
;~ | | (_| | | _| (_) | | | | | | | | _| (_) | || (_) |__) | (_) | | | |_| |\ | __/ |_| | | | | (_| |> <| | | | | | | |/ / __/
;~ |_|\__,_|___|_| \___/|_| |_| |_| |_|_| \___/ \__\___/____/ \___/|_| \__|_| \_|\___|\__,_|_| |_|\__,_/_/\_\_|_| |_| |_|_/___\___|
;~ |_____|
; Wird aufgerufen wenn die GUI maximiert wird. Nach irgendeiner Änderung von mir aber bevor die Controls ihre neue Größe haben
Func id_FormFotoSort2017Maximize()
$b_FormIsMaximized = True
_SettingsWrite("$b_FormIsMaximized", $b_FormIsMaximized) ; Merken wir uns für den nächsten Programmstart
_SelectCurrentPictureTimer()
; Ggf den + Button deaktivieren:
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_ENABLE)
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ _ _ _____ _____ _ ____ _ _ _ ____ _
;~ (_) __| | | ___|__ _ __ _ __ ___ | ___|__ | |_ ___/ ___| ___ _ __| |_| \ | | ___ _ _| _ \ ___ ___| |_ ___ _ __ ___
;~ | |/ _` | | |_ / _ \| '__| '_ ` _ \| |_ / _ \| __/ _ \___ \ / _ \| '__| __| \| |/ _ \ | | | |_) / _ \/ __| __/ _ \| '__/ _ \
;~ | | (_| | | _| (_) | | | | | | | | _| (_) | || (_) |__) | (_) | | | |_| |\ | __/ |_| | _ < __/\__ \ || (_) | | | __/
;~ |_|\__,_|___|_| \___/|_| |_| |_| |_|_| \___/ \__\___/____/ \___/|_| \__|_| \_|\___|\__,_|_| \_\___||___/\__\___/|_| \___|
;~ |_____|
; Wird aufgerufen wenn die GUI nach dem minimieren wieder sichtbar gemacht wird. Aber nach einer Änderung auch wieder bevor die Controls ihr neue Größe haben
Func id_FormFotoSort2017Restore()
_SelectCurrentPictureTimer()
$b_FormIsMaximized = False
_SettingsWrite("$b_FormIsMaximized", $b_FormIsMaximized)
; Ggf den + Button deaktivieren:
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_ENABLE)
EndIf
While (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= $a_GroupSize[3]
_Folder_Remove()
WEnd
$a_FormFotoSortNew_Size = WinGetPos($h_FormFotoSort2017)
_SettingsWrite("$a_FormFotoSortNew_Size[2]", $a_FormFotoSortNew_Size[2])
_SettingsWrite("$a_FormFotoSortNew_Size[3]", $a_FormFotoSortNew_Size[3])
EndFunc
; ###############################################################################################################################################################################################
;~ ____ _ _ ___ _______ _______ _ _ _____ ____ ____ ___ ____ ____ _____ ____
;~ / ___| | | |_ _| | ____\ \ / / ____| \ | |_ _| | _ \| _ \ / _ \| _ \| _ \| ____| _ \
;~ | | _| | | || | | _| \ \ / /| _| | \| | | | | | | | |_) | | | | |_) | |_) | _| | | | |
;~ | |_| | |_| || | | |___ \ V / | |___| |\ | | | | |_| | _ <| |_| | __/| __/| |___| |_| |
;~ \____|\___/|___|___|_____| \_/ |_____|_| \_| |_|___|____/|_| \_\\___/|_| |_| |_____|____/
;~ |_____| |_____|
; Das erste mal gemacht: Statt die Pfade mühsam über einzelne Dialog einzustellen kann man diese einfach aus dem Explorer auf die Felder oder die Vorschau ziehen
; Funktioniert bei Quellpfad, Zielpfad, Vorschau
Func GUI_EVENT_DROPPED()
Local $_s_empty = "", $_a_PathSplit[4]
; Wenn man mehr als einmal eine Datei/Ordner auf die Inputfelder zieht so wird der Text angehängt. Das verhindert folgende Zeile
If @GUI_DropId <> $id_Picture And @GUI_DropId <> $id_Background Then
; Es war nicht die Vorschau, also den Dateinamen in das entsprechende Input-Control
GUICtrlSetData(@GUI_DropId, @GUI_DragFile)
Else
; Es war die Vorschau. Dateinamen umlenken in das Feld für den Quellordner (in diesem Moment ggf noch mit Dateinamen)
GUICtrlSetData($id_InputSourceDirectory, @GUI_DragFile)
EndIf
; Jetzt können wir prüfen was es da gab
If @GUI_DROPID = $id_InputSourceDirectory Or @GUI_DROPID = $id_Picture Or @GUI_DropId = $id_Background Then
; Auseinander bauen was es gab und schauen ob es Datei oder Ordner war
$_a_PathSplit = _PathSplit(GUICtrlRead($id_InputSourceDirectory), $_s_empty, $_s_empty, $_s_empty, $_s_empty)
If $_a_PathSplit[4] <> "" Then
; Es eine Datei! Der Dateiname steht zu diesem Zeitpunkt noch im Input-Feld.
; Den ersetzen wir durch den reinen Pfad
GUICtrlSetData($id_InputSourceDirectory, StringTrimRight($_a_PathSplit[1] & $_a_PathSplit[2], 1))
EndIf
_SettingsWrite("$id_InputSourceDirectory", GUICtrlRead($id_InputSourceDirectory)) ; Und den Pfad merken wir uns als Startordner für das nächste mal
_ReadFileList()
; Jetzt suchen wir noch die Nummer des Bildes das es per Drag'n Drop gab um es darzustellen. _ArraySearch war mir zu umständlich
For $i = 1 To $a_s_PictureFilenames[0] Step 1
If $a_s_PictureFilenames[$i] = @GUI_DragFile Then
_SelectCurrentPicture($i)
ExitLoop
EndIf
Next
Else
; Ok, einer der Zielordner, erst einmal suchen welcher es war
For $i = 1 To $a_id_TargetDirectories[0][0] Step 1
If $a_id_TargetDirectories[$i][3] = @GUI_DROPID Then
; Dieser hier. Wieder den Text nehmen und Prüfen ob das ein Ordner oder eine Datei ist
$_a_PathSplit = _PathSplit(GUICtrlRead($a_id_TargetDirectories[$i][3]), $_s_empty, $_s_empty, $_s_empty, $_s_empty)
If $_a_PathSplit[4] <> "" Then
; Es war eine Datei! Wir nehmen nur den Ordnerteil, der Rest wird ignoriert
GUICtrlSetData($a_id_TargetDirectories[$i][3], StringTrimRight($_a_PathSplit[1] & $_a_PathSplit[2], 1))
EndIf
_SettingsWrite("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive, $a_id_TargetDirectories[0][0]) ; Anzahl der Zielverzeichnisse
_SettingsWrite("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive, GUICtrlRead($a_id_TargetDirectories[$i][3])) ; und wohin es zeigt
_SettingsWrite("$i_ProfileActive", $i_ProfileActive)
_SettingsWrite("$s_ProfileActive", $s_ProfileActive)
ExitLoop
EndIf
Next
EndIf
EndFunc
; ###############################################################################################################################################################################################
;~ __ ____ __ ____ ___ __ __ __ __ _ _ _ ____
;~ \ \ / / \/ | / ___/ _ \| \/ | \/ | / \ | \ | | _ \
;~ \ \ /\ / /| |\/| | | | | | | | |\/| | |\/| | / _ \ | \| | | | |
;~ \ V V / | | | | | |__| |_| | | | | | | |/ ___ \| |\ | |_| |
;~ \_/\_/ |_| |_|___\____\___/|_| |_|_| |_/_/ \_\_| \_|____/
;~ |_____|
; Wird aufgerufen sobald ein Control den Focus erhält. Oder verliert. Nutzen wir für das Input der Bildnummern und des Suffix,
; in der Zeit wo der Cursor in diesen steht müssen alle Tastenaufrufe deaktiviert sein
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg
Local $_i_Code = BitShift($wParam, 16)
Switch $lParam
Case GUICtrlGetHandle($id_InputPicNumber), GUICtrlGetHandle($id_InputSuffix)
Switch $_i_Code
Case $EN_SETFOCUS
; Aha, der Focus ist also in einem der beiden Inputs, Tasten aus!
GUISetAccelerators("dummy", $a_FormFotoSortNew_Size)
Case $EN_KILLFOCUS
; Focus ist wieder raus, Tasten wieder an
GUISetAccelerators($a_AcceleratorKeys, $h_FormFotoSort2017)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>ED_WM_COMMAND
; ###############################################################################################################################################################################################
;~ __ ____ __ ____ _____ _____ __ __ ___ _ _ __ __ _ __ _____ _ _ _____ ___
;~ \ \ / / \/ | / ___| ____|_ _| \/ |_ _| \ | | \/ | / \ \ \/ /_ _| \ | | ___/ _ \
;~ \ \ /\ / /| |\/| | | | _| _| | | | |\/| || || \| | |\/| | / _ \ \ / | || \| | |_ | | | |
;~ \ V V / | | | | | |_| | |___ | | | | | || || |\ | | | |/ ___ \ / \ | || |\ | _|| |_| |
;~ \_/\_/ |_| |_|___\____|_____| |_| |_| |_|___|_| \_|_| |_/_/ \_\/_/\_\___|_| \_|_| \___/
;~ |_____|
; Dient dazu eine minimale und maximale Größe der GUI durchzusetzen.
; gefunden unter: https://www.autoitscript.com/forum/topic/124195-gui-minimum-size/
Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
DllStructSetData($tagMaxinfo, 7, $i_FormFotoSortNew_SizeMinWidth) ; min X
DllStructSetData($tagMaxinfo, 8, $i_FormFotoSortNew_SizeMinHeight) ; min Y
DllStructSetData($tagMaxinfo, 9, $i_FormFotoSortNew_SizeMaxWidth ); max X
DllStructSetData($tagMaxinfo, 10, $i_FormFotoSortNew_SizeMaxHeight ) ; max Y
Return 0
EndFunc ;==>WM_GETMINMAXINFO
; ###############################################################################################################################################################################################
;~ __ ____ __ __ __ ___ _ _ ____ _______ ___ _ _____ _____ _
;~ \ \ / / \/ | | \/ |/ _ \| | | / ___|| ____\ \ / / | | | ____| ____| |
;~ \ \ /\ / /| |\/| | | |\/| | | | | | | \___ \| _| \ \ /\ / /| |_| | _| | _| | |
;~ \ V V / | | | | | | | | |_| | |_| |___) | |___ \ V V / | _ | |___| |___| |___
;~ \_/\_/ |_| |_|___|_| |_|\___/ \___/|____/|_____| \_/\_/ |_| |_|_____|_____|_____|
;~ |_____|
; Unter https://autoit.de/index.php/Thread/83596-MouseWheel-auswerten/
; steht wie man gezielt das Control findet über dem die Maus gerade ist - brauchen wir hier aber nicht, einfach Bild rauf oder runter
Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)
GUIRegisterMsg($WM_MOUSEWHEEL, '')
Local $_i_PicNumber = GUICtrlRead($id_InputPicNumber)
Local $_i_Wheel = _WinAPI_HiWord($wParam) / 120 ; down = -1, up = 1
Local $_a_ButtonPos
If $_i_Wheel = 1 Then
$_a_ButtonPos = ControlGetPos($h_FormFotoSort2017, "", $id_ButtonPicBack1)
ControlFocus($h_FormFotoSort2017, "", $id_ButtonPicBack1)
$_i_PicNumber = $_i_PicNumber - 1
Else
$_a_ButtonPos = ControlGetPos($h_FormFotoSort2017, "", $id_ButtonPicForward1)
ControlFocus($h_FormFotoSort2017, "", $id_ButtonPicForward1)
$_i_PicNumber = $_i_PicNumber + 1
EndIf
GUICtrlSetPos($id_ButtonSelected1, $_a_ButtonPos[0] - 1, $_a_ButtonPos[1] - 1)
GUICtrlSetPos($id_ButtonSelected2, $_a_ButtonPos[0] - 2, $_a_ButtonPos[1] - 2)
GUICtrlSetColor($id_ButtonSelected1, $hex_SignalColor)
GUICtrlSetColor($id_ButtonSelected2, $hex_SignalColor)
_SelectCurrentPicture($_i_PicNumber)
$i_Timeout = 250
_ThisOne()
GUIRegisterMsg($WM_MOUSEWHEEL, 'WM_MOUSEWHEEL')
Return $GUI_RUNDEFMSG
EndFunc
; ###############################################################################################################################################################################################
;~ __ ____ __ ____ ___ __________
;~ \ \ / / \/ | / ___|_ _|__ / ____|
;~ \ \ /\ / /| |\/| | \___ \| | / /| _|
;~ \ V V / | | | | ___) | | / /_| |___
;~ \_/\_/ |_| |_|___|____/___/____|_____|
;~ |_____|
; Wird bei jeder Größenänderung aufgerufen.
; Die Statusbar muss jedesmal angepasst werden
; Und die Vorschau auch, falls es die GDIPlus Version ist
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
;~ $b_WM_SIZE = True
; Statusbar unten muss von Hand angestoßen werden
_GUICtrlStatusBar_Resize($id_StatusBar)
; Vorschaubild wieder anpassen
If $b_Use_GuiCtrlSetImageEx = True Then
;~ _SelectCurrentPicture(GUICtrlRead($id_InputPicNumber)) ; Warum hatte ich das statt der direkten Funktion genommen?
_SelectCurrentPictureTimer()
;~ If $a_CurrentPictureFilename[1] = ".gif" Then
;~ _GUICtrlSetGIF_Mod($id_Picture, $d_CurrentPicture, $b_Upscale)
;~ Else
;~ _GuiCtrlSetImageEx($id_Picture, $d_CurrentPicture, $b_Upscale, $d_BackgroundColor_ARGB, False)
;~ EndIf
EndIf
; Ggf den + Button deaktivieren:
Local $a_GroupSize = ControlGetPos($h_FormFotoSort2017, "", $id_GroupTargetDirectories)
If (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= ($a_GroupSize[3] - $i_Distance) Then
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_DISABLE)
Else
GUICtrlSetState($id_ButtonAddTargetDirectory, $GUI_ENABLE)
EndIf
; Wenn wir zuviele Zielordner haben und die GUI zu klein dafür ist ... löschen wir solange Ordner bis es wieder passt
While (($a_id_TargetDirectories[0][0] + 1) * $i_Distance) >= $a_GroupSize[3]
_Folder_Remove()
WEnd
If BitAND(WinGetState($h_FormFotoSort2017), $WIN_STATE_MAXIMIZED) <> $WIN_STATE_MAXIMIZED Then ; prüfen ob das Fenster maximiert ist
; Nur wenn nicht wird die aktuelle Größe gesichert. Würden wir den Wert sichern während das Fenster maximiert ist
; so wären es eben diese maximierten Daten. Schließt dann einer das Programm und startet es neu,
; ist es wieder maximiert. Klickt er auf verkleinern gibt es dann nicht die vorherige Größe sondern eben diese maximale
$a_FormFotoSortNew_Size = WinGetPos($h_FormFotoSort2017)
_SettingsWrite("$a_FormFotoSortNew_Size[2]", $a_FormFotoSortNew_Size[2])
_SettingsWrite("$a_FormFotoSortNew_Size[3]", $a_FormFotoSortNew_Size[3])
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_SIZE
;~ ###############################################################################################################################################################################################
#EndRegion Funktionen
#Region GUI-FormFotoSort2017
; ###############################################################################################################################################################################################
; ###### ## ## ####
; ## ## ## ## ##
; ## ## ## ##
; ## #### ## ## ##
; ## ## ## ## ##
; ## ## ## ## ##
; ###### ####### ####
; ###############################################################################################################################################################################################
; Um GDIPlus nutzen zu können müssen wir es starten:
_GDIPlus_Startup()
; Das Fenster an sich erstellen. Die Größenwerte 1009 und 730 ist die nutzbare Innenfläche ohne Ränder und Titelleiste (deren Größe von der Windowsversion abhängt)
; Als Styles wurden folgende gewählt:
; $GUI_SS_DEFAULT_GUI: beinhaltet die Styles $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP und $WS_SYSMENU
; $WS_MINIMIZEBOX : Fenster hat eine Minimieren-Schaltfläche
; $WS_CAPTION : Es gibt eine Titelzeile oben (Steht oft der Programmname drin)
; $WS_POPUP : Macht ein Popup-Fenster (keine Ahnung wazu das hier drin ist)
; $WS_SYSMENU : Erlaubt das Menü das kommt wenn man oben links auf das Programsymbol in der Titelleiste klickt
; $WS_MAXIMIZEBOX : Fenster hat eine Maximieren-Schaltfläche
; $WS_SIZEBOX : Fenster hat einen Rahmen zur Größenänderung
; $WS_TABSTOP : Die Controls im Fenster können per Tabulator-Taste durchgeschaltet werden
; Als Extended Styles wurden folgende gewählt:
; $WS_EX_ACCEPTFILES : Man darf Dateien auf Edit-Controls ziehen, die bekommen dann den Dateinamen
$h_FormFotoSort2017 = GUICreate("FotoSort2017", 1009, 730, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_TABSTOP), $WS_EX_ACCEPTFILES)
; Schriftart setzen - diese wird von allen Controls verwendet sofern nicht etwas anderes an diesen angegeben werden
GUISetFont($s_FontSizeForm * $i_AppliedDPI, 400, 0, $s_FontNameForm)
GUISetBkColor(0xC8C8C8)
GUISetOnEvent($GUI_EVENT_CLOSE, "id_FormFotoSort2017Close")
GUISetOnEvent($GUI_EVENT_RESTORE, "id_FormFotoSort2017Restore")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "id_FormFotoSort2017Maximize")
; Die Statusbar unten erstellen
$id_StatusBar = _GUICtrlStatusBar_Create($h_FormFotoSort2017, -1, "", BitOR($WS_VISIBLE,$WS_CHILD,$WS_BORDER))
_GUICtrlStatusBar_SetMinHeight($id_StatusBar, 22)
; Die Größe der 3 Abschnitte, -1 = bis zum Ende
;~ Local $id_StatusBar_PartsWidth[3] = [300, 600, -1]
Local $id_StatusBar_PartsWidth[4] = [500, 630, 780, -1]
_GUICtrlStatusBar_SetParts($id_StatusBar, $id_StatusBar_PartsWidth)
;Anfangstext in die einzelnen Abschnitte der Statusbar setzen
_GUICtrlStatusBar_SetText($id_StatusBar, "Status", 0)
_GUICtrlStatusBar_SetText($id_StatusBar, "Bild 0 von 0", 1)
_GUICtrlStatusBar_SetText($id_StatusBar, "Bildinfos", 3)
$_Resources_Warningico = _GDIPlus_BitmapCreateFromMemory(_Resources_Warningico(), False)
$h_IconWarning = _GDIPlus_HICONCreateFromBitmap($_Resources_Warningico)
$_Resources_Pictureico = _GDIPlus_BitmapCreateFromMemory(_Resources_Pictureico(), False)
$h_IconPicture = _GDIPlus_HICONCreateFromBitmap($_Resources_Pictureico)
$_Resources_CheckOffico = _GDIPlus_BitmapCreateFromMemory(_Resources_CheckOffico(), False)
$_Resources_CheckOffico2 = _GDIPlus_BitmapCreateFromMemory(_Resources_CheckOffico(), True)
$h_IconCheckOff = _GDIPlus_HICONCreateFromBitmap($_Resources_CheckOffico)
$_Resources_Infoico = _GDIPlus_BitmapCreateFromMemory(_Resources_Infoico(), False)
$h_IconInfo = _GDIPlus_HICONCreateFromBitmap($_Resources_Infoico)
$_Resources_Cancelico = _GDIPlus_BitmapCreateFromMemory(_Resources_Cancelico(), True)
;~ $h_IconCancel = _GDIPlus_HICONCreateFromBitmap($_Resources_Cancelico)
$_Resources_Overwriteico = _GDIPlus_BitmapCreateFromMemory(_Resources_Overwriteico(), True)
$_Resources_Profilesico = _GDIPlus_BitmapCreateFromMemory(_Resources_Profilesico(), False)
$h_IconProfiles = _GDIPlus_HICONCreateFromBitmap($_Resources_Profilesico)
;~ $h_IconOverwrite = _GDIPlus_HICONCreateFromBitmap($_Resources_Overwriteico)
; Die Gruppen oben links mit dem Pfad zum aktuellen Ordner erstellen
$id_GroupQuellverzeichnis = GUICtrlCreateGroup(" Quellverzeichnis: ", 5, 8, 514, 68)
; Die Gruppe - und alle Controls in dieser - heften wir an den linken + oberen + rechten Rand - damit die bei Größenänderungen oben bleibt, sich aber in die Breite zieht. Die Höhe ist gesperrt
GUICtrlSetResizing($id_GroupQuellverzeichnis, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
; Das Input-Feld, ist Readonly, aktzeptiert Drag'n Drop
$id_InputSourceDirectory = GUICtrlCreateInput("", 13, 28, 462, 25, BitOR($ES_READONLY,$ES_LEFT, $ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_ACCEPTFILES))
GUICtrlSetFont($id_InputSourceDirectory, $s_FontSizeInputs * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetBkColor($id_InputSourceDirectory, 0xFFFFE1)
; Das Edit heften wir links, rechts und oben fest - damit es sich nicht in der Höhe ändert aber in die Breite geht. Höhe ist wieder gesperrt
GUICtrlSetResizing($id_InputSourceDirectory, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
; Damit das Feld Drag'n Drop annimmt (muss zusätzlich zum Extended-Style gesetzt werden)
GUICtrlSetState($id_InputSourceDirectory, $GUI_DROPACCEPTED)
; Und wir wollen mitbekommen wenn der Inhalt sich ändern, z.B, durch Drag'n Drop
; Der Button für die Auswahl der Datei
$id_ButtonSelectSourceDirectory = GUICtrlCreateButton("...", 477, 28, 33, 25)
; Der Button bekommt den Buchstaben q (Ich bracuhte einen Startwert in dem Array - und hier ist er!
$a_AcceleratorKeys[0][0] = "q"
$a_AcceleratorKeys[0][1] = $id_ButtonSelectSourceDirectory
; Den heften wir nur oben und rechts an - damit der mit nach rechts wandert wenn wir die GUI vergößern. Höhe und Breite ist gesperrt
GUICtrlSetResizing($id_ButtonSelectSourceDirectory, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonSelectSourceDirectory, "_Folder_Select")
; Und noch die Checkbox für die rekursive Suche
$id_CheckboxScanFolderRecursive = GUICtrlCreateCheckbox("inklusive Unterordner (Rekursiv)", 13, 56, 225, 17)
; Die heften wir oben und links an - so bleibt die einfach auf der Stelle stehen, Höhe und Breite gesperrt
GUICtrlSetResizing($id_CheckboxScanFolderRecursive, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Und wenn die Checkbox geändert wird, die Liste der Bilder neu einlesen:
GUICtrlSetOnEvent($id_CheckboxScanFolderRecursive, "_ReadFileList")
; Gruppe ist fertig, also schließen
GUICtrlCreateGroup("", -99, -99, 1, 1)
; Nun die verfügbaren Bildformate. Wie bei Oscar keine feste Liste sondern alles das was GDIPlus so kann.
$id_GroupFileFormats = GUICtrlCreateGroup(" Dateiformate: ", 528, 8, 473, 68)
; Die Group ist fest in der Größe und oben sowie rechts angeheftet
GUICtrlSetResizing($id_GroupFileFormats, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; und die verfügbaren Decoders abfragen. Hinweis: Den für GIF werden wir später nicht nutzen sondern einen anderen der mit animierten GIF umgehen kann.
$aGDIPlusDecoders = _GDIPlus_Decoders()
; $aGDIPlusDecoders sieht jetzt - gekürzt - wie folgt aus:
; $aGDIPlusDecoders[0][0] = Anzahl der verfügbaren Decoders
; $aGDIPlusDecoders[x][5] = Der Name des Dateiformates, z.B. BMP
; Die ControlIds der ganzen Checkboxen packen wir in ein Array. Das ist um 1 größer als nötig - wir packen noch eine Option "Alle" dazu.
; Oscar hat das als Popup/Rechtsklick Menü gemacht. Das hatte ich erst gefunden als ich es im Quellcode gesehen hatte.
ReDim $a_id_CheckboxFileformat[ $aGDIPlusDecoders[0][0] + 1 ]
; Die erste Checkbox mit "Alle" kommte oben links in die Group. Alle sind 65 lang und 17 hoch
$a_id_CheckboxFileformat[0] = GUICtrlCreateCheckbox("Alle", 536, 28, 65, 17)
GUICtrlSetOnEvent($a_id_CheckboxFileformat[0], "_CheckboxFileformat")
GUICtrlSetResizing($a_id_CheckboxFileformat[0], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Die erste Reihe kommt auf 28, die zweite Reihe auf 52
; Abstand Horizontal sind 72
For $i = 1 To $aGDIPlusDecoders[0][0] Step 1
; So die Formel habe ich mir bei Oscar abgeschaut - und musste erst einmal überlegen was er da macht
$a_id_CheckboxFileformat[$i] = GUICtrlCreateCheckbox($aGDIPlusDecoders[$i][5], 614 + Mod($i - 1, 5) * 78, 28 + Int(($i - 1) / 5) * 24, 65, 17)
; X: 614 + Mod($i - 1, 5) * 72
; 614 Pixel von links fangen wir an, dazu addieren wir das Ergebnis der rechten Berechnung (Punkt vor Strichrechnung!)
; Mod($i - 1, 5) ergibt - bei $i 1 bis 8 - die Zahlenfolge 0 1 2 3 4 0 1 2
; Und den Wert Multiplizieren wir immer mit 72, dem gewünschten Abstand der Spalten
; Y: 28 + Int(($i - 1) / 5) * 24
; 28 Pixel von oben ist die erste Reihe
; ($i - 1) / 5 liefert und die Zahlenfolge 0 0.2 0.4 0.8 1 1.2 1.4 usw.
; Durch Int() bekommen wir nur den Teil vor dem . (ohne Runden) also 0 0 0 0 1 1 1, also 4 mal 0 und dann 1 (und 2, 3 je nach Größe von $i)
; Und das dann mal 24, denn bei 28 + 24 = 52 soll die 2 Zeile hin
; Die Checkboxen haben alle eine feste Größe und werden oben und rechts angeheftet
GUICtrlSetResizing($a_id_CheckboxFileformat[$i], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Und noch die Funktion die aufgerufen werden soll wenn sich ein Wert ändert:
GUICtrlSetOnEvent($a_id_CheckboxFileformat[$i], "_CheckboxFileformat")
; und der Tooltip
GUICtrlSetTip($a_id_CheckboxFileformat[$i], "Alle Dateien mit Dateiendung: " & StringLower($aGDIPlusDecoders[$i][6]))
Next
; Und ersteinmal alle auswählen:
;~ GUICtrlSetState($a_id_CheckboxFileformat[0], $GUI_CHECKED)
;~ _CheckboxFileformat()
; Und die Gruppe ist komplett, also zumachen
GUICtrlCreateGroup("", -99, -99, 1, 1)
; Die Gruppe mit den Zielverzeichnissen. Ein Grund warum ich dieses Programm neu geschrieben habe. Ich brauchte mehr davon und der Platz des Bildschirmes sollte besser ausgenutzt werden
; Die Anzahl der Zielverzeichniss ist dynamisch
; Group anlegen
$id_GroupTargetDirectories = GUICtrlCreateGroup(" Zielverzeichnisse (1..1): ", 528, 176, 473, 441)
; Die Group rechts, oben und unten angeheftet. Die Breite ist fix, die Höhe nicht. Dadurch wird die Gruppe - als einzige - größer wenn das fenster vergrößert wird
GUICtrlSetResizing($id_GroupTargetDirectories, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH)
; So, nun brauchen wir pro Zielverzeichnis: 1x Button kopieren, 1x Button verschieben, 1x Input mit dem Pfad, 1x Input zur Pfadauswahl
; das machen wir natürlich mit einem Array das wie folgt aussieht:
; $a_id_TargetDirectories[2][5] ; [0][0] = Anzahl
; [x][1] = Button kopieren
; [x][2] = Butten verschieben
; [x][3] = Input
; [x][4] = Pfadauswahl
; Eine Zeile gibt es immer!
$a_id_TargetDirectories[0][0] = 1
; Den Button für kopieren
$a_id_TargetDirectories[1][1] = GUICtrlCreateButton("1", 536, 200, 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[1][1], "_Picture_Copy")
; Diesen und die nachfolgenden Buttons heften wir Rechts und oben an, Größe ist fix
GUICtrlSetResizing($a_id_TargetDirectories[1][1], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[1][1], "Taste: [1]" & @CRLF & "Datei kopieren")
_AcceleratorKeyAdd("1", $a_id_TargetDirectories[1][1])
_AcceleratorKeyAdd("{NUMPAD1}", $a_id_TargetDirectories[1][1])
; Den Button für verschieben
$a_id_TargetDirectories[1][2] = GUICtrlCreateButton("»", 568, 200, 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[1][2], "_Picture_Move")
GUICtrlSetResizing($a_id_TargetDirectories[1][2], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[1][2], "Taste: [Alt] + [1]" & @CRLF & "Datei verschieben")
_AcceleratorKeyAdd("!1", $a_id_TargetDirectories[1][2])
_AcceleratorKeyAdd("!{NUMPAD1}", $a_id_TargetDirectories[1][2])
; Das Input mit dem Pfad
$a_id_TargetDirectories[1][3] = GUICtrlCreateInput("", 603, 200, 354, 25, BitOR($ES_READONLY,$ES_LEFT, $ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_ACCEPTFILES))
GUICtrlSetFont($a_id_TargetDirectories[1][3], $s_FontSizeInputs * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetBkColor($a_id_TargetDirectories[1][3], 0xFFFFE1)
GUICtrlSetResizing($a_id_TargetDirectories[1][3], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Damit das Feld Drag'n Drop annimmt (muss zusätzlich zum Extended-Style gesetzt werden)
GUICtrlSetState($a_id_TargetDirectories[1][3], $GUI_DROPACCEPTED)
; Und noch der Button für die Pfadauswahl
$a_id_TargetDirectories[1][4] = GUICtrlCreateButton("...", 960, 200, 33, 25)
GUICtrlSetOnEvent($a_id_TargetDirectories[1][4], "_Folder_Select")
GUICtrlSetResizing($a_id_TargetDirectories[1][4], $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($a_id_TargetDirectories[1][4], "Pfad wählen")
; Rahmen um die gewählte Zeile hervorheben zu können
$_a_ButtonCopy = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[1][1])
$_a_ButtonSelectFolder = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[1][4])
$id_ThisOne1 = GUICtrlCreateGraphic($_a_ButtonCopy[0] - 2, $_a_ButtonCopy[1] - 2, $_a_ButtonSelectFolder[0] + $_a_ButtonSelectFolder[3] - $_a_ButtonCopy[0] + 12, $_a_ButtonCopy[3] + 4)
$id_ThisOne2 = GUICtrlCreateGraphic($_a_ButtonCopy[0] - 3, $_a_ButtonCopy[1] - 3, $_a_ButtonSelectFolder[0] + $_a_ButtonSelectFolder[3] - $_a_ButtonCopy[0] + 14, $_a_ButtonCopy[3] + 6)
GUICtrlSetColor($id_ThisOne1, 0xC8C8C8)
GUICtrlSetColor($id_ThisOne2, 0xC8C8C8)
GUICtrlSetResizing($id_ThisOne1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetResizing($id_ThisOne2, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState($id_ThisOne1, $GUI_DISABLE)
GUICtrlSetState($id_ThisOne2, $GUI_DISABLE)
; Unterhalb der Zeile kommen noch 2 Buttons für das Hinzufügen und Entfernen weiterer Zeilen hinzu
$id_ButtonAddTargetDirectory = GUICtrlCreateButton("+", 536, 232, 33, 25)
GUICtrlSetOnEvent($id_ButtonAddTargetDirectory, "_Folder_Add")
GUICtrlSetResizing($id_ButtonAddTargetDirectory, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($id_ButtonAddTargetDirectory, "Einen Pfad hinzufügen")
$id_ButtonRemoveTargetDirectory = GUICtrlCreateButton("-", 568, 232, 33, 25)
GUICtrlSetOnEvent($id_ButtonRemoveTargetDirectory, "_Folder_Remove")
GUICtrlSetResizing($id_ButtonRemoveTargetDirectory, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($id_ButtonRemoveTargetDirectory, "Den vorstehenden Pfad entfernen")
; "-" wird deaktiviert, haben im Moment ja nur eine Zeile
GUICtrlSetState($id_ButtonRemoveTargetDirectory, $GUI_DISABLE)
; Und auch diese Gruppe ist fertig
GUICtrlCreateGroup("", -99, -99, 1, 1)
; Die Gruppe mit den Optionen für doppelte / schon vorhandene Dateien
$id_GroupFileExists = GUICtrlCreateGroup(" Wenn Datei bereits vorhanden: ", 528, 80, 473, 90)
GUICtrlSetResizing($id_GroupFileExists, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$id_RadioOverwrite = GUICtrlCreateRadio("vorhandene Datei überschreiben", 536, 100, 241, 17)
GUICtrlSetOnEvent($id_RadioOverwrite, "_RadioFileExists")
GUICtrlSetResizing($id_RadioOverwrite, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$id_RadioAddSuffix = GUICtrlCreateRadio("Suffix anhängen:", 536, 124, 137, 17)
GUICtrlSetOnEvent($id_RadioAddSuffix, "_RadioFileExists")
;~ GUICtrlSetState($id_RadioAddSuffix, $GUI_CHECKED)
GUICtrlSetResizing($id_RadioAddSuffix, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$id_InputSuffix = GUICtrlCreateInput("_####", 674, 120, 89, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetOnEvent($id_InputSuffix, "_RadioFileExists")
GUICtrlSetFont($id_InputSuffix, $s_FontSizeInputs * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetResizing($id_InputSuffix, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$id_RadioAskOverwrite = GUICtrlCreateRadio("Nachfragen", 536, 148, 241, 17)
GUICtrlSetOnEvent($id_RadioAskOverwrite, "_RadioFileExists")
GUICtrlSetResizing($id_RadioAskOverwrite, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState($id_RadioAskOverwrite, $GUI_CHECKED)
; CheckBox Doppelte Dateien finden. Prüft beim kopieren/verschieben ob es die Datei schon gibt.
; Nicht am Dateinamen sondern im 1. Schritt an Größe und im 2. Schritt an Checksumme
$id_CheckboxDoubleFiles = GUICtrlCreateCheckbox("Prüfe auf identische Zieldatei", 784, 100, 209, 17)
GUICtrlSetOnEvent($id_CheckboxDoubleFiles, "_RadioFileExists")
GUICtrlSetState($id_CheckboxDoubleFiles, $GUI_CHECKED)
GUICtrlSetResizing($id_CheckboxDoubleFiles, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip($id_CheckboxDoubleFiles, "Prüft vor jedem Kopieren oder Verschieben ob die Datei" & @CRLF & "schon im Zielverzeichnis vorhanden ist." & @CRLF & "Zunächst werden Dateien gleicher Größe gesucht." & @CRLF & "Diese werden dann Bitweise verglichen")
;~ GUICtrlSetState($id_CheckboxDoubleFiles, $GUI_HIDE)
$id_LabelCountingNumber = GUICtrlCreateLabel("# = laufende Nummer", 784, 124, 146, 20)
GUICtrlSetResizing($id_LabelCountingNumber, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
; Die Gruppe mit den Werkzeugen
$id_GroupTools = GUICtrlCreateGroup(" Werkzeuge ", 528, 624, 473, 76)
GUICtrlSetResizing($id_GroupTools, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
; Und die Buttons selbst - als Array, So kann man durch Ändern der Reihenfolge im Array auch die Reihenfolge in der GUI ändern
For $i = 0 To (UBound($a_id_Tools) - 1) Step 1
$a_id_Tools[$i][1] = GUICtrlCreateButton($a_id_Tools[$i][0], 536 + ($i * 58), 644, 48, 48, $BS_MULTILINE)
GUICtrlSetResizing($a_id_Tools[$i][1], $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($a_id_Tools[$i][1], "_Tools")
Switch $a_id_Tools[$i][0]
Case "Filenames"
GUICtrlSetTip($a_id_Tools[$i][1], "Erstellt eine Textdatei mit gefundenen Dateien des Quellverzeichnisses")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_CopyDocpng = _GDIPlus_BitmapCreateFromMemory(_Resources_CopyDocpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_CopyDocpng))
Case "BKG"
GUICtrlSetTip($a_id_Tools[$i][1], "Ändert die Hintergrundfarbe der Vorschau")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Colorpng = _GDIPlus_BitmapCreateFromMemory(_Resources_Colorpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Colorpng))
Case "Reset"
GUICtrlSetTip($a_id_Tools[$i][1], "Löscht den Quellpfad und alle Zielpfade" & @CRLF & "sowie alle Registry-Einträge des Programmes")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Burnpng = _GDIPlus_BitmapCreateFromMemory(_Resources_Burnpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Burnpng))
Case "DEL"
GUICtrlSetTip($a_id_Tools[$i][1], "Verschiebt das aktuelle Bild in den Papierkorb" & @CRLF & "Taste [Entf]")
_AcceleratorKeyAdd("{DEL}", $a_id_Tools[$i][1])
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_TrashFullpng = _GDIPlus_BitmapCreateFromMemory(_Resources_TrashFullpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_TrashFullpng))
Case "Reload"
GUICtrlSetTip($a_id_Tools[$i][1], "Quellordner neu einlesen")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Refreshpng = _GDIPlus_BitmapCreateFromMemory(_Resources_Refreshpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Refreshpng))
Case "Rename"
GUICtrlSetTip($a_id_Tools[$i][1], "Aktuelles Bild umbenennen")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Editpng = _GDIPlus_BitmapCreateFromMemory(_Resources_Editpng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Editpng))
Case "Hilfe"
GUICtrlSetTip($a_id_Tools[$i][1], "Blendet Hilfe zur Bedienung ein")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Helppng = _GDIPlus_BitmapCreateFromMemory(_Resources_Helppng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Helppng))
Case "Profiles"
GUICtrlSetTip($a_id_Tools[$i][1], "Speichert oder Lädt eine Zielordnerliste" & @CRLF & "[P] schaltet Profile durch")
GUICtrlSetStyle($a_id_Tools[$i][1], $BS_ICON)
$_Resources_Profilespng = _GDIPlus_BitmapCreateFromMemory(_Resources_Profilespng(), True)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($a_id_Tools[$i][1]), $BM_SETIMAGE, $IMAGE_BITMAP, $_Resources_Profilespng))
$id_ProfilesDummy = GUICtrlCreateDummy()
GUICtrlSetOnEvent($id_ProfilesDummy, "_Profiles_Switch2Next")
_AcceleratorKeyAdd("p", $id_ProfilesDummy)
Case Else
; Noch ungenutzt, verstecken
GUICtrlSetState($a_id_Tools[$i][1],$GUI_HIDE)
EndSwitch
Next
; Auch bei den Tools soll man sehen was man gewählt hat, auch wieder die bunten Rahmen vorbereiten
$id_ToolSelected1 = GUICtrlCreateGraphic(535, 643 , 50, 50)
$id_ToolSelected2 = GUICtrlCreateGraphic(534, 642 , 52, 52)
GUICtrlSetColor($id_ToolSelected1, 0xC8C8C8)
GUICtrlSetColor($id_ToolSelected2, 0xC8C8C8)
GUICtrlSetResizing($id_ToolSelected1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetResizing($id_ToolSelected2,$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState($id_ToolSelected1, $GUI_DISABLE)
GUICtrlSetState($id_ToolSelected2, $GUI_DISABLE)
; Und die Gruppe ist fertig
GUICtrlCreateGroup("", -99, -99, 1, 1)
; Ab hier kommen die Navigation-Button unterhalb der Vorschau
; Hervorheben einer Schaltfläche bei Tastendruck oder Klick
$id_ButtonSelected1 = GUICtrlCreateGraphic(4, $i_ButtonPicYfromTop - 1, 52, 27)
$id_ButtonSelected2 = GUICtrlCreateGraphic(3, $i_ButtonPicYfromTop - 2, 54, 29)
GUICtrlSetColor($id_ButtonSelected1, 0xC8C8C8)
GUICtrlSetColor($id_ButtonSelected2, 0xC8C8C8)
GUICtrlSetResizing($id_ButtonSelected1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetResizing($id_ButtonSelected2,$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState($id_ButtonSelected1, $GUI_DISABLE)
GUICtrlSetState($id_ButtonSelected2, $GUI_DISABLE)
; Die Schaltflächen für vor / zurück etc. + das Input
$id_ButtonPicGoToFirst = GUICtrlCreateButton("Start", 5, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicGoToFirst, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicGoToFirst, "_ButtonPics")
_AcceleratorKeyAdd("{HOME}", $id_ButtonPicGoToFirst)
GUICtrlSetTip($id_ButtonPicGoToFirst, "[Pos1] ([Home])" & @CRLF & "Springt zum ersten Bild")
$id_ButtonPicBack100 = GUICtrlCreateButton("-100", 60, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicBack100, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicBack100, "_ButtonPics")
_AcceleratorKeyAdd("{PGUP}", $id_ButtonPicBack100)
GUICtrlSetTip($id_ButtonPicBack100, "[Bild hoch]" & @CRLF & "Springt 100 Bilder zurück")
$id_ButtonPicBack10 = GUICtrlCreateButton("-10", 115, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicBack10, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicBack10, "_ButtonPics")
_AcceleratorKeyAdd("{UP}", $id_ButtonPicBack10)
GUICtrlSetTip($id_ButtonPicBack10, "[Pfeil hoch]" & @CRLF & "Springt 10 Bilder zurück")
$id_ButtonPicBack1 = GUICtrlCreateButton("<", 170, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicBack1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicBack1, "_ButtonPics")
_AcceleratorKeyAdd("{LEFT}", $id_ButtonPicBack1)
GUICtrlSetTip($id_ButtonPicBack1, "[Pfeil links]" & @CRLF & "Springt 1 Bild zurück")
$id_InputPicNumber = GUICtrlCreateInput("0", 225, $i_ButtonPicYfromTop, 75, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont($id_InputPicNumber, $s_FontSizeInputs * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetResizing($id_InputPicNumber, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_InputPicNumber, "_ButtonPics")
$id_ButtonPicForward1 = GUICtrlCreateButton(">", 305, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicForward1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicForward1, "_ButtonPics")
_AcceleratorKeyAdd("{RIGHT}", $id_ButtonPicForward1)
GUICtrlSetTip($id_ButtonPicForward1, "[Pfeil rechts]" & @CRLF & "Springt 1 Bild vor")
$id_ButtonPicForward10 = GUICtrlCreateButton("+10", 360, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicForward10, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicForward10, "_ButtonPics")
_AcceleratorKeyAdd("{DOWN}", $id_ButtonPicForward10)
GUICtrlSetTip($id_ButtonPicForward10, "[Pfeil runter]" & @CRLF & "Springt 10 Bilder vor")
$id_ButtonPicForward100 = GUICtrlCreateButton("+100", 415, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicForward100, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicForward100, "_ButtonPics")
_AcceleratorKeyAdd("{PGDN}", $id_ButtonPicForward100)
GUICtrlSetTip($id_ButtonPicForward100, "[Bild runter]" & @CRLF & "Springt 100 Bilder vor")
$id_ButtonPicGoToLast = GUICtrlCreateButton("Ende", 470, $i_ButtonPicYfromTop, 50, 25)
GUICtrlSetResizing($id_ButtonPicGoToLast, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_ButtonPicGoToLast, "_ButtonPics")
_AcceleratorKeyAdd("{END}", $id_ButtonPicGoToLast)
GUICtrlSetTip($id_ButtonPicGoToLast, "[Ende]" & @CRLF & "Springt zum letzten Bild")
$id_CheckboxPictureFitSize = GUICtrlCreateCheckbox("Größe anpassen", 5, 685, 137, 17)
GUICtrlSetState($id_CheckboxPictureFitSize, $GUI_CHECKED)
GUICtrlSetResizing($id_CheckboxPictureFitSize, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetOnEvent($id_CheckboxPictureFitSize, "_ButtonPics")
; Ab hier die Vorschau. Ich wollte einen schwarzen Rand umzu.
; Label dahinter etc. hat nicht funktioniert. Also diese Version mit Linien aus Labels einmal umzu.
; Könnte auch mit GUICtrlCreateGraphic() gehen, jetzt bleibt das aber so
; oben Horizontal
$id_LabelBehindPicture1 = GUICtrlCreateLabel("", 5, 88, 514, 2)
GUICtrlSetResizing($id_LabelBehindPicture1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP)
GUICtrlSetBkColor($id_LabelBehindPicture1, 0x000000)
GUICtrlSetState($id_LabelBehindPicture1, $GUI_DISABLE)
; links
$id_LabelBehindPicture2 = GUICtrlCreateLabel("", 5, 88, 2, 530)
GUICtrlSetResizing($id_LabelBehindPicture2, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetBkColor($id_LabelBehindPicture2, 0x000000)
GUICtrlSetState($id_LabelBehindPicture2, $GUI_DISABLE)
;rechts
$id_LabelBehindPicture3 = GUICtrlCreateLabel("", 517, 88, 2, 530)
GUICtrlSetResizing($id_LabelBehindPicture3, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetBkColor($id_LabelBehindPicture3, 0x000000)
GUICtrlSetState($id_LabelBehindPicture3, $GUI_DISABLE)
;unten
;~ Global $id_LabelBehindPicture4 = GUICtrlCreateLabel("", 5, 616, 514, 2)
;~ GUICtrlSetResizing($id_LabelBehindPicture4, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
;~ GUICtrlSetBkColor($id_LabelBehindPicture4, 0x000000)
;~ GUICtrlSetState($id_LabelBehindPicture4, $GUI_DISABLE)
; Labelmit dem aktuellen Bildnamen unterhalb der Vorschau:
;~ $id_LabelPictureName = GUICtrlCreateLabel("", 5, 616, 514, 20, BitOR($SS_CENTER,$SS_CENTERIMAGE))
$id_LabelPictureName = GUICtrlCreateLabel("", 5, 616, 514, 20, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetResizing($id_LabelPictureName, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
GUICtrlSetFont($id_LabelPictureName, $s_FontSizeForm * $i_AppliedDPI, 400, 0, $s_FontNameInputs)
GUICtrlSetColor($id_LabelPictureName, 0xDDDDDD)
GUICtrlSetBkColor($id_LabelPictureName, 0x000000)
; Zentrieren - ist leicht anders als -1
$a_FormFotoSortNew_Size = WinGetPos($h_FormFotoSort2017)
$a_FormFotoSortNew_Size[0] = Int((@DesktopWidth - $a_FormFotoSortNew_Size[2]) / 2) ; Falls es 0 wäre - Null darf man teilen (durch 0 nicht)
$a_FormFotoSortNew_Size[1] = Int((@DesktopHeight - $a_FormFotoSortNew_Size[3]) / 2)
WinMove($h_FormFotoSort2017, "", $a_FormFotoSortNew_Size[0], $a_FormFotoSortNew_Size[1], $a_FormFotoSortNew_Size[2], $a_FormFotoSortNew_Size[3])
; GUI anzeigen:
GUISetState(@SW_SHOW, $h_FormFotoSort2017)
; Und die Vorschau erstellen. Die GDIPlus Funktionen scheinen nur bei einer sichtbaren GUI zu funktionieren
$id_Picture = GUICtrlCreatePic("", 7, 90, 510, 526)
GUICtrlSetResizing($id_Picture, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetStyle($id_Picture, "", $WS_EX_TOPMOST)
GUICtrlSetState($id_Picture, $GUI_DROPACCEPTED)
; Leeres Bild "Transparent" als Binary laden
$h_Resources_PicTestBildpngGlobal = _GDIPlus_BitmapCreateFromMemory(_Resources_PicTestBildpng(), True)
$d_Resources_PicTestBildpngGlobal = _Resources_PicTestBildpng()
; und in das Pic-Control setzen
_WinAPI_DeleteObject(GUICtrlSendMsg($id_Picture, $STM_SETIMAGE, $IMAGE_BITMAP, $h_Resources_PicTestBildpngGlobal))
$b_Use_GuiCtrlSetImageEx = False
#EndRegion GUI-FormFotoSort2017
#Region Startup
; ###############################################################################################################################################################################################
; ###### ######## ### ######## ######## ## ## ########
; ## ## ## ## ## ## ## ## ## ## ## ##
; ## ## ## ## ## ## ## ## ## ## ##
; ###### ## ## ## ######## ## ## ## ########
; ## ## ######### ## ## ## ## ## ##
; ## ## ## ## ## ## ## ## ## ## ##
; ###### ## ## ## ## ## ## ####### ##
; ###############################################################################################################################################################################################
; Eigentlich ist alles nun soweit, alles nachfolgende dient zum wiederherstellen der Einstellungen der letzten Sitzung
; sowie um die Funktionen zu registrieren und sonstige Anpassungen
; Das letzte zwischengespeicherte Bild laden. Gibt es den Key nicht so kommt nichts zurück.
; Dank Int() wird auch aus Nichts eine 0 = ein gültiger Wert
$i_CurrentPictureSavedFromregistry = Int(_SettingsRead("$id_InputPicNumber"))
; Program-Icon setzen falls nicht kompiliert
If @Compiled = 0 Then
Local $_Resources_FotoSort2017ico = _GDIPlus_BitmapCreateFromMemory(_Resources_FotoSort2017ico(), False)
_WinAPI_SetWindowTitleIcon($_Resources_FotoSort2017ico, $h_FormFotoSort2017)
EndIf
; Version in den Fenstertitel setzen:
WinSetTitle($h_FormFotoSort2017, "", $s_ProgramTitle & " " & $s_ProgramVersion)
; Die Statusbar ist nicht wie die anderen Controls an den Rändern "angeklebt".
; Wir müssen nach jeder Größenanderung eine Funktion aufrufen welche die Statusbar wieder anpasst
; Inzwischen sort die Funktion auch für die Anpassung der Vorschau und die Anzahl der Zielordner etc.
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
; Wir wollen die Bilder auch mit dem Mausrad durchschalten - die Lösung ist wiederum von Oscar: https://autoit.de/index.php/Thread/83596-MouseWheel-auswerten/
GUIRegisterMsg($WM_MOUSEWHEEL, 'WM_MOUSEWHEEL')
; Da wir nicht mit Tastenkombinationen arbeiten (sondern auch direkt die Zahlen nutzen) müssen
; diese deaktiviert werden sobald das Input mit der Bildnummer oder dem Suffix den Focus erhält
; https://www.autoitscript.com/forum/topic/98963-can-i-set-an-event-click-on-an-input-textbox/
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
; Die GUI soll einen minimale Größe von 1024 x 768 nicht unterschreiten.
; Die Lösung:
; 1. Wir holen uns die Anfangsgröße (sollte 1024 x 768 sein, Bei GUICreate steht die Größe der inneren Nutzfläche)
$a_FormFotoSortNew_Size = WinGetPos($h_FormFotoSort2017)
; 2. Wir setzen die erlaubten minimal und maximal Werte
$i_FormFotoSortNew_SizeMinWidth = $a_FormFotoSortNew_Size[2]
$i_FormFotoSortNew_SizeMinHeight = $a_FormFotoSortNew_Size[3]
; Als maximale Werte nehmen wir die des Desktops
$i_FormFotoSortNew_SizeMaxWidth = @DesktopWidth
$i_FormFotoSortNew_SizeMaxHeight = @DesktopHeight
; 3. Wir registrieren eine Funktion welche dafür sorgt das die Grenzwerte eingehalten werden, diese wird von Windows/AutoIt automatisch aufgerufen
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")
; Funktion Registrieren die reagiert wenn per Drag'n Drop eine Datei auf die GUI gezogen wird
; Reagiert nur wenn die Maustaste über einem dafür vorbereiteten Control losgelassen wird
GUISetOnEvent($GUI_EVENT_DROPPED, "GUI_EVENT_DROPPED", $h_FormFotoSort2017)
;Funktionien für Doppelklick auf das Bild
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, '_PrimaryDown')
; Weitere Einstellungen aus der Registry wiederherstellen:
; Größe der GUI / des Fensters
$a_FormFotoSortNew_Size[2] = _SettingsRead("$a_FormFotoSortNew_Size[2]") ; Gibt es den Wert nicht so kommt 0 zurück
$a_FormFotoSortNew_Size[3] = _SettingsRead("$a_FormFotoSortNew_Size[3]")
$a_FormFotoSortNew_Size[0] = Int((@DesktopWidth - $a_FormFotoSortNew_Size[2]) / 2) ; Falls es 0 wäre - Null darf man teilen (durch 0 nicht)
$a_FormFotoSortNew_Size[1] = Int((@DesktopHeight - $a_FormFotoSortNew_Size[3]) / 2)
If $a_FormFotoSortNew_Size[2] >= $i_FormFotoSortNew_SizeMinWidth And $a_FormFotoSortNew_Size[3] >= $i_FormFotoSortNew_SizeMinHeight Then
; Alle vorgaben wurden eingehalten, neue Größe einstellen
WinMove($h_FormFotoSort2017, "", $a_FormFotoSortNew_Size[0], $a_FormFotoSortNew_Size[1], $a_FormFotoSortNew_Size[2], $a_FormFotoSortNew_Size[3])
EndIf
If _SettingsRead("$b_FormIsMaximized") = "True" Then
; Und falls das Programm maximiert geschlossen wurden, maximieren wir es auch wieder
$b_FormIsMaximized = True
Else
$b_FormIsMaximized = False
EndIf
; Warum erst die Variable setzen und nicht gleich WinSetState() aufrufen? Weil wir einen Platzhalter brauchten um es in den Einstellungen zu speichern!
; Für alles andere gibt es eine Variable, also auch hier.
If $b_FormIsMaximized = True Then
WinSetState($h_FormFotoSort2017, "", @SW_MAXIMIZE)
EndIf
; Optionen bei doppelten Dateinamen wiederherstellen
If Int(_SettingsRead("$id_RadioOverwrite")) <> 0 Then
GUICtrlSetState($id_RadioOverwrite, _SettingsRead("$id_RadioOverwrite"))
GUICtrlSetState($id_RadioAddSuffix, _SettingsRead("$id_RadioAddSuffix"))
GUICtrlSetState($id_RadioAskOverwrite, _SettingsRead("$id_RadioAskOverwrite"))
GUICtrlSetData($id_InputSuffix, _SettingsRead("$id_InputSuffix"))
GUICtrlSetState($id_CheckboxDoubleFiles, _SettingsRead("$id_CheckboxDoubleFiles"))
EndIf
; Profile
$i_ProfileActive = Int(_SettingsRead("$i_ProfileActive"))
$s_ProfileActive = _SettingsRead("$s_ProfileActive")
$a_Profiles[0] = Int(_SettingsRead("$a_Profiles[0]"))
If $s_ProfileActive = "" Or $a_Profiles[0] = 0 Then
ReDim $a_Profiles[2]
$a_Profiles[0] = 1
$a_Profiles[1] = "Standard"
$i_ProfileActive = 1
$s_ProfileActive = "Standard"
Else
ReDim $a_Profiles[ $a_Profiles[0] + 1 ]
For $i = 1 To $a_Profiles[0] Step 1
$a_Profiles[$i] = _SettingsRead("$a_Profiles[" & $i &"]")
Next
EndIf
_GUICtrlStatusBar_SetText($id_StatusBar, $s_ProfileActive , 2)
_GUICtrlStatusBar_SetIcon($id_StatusBar, 2, $h_IconProfiles)
; Zielverzeichnisse
GUICtrlSetData($a_id_TargetDirectories[1][3], _SettingsRead("$a_id_TargetDirectories[1][3]" & "-" & $s_ProfileActive))
For $i = 2 To Int(_SettingsRead("$a_id_TargetDirectories[0][0]" & "-" & $s_ProfileActive)) Step 1 ; gibt es den Wert nicht so ist er 0 - und die Schleife wird nie gestartet
_Folder_Add()
GUICtrlSetData($a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][3], _SettingsRead("$a_id_TargetDirectories[" & $i & "][3]" & "-" & $s_ProfileActive))
Next
; Manchmal - warum auch immer - sitzen nach einem Programmstart und einem WinMove die + und - Schaltflächen nicht richtig. Also Sicherheitshalber noch mal die Korrektur laufen lassen
Local $a_ControlPos = ControlGetPos($h_FormFotoSort2017, "", $a_id_TargetDirectories[ $a_id_TargetDirectories[0][0] ][1])
GUICtrlSetPos($id_ButtonAddTargetDirectory, $a_ControlPos[0], 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
GUICtrlSetPos($id_ButtonRemoveTargetDirectory, $a_ControlPos[0] + 32, 232 + (($a_id_TargetDirectories[0][0] - 1) * $i_Distance))
; Alle Dateiformate anhaken falls es noch keine Voreinstellungen gibt:
If Int(_SettingsRead("$a_id_CheckboxFileformat[0]")) = 0 Then ; Nein, 0 ist kein gültiger Wert für eine Checkbox
; Wir klicken die Checkbox an damit die Funktion startet
; Bei direkten Aufruf wäre @GUI_CtrlId nicht "vorhanden" und die ist an der Stelle wichtig
; Hätte man auch anders lösen können.
ControlClick($h_FormFotoSort2017, "", $a_id_CheckboxFileformat[0])
Else
; Ansonsten Auswahl wieder herstellen
For $z = 0 To (UBound($a_id_CheckboxFileformat) - 1) Step 1
GUICtrlSetState($a_id_CheckboxFileformat[$z], _SettingsRead("$a_id_CheckboxFileformat[" & $z & "]"))
Next
_CheckboxFileformatCreatePattern() ; Suchpattern auf Basis der Auswahl der Checkboxen erstellen
EndIf
; Checkbox Bild anpassen (oder nicht)
If Int(_SettingsRead("$id_CheckboxPictureFitSize")) <> 0 Then
GUICtrlSetState($id_CheckboxPictureFitSize, _SettingsRead("$id_CheckboxPictureFitSize"))
EndIf
; Hintergrundfarbe
If Int(_SettingsRead("$d_BackgroundColor_ARGB")) <> 0 Then
$d_BackgroundColor_ARGB = _SettingsRead("$d_BackgroundColor_ARGB")
EndIf
; Quellverzeichnis
GUICtrlSetData($id_InputSourceDirectory, _SettingsRead("$id_InputSourceDirectory"))
If _SettingsRead("$_b_ScanFolderRecursive") = "True" Then
GUICtrlSetState($id_CheckboxScanFolderRecursive, $GUI_CHECKED)
Else
GUICtrlSetState($id_CheckboxScanFolderRecursive, $GUI_UNCHECKED)
EndIf
; Jetzt haben wir alles - die Dateien aus dem zuletzt genutzen Pfad auslesen
_ReadFileList()
; Das zuletzt angezeigte Bild anzeigen (sofern möglich)
_SelectCurrentPicture($i_CurrentPictureSavedFromregistry)
; Tastendrücke aktivieren
GUISetAccelerators($a_AcceleratorKeys, $h_FormFotoSort2017)
; Und einmal Prüfen welche Buttons angezeigt werden dürfen (Ist nur notwendig wenn mit leeren Bild gestartet wird - schadet aber auch nicht
_ButtonPicsCheckEnableDisable()
#EndRegion Startup
#Region Main
; ###############################################################################################################################################################################################
; ## ## ### ## ## ######## ######## ###### ###### ## ## ## ######## #### ######## ########
; ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
; ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
; ######### ## ## ## ## ######## ## ###### ## ######### ## ###### ## ###### ######
; ## ## ######### ## ## ## ## ## ## ## ## ## ## ## ## ##
; ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
; ## ## ## ## ####### ## ## ###### ###### ## ## ######## ######## #### ## ########
; ###############################################################################################################################################################################################
While 1
Sleep(100)
If _IsPressed("04") = True Then ; Check ob die mittlere Maustaste gedrückt wurde (zum Profilwechsel)
_Profiles_Switch2Next()
Sleep(250)
EndIf
WEnd
#EndRegion Main