diff --git a/PBGitTheme.zip b/PBGitTheme_old.zip similarity index 100% rename from PBGitTheme.zip rename to PBGitTheme_old.zip diff --git a/PBIDE-GitTool.pb b/PBIDE-GitTool.pb index d8a94c5..cd14842 100644 --- a/PBIDE-GitTool.pb +++ b/PBIDE-GitTool.pb @@ -34,6 +34,13 @@ CompilerElse #GitExe$ = "git" CompilerEndIf +; ===== Language constants / Constantes de langue ===== +#LangEnglish = 0 +#LangFrench = 1 + +Global gLanguage.i = #LangFrench ; default FR → overridden at runtime / FR par défaut → surchargé au runtime + + ; ============================================================================= ; UI IDENTIFIERS / IDENTIFIANTS UI ; ============================================================================= @@ -65,6 +72,8 @@ CompilerEndIf #GConfig = 34 #GGuide = 35 #GRestoreFile = 36 +#GRenameFile = 37 ; Bouton pour renommer un fichier +#GDeleteFile = 38 ; Bouton pour supprimer un fichier avec git rm ; Display options / Options d'affichage #GShowClean = 39 ; Show tracked files that are up to date / Afficher les fichiers suivis à jour @@ -211,6 +220,10 @@ Declare.i OpenAdvancedWindow(repoDir$) Declare.i OpenDiffWindow(repoDir$, List rows.FileRow()) Declare.i OpenRestoreFileWindow(repoDir$, List rows.FileRow()) Declare.i RestoreFileFromCommit(repoDir$, file$, commit$) +Declare.i DoRenameFile(repoDir$, oldFile$, newFile$) +Declare.i DoDeleteFile(repoDir$, file$) + + ; Configuration and setup / Configuration et installation Declare.i ConfigIdentityWizard(repoDir$) @@ -219,7 +232,13 @@ Declare.i InstallPBGitInIDE(ideExe$, toolsPrefs$, themeZip$) Declare.i OpenInstallWizard() ; Helper functions / Fonctions d'aide +; --- Localization / Localisation --- +Declare.i InitLanguage() +Declare.s Tr(fr$, en$) +Declare.i LocalizeGUI() + Declare.s PorcelainToLabel(code$) + Declare.s GetLocalConfig(repoDir$, key$) Declare.i IsGitRepo(dir$) Declare.i UpdateGuide(repoDir$, List rows.FileRow(), branch$, remote$) @@ -240,6 +259,57 @@ Declare.i RemovePermanentExclude(repoDir$, file$) ; UTILITY FUNCTIONS / FONCTIONS UTILITAIRES ; ============================================================================= +; Detect IDE language first (PB_TOOL_Language), then OS env vars. +; Détecte d'abord la langue de l'IDE (PB_TOOL_Language), puis des variables d'environnement OS. +Procedure.i InitLanguage() + Protected val$, lc$, got.i = -1 + + ; 1) IDE language (PureBasic exposes PB_TOOL_Language to external tools) + val$ = GetEnvironmentVariable("PB_TOOL_Language") + lc$ = LCase(val$) + If lc$ <> "" + If Left(lc$, 2) = "fr" Or FindString(lc$, "fran", 1) + got = #LangFrench + ElseIf Left(lc$, 2) = "en" Or FindString(lc$, "engl", 1) Or FindString(lc$, "angl", 1) + got = #LangEnglish + EndIf + EndIf + + ; 2) OS locale fallback + If got < 0 + val$ = GetEnvironmentVariable("LANGUAGE") + If val$ = "" : val$ = GetEnvironmentVariable("LANG") : EndIf + If val$ = "" : val$ = GetEnvironmentVariable("LC_ALL") : EndIf + If val$ = "" : val$ = GetEnvironmentVariable("LC_MESSAGES") : EndIf + lc$ = LCase(val$) + If lc$ <> "" + If Left(lc$, 2) = "fr" + got = #LangFrench + ElseIf Left(lc$, 2) = "en" + got = #LangEnglish + EndIf + EndIf + EndIf + + If got < 0 : got = #LangFrench : EndIf ; default FR if nothing else / FR par défaut + + gLanguage = got + If #EnableDebug + Debug "[Lang] PB_TOOL_Language=" + GetEnvironmentVariable("PB_TOOL_Language") + " -> gLanguage=" + Str(gLanguage) + EndIf + ProcedureReturn gLanguage +EndProcedure + +; Tiny translator helper: pass both texts, it returns the one matching gLanguage. +; Petit helper de traduction : passe FR et EN, renvoie selon gLanguage. +Procedure.s Tr(fr$, en$) + If gLanguage = #LangFrench + ProcedureReturn fr$ + EndIf + ProcedureReturn en$ +EndProcedure + + ; Convert path for Git (Windows compatible) ; Convertit le chemin pour Git (compatible Windows) ; - Replace "\" with "/" @@ -1020,6 +1090,63 @@ Procedure.i DoPull(repoDir$, remote$, branch$) ProcedureReturn 0 EndProcedure +Procedure.i DoRenameFile(repoDir$, oldFile$, newFile$) + Protected gc.GitCall, q$ = Chr(34) + Protected oldPath$ = GitPath(oldFile$) + Protected newPath$ = GitPath(newFile$) + + If oldPath$ = "" Or newPath$ = "" + MessageRequester("Renommer", "Les noms de fichier ne peuvent pas être vides.", #PB_MessageRequester_Error) + ProcedureReturn 0 + EndIf + + gc\workdir = repoDir$ + gc\args = "mv " + q$ + oldPath$ + q$ + " " + q$ + newPath$ + q$ + + If RunGit(@gc) = 0 + MessageRequester("Renommer", "Fichier renommé avec succès.", #PB_MessageRequester_Info) + ProcedureReturn 1 + Else + MessageRequester("Renommer", "Échec du renommage : " + #LF$ + TrimNewlines(gc\errors), #PB_MessageRequester_Error) + ProcedureReturn 0 + EndIf +EndProcedure + +; Supprime un fichier avec git rm +Procedure.i DoDeleteFile(repoDir$, file$) + Protected gc.GitCall, q$ = Chr(34) + Protected path$ = GitPath(file$) + + If path$ = "" + MessageRequester("Supprimer", "Le nom du fichier ne peut pas être vide.", #PB_MessageRequester_Error) + ProcedureReturn 0 + EndIf + + ; Vérifie que le fichier existe dans le dépôt + If RepoFileExists(repoDir$, path$) = 0 + MessageRequester("Supprimer", "Le fichier n'existe pas dans le dépôt : " + path$, #PB_MessageRequester_Error) + ProcedureReturn 0 + EndIf + + ; Confirme la suppression + If MessageRequester("Supprimer", "Voulez-vous vraiment supprimer ce fichier ?" + #LF$ + path$, #PB_MessageRequester_YesNo) = #PB_MessageRequester_No + ProcedureReturn 0 + EndIf + + ; Exécute git rm + gc\workdir = repoDir$ + gc\args = "rm -- " + q$ + path$ + q$ + + If RunGit(@gc) = 0 + MessageRequester("Supprimer", "Fichier supprimé avec succès.", #PB_MessageRequester_Info) + ProcedureReturn 1 + Else + MessageRequester("Supprimer", "Échec de la suppression : " + #LF$ + TrimNewlines(gc\errors), #PB_MessageRequester_Error) + ProcedureReturn 0 + EndIf +EndProcedure + + ; ============================================================================= ; DIFF WINDOW / FENÊTRE DIFF ; ============================================================================= @@ -1363,6 +1490,9 @@ EndProcedure ; STATUS LABEL CONVERSION / CONVERSION DES LABELS DE STATUT ; ============================================================================= +; Convert Git porcelain status codes to readable labels +; Convertit les codes de statut porcelain Git en labels lisibles + ; Convert Git porcelain status codes to readable labels ; Convertit les codes de statut porcelain Git en labels lisibles Procedure.s PorcelainToLabel(code$) @@ -1386,18 +1516,22 @@ Procedure.s PorcelainToLabel(code$) ProcedureReturn "Ignoré (.gitignore)" EndIf + ; Deleted files / Fichiers supprimés + If x$ = "D" Or y$ = "D" + ProcedureReturn "Supprimé" + EndIf + ; Index status (X column) / Statut de l'index (colonne X) If x$ = "M" : ProcedureReturn "Modifié (indexé)" : EndIf If x$ = "A" : ProcedureReturn "Ajouté (indexé)" : EndIf - If x$ = "D" : ProcedureReturn "Supprimé (indexé)" : EndIf If x$ = "R" : ProcedureReturn "Renommé (indexé)" : EndIf If x$ = "C" : ProcedureReturn "Copié (indexé)" : EndIf ; Working tree status (Y column) / Statut du répertoire de travail (colonne Y) If y$ = "M" : ProcedureReturn "Modifié (non indexé)" : EndIf If y$ = "A" : ProcedureReturn "Ajouté (non indexé)" : EndIf - If y$ = "D" : ProcedureReturn "Supprimé (non indexé)" : EndIf + ; Default for other cases / Par défaut pour les autres cas ProcedureReturn "Changement" EndProcedure @@ -1688,6 +1822,10 @@ Procedure.i OpenRestoreFileWindow(repoDir$, List rows.FileRow()) ProcedureReturn 0 EndProcedure +; Renomme un fichier avec git mv + + + ; ============================================================================= ; GUIDE PANEL / PANNEAU GUIDE ; ============================================================================= @@ -1913,6 +2051,10 @@ EndProcedure ; SORTING BY INTEREST / TRI PAR INTÉRÊT ; ============================================================================= +; Sort rows() list by "interest" (see order above) then by path +; Trie la liste rows() par "intérêt" (cf. ordre ci-dessus) puis par chemin +; Uses buckets then reassembles. No underscore, no IIf. +; Utilise des seaux (buckets) puis recolle le tout. Pas de underscore, pas de IIf. ; Sort rows() list by "interest" (see order above) then by path ; Trie la liste rows() par "intérêt" (cf. ordre ci-dessus) puis par chemin ; Uses buckets then reassembles. No underscore, no IIf. @@ -1931,7 +2073,8 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) NewList b4.FileRow() ; OK NewList b5.FileRow() ; Ignored (!!) / Ignorés (!!) NewList b6.FileRow() ; Permanently excluded (EX) / Exclus permanents (EX) - NewList b7.FileRow() ; Not found (NF) / Introuvables (NF) + NewList b7.FileRow() ; Deleted (D) / Supprimés (D) + NewList b8.FileRow() ; Not found (NF) / Introuvables (NF) ; Helper: push a FileRow into a bucket / Helper: pousse un FileRow dans un seau Macro PushTo(bucket) @@ -1957,8 +2100,10 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) cat = 5 ; Ignored / Ignorés ElseIf rows()\stat = "EX" cat = 6 ; Permanently excluded / Exclus permanents + ElseIf x$ = "D" Or y$ = "D" + cat = 7 ; Deleted / Supprimés ElseIf rows()\stat = "NF" - cat = 7 ; Not found / Introuvables + cat = 8 ; Not found / Introuvables Else ; Other porcelain XY codes / Autres codes porcelain XY If x$ <> " " @@ -1979,7 +2124,8 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) Case 4 : PushTo(b4) Case 5 : PushTo(b5) Case 6 : PushTo(b6) - Default: PushTo(b7) + Case 7 : PushTo(b7) + Default: PushTo(b8) EndSelect Next @@ -1992,6 +2138,7 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) SortStructuredList(b5(), #PB_Sort_Ascending, OffsetOf(FileRow\file), #PB_String) SortStructuredList(b6(), #PB_Sort_Ascending, OffsetOf(FileRow\file), #PB_String) SortStructuredList(b7(), #PB_Sort_Ascending, OffsetOf(FileRow\file), #PB_String) + SortStructuredList(b8(), #PB_Sort_Ascending, OffsetOf(FileRow\file), #PB_String) ; 3) Recomposition of rows() in bucket order / Recomposition de rows() dans l'ordre des seaux ClearList(rows()) @@ -2006,14 +2153,15 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) Next EndMacro - AppendBucket(b0) - AppendBucket(b1) - AppendBucket(b2) - AppendBucket(b3) - AppendBucket(b4) - AppendBucket(b5) - AppendBucket(b6) - AppendBucket(b7) + AppendBucket(b0) ; Conflicts / Conflits + AppendBucket(b1) ; Indexed changes / Changements indexés + AppendBucket(b2) ; Non-indexed changes / Changements non indexés + AppendBucket(b3) ; New files / Nouveaux fichiers + AppendBucket(b4) ; OK + AppendBucket(b5) ; Ignored / Ignorés + AppendBucket(b6) ; Permanently excluded / Exclus permanents + AppendBucket(b7) ; Deleted / Supprimés + AppendBucket(b8) ; Not found / Introuvables If #EnableDebug Debug "[SortRows] total=" + Str(ProcedureReturnValue) @@ -2022,6 +2170,62 @@ Procedure.i SortRowsByInterest(List rows.FileRow()) ProcedureReturn ProcedureReturnValue EndProcedure +; Apply English labels/tooltips to main window when needed. +; Applique les libellés/bulles en anglais sur la fenêtre principale si nécessaire. +Procedure.i LocalizeGUI() + If gLanguage = #LangFrench + ProcedureReturn 1 ; Nothing to change / Rien à changer + EndIf + + ; Window title + SetWindowTitle(#GWindow, "PBIDE-GitTool — Git (simple mode)") + + ; Header + SetGadgetText(#GLabelRepo, "Repository:") + SetGadgetText(#GButtonBrowse, "Browse…") + + ; Options + SetGadgetText(#GShowClean, "Show tracked up-to-date") + SetGadgetText(#GShowIgnored, "Show ignored (.gitignore)") + SetGadgetText(#GShowPermanent, "Show permanently excluded") + GadgetToolTip(#GShowIgnored, "Show files ignored by rules (.gitignore, global exclude) — status '!!'.") + GadgetToolTip(#GShowPermanent, "Show files excluded via the tool (.git/info/exclude) — status 'EX'.") + + ; List columns + SetGadgetItemText(#GListStatus, -1, "Status", 0) + SetGadgetItemText(#GListStatus, -1, "File", 1) + + ; Action strip + SetGadgetText(#GRefresh, "Refresh") + SetGadgetText(#GInit, "Init repo") + SetGadgetText(#GExcludeForever, "Exclude (permanent)") + SetGadgetText(#GReincludeForever, "Re-include (permanent)") + SetGadgetText(#GDiff, "Diff…") + SetGadgetText(#GRestoreFile, "Restore…") + SetGadgetText(#GRenameFile, "Rename…") + GadgetToolTip(#GRenameFile, "Rename the selected file with git mv.") + + ; Msg/remote/branch + SetGadgetText(#GLabelMsg, "Message:") + SetGadgetText(#GLabelRemote, "Remote:") + SetGadgetText(#GLabelBranch, "Branch:") + SetGadgetText(#GSavePrefs, "Defaults") + SetGadgetText(#GAddBranch, "Add branch…") + SetGadgetText(#GReloadBranches, "Reload branches") + + ; Main actions + SetGadgetText(#GCommit, "Add + Commit (checked)") + SetGadgetText(#GAdvanced, "Advanced…") + SetGadgetText(#GConfig, "Configure identity…") + GadgetToolTip(#GCommit, "Commits ONLY checked lines.") + GadgetToolTip(#GPush, "Push local commits to the remote (manual).") + GadgetToolTip(#GRestoreFile, "Restore the selected file to a specific commit.") + GadgetToolTip(#GDiff, "Show diff for the selected file.") + + ProcedureReturn 1 +EndProcedure + + ; ============================================================================= ; MAIN GUI / INTERFACE PRINCIPALE ; ============================================================================= @@ -2034,6 +2238,8 @@ EndProcedure ; - Push manuel, guide scrollable ; - Prefs dépôt correctement rechargées & auto-sauvegardées ; - Tri par intérêt avant affichage +; Open main interface / Ouvre l'interface principale + Procedure.i OpenGUI(initialDir$, prefsPath$) Protected repoDir$ = DetectRepoRoot(initialDir$) @@ -2055,64 +2261,84 @@ Procedure.i OpenGUI(initialDir$, prefsPath$) ; Automatically ignore our local prefs / Ignorer automatiquement notre prefs locale EnsureToolFilesExcluded(repoDir$) - If OpenWindow(#GWindow, 0, 0, 920, 720, "PBIDE-GitTool — Git (mode simplifié)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) + If OpenWindow(#GWindow, 0, 0, 950, 800, "PBIDE-GitTool — Git (mode simplifié)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) - ; --- Repository header / En-tête dépôt --- - TextGadget(#GLabelRepo, 10, 12, 60, 22, "Dépôt :") - StringGadget(#GStringRepo, 80, 10, 740, 24, repoDir$) - ButtonGadget(#GButtonBrowse, 830, 10, 80, 24, "Parcourir…") - - ; --- Display options / Options d'affichage --- - CheckBoxGadget(#GShowClean, 10, 40, 220, 20, "Afficher suivis à jour") + ; --- SECTION 1: Configuration du dépôt (10-45) --- + TextGadget(#GLabelRepo, 15, 15, 60, 22, "Dépôt :") + StringGadget(#GStringRepo, 80, 13, 750, 26, repoDir$) + ButtonGadget(#GButtonBrowse, 840, 13, 95, 26, "Parcourir…") + + ; --- SECTION 2: Actions de base sur le dépôt (50-85) --- + ButtonGadget(#GRefresh, 15, 50, 95, 30, "Rafraîchir") + ButtonGadget(#GInit, 120, 50, 95, 30, "Init repo") + + ; --- SECTION 3: Options d'affichage (55-85) --- + ; Regroupement logique des options sur une seule ligne avec plus d'espace + CheckBoxGadget(#GShowClean, 240, 55, 200, 22, "Afficher suivis à jour") SetGadgetState(#GShowClean, #True) - CheckBoxGadget(#GShowIgnored, 240, 40, 240, 20, "Afficher ignorés (.gitignore)") + + CheckBoxGadget(#GShowIgnored, 450, 55, 220, 22, "Afficher ignorés (.gitignore)") SetGadgetState(#GShowIgnored, #False) - CheckBoxGadget(#GShowPermanent, 490, 40, 240, 20, "Afficher exclus permanents") - SetGadgetState(#GShowPermanent, #True) - GadgetToolTip(#GShowIgnored, "Montre les fichiers ignorés par règles (.gitignore, exclude global) — statut '!!'.") + + CheckBoxGadget(#GShowPermanent, 680, 55, 220, 22, "Afficher exclus permanents") + SetGadgetState(#GShowPermanent, #True) GadgetToolTip(#GShowPermanent, "Montre les fichiers exclus via l'outil (.git/info/exclude) — statut 'EX'.") - - ; --- File list / Liste des fichiers --- - ListIconGadget(#GListStatus, 10, 66, 900, 320, "État", 240, #PB_ListIcon_CheckBoxes | #PB_ListIcon_FullRowSelect) - AddGadgetColumn(#GListStatus, 1, "Fichier", 640) - - ; --- List action buttons / Bande d'actions sur la liste --- - ButtonGadget(#GRefresh, 10, 392, 100, 26, "Rafraîchir") - ButtonGadget(#GInit, 120, 392, 100, 26, "Init repo") - ButtonGadget(#GExcludeForever, 230, 392, 150, 26, "Exclure (permanent)") - ButtonGadget(#GReincludeForever, 390, 392, 170, 26, "Ré-inclure (permanent)") - ButtonGadget(#GDiff, 570, 392, 90, 26, "Diff…") - ButtonGadget(#GRestoreFile, 670, 392, 130, 26, "Restaurer…") - - ; --- Message / remote / branch area / Zone message / remote / branche --- - TextGadget(#GLabelMsg, 10, 428, 100, 22, "Message :") - StringGadget(#GStringMsg, 110, 426, 620, 24, "") - - TextGadget(#GLabelRemote, 10, 456, 60, 22, "Remote :") - StringGadget(#GStringRemote, 70, 454, 210, 24, rp\remote) - - TextGadget(#GLabelBranch, 290, 456, 60, 22, "Branche :") - ComboBoxGadget(#GComboBranch, 350, 454, 210, 24) - - ButtonGadget(#GSavePrefs, 570, 454, 90, 24, "Défauts") - ButtonGadget(#GAddBranch, 670, 454, 110, 24, "Ajouter br.…") - ButtonGadget(#GReloadBranches, 790, 454, 120, 24, "Actualiser br.") - - ; --- Main actions / Actions principales --- - ButtonGadget(#GCommit, 10, 490, 160, 30, "Add + Commit (cochés)") - ButtonGadget(#GPush, 180, 490, 120, 30, "Push") - ButtonGadget(#GPull, 310, 490, 120, 30, "Pull") - ButtonGadget(#GAdvanced, 440, 490, 120, 30, "Avancé…") - ButtonGadget(#GConfig, 570, 490, 170, 30, "Configurer identité…") - - GadgetToolTip(#GCommit, "Valide SEULEMENT les lignes cochées.") - GadgetToolTip(#GPush, "Pousse les commits locaux vers le dépôt distant (manuel).") - GadgetToolTip(#GRestoreFile, "Restaurer le fichier sélectionné à un commit précis.") + + ; --- SECTION 4: Liste des fichiers (90-425) --- + ListIconGadget(#GListStatus, 15, 90, 920, 335, "État", 120, #PB_ListIcon_CheckBoxes | #PB_ListIcon_FullRowSelect) + AddGadgetColumn(#GListStatus, 1, "Fichier", 780) + + ; --- SECTION 5: Actions sur les fichiers (435-475) --- + ; Première ligne d'actions + ButtonGadget(#GDiff, 15, 435, 90, 30, "Diff…") GadgetToolTip(#GDiff, "Afficher les différences du fichier sélectionné.") - - ; --- Guide (scrollable read-only) / Guide (scrollable en lecture seule) --- - EditorGadget(#GGuide, 10, 530, 900, 170) + + ButtonGadget(#GRestoreFile, 115, 435, 110, 30, "Restaurer…") + GadgetToolTip(#GRestoreFile, "Restaurer le fichier sélectionné à un commit précis.") + + ButtonGadget(#GRenameFile, 235, 435, 100, 30, "Renommer…") + GadgetToolTip(#GRenameFile, "Renommer le fichier sélectionné avec git mv.") + + ButtonGadget(#GDeleteFile, 345, 435, 100, 30, "Supprimer") + GadgetToolTip(#GDeleteFile, "Supprimer le fichier sélectionné avec git rm.") + + ; Deuxième ligne d'actions (séparée pour éviter l'encombrement) + ButtonGadget(#GExcludeForever, 15, 475, 140, 30, "Exclure (permanent)") + ButtonGadget(#GReincludeForever, 165, 475, 150, 30, "Ré-inclure (permanent)") + + ; --- SECTION 6: Configuration commit/remote/branche (515-585) --- + ; Message de commit + TextGadget(#GLabelMsg, 15, 520, 80, 22, "Message :") + StringGadget(#GStringMsg, 100, 518, 835, 26, "") + + ; Remote et branche sur une ligne séparée + TextGadget(#GLabelRemote, 15, 555, 60, 22, "Remote :") + StringGadget(#GStringRemote, 80, 553, 200, 26, "origin") ; Valeur par défaut + + TextGadget(#GLabelBranch, 290, 555, 60, 22, "Branche :") + ComboBoxGadget(#GComboBranch, 355, 553, 180, 26) + + ; Boutons de gestion des branches + ButtonGadget(#GSavePrefs, 545, 553, 85, 26, "Défauts") + ButtonGadget(#GAddBranch, 640, 553, 110, 26, "Ajouter br.…") + ButtonGadget(#GReloadBranches, 760, 553, 120, 26, "Actualiser br.") + + ; --- SECTION 7: Actions principales Git (595-640) --- + ButtonGadget(#GCommit, 15, 595, 180, 35, "Add + Commit (cochés)") + GadgetToolTip(#GCommit, "Valide SEULEMENT les lignes cochées.") + + ButtonGadget(#GPush, 205, 595, 120, 35, "Push") + GadgetToolTip(#GPush, "Pousse les commits locaux vers le dépôt distant (manuel).") + + ButtonGadget(#GPull, 335, 595, 120, 35, "Pull") + + ButtonGadget(#GAdvanced, 465, 595, 120, 35, "Avancé…") + + ButtonGadget(#GConfig, 595, 595, 160, 35, "Configurer identité…") + + ; --- SECTION 8: Guide utilisateur (650-790) --- + EditorGadget(#GGuide, 15, 650, 920, 140) SetGadgetAttribute(#GGuide, #PB_Editor_ReadOnly, 1) ; --- Local branches / Branches locales --- @@ -2259,7 +2485,52 @@ Procedure.i OpenGUI(initialDir$, prefsPath$) RestoreSel() UpdateGuide(repoDir$, rows(), GetGadgetText(#GComboBranch), GetGadgetText(#GStringRemote)) EndIf + + Case #GRenameFile + idx.i = GetGadgetState(#GListStatus) + If idx >= 0 + Protected oldFile$ = GetGadgetItemText(#GListStatus, idx, 1) + Protected newFile$ = InputRequester("Renommer", "Nouveau nom pour " + oldFile$ + " :", oldFile$) + If newFile$ <> "" And newFile$ <> oldFile$ + If DoRenameFile(repoDir$, oldFile$, newFile$) + RememberSel() + ClearList(rows()) + BuildFullFileList(repoDir$, GetGadgetState(#GShowClean), GetGadgetState(#GShowIgnored), rows()) + If GetGadgetState(#GShowPermanent) = 0 + ForEach rows() : If rows()\stat = "EX" : DeleteElement(rows()) : EndIf : Next + EndIf + SortRowsByInterest(rows()) + FillStatusList(rows()) + RestoreSel() + UpdateGuide(repoDir$, rows(), GetGadgetText(#GComboBranch), GetGadgetText(#GStringRemote)) + EndIf + EndIf + Else + MessageRequester("Renommer", "Sélectionnez d'abord un fichier dans la liste.", #PB_MessageRequester_Info) + EndIf + Case #GDeleteFile + idx.i = GetGadgetState(#GListStatus) + If idx >= 0 + Protected file$ = GetGadgetItemText(#GListStatus, idx, 1) + If DoDeleteFile(repoDir$, file$) + ; Rafraîchir la liste après suppression + RememberSel() + ClearList(rows()) + BuildFullFileList(repoDir$, GetGadgetState(#GShowClean), GetGadgetState(#GShowIgnored), rows()) + If GetGadgetState(#GShowPermanent) = 0 + ForEach rows() : If rows()\stat = "EX" : DeleteElement(rows()) : EndIf : Next + EndIf + SortRowsByInterest(rows()) + FillStatusList(rows()) + RestoreSel() + UpdateGuide(repoDir$, rows(), GetGadgetText(#GComboBranch), GetGadgetText(#GStringRemote)) + EndIf + Else + MessageRequester("Supprimer", "Sélectionnez d'abord un fichier dans la liste.", #PB_MessageRequester_Info) + EndIf + + ; ---- Branches: update / add / Branches : maj / ajout ---- Case #GReloadBranches ClearList(branchItems()) @@ -2577,8 +2848,8 @@ EndIf ; END OF FILE / FIN DU FICHIER ; ============================================================================= ; IDE Options = PureBasic 6.21 (Windows - x64) -; CursorPosition = 422 -; FirstLine = 418 +; CursorPosition = 2342 +; FirstLine = 2317 ; Folding = ----------- ; EnableXP ; DPIAware diff --git a/git_icons_pack/git_icons_pack/dark/git_add_24.png b/git_icons_pack/git_icons_pack/dark/git_add_24bis.png similarity index 100% rename from git_icons_pack/git_icons_pack/dark/git_add_24.png rename to git_icons_pack/git_icons_pack/dark/git_add_24bis.png