From 0282763790b0a19bbc99b6f62801e25f0b9d01d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 13 Sep 2016 02:17:30 +0000 Subject: [PATCH] [GB.FORM] * NEW: DirChooser,FileChooser: Add a "delete directory" menu that can delete void directories only. * BUG: DirView: File watch events does not disturb renaming anymore. git-svn-id: svn://localhost/gambas/trunk@7910 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.form/.lang/fr.mo | Bin 6473 -> 6645 bytes comp/src/gb.form/.lang/fr.po | 218 ++++++++++-------- .../.src/File/Chooser/FDirChooser.class | 28 +++ comp/src/gb.form/.src/File/DirView.class | 10 + .../File/Properties/FFileProperties.class | 17 +- .../src/gb.form/.src/Test/FTestFileView.class | 6 + 6 files changed, 185 insertions(+), 94 deletions(-) diff --git a/comp/src/gb.form/.lang/fr.mo b/comp/src/gb.form/.lang/fr.mo index ecafaefdf945b223067afdb455aa5c4a0c0d67b9..321390110e97f8761b3a56a92c8a293b24d6de25 100644 GIT binary patch delta 2661 zcmYk+4NR3)9LMoPAY9($@+!#N1teI!L%v+va<*PvwHottER7}072OhD%4_J?*#toz9JB14TG=}2` zw*5R3qxlR&dA|9Un`9cMP#L&k>rqk0#8c1373f6;RE3(b8ufr$RN&7dL(M)^0Ebb5 zzKrTWhzU51S@WMWYn^Vs(681k=`7to-TmZKtm5H(R1YM>7_a1SbgX4I+fMxBw@PzxDG1@azh z{1_^L3#bKLM2(+BJ$E)>JIvwzH2i@|VF}C93b&#rdKxux1L`$v!X!L`n)n3rF{6Ab zgXd5Ie}bB495v4uwmyl8)B{(z(Te9$DZ7P=Fqm{G@>u*6SE2%lX4#57&YEKNARm** zS0+}X0^Ekm%wAjXM$PLW&k2|zZWP%lY9(he1;zwZK)jy>LSVeLW% z@&YOoeW-wr+V%m|xIttW%}Ff6F$^eWKXapr=1_YR!p3RBXw-vaP?6`@_7ZEEwZgjE zx)zl=FJ|EmR0a>B7IX?V??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D)M)1`yuOx)(PuJ z*2Acb9l-*;ippFp8$c5)LXEo^6#to{Z*OQs?c#OTCM@N;8P(wx)aDtq4kN2& z#!!JyTE9Zwf5~3|fb3&)9W}w5_WN5Ie3t+xEXud*UW4uYRp2-*pHggpmjfLHy=R#hJSzx z{5)!HFWc{bM~(NVbru!C->3)1@rvntH>#g+9u=ju0QF0^1oht5p>Etp*+O}iqNC68 zC1yIy6XSeZ(JsnPHFH!^?x!rHXpY?!9gp0`-RP)D~i5 diff --git a/comp/src/gb.form/.lang/fr.po b/comp/src/gb.form/.lang/fr.po index 0654bc2bf..4f20ee9b2 100644 --- a/comp/src/gb.form/.lang/fr.po +++ b/comp/src/gb.form/.lang/fr.po @@ -26,9 +26,8 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gb.form 3.6.90\n" -"POT-Creation-Date: 2016-03-01 02:17 UTC\n" -"PO-Revision-Date: 2014-12-16 11:04 UTC\n" +"Project-Id-Version: gb.form 3.9.90\n" +"PO-Revision-Date: 2016-09-13 02:12 UTC\n" "Last-Translator: Benoît Minisini \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -55,27 +54,27 @@ msgstr "Système" msgid "Last colors" msgstr "Dernières couleurs" -#: ColorPalette.class:240 FColorChooser.form:50 +#: ColorPalette.class:240 msgid "Remove color" msgstr "Retirer la couleur" -#: ColorPalette.class:244 FColorChooser.form:55 +#: ColorPalette.class:244 msgid "Remove all colors" msgstr "Retirer toutes les couleurs" -#: ColorPalette.class:248 FColorChooser.form:60 +#: ColorPalette.class:248 msgid "Sort colors" msgstr "Trier les couleurs" -#: DirView.class:459 +#: DirView.class:530 msgid "Cannot rename directory." msgstr "Impossible de renommer le répertoire." -#: DirView.class:489 +#: DirView.class:561 msgid "New folder" msgstr "Nouveau répertoire" -#: DirView.class:507 +#: DirView.class:580 msgid "Cannot create directory." msgstr "Impossible de créer le répertoire." @@ -95,134 +94,146 @@ msgstr "Mois suivant" msgid "Apply" msgstr "Appliquer" -#: FColorChooser.form:102 +#: FColorChooser.form:81 msgid "Follow color grid" msgstr "Suivre la grille de couleurs" -#: FColorChooser.form:148 +#: FColorChooser.form:110 msgid "R" msgstr "-" -#: FColorChooser.form:153 -msgid "G" -msgstr "-" - -#: FColorChooser.form:158 -msgid "B" -msgstr "-" - -#: FColorChooser.form:169 +#: FColorChooser.form:122 msgid "H" msgstr "-" -#: FColorChooser.form:174 +#: FColorChooser.form:139 +msgid "G" +msgstr "-" + +#: FColorChooser.form:151 msgid "S" msgstr "-" -#: FColorChooser.form:185 +#: FColorChooser.form:168 +msgid "B" +msgstr "-" + +#: FColorChooser.form:180 msgid "V" msgstr "-" -#: FColorChooser.form:201 +#: FColorChooser.form:198 msgid "A" msgstr "-" -#: FDirChooser.class:427 +#: FDirChooser.class:428 msgid "Directory not found." msgstr "Répertoire introuvable." -#: FDirChooser.class:533 +#: FDirChooser.class:534 msgid "All files (*)" msgstr "Tous les fichiers (*)" -#: FDirChooser.class:965 +#: FDirChooser.class:966 msgid "&Bookmark current directory" msgstr "&Marquer le répertoire courant" -#: FDirChooser.class:973 +#: FDirChooser.class:974 msgid "&Edit bookmarks..." msgstr "&Editer les signets..." -#: FDirChooser.class:982 +#: FDirChooser.class:983 msgid "Show &details" msgstr "Vue &détaillée" -#: FDirChooser.class:988 +#: FDirChooser.class:989 msgid "Show &hidden files" msgstr "Afficher les fichiers &cachés" -#: FDirChooser.class:994 +#: FDirChooser.class:995 msgid "Show &image preview" msgstr "Prévisualisation des &images" -#: FDirChooser.class:1002 +#: FDirChooser.class:1003 msgid "&Rename" msgstr "&Renommer" -#: FDirChooser.class:1007 +#: FDirChooser.class:1008 msgid "Copy" msgstr "Copier" -#: FDirChooser.class:1012 +#: FDirChooser.class:1013 msgid "&Delete" msgstr "&Supprimer" -#: FDirChooser.class:1019 +#: FDirChooser.class:1025 msgid "&Uncompress file" msgstr "&Décompresser le fichier" -#: FDirChooser.class:1024 +#: FDirChooser.class:1030 msgid "&Create directory" msgstr "&Créer un répertoire" -#: FDirChooser.class:1029 +#: FDirChooser.class:1035 msgid "Open in &file manager..." msgstr "Ouvrir dans le gestionnaire de &fichiers..." -#: FDirChooser.class:1034 +#: FDirChooser.class:1040 msgid "&Refresh" msgstr "&Actualiser" -#: FDirChooser.class:1042 +#: FDirChooser.class:1048 msgid "&Properties" msgstr "&Propriétés" -#: FDirChooser.class:1254 +#: FDirChooser.class:1264 msgid "Overwrite" msgstr "Ecraser" -#: FDirChooser.class:1254 +#: FDirChooser.class:1264 msgid "Overwrite all" msgstr "Tout écraser" -#: FDirChooser.class:1254 +#: FDirChooser.class:1264 msgid "This file or directory already exists." msgstr "Ce fichier ou ce répertoire existe déjà." -#: FDirChooser.class:1273 +#: FDirChooser.class:1283 msgid "Cannot list archive contents" msgstr "Impossible de lister le contenu de l'archive" -#: FDirChooser.class:1307 +#: FDirChooser.class:1317 msgid "Cannot uncompress file." msgstr "Impossible de décompresser le fichier." -#: FDirChooser.class:1307 +#: FDirChooser.class:1317 msgid "Unknown archive." msgstr "Archive inconnue." -#: FDirChooser.class:1366 +#: FDirChooser.class:1376 msgid "Delete file" msgstr "Supprimer le fichier" -#: FDirChooser.class:1367 +#: FDirChooser.class:1377 msgid "Do you really want to delete that file?" msgstr "Désirez-vous réellement supprimer ce fichier ?" -#: FDirChooser.class:1374 +#: FDirChooser.class:1384 msgid "Unable to delete file." msgstr "Impossible de supprimer le fichier." +#: FDirChooser.class:1394 +msgid "Delete directory" +msgstr "Supprimer le répertoire" + +#: FDirChooser.class:1395 +msgid "Do you really want to delete that directory?" +msgstr "Désirez-vous vraiment supprimer ce répertoire ?" + +#: FDirChooser.class:1402 +msgid "Unable to delete directory." +msgstr "Impossible de supprimer le répertoire." + #: FDirChooser.form:66 msgid "Parent directory" msgstr "Répertoire parent" @@ -251,11 +262,10 @@ msgstr "Afficher les fichiers" msgid "Bookmarks" msgstr "Signets" -#: FDirChooser.form:236 FInputBox.form:43 FWizard.class:76 +#: FDirChooser.form:236 FInputBox.form:45 FWizard.class:76 msgid "OK" msgstr "OK" -#: FDirChooser.form:242 FEditBookmark.class:113 FInputBox.form:49 #: FSidePanel.class:978 FWizard.form:53 msgid "Cancel" msgstr "Annuler" @@ -312,7 +322,6 @@ msgstr "" msgid "ComboBox1" msgstr "-" -#: FDocumentView.form:101 FTestBalloon.form:17 FTestCompletion.form:23 #: FTestMessageView.form:32 FTestWizard.form:23 msgid "Button1" msgstr "-" @@ -325,7 +334,7 @@ msgstr "" msgid "Autocenter" msgstr "" -#: FEditBookmark.class:20 FileView.class:112 +#: FEditBookmark.class:20 FileView.class:122 msgid "Name" msgstr "Nom" @@ -357,47 +366,51 @@ msgstr "Supprimer" msgid "Close" msgstr "Fermer" -#: FFileProperties.class:84 +#: FFileProperties.class:91 msgid "Symbolic link" msgstr "Lien symbolique" -#: FFileProperties.class:106 +#: FFileProperties.class:120 msgid "Image" msgstr "Image" -#: FFileProperties.class:110 +#: FFileProperties.class:125 msgid "Audio" msgstr "Audio" -#: FFileProperties.class:143 +#: FFileProperties.class:129 +msgid "Video" +msgstr "Vidéo" + +#: FFileProperties.class:178 msgid "&1 properties" msgstr "Propriétés de &1" -#: FFileProperties.class:174 Main.module:50 +#: FFileProperties.class:209 Main.module:50 msgid "&1 B" msgstr "&1 o" -#: FFileProperties.class:179 +#: FFileProperties.class:214 msgid "no file" msgstr "aucun fichier" -#: FFileProperties.class:181 +#: FFileProperties.class:216 msgid "one file" msgstr "un fichier" -#: FFileProperties.class:183 +#: FFileProperties.class:218 msgid "files" msgstr "fichiers" -#: FFileProperties.class:187 +#: FFileProperties.class:222 msgid "no directory" msgstr "aucun répertoire" -#: FFileProperties.class:189 +#: FFileProperties.class:224 msgid "one directory" msgstr "un répertoire" -#: FFileProperties.class:191 +#: FFileProperties.class:226 msgid "directories" msgstr "répertoires" @@ -413,11 +426,11 @@ msgstr "Type" msgid "Directory" msgstr "Répertoire" -#: FFileProperties.form:103 FileView.class:114 +#: FFileProperties.form:103 FileView.class:124 msgid "Size" msgstr "Taille" -#: FFileProperties.form:115 FileView.class:116 +#: FFileProperties.form:115 FileView.class:126 msgid "Last modified" msgstr "Modifié le" @@ -513,15 +526,15 @@ msgstr "Masqué" msgid "Transparent" msgstr "Transparent" -#: FSpinBar.form:12 +#: FSpinBar.form:14 msgid "Test" msgstr "" -#: FSwitchButton.form:33 FTestBalloon.form:12 FTestFileView.form:85 +#: FSwitchButton.form:34 FTestBalloon.form:12 FTestFileView.form:86 msgid "TextBox1" msgstr "-" -#: FSwitchButton.form:40 +#: FSwitchButton.form:41 msgid "http://gambaswiki.org" msgstr "-" @@ -533,45 +546,78 @@ msgstr "" msgid "Orientation" msgstr "" +#: FTestColorChooser.form:20 +msgid "Resizable" +msgstr "" + #: FTestCompletion.form:28 -#, fuzzy msgid "Button2" -msgstr "-" +msgstr "" -#: FTestFileView.form:27 -#, fuzzy +#: FTestFileView.form:28 FTestMenuButton.form:31 msgid "Menu1" -msgstr "-" +msgstr "" -#: FTestFileView.form:30 Form5.form:22 +#: FTestFileView.form:31 FTestMenuButton.form:35 Form5.form:22 msgid "Menu2" msgstr "-" -#: FTestFileView.form:35 Form5.form:26 +#: FTestFileView.form:36 FTestMenuButton.form:39 Form5.form:26 msgid "Menu3" msgstr "-" -#: FTestFileView.form:40 -#, fuzzy +#: FTestFileView.form:41 FTestMenuButton.form:65 msgid "Menu7" -msgstr "-" +msgstr "" -#: FTestFileView.form:48 Form5.form:30 +#: FTestFileView.form:49 FTestMenuButton.form:48 Form5.form:30 msgid "Menu4" msgstr "-" -#: FTestFileView.form:53 Form5.form:34 +#: FTestFileView.form:54 FTestMenuButton.form:52 Form5.form:34 msgid "Menu5" msgstr "-" -#: FTestFileView.form:75 +#: FTestFileView.form:76 msgid "Balloon" msgstr "-" -#: FTestFileView.form:80 +#: FTestFileView.form:81 msgid "Label1" msgstr "-" +#: FTestMenuButton.form:27 +msgid "Project" +msgstr "" + +#: FTestMenuButton.form:44 +msgid "View" +msgstr "" + +#: FTestMenuButton.form:56 +msgid "Menu6" +msgstr "" + +#: FTestMenuButton.form:61 +msgid "Tools" +msgstr "" + +#: FTestMenuButton.form:69 +msgid "Menu8" +msgstr "" + +#: FTestMenuButton.form:73 +msgid "Menu9" +msgstr "" + +#: FTestMenuButton.form:76 +msgid "Menu10" +msgstr "" + +#: FTestMenuButton.form:80 +msgid "Menu11" +msgstr "" + #: FTestValueBox.form:18 msgid "Hello world!" msgstr "" @@ -608,7 +654,7 @@ msgstr "Suivant" msgid "Previous" msgstr "Précédent" -#: FileView.class:951 +#: FileView.class:1026 msgid "Cannot rename file." msgstr "Impossible de renommer le fichier." @@ -652,11 +698,3 @@ msgstr "OFF" msgid "Step #&1" msgstr "Étape n°&1" -#~ msgid "File not found." -#~ msgstr "Fichier introuvable." - -#~ msgid "ValueBox1" -#~ msgstr "-" - -#~ msgid "ButtonBox1" -#~ msgstr "-" diff --git a/comp/src/gb.form/.src/File/Chooser/FDirChooser.class b/comp/src/gb.form/.src/File/Chooser/FDirChooser.class index 214c26d90..eeaae27f6 100644 --- a/comp/src/gb.form/.src/File/Chooser/FDirChooser.class +++ b/comp/src/gb.form/.src/File/Chooser/FDirChooser.class @@ -20,6 +20,7 @@ Private mnuUncompress As Menu Private mnuRename As Menu Private mnuCopy As Menu Private mnuDelete As Menu +Private mnuDeleteDir As Menu Private mnuProperty As Menu Private $bView As Boolean @@ -1013,6 +1014,11 @@ Private Sub FillMenu() hMenu.Picture = Picture["icon:/small/delete"] mnuDelete = hMenu + hMenu = New Menu(mnuPopup) As "mnuDeleteDir" + hMenu.Text = ("&Delete") + hMenu.Picture = Picture["icon:/small/delete"] + mnuDeleteDir = hMenu + hMenu = New Menu(mnuPopup) hMenu = New Menu(mnuPopup) As "mnuUncompress" @@ -1111,6 +1117,9 @@ Public Sub dvwChoose_Menu() mnuShowPreview.Hide mnuRename.Show mnuDelete.Hide + mnuDeleteDir.Hide + Try mnuDeleteDir.Visible = Dir(dvwChoose.Current).Count = 0 + dvwChoose.SetFocus mnuPopup.Popup @@ -1131,6 +1140,7 @@ Public Sub fvwChoose_Menu() mnuShowPreview.Show mnuRename.Visible = sFile mnuDelete.Visible = sFile + mnuDeleteDir.Hide mnuPopup.Popup @@ -1375,6 +1385,24 @@ Catch End +Public Sub mnuDeleteDir_Click() + + Dim sPath As String = dvwChoose.Current + + If Not sPath Then Return + + Message.Title = ("Delete directory") + If Message.Warning("" & File.Name(sPath) & "

