Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/111-remodel-gui-work-and…
Browse files Browse the repository at this point in the history
…-split-between-threads'
  • Loading branch information
JockeJarre committed Nov 7, 2024
2 parents df28ace + ec67e49 commit 7842b36
Show file tree
Hide file tree
Showing 15 changed files with 322 additions and 346 deletions.
12 changes: 8 additions & 4 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
2.5.0
- Finally a merge of the source code of B2SBackglassServer & B2SBackglassServerEXE into one. Should not be noticed while running, but huge for development.
- Added new method B2SSetPos(ImageId, xpos, ypos) to move the images on the backglass.
- Added new method B2SServerBuild() returning float version number: 20500.0295
- **Finally a merge of the source code** for B2SBackglassServer & B2SBackglassServerEXE into one. _Should not be noticed_ while running, but huge for development.
- Added new method B2SSetPos(ImageId, xpos, ypos) to move the images on the backglass. Currently only as DLL!!!
- Added new method B2SBuildVersion() returning float version number: 20500.0295
- #122 Only crop "standard" images which does not rotate, while fixing "Events of overlapping pictures get merged #76" too many images was cropped.
- #121 B2S 2.1.2 Throws System NullReferenceException, a crash on certain tables fixed.
- #119 B2S Table Settings Saving But WIll Not Apply, the backglass hide flag was forgotten to be read.
- #96 Improve Fuzzy Matching to not use the DOS short names: "Fuzzy Matching" now cuts the table name after the first ")" and then tries to find a backglass named something like that.

2.1.2
- Request to turn off backglass in b2s settings #80 Thanks @stevejones72!
It is a setting per table, so the table you save with hidden backglass will have it's backglass not shown.
You can still get settings opened on the background or b2s-dmd using right click though.
To edit the B2SBackglassSettings.xml file manually search for <HideB2SBackglass>1</HideB2SBackglass> and set to zero.
- Backglasses using overlapping partly transparent pictures get it's events merged. This is now deactivated by default. And cannot be deactivated!
- Backglasses using overlapping partly transparent pictures get it's events merged. This is now deactivated by default.

2.1.1

Expand Down
4 changes: 2 additions & 2 deletions b2sbackglassserver/b2sbackglassserver/Classes/B2SAnimation.vb
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,10 @@ Public Class B2SAnimation
With DirectCast(currentForm, formBackglass)
MainFormBackgroundImage = .BackgroundImage
.BackgroundImage = .DarkImage
.Refresh()
.Invalidate()
End With
Else
currentForm.Refresh()
currentForm.Invalidate()
End If
End If
End If
Expand Down
17 changes: 3 additions & 14 deletions b2sbackglassserver/b2sbackglassserver/Classes/B2SScreen.vb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports Microsoft.Win32
Imports System.IO
Imports System.Reflection
Imports System.Text.RegularExpressions
Expand Down Expand Up @@ -368,9 +366,9 @@ Public Class B2SScreen
((Me.DMDViewMode = eDMDViewMode.ShowDMD) OrElse
(Me.DMDViewMode = eDMDViewMode.ShowDMDOnlyAtDefaultLocation AndAlso Me.DMDAtDefaultLocation) OrElse
(Me.DMDViewMode = eDMDViewMode.DoNotShowDMDAtDefaultLocation AndAlso Not Me.DMDAtDefaultLocation)))
#If B2S = "DLL" Then

On Error Resume Next
#End If

