Files
staxrip/Source/Forms/LogForm.vb
T
ValdiralitaandDendraspis aa92c99804 Improve linux compatibility (#852)
* improve directory path handling by using the inbuilt functions

* use SetThreadExecutionState instead of PowerSetRequest to suppress standby

* linux compatible environment variable handling

* always use shipped fonts

* catch missing icon exception on linux

* remove generated FrameServer.aps file from source control

* fix linux problem when culture is empty

* fix checkbox text rendering on linux

* fix apps launching from the apps window on linux

* improve path handling for adding and removing path entries from apps window

* fix opening help files of apps

* Fix Path.DirectorySeparatorChar in MainForm.vb

* Update Muxer.vb

Change was not necessary and wrong

* Update Muxer.vb

Re-add the additional statement in case of...

* Revert Controls.vb

Due to other implementation meanwhile

* Update AudioProfile.vb

* Update GlobalClass.vb

Improvements and minor fixes

* Update Audio.vb

* use more path.combine

(cherry picked from commit 36facec70aa71334c51ec073cd6ed1bf6a3fff04)

* fix linux get path variable

(cherry picked from commit 4300eb68746973f09321a05f6063015933a6627a)

* fix build

* fix VCEEncC path

---------

Co-authored-by: Dendraspis <dendraspis@gmx.net>
2024-04-23 11:51:09 +02:00

92 lines
3.2 KiB
VB.net

Imports System.Text.RegularExpressions
Imports StaxRip.UI
Public Class LogForm
Sub New()
InitializeComponent()
RestoreClientSize(50, 35)
Text += " - " + p.Log.GetPath
lb.ItemHeight = FontHeight * 2
rtb.Font = g.GetCodeFont
rtb.ReadOnly = True
rtb.Text = p.Log.GetPath.ReadAllText
rtb.DetectUrls = False
For Each match As Match In Regex.Matches(rtb.Text, "^-+ (.+) -+", RegexOptions.Multiline)
Dim val = match.Groups(1).Value
Dim match2 = Regex.Match(val, " \d+\.+.+")
If match2.Success Then
val = val.Substring(0, val.Length - match2.Value.Length)
End If
lb.Items.Add(val)
Next
Dim cms = DirectCast(rtb.ContextMenuStrip, ContextMenuStripEx)
cms.Form = Me
cms.Add("-")
cms.Add("Save As...", Sub()
Using dialog As New SaveFileDialog
dialog.FileName = p.Log.GetPath.FileName
If dialog.ShowDialog = DialogResult.OK Then
rtb.Text.FixBreak.WriteFileUTF8(dialog.FileName)
End If
End Using
End Sub, Keys.Control Or Keys.S).SetImage(Symbol.Save)
cms.Add("Open in Text Editor", Sub() g.ShellExecute(g.GetTextEditorPath, p.Log.GetPath.Escape), Keys.Control Or Keys.T).SetImage(Symbol.Edit)
cms.Add("Show in File Explorer", Sub() g.SelectFileWithExplorer(p.Log.GetPath), Keys.Control Or Keys.E).SetImage(Symbol.FileExplorer)
cms.Add("Show History", Sub() g.ShellExecute(Path.Combine(Folder.Settings, "Log Files")), Keys.Control Or Keys.H).SetImage(Symbol.ClockLegacy)
ApplyTheme()
AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged
End Sub
Protected Overrides Sub Dispose(disposing As Boolean)
RemoveHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged
components?.Dispose()
MyBase.Dispose(disposing)
End Sub
Sub OnThemeChanged(theme As Theme)
ApplyTheme(theme)
End Sub
Sub ApplyTheme()
ApplyTheme(ThemeManager.CurrentTheme)
End Sub
Sub ApplyTheme(controls As IEnumerable(Of Control))
ApplyTheme(controls, ThemeManager.CurrentTheme)
End Sub
Sub ApplyTheme(theme As Theme)
ApplyTheme(Me.GetAllControls(), theme)
End Sub
Sub ApplyTheme(controls As IEnumerable(Of Control), theme As Theme)
If DesignHelp.IsDesignMode Then
Exit Sub
End If
BackColor = theme.General.BackColor
For Each control In controls.OfType(Of TableLayoutPanel)
control.BackColor = theme.General.Controls.TableLayoutPanel.BackColor
control.ForeColor = theme.General.Controls.TableLayoutPanel.ForeColor
Next
End Sub
Sub lb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lb.SelectedIndexChanged
If lb.SelectedItem IsNot Nothing Then
rtb.Find("- " + lb.SelectedItem.ToString + " -")
rtb.ScrollToCaret()
End If
End Sub
End Class