[DEVELOPMENT ENVIRONMENT]
* OPT: FPatch: Make hunk (un)checking behave more intuitive. * BUG: FMakePatch: Don't add a patch to the viewer multiple times. git-svn-id: svn://localhost/gambas/trunk@6785 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
7dca5a263a
commit
8e1ca6210f
2 changed files with 32 additions and 30 deletions
|
@ -11,13 +11,8 @@ Public Sub wizMakePatch_BeforeChange()
|
||||||
|
|
||||||
Select Case wizMakePatch.Index
|
Select Case wizMakePatch.Index
|
||||||
Case 0
|
Case 0
|
||||||
If radArchive.Value Then
|
wizMakePatch[1].Enabled = radArchive.Value
|
||||||
wizMakePatch[1].Enabled = True
|
wizMakePatch[2].Enabled = Not radArchive.Value
|
||||||
wizMakePatch[2].Enabled = False
|
|
||||||
Else
|
|
||||||
wizMakePatch[1].Enabled = False
|
|
||||||
wizMakePatch[2].Enabled = True
|
|
||||||
Endif
|
|
||||||
|
|
||||||
Case 1
|
Case 1
|
||||||
If Not Exist(fchOld.SelectedPath) Or If IsDir(fchOld.SelectedPath) Then
|
If Not Exist(fchOld.SelectedPath) Or If IsDir(fchOld.SelectedPath) Then
|
||||||
|
@ -116,7 +111,7 @@ Public Sub Form_Open()
|
||||||
fchOld.SelectedPath = Project.Config["/FMakePatch/LastArchive", User.Home]
|
fchOld.SelectedPath = Project.Config["/FMakePatch/LastArchive", User.Home]
|
||||||
pchOld.Path = Project.Config["/FMakePatch/LastProject", User.Home]
|
pchOld.Path = Project.Config["/FMakePatch/LastProject", User.Home]
|
||||||
|
|
||||||
$hViewer = New FPatch(panViewer, False)
|
$hViewer = New FPatch(panViewer)
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -132,6 +127,7 @@ Public Sub wizMakePatch_Change()
|
||||||
Dim sName As String
|
Dim sName As String
|
||||||
|
|
||||||
If wizMakePatch.Index = 3 Then
|
If wizMakePatch.Index = 3 Then
|
||||||
|
$hViewer.Clear()
|
||||||
Try $hViewer.Parse(GetDiff())
|
Try $hViewer.Parse(GetDiff())
|
||||||
If Error Then
|
If Error Then
|
||||||
Message.Error(("Unable to generate the patch.") & "\n\n" & Error.Text)
|
Message.Error(("Unable to generate the patch.") & "\n\n" & Error.Text)
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
' Gambas class file
|
' Gambas class file
|
||||||
|
|
||||||
' (C) 2013, 2014 Tobias Boege <tobias@gambas-buch.de>
|
' (C) 2013, 2014, almost-2015 Tobias Boege <tobias@gambas-buch.de>
|
||||||
|
|
||||||
'' Get the edited patch back
|
'' Get the edited patch back
|
||||||
Property Read {Patch} As Patch
|
Property Read {Patch} As Patch
|
||||||
|
|
||||||
Private $hPatch As New Patch
|
Private $hPatch As New Patch
|
||||||
Private $hObs As Observer
|
Private $hObs As Observer
|
||||||
' Whether we behave like a window or just an embedded control (see FMakePatch, Step #4)
|
' Whether we behave like a window or just an embedded control (see FMakePatch, Step #4)
|
||||||
Private $bWindowed As Boolean
|
Private $bWindowed As Boolean
|
||||||
|
|
||||||
Public Sub _new(Optional Windowed As Boolean = True)
|
Public Sub _new()
|
||||||
|
|
||||||
$bWindowed = Windowed
|
$bWindowed = Not Me.Parent
|
||||||
Panel3.Visible = Windowed
|
Panel3.Visible = $bWindowed
|
||||||
HBox2.Visible = Windowed
|
HBox2.Visible = $bWindowed
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ Public Sub Form_Open()
|
||||||
gvwHunks.Columns[2].Expand = False
|
gvwHunks.Columns[2].Expand = False
|
||||||
gvwHunks.Columns[3].Expand = False
|
gvwHunks.Columns[3].Expand = False
|
||||||
|
|
||||||
$hObs = New Observer(gvwHunks.Proxy) As "Observer"
|
$hObs = New Observer(gvwHunks.Proxy, True) As "Observer"
|
||||||
|
|
||||||
edtPatch.ReadConfig
|
edtPatch.ReadConfig
|
||||||
edtPatch.Flags[Editor.ShowLineNumbers] = True
|
edtPatch.Flags[Editor.ShowLineNumbers] = True
|
||||||
|
@ -40,6 +40,7 @@ Private Sub Check(iRow As Integer, bActive As Boolean)
|
||||||
|
|
||||||
$hPatch[iRow].Active = bActive
|
$hPatch[iRow].Active = bActive
|
||||||
gvwHunks[iRow, 0].Picture = If(bActive, Picture["img/16/checked.png"], Picture["img/16/unchecked.png"])
|
gvwHunks[iRow, 0].Picture = If(bActive, Picture["img/16/checked.png"], Picture["img/16/unchecked.png"])
|
||||||
|
edtPatch.Highlight = IIf($hPatch[gvwHunks.Row].Active, Highlight.Diff, Highlight.Custom)
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ Public Sub Observer_MouseDown()
|
||||||
|
|
||||||
If .ColumnAt(Mouse.X) = 0 Then
|
If .ColumnAt(Mouse.X) = 0 Then
|
||||||
iRow = .RowAt(Mouse.Y)
|
iRow = .RowAt(Mouse.Y)
|
||||||
If iRow >= 0 And .Row >= 0 Then
|
If iRow >= 0 Then
|
||||||
bSelect = Not $hPatch[.Row].Active
|
bSelect = Not $hPatch[.Row].Active
|
||||||
For Each iRow In .Rows.Selection
|
For Each iRow In .Rows.Selection
|
||||||
Check(iRow, bSelect)
|
Check(iRow, bSelect)
|
||||||
|
@ -84,14 +85,13 @@ Public Sub gvwHunks_Select()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub gvwHunks_Activate()
|
' Public Sub gvwHunks_Activate()
|
||||||
|
'
|
||||||
Dim iRow As Integer = gvwHunks.Row
|
' Dim iRow As Integer = gvwHunks.Row
|
||||||
|
'
|
||||||
If iRow >= 0 Then Check(iRow, Not $hPatch[iRow].Active)
|
' If iRow >= 0 Then Check(iRow, Not $hPatch[iRow].Active)
|
||||||
|
'
|
||||||
End
|
' End
|
||||||
|
|
||||||
|
|
||||||
Public Sub edtPatch_Highlight()
|
Public Sub edtPatch_Highlight()
|
||||||
|
|
||||||
|
@ -103,17 +103,16 @@ Private Sub RefreshHunks()
|
||||||
|
|
||||||
Dim iInd As Integer
|
Dim iInd As Integer
|
||||||
Dim sToFile As String
|
Dim sToFile As String
|
||||||
'Dim sLineInfo As String
|
' Dim sLineInfo As String
|
||||||
'Dim iAltColor As Integer
|
' Dim iAltColor, iJ As Integer
|
||||||
Dim aScan As String[]
|
Dim aScan As String[]
|
||||||
|
|
||||||
'iAltColor = Color.Merge(Color.TextBackground, Color.LightBackground)
|
' iAltColor = Color.Merge(Color.TextBackground, Color.LightBackground)
|
||||||
|
|
||||||
gvwHunks.Rows.Height = Max(gvwHunks.Font.Height, 20)
|
gvwHunks.Rows.Height = Max(gvwHunks.Font.Height, 20)
|
||||||
|
gvwHunks.Rows.Count = $hPatch.Count
|
||||||
For iInd = gvwHunks.Rows.Count To $hPatch.Count - 1
|
For iInd = 0 To $hPatch.Count - 1
|
||||||
With $hPatch[iInd]
|
With $hPatch[iInd]
|
||||||
Inc gvwHunks.Rows.Count
|
|
||||||
gvwHunks[iInd, 0].Picture = Picture["img/16/" & IIf(.Active, "checked.png", "unchecked.png")]
|
gvwHunks[iInd, 0].Picture = Picture["img/16/" & IIf(.Active, "checked.png", "unchecked.png")]
|
||||||
gvwHunks[iInd, 0].Padding = 2
|
gvwHunks[iInd, 0].Padding = 2
|
||||||
If .ToFile Then
|
If .ToFile Then
|
||||||
|
@ -196,6 +195,13 @@ Public Sub txtPath_Click()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub Clear()
|
||||||
|
|
||||||
|
$hPatch = New Patch
|
||||||
|
RefreshHunks()
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
Public Sub Parse(sFile As String)
|
Public Sub Parse(sFile As String)
|
||||||
|
|
||||||
Inc Application.Busy
|
Inc Application.Busy
|
||||||
|
|
Loading…
Reference in a new issue