Some fixes about profile file management.
[DEVELOPMENT ENVIRONMENT] * OPT: Do not load recent file settings twice at startup. * BUG: Fix layout of some confirmation messages. * BUG: The open profile dialog correctly remembers its directory. * BUG: Fix popup menu of external files. * NEW: Add "Remove all profile files" action to the 'Debug' menu.
This commit is contained in:
parent
11d7836779
commit
d0b75bcd54
9 changed files with 48 additions and 46 deletions
|
@ -98,11 +98,11 @@ Static Public Sub Load()
|
|||
|
||||
If Not $hSettings Then
|
||||
$hSettings = New Settings("gambas3.recent")
|
||||
Else
|
||||
If Not IsOutOfDate(LastLoad) Then Return
|
||||
$hSettings.Reload
|
||||
Endif
|
||||
|
||||
If Not IsOutOfDate(LastLoad) Then Return
|
||||
|
||||
$hSettings.Reload
|
||||
nRecent = $hSettings["/Recent/Count", 0]
|
||||
|
||||
If nRecent = 0 Then
|
||||
|
|
|
@ -49,7 +49,7 @@ Public Sub fprInfo_Data()
|
|||
Return
|
||||
Endif
|
||||
|
||||
Else If Project.IsProfilePath(sPath) Then
|
||||
Else If File.Ext(sPath) = "prof" Then
|
||||
|
||||
Try fprInfo.Data.Icon = Project.GetFileIcon(sPath, 64)
|
||||
fprInfo.Data.Type = ("Gambas profile file")
|
||||
|
|
|
@ -373,7 +373,7 @@ Public Sub mnuDelete_Click()
|
|||
Try Project.DeleteFile(sPath)
|
||||
Endif
|
||||
If Error Then
|
||||
Select Case Message.Warning(Project.GetMessagePrefix(sPath) & "\n\n<b>" & If(IsDir(sPath), ("Cannot delete directory"), ("Cannot delete file")) & "<b>\n\n" & Error.Text, ("Ignore"), ("Cancel"))
|
||||
Select Case Message.Warning(Project.GetMessagePrefix(sPath) & "<b>" & If(IsDir(sPath), ("Cannot delete directory"), ("Cannot delete file")) & "<b>\n\n" & Error.Text, ("Ignore"), ("Cancel"))
|
||||
Case 1
|
||||
Continue
|
||||
Case 2
|
||||
|
|
|
@ -289,6 +289,9 @@ Public Sub Form_Close()
|
|||
Settings.Write(Me)
|
||||
Settings.Write(splProfile)
|
||||
|
||||
Project.AddRecentFile(Me)
|
||||
Project.Files[Path] = Null
|
||||
|
||||
End
|
||||
|
||||
Public Sub Form_Open()
|
||||
|
@ -709,7 +712,7 @@ Public Sub btnSave_Click()
|
|||
|
||||
Dialog.Title = ("Save profile")
|
||||
Dialog.Filter = ["*.prof", ("Profile files")]
|
||||
Dialog.Path = Settings["/FProfile/Path", User.Home] &/ Project.Name & File.Name(Path)
|
||||
Dialog.Path = Settings["/FProfile/Path", User.Home] &/ File.Name(Path)
|
||||
If Dialog.SaveFile() Then Return
|
||||
|
||||
Settings["/FProfile/Path"] = File.Dir(Dialog.Path)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
{ Form Form
|
||||
MoveScaled(0,0,117,80)
|
||||
Icon = Picture["icon:/medium/clock"]
|
||||
Persistent = True
|
||||
Arrangement = Arrange.Vertical
|
||||
{ panToolbar ToolBar
|
||||
MoveScaled(2,2,110,4)
|
||||
|
|
|
@ -295,7 +295,7 @@ Public Sub mnuDeleteFile_Click()
|
|||
sName = File.Name(sPath)
|
||||
Endif
|
||||
|
||||
If Message.Delete(Project.GetMessagePrefix(sName) & "\n\n" & ("Do you really want to delete this file ?"), ("Delete"), ("Cancel")) <> 1 Then Return
|
||||
If Message.Delete(Project.GetMessagePrefix(sName) & ("Do you really want to delete this file ?"), ("Delete"), ("Cancel")) <> 1 Then Return
|
||||
Project.DeleteFile(sPath)
|
||||
|
||||
Endif
|
||||
|
@ -537,20 +537,6 @@ Public Sub mnuPopup_Show()
|
|||
|
||||
Endif
|
||||
|
||||
Else If sRoot = Project.KEY_PROFILE Then
|
||||
|
||||
mnuNew.Hide
|
||||
mnuImportFile.Hide
|
||||
mnuRenameFile.Hide
|
||||
mnuDeleteFile.Visible = CanDelete(sCurrent)
|
||||
mnuStartup.Hide
|
||||
mnuRunThat.Hide
|
||||
mnuDoNotTranslate.Hide
|
||||
mnuCompressFile.Hide
|
||||
mnuCut.Hide
|
||||
mnuCopy.Hide
|
||||
mnuPaste.Hide
|
||||
|
||||
Else
|
||||
|
||||
' If sRoot = Project.KEY_EXTERN Or If sRoot Begins "/" Or If sRoot = Project.KEY_PROFILE Then
|
||||
|
@ -587,13 +573,22 @@ Public Sub mnuPopup_Show()
|
|||
|
||||
mnuDoNotTranslate.Hide
|
||||
|
||||
mnuCompressNow.Visible = MCompressFile.CanCompress(sCurrent, True)
|
||||
If bProject Then
|
||||
|
||||
If MCompressFile.CanCompress(sCurrent, False) Then
|
||||
mnuCompressFile.Show
|
||||
mnuCompressFile.Checked = Project.ShouldCompress(sCurrent)
|
||||
mnuCompressNow.Visible = MCompressFile.CanCompress(sCurrent, True)
|
||||
|
||||
If MCompressFile.CanCompress(sCurrent, False) Then
|
||||
mnuCompressFile.Show
|
||||
mnuCompressFile.Checked = Project.ShouldCompress(sCurrent)
|
||||
Else
|
||||
mnuCompressFile.Hide
|
||||
Endif
|
||||
|
||||
Else
|
||||
|
||||
mnuCompressNow.Hide
|
||||
mnuCompressFile.Hide
|
||||
|
||||
Endif
|
||||
|
||||
bFile = bCurrent
|
||||
|
@ -678,15 +673,11 @@ Public Sub mnuPopup_Show()
|
|||
If VersionControl.Enabled Then
|
||||
If $sKey = Project.Dir Then
|
||||
mnuInfoVC.Show
|
||||
Else If Not bIsDir And If Not bIsSpecial And If sRoot Not Begins "/" And If Not Project.HasFlag($sKey, Project.FLAG_ADDED) Then
|
||||
Else If bProject And If Not bIsDir And If Not bIsSpecial And If sRoot Not Begins "/" And If Not Project.HasFlag($sKey, Project.FLAG_ADDED) Then
|
||||
mnuInfoVC.Show
|
||||
Endif
|
||||
Endif
|
||||
|
||||
If $sKey = Project.KEY_PROFILE And If IsDir(Project.Dir &/ ".profile") And If Dir(Project.Dir &/ ".profile", "*.prof").Count Then
|
||||
mnuRemoveAllProfile.Show
|
||||
Endif
|
||||
|
||||
UpdateRecentFile(mnuOpenRecentFile)
|
||||
|
||||
End
|
||||
|
@ -720,7 +711,11 @@ Public Sub mnuProfile_Show()
|
|||
mnuDeleteProfile.Visible = bVisible
|
||||
mnuInfoProfile.Show
|
||||
|
||||
mnuRemoveAllProfile.Visible = Not bVisible
|
||||
If Not bVisible And If IsDir(Project.Dir &/ ".profile") And If Dir(Project.Dir &/ ".profile", "*.prof").Count Then
|
||||
mnuRemoveAllProfile.Show
|
||||
Else
|
||||
mnuRemoveAllProfile.Hide
|
||||
Endif
|
||||
|
||||
UpdateRecentFile(mnuOpenRecentFile3)
|
||||
|
||||
|
@ -2715,8 +2710,8 @@ Private Sub OpenProfile()
|
|||
Dialog.Path = Settings["/FMain/OpenProfile"]
|
||||
If Dialog.OpenFile() Then Return
|
||||
|
||||
Settings["/FMain/OpenProfile"] = File.Dir(Dialog.Path)
|
||||
Project.OpenExternFile(Dialog.Path)
|
||||
Settings["/FMain/OpenProfile"] = Dialog.Path
|
||||
Project.OpenFile(Dialog.Path)
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -393,6 +393,11 @@
|
|||
Text = Shortcut(("Open profile"), "O") & "..."
|
||||
Picture = Picture["icon:/small/clock"]
|
||||
}
|
||||
{ Menu46 Menu
|
||||
Action = "remove-all-profile"
|
||||
Text = ("Remove all profile files") & "..."
|
||||
Picture = Picture["icon:/small/trash"]
|
||||
}
|
||||
{ Menu9 Menu
|
||||
}
|
||||
{ mnuClearBreakpoints Menu
|
||||
|
@ -892,7 +897,7 @@
|
|||
{ mnuRemoveAllProfile Menu
|
||||
Action = "remove-all-profile"
|
||||
Text = ("Remove all profile files") & "..."
|
||||
Picture = Picture["icon:/small/delete"]
|
||||
Picture = Picture["icon:/small/trash"]
|
||||
}
|
||||
{ Menu57 Menu
|
||||
}
|
||||
|
@ -2003,7 +2008,7 @@
|
|||
{ Action remove-all-profile
|
||||
Text = "Remove all profile files"
|
||||
Shortcut = ""
|
||||
Picture = "icon:/small/delete"
|
||||
Picture = "icon:/small/trash"
|
||||
}
|
||||
{ Action rename
|
||||
Text = "Rename"
|
||||
|
|
|
@ -7107,7 +7107,7 @@ End
|
|||
Public Sub GetMessagePrefix(sPath As String) As String
|
||||
|
||||
If sPath Begins Project.Dir & "/" Then sPath = Mid$(sPath, Len(Project.Dir) + 2)
|
||||
Return "<tt><b>" & Html(sPath) & "</b></tt>\n"
|
||||
Return "<b>" & Html(sPath) & "</b>\n\n"
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -487,15 +487,15 @@ Public Sub SolveConflict(sPath As String, Optional iAccept As Integer) As Boolea
|
|||
|
||||
End
|
||||
|
||||
Private Sub FormatDate(sDate As String) As String
|
||||
|
||||
Dim dDate As Date
|
||||
|
||||
Try dDate = Date.FromRFC822(sDate)
|
||||
If Not dDate Then Return "?"
|
||||
Return Format(dDate, gb.LongDate)
|
||||
|
||||
End
|
||||
' Private Sub FormatDate(sDate As String) As String
|
||||
'
|
||||
' Dim dDate As Date
|
||||
'
|
||||
' Try dDate = Date.FromRFC822(sDate)
|
||||
' If Not dDate Then Return "?"
|
||||
' Return Format(dDate, gb.LongDate)
|
||||
'
|
||||
' End
|
||||
|
||||
Public Sub InitHistory(hEditor As TextEditor)
|
||||
|
||||
|
|
Loading…
Reference in a new issue