" & ("Do you really want to delete that directory?"), ("&Delete"), ("Cancel")) = 2 Then Return + + Rmdir sPath + mnuRefresh_Click + +Catch + + Message.Error(("Unable to delete directory.") & "\n\n" & Error.Text) + +End + Public Sub SetFocus() diff --git a/comp/src/gb.form/.src/File/DirView.class b/comp/src/gb.form/.src/File/DirView.class index 2affb8b34..a88ac21dc 100644 --- a/comp/src/gb.form/.src/File/DirView.class +++ b/comp/src/gb.form/.src/File/DirView.class @@ -42,6 +42,7 @@ Private $bWatch As Boolean Private $hRefreshTimer As Timer Private $bRefreshTimerTriggered As Boolean Private $hWatcher As Watcher +Private $bRefreshAfterRename As Boolean Public Sub _new() @@ -372,6 +373,11 @@ Private Sub RefreshView() Dim SX As Integer Dim SY As Integer + If $bInRename Then + $bRefreshAfterRename = True + Return + Endif + SX = $hTreeView.ScrollX SY = $hTreeView.ScrollY @@ -516,6 +522,8 @@ Public Sub TreeView_Rename() $bDeleteOnCancel = False + If $bRefreshAfterRename Then RefreshViewLater + Catch $hTreeView[sKey].Text = File.Name(sKey) @@ -539,6 +547,7 @@ Public Sub TreeView_Cancel() $hTreeView[sParent].Selected = True $bDeleteOnCancel = False + If $bRefreshAfterRename Then RefreshViewLater End @@ -563,6 +572,7 @@ Public Sub NewFolder() AddDir(Current_Read(), sDir) $bDeleteOnCancel = True $bInRename = True + $bRefreshAfterRename = False $hTreeView[sPath].Rename Catch diff --git a/comp/src/gb.form/.src/File/Properties/FFileProperties.class b/comp/src/gb.form/.src/File/Properties/FFileProperties.class index ce4105a0c..31cd8c4b2 100644 --- a/comp/src/gb.form/.src/File/Properties/FFileProperties.class +++ b/comp/src/gb.form/.src/File/Properties/FFileProperties.class @@ -5,6 +5,7 @@ Class MediaView Static Private $aImgExt As String[] = ["png", "jpg", "jpeg", "gif", "bmp", "xpm"] Static Private $aAudioExt As String[] = ["wav", "mp3", "ogg", "flac"] +Static Private $aVideoExt As String[] = ["mp4", "mov", "avi", "mpg", "mpeg", "flv", "wmv", "mkv"] Private $sPath As String @@ -108,6 +109,8 @@ Private Sub RefreshPath() If Error Then Error "gb.form: unable to find icon for mimetype: "; hMime.GenericIcon If hMime.Type Like "image/*" Then bShowImagePreview = True + Else If $bMedia And If hMime.Type Like "{video,audio}/*" Then + bShowMediaPreview = True Else If $bMedia And If hMime.Type Like "audio/*" Then bShowMediaPreview = True Endif @@ -116,10 +119,16 @@ Private Sub RefreshPath() picIcon.Picture = Picture["icon:/64/image"] lblType.Text = ("Image") bShowImagePreview = True - Else If $bMedia And If $aAudioExt.Exist(File.Ext($sPath), gb.IgnoreCase) Then - picIcon.Picture = Picture["icon:/64/audio"] - lblType.Text = ("Audio") - bShowMediaPreview = True + Else If $bMedia Then + If $aAudioExt.Exist(File.Ext($sPath), gb.IgnoreCase) Then + picIcon.Picture = Picture["icon:/64/audio"] + lblType.Text = ("Audio") + bShowMediaPreview = True + Else If $aVideoExt.Exist(File.Ext($sPath), gb.IgnoreCase) Then + picIcon.Picture = Picture["icon:/64/video"] + lblType.Text = ("Video") + bShowMediaPreview = True + Endif Endif Endif diff --git a/comp/src/gb.form/.src/Test/FTestFileView.class b/comp/src/gb.form/.src/Test/FTestFileView.class index da2bcf9ce..87b866b94 100644 --- a/comp/src/gb.form/.src/Test/FTestFileView.class +++ b/comp/src/gb.form/.src/Test/FTestFileView.class @@ -32,3 +32,9 @@ Public Sub FileChooser1_Change() FileProperties1.Path = FileChooser1.SelectedPath End + +Static Public Sub _init() + + Component.Load("gb.inotify") + +End