' get the correct screen
Me.BackglassScreen = ScreensOrdered(0)
Dim s As Screen
Expand Down Expand Up @@ -423,7 +421,7 @@ Public Class B2SScreen
Me.formbackground.Size = Me.BackgroundSize
Me.formbackground.Text = "B2S Backglass Server"
Me.formbackground.BackColor = Color.Black
If (IO.File.Exists(Me.BackgroundPath)) Then
If (File.Exists(Me.BackgroundPath)) Then
Me.formbackground.BackgroundImage = Image.FromFile(Me.BackgroundPath) ' ("C:\backglass.png")
End If
Me.formbackground.Show()
Expand Down Expand Up @@ -515,11 +513,6 @@ Public Class B2SScreen
formBackglass.Text = "B2S Backglass Server"
formBackglass.Show()
End If
#If B2S = "DLL" Then
' bring backglass screen to the front
If B2SSettings.FormToFront Then formBackglass.TopMost = True
formBackglass.BringToFront()
#End If
' maybe show DMD form
If IsDMDToBeShown Then
' set DMD location relative to the backglass location
Expand All @@ -529,11 +522,7 @@ Public Class B2SScreen
Me.formDMD.ControlBox = False
Me.formDMD.MaximizeBox = False
Me.formDMD.MinimizeBox = False
#If B2S = "DLL" Then
Me.formDMD.Location = formBackglass.Location + Me.DMDLocation
#Else
Me.formDMD.Location = Me.BackglassScreen.Bounds.Location + DMDKeepBackglassLocation + Me.DMDLocation
#End If
Me.formDMD.Size = Me.DMDSize
Me.formDMD.Text = "B2S DMD"

Expand Down
6 changes: 1 addition & 5 deletions b2sbackglassserver/b2sbackglassserver/Classes/B2SSettings.vb
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,8 @@ Public Class B2SSettings
Public Shared Function GetSettingFilename() As String
If IO.File.Exists(settingsFilename) Then
Return settingsFilename
#If B2S = "DLL" Then
ElseIf StartAsEXE And B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Application.StartupPath(), settingsFilename)) Then
Return IO.Path.Combine(Application.StartupPath(), settingsFilename)
#Else
ElseIf B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Application.StartupPath(), settingsFilename)) Then
Return IO.Path.Combine(Application.StartupPath(), settingsFilename)
#End If
ElseIf B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), settingsFilename)) Then
Return IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), settingsFilename)
End If
Expand All @@ -272,6 +267,7 @@ Public Class B2SSettings
Public Shared Sub LoadGlobalAndTableSettings(xmlNode As Xml.XmlNode)
If xmlNode.SelectSingleNode("DisableBuiltInEMReelSound") IsNot Nothing Then DisableBuiltInEMReelSound = (xmlNode.SelectSingleNode("DisableBuiltInEMReelSound").InnerText = "1")
If xmlNode.SelectSingleNode("HideGrill") IsNot Nothing Then HideGrill = CInt(xmlNode.SelectSingleNode("HideGrill").InnerText)
If xmlNode.SelectSingleNode("HideB2SBackglass") IsNot Nothing Then HideB2SBackglass = (xmlNode.SelectSingleNode("HideB2SBackglass").InnerText = "1")
If xmlNode.SelectSingleNode("HideB2SDMD") IsNot Nothing Then HideB2SDMD = (xmlNode.SelectSingleNode("HideB2SDMD").InnerText = "1")
If xmlNode.SelectSingleNode("HideDMD") IsNot Nothing Then HideDMD = CInt(xmlNode.SelectSingleNode("HideDMD").InnerText)
If xmlNode.SelectSingleNode("LampsBlackTurns") IsNot Nothing Then LampsSkipFrames = CInt(xmlNode.SelectSingleNode("LampsBlackTurns").InnerText)
Expand Down
5 changes: 5 additions & 0 deletions b2sbackglassserver/b2sbackglassserver/Classes/Processes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ Public Class Processes
For Each proc As ProcInfo In windowlist
If Not String.IsNullOrEmpty(proc.Name) Then
If proc.Name.StartsWith("Visual Pinball - ", StringComparison.CurrentCultureIgnoreCase) Then
'Visual Pinball - [Tom and Jerry (Original 2019) v 1.33]
If String.IsNullOrEmpty(_tablename) Then
_tablename = proc.Name.Substring(17)
'[Tom and Jerry (Original 2019) v 1.33]___
If _tablename.StartsWith("[") AndAlso Not _tablename.EndsWith("]") Then
Dim i As Integer = _tablename.Length - 1
Dim found As Boolean = False
Expand All @@ -48,10 +50,13 @@ Public Class Processes
Loop
If found Then
_tablename = _tablename.Substring(0, i + 1)
'[Tom and Jerry (Original 2019) v 1.33]
End If
End If
If _tablename.StartsWith("[") Then _tablename = _tablename.Substring(1)
'Tom and Jerry (Original 2019) v 1.33]
If _tablename.EndsWith("]") Then _tablename = _tablename.Substring(0, _tablename.Length - 1)
'Tom and Jerry (Original 2019) v 1.33
If _tablename.EndsWith("*") Then _tablename = _tablename.Substring(0, _tablename.Length - 1)
If _tablename.EndsWith(".vpt") Then _tablename = _tablename.Substring(0, _tablename.Length - 4)
If _tablename.EndsWith("*") Then _tablename = _tablename.Substring(0, _tablename.Length - 1)
Expand Down
6 changes: 5 additions & 1 deletion b2sbackglassserver/b2sbackglassserver/Controls/B2SLEDBox.vb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ Public Class B2SLEDBox
Set(ByVal newvalue As Integer)
If _Value <> newvalue OrElse refresh Then
_Value = newvalue
Me.Refresh()
If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
End If
End Set
End Property
Expand Down
20 changes: 5 additions & 15 deletions b2sbackglassserver/b2sbackglassserver/Controls/B2SPictureBox.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,17 @@ Public Class B2SPictureBox


Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
' rectangle area for painting
Dim rect As Rectangle = New Rectangle(0, 0, Me.Width - 1, Me.Height - 1)

