...
 
Commits (4)
This diff is collapsed.
' Gambas class file
Class DesktopMime
Static Private $sPath As String
Public Sub Run(sPath As String) As Boolean
$sPath = sPath
Return Not FFileInfoVC.ShowModal()
End
Public Sub Form_Open()
Dim sPath As String
sPath = $sPath
If Left(sPath) = "$" Then sPath = Project.GetSpecialDir(sPath)
If Not sPath Then sPath = Project.Dir
Me.Title = Subst(("'&1' version control"), File.Name(sPath))
edtChange.ReadConfig
edtHistory.ReadConfig
btnClose.SetFocus
tabInfo_Click
End
Public Sub btnClose_Click()
Me.Close
End
Private Sub LoadVersionControlInfo()
Dim sDiff As String
Dim bHideUndoButton As Boolean
edtChange.SetFocus
Inc Application.Busy
edtChange.Font = Font[Settings["/Editor/Font", Project.DEFAULT_FONT]]
sDiff = VersionControl.Diff($sPath)
If Project.IsFormPath($sPath) Then
sDiff &= "\n" & VersionControl.Diff(File.SetExt($sPath, "class"))
Endif
sDiff = Trim(sDiff)
If sDiff Then
edtChange.Highlight = "Diff"
edtChange.Text = sDiff
edtChange.Show
lblVersioning.Hide
Else
edtChange.Hide
If Project.IsLocked($sPath) Then
lblVersioning.Text = ("This file is locked, and will be deleted on the next commit.")
Else If Project.IsAdded($sPath) Then
lblVersioning.Text = ("This file is not versioned, and must be added to the repository.")
bHideUndoButton = True
Else
lblVersioning.Text = ("This file has not been modified since the last commit.")
bHideUndoButton = True
Endif
lblVersioning.Show
Endif
btnRevert.Visible = Not bHideUndoButton
Dec Application.Busy
End
Public Sub btnRevert_Click()
If Message.Warning(("You are going to cancel your changes!"), ("Continue"), ("Cancel")) = 2 Then Return
Project.RevertFile($sPath)
LoadVersionControlInfo
End
' Public Sub panStat_Arrange()
'
' Dim hModule As CModule
'
' If $bStat Then Return
'
' Inc Application.Busy
'
' gvwStat.Columns.Count = 2
'
' AddStat(("Modules"), Project.GetCount("module"))
' If Project.HasTest Then AddStat(("Test modules"), Project.GetCount("test"))
' AddStat(("Classes"), Project.GetCount("class"))
' For Each hModule In CModule.All
' If hModule.Used Then AddStat(hModule.NamePlural, Project.GetCount(hModule.Key))
' Next
' AddStat(("Lines of code"), Format(Project.GetLinesOfCode(), ",#"))
'
' gvwStat.Rows.H = Desktop.Scale * 4
' gvwStat.Columns[0].Width = Desktop.Scale * 16
'
' Dec Application.Busy
'
' $bStat = True
'
' End
Public Sub tabInfo_Click()
Select Case tabInfo.Index
Case 0
LoadVersionControlInfo
Case 1
edtHistory.FillWithHistory($sPath)
End Select
End
Public Sub edtHistory_Highlight(Text As String)
VersionControl.HighlightHistory(Text)
End
Public Sub edtChange_KeyPress()
If Key.Code = Key.Escape Then Me.Close
End
Public Sub edtHistory_KeyPress()
If Key.Code = Key.Escape Then Me.Close
End
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,125,90)
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
{ tabInfo TabPanel
MoveScaled(1,2,59,43)
Expand = True
Arrangement = Arrange.Fill
Count = 2
Index = 0
Text = ("Changes")
{ lblVersioning TextLabel
MoveScaled(2,5,42,6)
Visible = False
Font = Font["Italic"]
Padding = 15
}
{ edtChange TextEditor
MoveScaled(6,13,40,18)
Border = False
ReadOnly = True
Wrap = True
}
Index = 1
Text = ("History")
{ edtHistory TextEditor
MoveScaled(3,4,38,13)
Border = False
Highlight = "Custom"
ReadOnly = True
Wrap = True
}
Index = 0
}
{ HBox1 HBox
MoveScaled(4,54,51,4)
{ btnRevert Button
MoveScaled(0,0,18,4)
AutoResize = True
Text = Shortcut(("Undo changes"), "U")
Picture = Picture["icon:/small/undo"]
}
{ Panel3 Panel
MoveScaled(22,0,3,4)
Expand = True
}
{ btnClose Button
MoveScaled(32,0,16,4)
Text = ("Close")
Picture = Picture["icon:/small/close"]
Default = True
Cancel = True
}
}
}
......@@ -4,11 +4,6 @@ Class DesktopMime
Static Private $sPath As String
Private $iTabHistory As Integer
Private $iTabChanges As Integer
Private $bVersion As Boolean
Private $bHideUndoButton As Boolean
'Private $bStat As Boolean
Public Sub Run(sPath As String) As Boolean
......@@ -85,24 +80,12 @@ Public Sub Form_Open()
Me.Title = Subst(("'&1' properties"), File.Name(sPath))
If VersionControl.Enabled And Not IsDir($sPath) Then
$iTabChanges = fprInfo.Add(panVersion, ("Changes"))
$iTabHistory = fprInfo.Add(panHistory, ("History"))
edtChange.Clear
edtChange.ReadConfig
edtHistory.Clear
edtHistory.ReadConfig
$bVersion = False
Endif
' If (sPath &/ "/") = (Project.SourceDir &/ "/") Then
' fprInfo.Add(panStat, ("Statistics"))
' Endif
btnClose.SetFocus
UpdateUndoButton
End
Public Sub btnClose_Click()
......@@ -111,114 +94,3 @@ Public Sub btnClose_Click()
End
Private Sub LoadVersionControlInfo()
Dim sDiff As String
edtChange.SetFocus
If $bVersion Then Return
Inc Application.Busy
$bHideUndoButton = False
edtChange.Font = Font[Settings["/Editor/Font", Project.DEFAULT_FONT]]
sDiff = VersionControl.Diff($sPath)
If Project.IsFormPath($sPath) Then
sDiff &= "\n" & VersionControl.Diff(File.SetExt($sPath, "class"))
Endif
sDiff = Trim(sDiff)
If sDiff Then
edtChange.Highlight = "Diff"
edtChange.Text = sDiff
edtChange.Show
lblVersioning.Hide
Else
edtChange.Hide
If Project.IsLocked($sPath) Then
lblVersioning.Text = ("This file is locked, and will be deleted on the next commit.")
Else If Project.IsAdded($sPath) Then
lblVersioning.Text = ("This file is not versioned, and must be added to the repository.")
$bHideUndoButton = True
Else
lblVersioning.Text = ("This file has not been modified since the last commit.")
$bHideUndoButton = True
Endif
lblVersioning.Show
Endif
UpdateUndoButton
Dec Application.Busy
$bVersion = True
End
Public Sub btnRevert_Click()
If Message.Warning(("You are going to cancel your changes!"), ("Continue"), ("Cancel")) = 2 Then Return
Project.RevertFile($sPath)
$bVersion = False
LoadVersionControlInfo
End
' Public Sub panStat_Arrange()
'
' Dim hModule As CModule
'
' If $bStat Then Return
'
' Inc Application.Busy
'
' gvwStat.Columns.Count = 2
'
' AddStat(("Modules"), Project.GetCount("module"))
' If Project.HasTest Then AddStat(("Test modules"), Project.GetCount("test"))
' AddStat(("Classes"), Project.GetCount("class"))
' For Each hModule In CModule.All
' If hModule.Used Then AddStat(hModule.NamePlural, Project.GetCount(hModule.Key))
' Next
' AddStat(("Lines of code"), Format(Project.GetLinesOfCode(), ",#"))
'
' gvwStat.Rows.H = Desktop.Scale * 4
' gvwStat.Columns[0].Width = Desktop.Scale * 16
'
' Dec Application.Busy
'
' $bStat = True
'
' End
Private Sub UpdateUndoButton()
btnRevert.Visible = fprInfo.Index = $iTabChanges And Not $bHideUndoButton
End
Public Sub fprInfo_Click()
Select Case fprInfo.Index
Case $iTabChanges
LoadVersionControlInfo
Case $iTabHistory
edtHistory.FillWithHistory($sPath)
End Select
UpdateUndoButton
End
Public Sub edtHistory_Highlight(Text As String)
VersionControl.HighlightHistory(Text)
End
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,126,75)
MoveScaled(0,0,62,56)
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
{ panVersion Panel
MoveScaled(3,1,46,31)
Visible = False
Arrangement = Arrange.Fill
{ lblVersioning TextLabel
MoveScaled(0,0,42,6)
Visible = False
Font = Font["Italic"]
Padding = 15
}
{ edtChange TextEditor
MoveScaled(4,8,40,18)
Border = False
ReadOnly = True
Wrap = True
}
}
{ panStat Panel
MoveScaled(57,3,57,30)
MoveScaled(43,5,29,24)
Visible = False
Arrangement = Arrange.Fill
Margin = True
{ gvwStat GridView
MoveScaled(3,3,51,24)
MoveScaled(3,3,23,18)
Background = Color.Background
Border = False
Grid = False
}
}
{ fprInfo FileProperties
MoveScaled(10,16,36,37)
MoveScaled(2,2,36,37)
Expand = True
}
{ panHistory Panel
MoveScaled(57,36,48,19)
Visible = False
Arrangement = Arrange.Fill
{ edtHistory TextEditor
MoveScaled(3,3,38,13)
Border = False
Highlight = "Custom"
ReadOnly = True
Wrap = True
}
}
{ HBox1 HBox
MoveScaled(1,57,51,4)
{ btnRevert Button
MoveScaled(0,0,18,4)
Visible = False
AutoResize = True
Text = Shortcut(("Undo changes"), "U")
Picture = Picture["icon:/small/undo"]
}
MoveScaled(1,43,40,4)
{ Panel3 Panel
MoveScaled(22,0,3,4)
MoveScaled(11,0,3,4)
Expand = True
}
{ btnClose Button
MoveScaled(32,0,16,4)
MoveScaled(20,0,16,4)
Text = ("Close")
Picture = Picture["icon:/small/close"]
Default = True
......
......@@ -392,10 +392,14 @@ Public Sub mnuPopup_Show()
Dim sRoot As String
Dim bLink As Boolean
Dim sPath As String
Dim bIsDir As Boolean
Dim bIsSpecial As Boolean
sCurrent = GetCurrent()
bCurrent = sCurrent
sRoot = GetRootKey($sKey)
bIsSpecial = $sKey Begins "$"
bIsDir = IsDir(sCurrent)
If sCurrent Then
Try bLink = Stat(sCurrent).Type = gb.Link
......@@ -406,7 +410,7 @@ Public Sub mnuPopup_Show()
If sCurrent And If Project.IsReadOnly(sCurrent) Then
'mnuNew.Visible = False
If Not IsDir(sCurrent) Or If Not bLink Then
If Not bIsDir Or If Not bLink Then
mnuCut.Visible = False
mnuCopy.Visible = False
mnuPaste.Visible = False
......@@ -435,7 +439,7 @@ Public Sub mnuPopup_Show()
mnuRunThat.Visible = mnuStartup.Visible
mnuRunThat.Enabled = mnuStartup.Enabled
If sCurrent And If Left(sCurrent) <> "$" Then
If sCurrent And If Not bIsSpecial Then
mnuDoNotTranslate.Show
mnuDoNotTranslate.Checked = Not Project.ShouldTranslate(sCurrent)
Else
......@@ -498,7 +502,7 @@ Public Sub mnuPopup_Show()
mnuRenameFile.Visible = mnuRenameFile.Visible And bCurrent
mnuDeleteFile.Visible = mnuDeleteFile.Visible And CanDelete(sCurrent)
If $sKey = Project.KEY_MISC Or If IsDir(sCurrent) And bProject Then
If $sKey = Project.KEY_MISC Or If bIsDir And bProject Then
If MCompressFile.CanCompress(If($sKey = Project.KEY_MISC, Project.Dir, sCurrent), True) Then
mnuCompressAll.Show
mnuUncompressAll.Show
......@@ -564,7 +568,7 @@ Public Sub mnuPopup_Show()
mnuOpenInProject.Hide
mnuOpenWithFileManager.Show
If IsDir(sCurrent) Or If Left($sKey) = "$" Then
If bIsDir Or If bIsSpecial Then
Else
If bLink Then
sPath = Project.GetAbsoluteLink(sCurrent, Stat(sCurrent).Link)
......@@ -592,6 +596,12 @@ Public Sub mnuPopup_Show()
mnuFilter.Hide
mnuAddVersionAll.Hide
Endif
If VersionControl.Enabled And If Not bIsDir And If Not bIsSpecial Then
mnuInfoVC.Show
Else
mnuInfoVC.Hide
Endif
UpdateRecentFile(mnuOpenRecentFile)
......@@ -1499,6 +1509,9 @@ Public Sub Action_Activate((Key) As String) As Boolean
FFileProperty.Run(tvwProject.Key)
Endif
Case "info-vc"
FFileInfoVC.Run(tvwProject.Key)
Case "go-back"
CPosition.MovePrevious
Case "go-forward"
......
......@@ -748,6 +748,13 @@
Picture = Picture["img/32/do-not-translate.png"]
Toggle = True
}
{ Menu46 Menu
}
{ mnuInfoVC Menu
Action = "info-vc"
Text = ("Version control") & "..."
Picture = Picture["icon:/small/record"]
}
{ mnuInformation Menu
Action = "info"
Text = Shortcut(("Properties"), "P") & "..."
......@@ -1316,13 +1323,6 @@
MoveScaled(86,8,0,9)
Visible = False
}
{ btnWorkspaceProject ToolButton
MoveScaled(22,1,4,4)
Visible = False
ToolTip = ("Show project tree")
Ignore = True
Picture = Picture["icon:/small/view-tree"]
}
{ btnWorkspaceProperty ToolButton
MoveScaled(27,1,4,4)
Visible = False
......@@ -1330,6 +1330,13 @@
Ignore = True
Picture = Picture["icon:/small/properties"]
}
{ btnWorkspaceProject ToolButton
MoveScaled(22,1,4,4)
Visible = False
ToolTip = ("Show project tree")
Ignore = True
Picture = Picture["icon:/small/view-tree"]
}
}
{ panDebug SidePanel
MoveScaled(3,37,81,14)
......@@ -1384,13 +1391,6 @@
Text = ("Hierarchy")
Index = 0
}
{ btnPropertyToolbar ToolButton
MoveScaled(0,0,4,4)
Visible = False
ToolTip = ("Show controls")
Ignore = True
Picture = Picture["img/16/control.png"]
}
{ btnPropertyHelp ToolButton
MoveScaled(4,0,4,4)
Visible = False
......@@ -1398,6 +1398,13 @@
Ignore = True
Picture = Picture["icon:/small/help"]
}
{ btnPropertyToolbar ToolButton
MoveScaled(0,0,4,4)
Visible = False
ToolTip = ("Show controls")
Ignore = True
Picture = Picture["img/16/control.png"]
}
}
{ panTool SidePanel
MoveScaled(5,49,21,37)
......@@ -1589,6 +1596,11 @@
Shortcut = "Ctrl+Shift+I"
Picture = "icon:/small/info"
}
{ Action info-vc
Text = "Version control"
Shortcut = ""
Picture = "icon:/small/record"
}
{ Action install
Text = "Installation package"
Shortcut = "Ctrl+Alt+I"
......
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FListBox
Startup=TestMessage
Version=3.14.90
VersionFile=1
Component=gb.image
......
......@@ -32,6 +32,10 @@ Public Sub Run(sIcon As String, sText As String, aButton As String[]) As Integer
If Not hPict Then hPict = Picture["./gb.gui.base/message/info.png"]
picMessage.Picture = hPict
hPict = Picture["icon:/small/copy"]
If Not hPict Then hPict = Picture["./gb.gui.base/message/copy.png"]
btnCopy.Picture = hPict
sText = Replace(sText, "\n", "<br>")
txtMessage.Ignore = True
......@@ -79,7 +83,6 @@ Public Sub Button_Click()
End
Public Sub Form_KeyPress()
Dim hButton As Button
......@@ -93,3 +96,10 @@ Public Sub Form_KeyPress()
Endif
End
Public Sub btnCopy_Click()
Component.Load("gb.util")
Clipboard.Copy(String.FromHTML(txtMessage.Text))
End
......@@ -26,8 +26,12 @@
{ panButton HBox
MoveScaled(1,13,62,4)
Spacing = True
{ Panel1 Panel
{ btnCopy ToolButton
MoveScaled(2,0,4,4)
ToolTip = ("Copy message")
}
{ Panel1 Panel
MoveScaled(9,0,4,4)
Expand = True
}
}
......
' Gambas module file
Use "gb.form"
Use "gb.form.stock"
Public Sub Main()
Print Message.Question("Ceci est un message d'avertissement dont le texte est tout spécialement long afin de tester la boite de dialogue. Toutes les modifications non enregistrées seront perdues !", "Sauvegarder", "Envoyer", "Annuler")
Print Message.Question("Ceci est un <i>message d'avertissement</i> dont le texte est <b>tout spécialement long</b> afin de tester la boite de dialogue. Toutes les modifications non enregistrées seront perdues !", "Sauvegarder", "Envoyer", "Annuler")
End
## Package version and e-mail for bugs are defined here
m4_define([GB_VERSION], [3.14.90])
m4_define([GB_MAIL], [g[email protected]])
m4_define([GB_MAIL], [g[email protected]])
m4_define([GB_URL], [http://gambas.sourceforge.net])
m4_define([GB_VERSION_MAJOR], [3])
......