4270c30d20
* NEW: Actions lists are now written directly in *.form files. The compiler will copy them into *.action files in the '.action' project directory. [WIKI CGI SCRIPT] * NEW: The "?view" argument in URLs is now kept through links. [INTERPRETER] * BUG: Paths beginning with "../" now work correctly with executables. * BUG: Fix a crash when using Dir() on relative paths. [COMPILER] * NEW: Now the compiler automatically generates *.action files from the *.form file contents. [GB.FORM.MDI] * BUG: Support for the new action file format in the action configuration dialog. * BUG: Bad shortcuts are correctly handle in the action configuration dialog now. git-svn-id: svn://localhost/gambas/trunk@1782 867c0c6c-44f3-4631-809d-bfa615b0a4ec
171 lines
3 KiB
Text
171 lines
3 KiB
Text
' Gambas class file
|
|
|
|
'Private $hSettings As Settings
|
|
Private $cAction As Collection
|
|
Private $aAction As CAction[]
|
|
Private $hEditor As FShortcutEditor
|
|
|
|
Public Sub Run(cAction As Collection) As Boolean
|
|
|
|
$cAction = cAction
|
|
Return Not Me.ShowModal()
|
|
|
|
End
|
|
|
|
Public Sub Form_Open()
|
|
|
|
Dim iInd As Integer
|
|
Dim hAction As CAction
|
|
|
|
'$hSettings = New Settings("gb.form.mdi")
|
|
Settings.ReadWindow(Me, "gb.form.mdi/FShortcut")
|
|
|
|
$aAction = New CAction[]
|
|
For Each hAction In $cAction
|
|
If hAction.HasShortcut Then $aAction.Add(hAction)
|
|
Next
|
|
$aAction.Sort
|
|
|
|
tvwShortcut.Rows.Count = $aAction.Count
|
|
tvwShortcut.Columns.Count = 2
|
|
tvwShortcut.Columns[0].Text = ("Action")
|
|
tvwShortcut.Columns[1].Text = ("Shortcut")
|
|
|
|
For iInd = 0 To $aAction.Max
|
|
|
|
hAction = $aAction[iInd]
|
|
|
|
tvwShortcut[iInd, 0].Text = hAction.Display
|
|
tvwShortcut[iInd, 0].Padding = 4
|
|
tvwShortcut[iInd, 0].Picture = hAction.Icon
|
|
tvwShortcut[iInd, 1].Text = hAction.Shortcut
|
|
tvwShortcut[iInd, 1].Padding = 4
|
|
|
|
Next
|
|
|
|
tvwShortcut.Columns[0].Width = -1
|
|
tvwShortcut.Columns[1].Width = -1
|
|
tvwShortcut.Rows.Height = -1
|
|
|
|
$hEditor = New FShortcutEditor(Me)
|
|
$hEditor.Hide
|
|
$hEditor.Ignore = True
|
|
|
|
End
|
|
|
|
Public Sub btnCancel_Click()
|
|
|
|
Me.Close
|
|
|
|
End
|
|
|
|
Public Sub btnOK_Click()
|
|
|
|
tvwShortcut.Save
|
|
SaveShortcut
|
|
Me.Close(True)
|
|
|
|
End
|
|
|
|
Public Sub tvwShortcut_Select()
|
|
|
|
Dim hAction As CAction
|
|
|
|
If btnFind.Value Then Return
|
|
If tvwShortcut.Row < 0 Then Return
|
|
|
|
hAction = $aAction[tvwShortcut.Row]
|
|
|
|
If tvwShortcut.Column = 0 Then tvwShortcut.Column = 1
|
|
|
|
$hEditor.Define($cAction, hAction)
|
|
tvwShortcut.EditWith($hEditor)
|
|
|
|
End
|
|
|
|
Public Sub tvwShortcut_MouseUp()
|
|
|
|
tvwShortcut_Select
|
|
|
|
End
|
|
|
|
|
|
Private Sub SaveShortcut()
|
|
|
|
Dim hAction As CAction
|
|
Dim sKey As String
|
|
|
|
For Each hAction In $cAction
|
|
hAction.Save
|
|
Next
|
|
Settings.Save
|
|
|
|
End
|
|
|
|
Public Sub Form_Close()
|
|
|
|
Settings.WriteWindow(Me, "gb.form.mdi/FShortcut")
|
|
|
|
End
|
|
|
|
Public Sub tvwShortcut_Save(Row As Integer, Column As Integer, Value As String)
|
|
|
|
If $hEditor.BadShortcut Then Return
|
|
|
|
tvwShortcut[Row, 1].Text = Value
|
|
$aAction[Row].Shortcut = Value
|
|
|
|
End
|
|
|
|
Public Sub btnFind_Click()
|
|
|
|
If btnFind.Value Then
|
|
tvwShortcut.Cancel
|
|
btnFind.SetFocus
|
|
Endif
|
|
|
|
End
|
|
|
|
Public Sub btnFind_KeyPress()
|
|
|
|
Dim sShortcut As String
|
|
Dim iRow As Integer
|
|
|
|
If btnFind.Value Then
|
|
sShortcut = MShortcut.FindShortcut()
|
|
If sShortcut Then
|
|
For iRow = 0 To tvwShortcut.Rows.Count - 1
|
|
If tvwShortcut[iRow, 1].Text = sShortcut Then
|
|
tvwShortcut.Row = iRow
|
|
Break
|
|
Endif
|
|
Next
|
|
Endif
|
|
Stop Event
|
|
Endif
|
|
|
|
End
|
|
|
|
Public Sub btnFind_LostFocus()
|
|
|
|
btnFind.Value = False
|
|
|
|
End
|
|
|
|
Public Sub btnDefault_Click()
|
|
|
|
Dim hAction As CAction
|
|
Dim iRow As Integer
|
|
|
|
If Message.Warning(("You are going back to the default shortcuts."), ("Go back"), ("Cancel")) = 2 Then Return
|
|
|
|
tvwShortcut.Cancel
|
|
For iRow = 0 To tvwShortcut.Rows.Count - 1
|
|
hAction = $aAction[iRow]
|
|
hAction.Shortcut = hAction.DefaultShortcut
|
|
tvwShortcut[iRow, 1].Text = hAction.Shortcut
|
|
Next
|
|
|
|
SaveShortcut
|
|
|
|
End
|