' draw dashed frame
Dim pen As Pen = New Pen(Brushes.LightGray)
pen.DashPattern = New Single() {3.0F, 3.0F}
e.Graphics.DrawRectangle(pen, rect)
pen.Dispose()

' draw text
'If Not String.IsNullOrEmpty(Me.Text) Then
' TextRenderer.DrawText(e.Graphics, Me.Text, Me.Font, rect, Color.White, TextFormatFlags.WordBreak Or TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)
'End If

'e.Graphics.DrawImage(BackgroundImage, e.ClipRectangle)
End Sub

Public Sub New()

' set some drawing styles
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
'Me.SetStyle(ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
'Me.DoubleBuffered = True
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
Me.DoubleBuffered = True
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer, True)

' backcolor needs to be transparent
Me.BackColor = Color.Transparent
Expand Down
31 changes: 25 additions & 6 deletions b2sbackglassserver/b2sbackglassserver/Controls/B2SReelBox.vb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ Public Class B2SReelBox

If intermediates2go > 0 OrElse intermediates = -1 Then

Me.Refresh()
If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
intermediates2go -= 1

Else
Expand All @@ -143,8 +147,11 @@ Public Class B2SReelBox
End If
Catch
End Try
Me.Refresh()

If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
intermediates2go -= 1
ElseIf intermediates2go = -1 Then
intermediates2go -= 1
Expand Down Expand Up @@ -201,7 +208,11 @@ Public Class B2SReelBox
If _Illuminated <> value Then
_Illuminated = value
intermediates2go = 0
Me.Refresh()
If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
End If
End Set
End Property
Expand All @@ -215,7 +226,11 @@ Public Class B2SReelBox
If _Value <> value OrElse refresh Then
_Value = value
reelindex = ConvertValue(_Value)
Me.Refresh()
If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
End If
End Set
End Property
Expand All @@ -236,7 +251,11 @@ Public Class B2SReelBox
timer.Start()
Else
reelindex = ConvertText(_Text)
Me.Refresh()
If Me.InvokeRequired Then
Me.BeginInvoke(Sub() Me.Invalidate())
Else
Me.Invalidate()
End If
End If
End If
End If
Expand Down
Loading

0 comments on commit 7842b36

Please sign in to comment.