- Picker : recherche instantanée, aperçu, navigation clavier complète, raccourcis actifs seulement dans sa fenêtre (HotIfWinActive) - Gestionnaire : arbre des catégories, favoris/récents/erreurs, aperçu, création depuis le presse-papiers, suppression par la corbeille - Éditeur : métadonnées, insertion/déclaration de variables synchronisées, validation en direct, Tester (prévisualisation résolue, sans injection) - VarForm : un contrôle par type de variable, requis validés, Échap annule toute l'injection et rend le focus
90 lines
3.7 KiB
AutoHotkey
90 lines
3.7 KiB
AutoHotkey
; SettingsGui.ahk — Fenêtre des paramètres (architecture §17.1).
|
|
; Les champs essentiels ; le reste vit dans config.ini, ouvrable d'un clic.
|
|
|
|
class SettingsGui {
|
|
GuiObj := ""
|
|
F := Map()
|
|
|
|
Show() {
|
|
if (this.GuiObj != "")
|
|
this.GuiObj.Destroy()
|
|
st := App.Settings
|
|
g := Gui("-MaximizeBox", "PromptKey — Paramètres")
|
|
g.SetFont("s10", "Segoe UI")
|
|
this.GuiObj := g
|
|
F := this.F
|
|
|
|
g.Add("Text", "xm w190", "Dossier de la bibliothèque :")
|
|
F["library"] := g.Add("Edit", "x+5 w420", st.LibraryPath)
|
|
btnBrowse := g.Add("Button", "x+5 w90", "Parcourir…")
|
|
btnBrowse.OnEvent("Click", (*) => this.BrowseLibrary())
|
|
g.Add("Text", "xm w190", "Raccourci du Picker :")
|
|
F["pickerHk"] := g.Add("Edit", "x+5 w200", st.PickerHotkey)
|
|
g.Add("Text", "xm w190", "Raccourci du Gestionnaire :")
|
|
F["managerHk"] := g.Add("Edit", "x+5 w200", st.ManagerHotkey)
|
|
g.Add("Text", "xm w190", "Méthode d'injection :")
|
|
F["method"] := g.Add("ComboBox", "x+5 w200", ["clipboard", "sendtext"])
|
|
F["method"].Text := st.Method
|
|
g.Add("Text", "xm w190", "Délai après collage (ms) :")
|
|
F["pasteDelay"] := g.Add("Edit", "x+5 w100 Number", st.PasteDelayMs)
|
|
g.Add("Text", "xm w190", "Délai de restauration (ms) :")
|
|
F["restoreDelay"] := g.Add("Edit", "x+5 w100 Number", st.RestoreDelayMs)
|
|
g.Add("Text", "xm w190", "Délai d'envoi auto (ms) :")
|
|
F["sendDelay"] := g.Add("Edit", "x+5 w100 Number", st.SendAfterDelayMs)
|
|
g.Add("Text", "xm w190", "Éditeur externe (optionnel) :")
|
|
F["editor"] := g.Add("Edit", "x+5 w420", st.ExternalEditor)
|
|
|
|
g.Add("Text", "xm", "Profils de destination : " Join(App.Settings.ProfileNames(), ", "))
|
|
conflicts := App.Hotkeys.Conflicts
|
|
g.Add("Text", "xm w620", "Raccourcis en conflit : " (conflicts.Length ? "" : "aucun"))
|
|
if (conflicts.Length) {
|
|
txt := ""
|
|
for c in conflicts
|
|
txt .= "• " c "`r`n"
|
|
g.Add("Edit", "xm w620 r4 ReadOnly", txt)
|
|
}
|
|
|
|
btnSave := g.Add("Button", "xm w160 Default", "Enregistrer")
|
|
btnSave.OnEvent("Click", (*) => this.Save())
|
|
btnIni := g.Add("Button", "x+10 w180", "Ouvrir config.ini")
|
|
btnIni.OnEvent("Click", (*) => Run(App.Settings.Path))
|
|
btnStats := g.Add("Button", "x+10 w200", "Réinitialiser les statistiques")
|
|
btnStats.OnEvent("Click", (*) => this.ResetStats())
|
|
g.OnEvent("Close", (*) => g.Hide())
|
|
g.OnEvent("Escape", (*) => g.Hide())
|
|
g.Show()
|
|
}
|
|
|
|
BrowseLibrary() {
|
|
dir := DirSelect("*" App.Settings.LibraryPath, 3, "Choisir le dossier de la bibliothèque")
|
|
if (dir != "")
|
|
this.F["library"].Value := dir
|
|
}
|
|
|
|
Save() {
|
|
st := App.Settings
|
|
F := this.F
|
|
st.LibraryPath := Trim(F["library"].Value)
|
|
st.PickerHotkey := Trim(F["pickerHk"].Value)
|
|
st.ManagerHotkey := Trim(F["managerHk"].Value)
|
|
st.Method := F["method"].Text
|
|
st.PasteDelayMs := Integer(F["pasteDelay"].Value)
|
|
st.RestoreDelayMs := Integer(F["restoreDelay"].Value)
|
|
st.SendAfterDelayMs := Integer(F["sendDelay"].Value)
|
|
st.ExternalEditor := Trim(F["editor"].Value)
|
|
st.Save()
|
|
DirCreate(st.LibraryPath)
|
|
App.Store.LibraryPath := st.LibraryPath
|
|
App.Store.Load()
|
|
App.RefreshAfterLibraryChange()
|
|
TrayTip("Paramètres enregistrés.", "PromptKey")
|
|
this.GuiObj.Hide()
|
|
}
|
|
|
|
ResetStats() {
|
|
r := MsgBox("Réinitialiser les compteurs d'utilisation ?", "PromptKey", "YesNo")
|
|
if (r = "Yes" && App.Usage)
|
|
App.Usage.Reset()
|
|
}
|
|
}
|