mirror of
https://github.com/EverythingWindows/ShiftOS-TheRevival-Old.git
synced 2025-01-22 18:02:16 +00:00
Added KeyboardHandler to handle shortcuts and key input to make it universally used
This commit is contained in:
parent
dc8ddb780f
commit
9d0b741e7b
4 changed files with 54 additions and 41 deletions
|
@ -0,0 +1,51 @@
|
||||||
|
Imports System.IO
|
||||||
|
|
||||||
|
Module KeyboardHandler
|
||||||
|
Public InputKey As Keys
|
||||||
|
|
||||||
|
Public Sub ShortcutHandle()
|
||||||
|
Select Case InputKey
|
||||||
|
Case (Keys.Control + Keys.Q)
|
||||||
|
If Console.CurrentInterpreter = "terminal" Then
|
||||||
|
Else
|
||||||
|
TerminateApp(KeyInput)
|
||||||
|
TextRebind()
|
||||||
|
End If
|
||||||
|
Case Else
|
||||||
|
ExecKeyBinding(KeyInput)
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub ExecKeyBinding(KeyInput As Keys)
|
||||||
|
Select Case KeyInput
|
||||||
|
Case (Keys.S + Keys.Control)
|
||||||
|
Select Case Console.CurrentInterpreter
|
||||||
|
Case "textpad"
|
||||||
|
If File.Exists(Console.CurrentDirectory & "\" & command) = True Then
|
||||||
|
Dim TempCompare As String = File.ReadAllText(Console.CurrentDirectory & "\" & command)
|
||||||
|
If Console.TextBox1.Text = TempCompare Then
|
||||||
|
|
||||||
|
Else
|
||||||
|
Dim BeforeCP As Integer = Strings.ComputerInfo(2)
|
||||||
|
SaveFile(command)
|
||||||
|
TextPad_GenerateCP_SavedFile()
|
||||||
|
Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
|
||||||
|
Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Dim BeforeCP As Integer = Strings.ComputerInfo(2)
|
||||||
|
SaveFile(command)
|
||||||
|
TextPad_GenerateCP_SavedFile()
|
||||||
|
Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
|
||||||
|
Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
Case (Keys.N + Keys.Control)
|
||||||
|
Select Case Console.CurrentInterpreter
|
||||||
|
Case "textpad"
|
||||||
|
Console.TextBox1.Text = Nothing
|
||||||
|
End Select
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Module
|
|
@ -98,16 +98,8 @@ Public Class Console
|
||||||
|
|
||||||
Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
|
Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
|
||||||
KeyInput = e.KeyData
|
KeyInput = e.KeyData
|
||||||
Select Case e.KeyData
|
InputKey = e.KeyData
|
||||||
Case (Keys.Control + Keys.Q)
|
ShortcutHandle()
|
||||||
If CurrentInterpreter = "terminal" Then
|
|
||||||
Else
|
|
||||||
TerminateApp(KeyInput)
|
|
||||||
TextRebind()
|
|
||||||
End If
|
|
||||||
Case Else
|
|
||||||
CaptureKeyBinding(KeyInput)
|
|
||||||
End Select
|
|
||||||
If ReleaseCursor = True Then
|
If ReleaseCursor = True Then
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Functions\InGame\Hardwares\KeyboardHandler.vb" />
|
||||||
<Compile Include="Functions\InGame\SystemManager\CodepointSystem.vb" />
|
<Compile Include="Functions\InGame\SystemManager\CodepointSystem.vb" />
|
||||||
<Compile Include="Functions\InGame\SystemManager\Terminate.vb" />
|
<Compile Include="Functions\InGame\SystemManager\Terminate.vb" />
|
||||||
<Compile Include="MainForms\BugSlap.Designer.vb">
|
<Compile Include="MainForms\BugSlap.Designer.vb">
|
||||||
|
|
|
@ -73,37 +73,6 @@ Module TerminalExternalApps
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub CaptureKeyBinding(KeysInput As Keys)
|
|
||||||
Select Case KeysInput
|
|
||||||
Case (Keys.S + Keys.Control)
|
|
||||||
Select Case Console.CurrentInterpreter
|
|
||||||
Case "textpad"
|
|
||||||
If File.Exists(Console.CurrentDirectory & "\" & command) = True Then
|
|
||||||
Dim TempCompare As String = File.ReadAllText(Console.CurrentDirectory & "\" & command)
|
|
||||||
If Console.TextBox1.Text = TempCompare Then
|
|
||||||
|
|
||||||
Else
|
|
||||||
Dim BeforeCP As Integer = Strings.ComputerInfo(2)
|
|
||||||
SaveFile(command)
|
|
||||||
TextPad_GenerateCP_SavedFile()
|
|
||||||
Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
|
|
||||||
Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Dim BeforeCP As Integer = Strings.ComputerInfo(2)
|
|
||||||
SaveFile(command)
|
|
||||||
TextPad_GenerateCP_SavedFile()
|
|
||||||
Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
|
|
||||||
Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
|
|
||||||
End If
|
|
||||||
End Select
|
|
||||||
Case (Keys.N + Keys.Control)
|
|
||||||
Select Case Console.CurrentInterpreter
|
|
||||||
Case "textpad"
|
|
||||||
Console.TextBox1.Text = Nothing
|
|
||||||
End Select
|
|
||||||
End Select
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub TerminateApp(KeyInput As Keys)
|
Public Sub TerminateApp(KeyInput As Keys)
|
||||||
Select Case Console.CurrentInterpreter
|
Select Case Console.CurrentInterpreter
|
||||||
|
|
Loading…
Reference in a new issue