Skip to content
Permalink
Browse files

[Whisper Panel/Whisper Windows] Fix numerous issues and inconsistencies.

- Individual whisper window textboxes now have a hanging indent and
  a right-click menu like the chat and whisper boxes on the main form.
- Profile window textboxes now have
  a right-click menu like the chat and whisper boxes on the main form.
- Changing the font or the font size no longer applies the list view
  font size to the chat boxes.
- The "Show expandable whisper panel" setting (and reload config)
  now correctly toggle the whisper panel.
- The "Show expandable whisper panel" setting now has corrected tooltip text.
- Closing the bot with the whisper panel open now saves this properly
  and on next open will not cause the window to be the wrong size or the
  panel to be closed.
- DisplayRichText() no longer makes RichTextBoxes that were previously
  .Visible = False visible.
- Sending whispers containing "ß~ß" (the removed TicTacToe's messages)
  are no longer skipped by whisper windows.
  • Loading branch information...
nmbook committed Nov 4, 2017
1 parent d3d6eb7 commit 13e6c5356bb42b5f0e480fae1807a6fb15c6b86b
@@ -71,7 +71,7 @@ Public Function GetDelay(ByVal sText As String) As Long
End If

ThisPacketCost = BotVars.QueueCostPerPacket + (ThisByteDelay * Len(sText))
Debug.Print "Cost for this packet: " & ThisPacketCost
'Debug.Print "Cost for this packet: " & ThisPacketCost

'// Check how long this packet will have to wait
If (Credits < 0) Then
@@ -84,7 +84,7 @@ Public Function GetDelay(ByVal sText As String) As Long

Credits = Credits - ThisPacketCost

Debug.Print "Remaining credits: " & Credits & "; delay: " & RequiredDelay
'Debug.Print "Remaining credits: " & Credits & "; delay: " & RequiredDelay
GetDelay = RequiredDelay
End Function

@@ -1111,6 +1111,7 @@ Begin VB.Form frmChat
TabIndex = 4
TabStop = 0 'False
Top = 6960
Visible = 0 'False
Width = 12375
_ExtentX = 21828
_ExtentY = 2990
@@ -1766,7 +1767,6 @@ Private Const SB_INET_BETA As String = "AUTHBETA"
Private Sub Form_Load()
Dim s As String
Dim f As Integer
Dim HeightVal As Long
Dim FrmSplashInUse As Boolean
Dim strBeta As String
Dim sStr() As String
@@ -1811,9 +1811,6 @@ Private Sub Form_Load()
sStr = SetCommandLine(Command())

' EVERYTHING ELSE
rtbWhispers.Visible = False 'default
rtbWhispersVisible = False

'Set dictTimerInterval = New Dictionary
'Set dictTimerEnabled = New Dictionary
'Set dictTimerCount = New Dictionary
@@ -1830,14 +1827,12 @@ Private Sub Form_Load()
f = FreeFile

With rtbChat
.Font.Size = 8
.SelTabCount = 1
.SelTabs(0) = 15 * Screen.TwipsPerPixelX
.SelHangingIndent = .SelTabs(0)
End With

With rtbWhispers
.Font.Size = 8
.SelTabCount = 1
.SelTabs(0) = 15 * Screen.TwipsPerPixelX
.SelHangingIndent = .SelTabs(0)
@@ -1866,21 +1861,14 @@ Private Sub Form_Load()
frmSplash.Show
FrmSplashInUse = True
End If

If Config.ShowWhisperBox Then
If Not rtbWhispersVisible Then Call cmdShowHide_Click
Else
If rtbWhispersVisible Then Call cmdShowHide_Click
End If

' whisper panel show/hide button
ShowHideChangeHeight = False
rtbWhispers.Visible = False 'default
cmdShowHide.Caption = CAP_HIDE

If Config.PositionHeight > 0 Then
HeightVal = (IIf(CLng(Config.PositionHeight) < 200, 200, CLng(Config.PositionHeight)) * Screen.TwipsPerPixelY)

If (rtbWhispersVisible) Then
HeightVal = HeightVal - (rtbWhispers.Height / Screen.TwipsPerPixelY)
End If

Me.Height = HeightVal
Me.Height = (IIf(CLng(Config.PositionHeight) < 200, 200, CLng(Config.PositionHeight)) * Screen.TwipsPerPixelY)
End If

If Config.PositionWidth > 0 Then
@@ -1978,6 +1966,9 @@ Private Sub Form_Load()

TASKBARCREATED_MSGID = RegisterWindowMessage("TaskbarCreated")

' whisper panel show/hide button: now user can click (after reload config)
ShowHideChangeHeight = True
' focus on send box
cboSend.SetFocus

LoadQuickChannels
@@ -2623,7 +2614,7 @@ Public Sub Form_Resize()
cboSend.Width = rtbChat.Width

With cmdShowHide
If rtbWhispersVisible Then
If rtbWhispers.Visible Then
'Debug.Print "-> " & rtbWhispers.Height
.Height = rtbWhispers.Height + 285
.Caption = CAP_HIDE
@@ -2637,10 +2628,8 @@ Public Sub Form_Resize()
.ZOrder vbBringToFront
End With

rtbWhispers.Visible = rtbWhispersVisible

'height is based on rtbchat.height + cmdshowhide.height
If rtbWhispersVisible Then
If rtbWhispers.Visible Then
rtbChat.Height = ((Me.ScaleHeight / Screen.TwipsPerPixelY) - (txtPre.Height / _
Screen.TwipsPerPixelY) - (rtbWhispers.Height / Screen.TwipsPerPixelY)) * _
(Screen.TwipsPerPixelY)
@@ -2683,7 +2672,7 @@ Public Sub Form_Resize()
ListviewTabs.Move lvChannel.Left, cboSend.Top + Screen.TwipsPerPixelY, lvChannel.Width - _
cmdShowHide.Width - Screen.TwipsPerPixelX, cboSend.Height '+ 2 * Screen.TwipsPerPixelY

If rtbWhispersVisible Then
If rtbWhispers.Visible Then
cmdShowHide.Move (((rtbWhispers.Left + rtbWhispers.Width) / Screen.TwipsPerPixelX) + 1) * _
Screen.TwipsPerPixelX, lvChannel.Top + lvChannel.Height + Screen.TwipsPerPixelY
Else
@@ -2718,7 +2707,6 @@ Public Sub Form_Resize()

If Me.WindowState = vbMaximized Then
WasMaximized = True
Call RecordWindowPosition(True)
ElseIf Me.WindowState = vbMinimized Then
If WasMaximized Then
WasMaximized = False
@@ -3276,7 +3264,7 @@ Sub Form_Unload(Cancel As Integer)
If Me.WindowState <> vbMinimized Then
Call RecordWindowPosition(CBool(Me.WindowState = vbMaximized))
End If

'Debug.Print Config.ShowWhisperBox
Call Config.Save
End If

@@ -5257,13 +5245,13 @@ Sub mnuLock_Click()
mnuLock.Checked = (Not (mnuLock.Checked))

If BotVars.LockChat = False Then
AddChat RTBColors.InformationText, "Chat window locked."
AddChat RTBColors.ConsoleText, ">> Chat window locked."
AddChat RTBColors.ErrorMessageText, "NO MESSAGES WHATSOEVER WILL BE DISPLAYED UNTIL YOU UNLOCK THE WINDOW."
AddChat RTBColors.ErrorMessageText, "To return to normal mode, press CTRL+L or use the toggle under the Window menu."
BotVars.LockChat = True
Else
BotVars.LockChat = False
AddChat RTBColors.SuccessText, "Chat window unlocked."
AddChat RTBColors.ConsoleText, ">> Chat window unlocked."
End If
End Sub

@@ -7202,8 +7190,8 @@ Sub ReloadConfig(Optional Mode As Byte = 0)
End If

If ResizeChatElements Then
Call ChangeRTBFont(rtbChat, Config.ChatFont, Config.ChannelListFontSize)
Call ChangeRTBFont(rtbWhispers, Config.ChatFont, Config.ChannelListFontSize)
Call ChangeRTBFont(rtbChat, Config.ChatFont, Config.ChatFontSize)
Call ChangeRTBFont(rtbWhispers, Config.ChatFont, Config.ChatFontSize)

Form_Resize
End If
@@ -7357,6 +7345,11 @@ Sub ReloadConfig(Optional Mode As Byte = 0)
g_Logger.LogPath = s
End If

' xor: if showwhisperbox XOR whisperboxopen then toggle it
If (Config.ShowWhisperBox Xor (StrComp(cmdShowHide.Caption, CAP_HIDE, vbBinaryCompare) = 0)) Then
Call cmdShowHide_Click
End If

Call Form_Resize

If (g_Online) Then
@@ -7988,20 +7981,23 @@ End Sub

'SHOW/HIDE STUFF
Public Sub cmdShowHide_Click()
rtbWhispersVisible = (StrComp(cmdShowHide.Caption, CAP_HIDE))
rtbWhispers.Visible = rtbWhispersVisible
Config.WhisperWindows = CBool(rtbWhispers.Visible)
Call Config.Save

If Me.WindowState <> vbMaximized And Me.WindowState <> vbMinimized Then
If rtbWhispersVisible Then
Dim Visible As Boolean
Visible = (Not rtbWhispers.Visible)

'Debug.Print ShowHideChangeHeight
If Me.WindowState = vbNormal And ShowHideChangeHeight Then
If Visible Then
Me.Height = Me.Height + rtbWhispers.Height - Screen.TwipsPerPixelY
Else
Me.Height = Me.Height - rtbWhispers.Height + Screen.TwipsPerPixelY
End If
End If


rtbWhispers.Visible = Visible
Call Form_Resize

Config.ShowWhisperBox = Visible
Call Config.Save
End Sub

'// to be called on every successful login
@@ -8720,7 +8716,7 @@ Public Sub RecordWindowPosition(Optional Maximized As Boolean = False)
Config.PositionHeight = Int(Me.Height / Screen.TwipsPerPixelY)
Config.PositionWidth = Int(Me.Width / Screen.TwipsPerPixelX)
End If

Config.IsMaximized = Maximized
Call Config.Save
End Sub
@@ -45,6 +45,8 @@ Begin VB.Form frmProfile
_Version = 393217
BackColor = 0
BorderStyle = 0
Enabled = -1 'True
AutoVerbMenu = -1 'True
TextRTF = $"frmProfile.frx":0CCA
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
@@ -85,8 +87,10 @@ Begin VB.Form frmProfile
_ExtentY = 4895
_Version = 393217
BackColor = 0
Enabled = -1 'True
ReadOnly = -1 'True
ScrollBars = 2
AutoVerbMenu = -1 'True
TextRTF = $"frmProfile.frx":0D5B
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
@@ -110,6 +114,8 @@ Begin VB.Form frmProfile
_Version = 393217
BackColor = 0
BorderStyle = 0
Enabled = -1 'True
AutoVerbMenu = -1 'True
TextRTF = $"frmProfile.frx":0DEC
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
@@ -133,6 +139,8 @@ Begin VB.Form frmProfile
_Version = 393217
BackColor = 0
BorderStyle = 0
Enabled = -1 'True
AutoVerbMenu = -1 'True
TextRTF = $"frmProfile.frx":0E7D
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
@@ -923,7 +923,7 @@ Begin VB.Form frmSettings
End
Begin VB.CheckBox chkWhisperPanelExpand
BackColor = &H00000000&
Caption = "Expand expandable whisper panel"
Caption = "Show expandable whisper panel"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
@@ -937,7 +937,7 @@ Begin VB.Form frmSettings
Height = 255
Left = 360
TabIndex = 45
ToolTipText = "Enables the small prefix box to the left of the send box used to put text before all messages."
ToolTipText = "Shows the whisper panel below the main chat box."
Top = 2520
Width = 2775
End
@@ -6198,8 +6198,8 @@ Sub SaveFontSettings()
End If

If ResizeChatElements Then
Call ChangeRTBFont(frmChat.rtbChat, Config.ChatFont, Config.ChannelListFontSize)
Call ChangeRTBFont(frmChat.rtbWhispers, Config.ChatFont, Config.ChannelListFontSize)
Call ChangeRTBFont(frmChat.rtbChat, Config.ChatFont, Config.ChatFontSize)
Call ChangeRTBFont(frmChat.rtbWhispers, Config.ChatFont, Config.ChatFontSize)

frmChat.Form_Resize
End If
@@ -6,7 +6,7 @@ Begin VB.Form frmWhisperWindow
Caption = "< account name >"
ClientHeight = 3270
ClientLeft = 165
ClientTop = 450
ClientTop = 810
ClientWidth = 4695
LinkTopic = "Form1"
ScaleHeight = 3270
@@ -38,9 +38,9 @@ Begin VB.Form frmWhisperWindow
_ExtentY = 4683
_Version = 393217
BackColor = 0
Enabled = -1 'True
ReadOnly = -1 'True
ScrollBars = 2
AutoVerbMenu = -1 'True
TextRTF = $"frmWhisperWindow.frx":0000
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
@@ -128,6 +128,12 @@ Private Sub Form_Load()
txtSend.Font.Size = .Font.Size
End With

With rtbWhispers
.SelTabCount = 1
.SelTabs(0) = 15 * Screen.TwipsPerPixelX
.SelHangingIndent = .SelTabs(0)
End With

#If (COMPILE_DEBUG = 0) Then
HookWindowProc Me.hWnd
#End If
@@ -115,6 +115,7 @@ Public Sub DisplayRichText(ByRef rtb As RichTextBox, ByRef saElements() As Varia
Dim SelLength As Long
' don't draw while printing
Dim blnUnlock As Boolean
Dim blnVisible As Boolean
' logging
Dim LineLength As Long
Dim LineText As String
@@ -209,6 +210,9 @@ Public Sub DisplayRichText(ByRef rtb As RichTextBox, ByRef saElements() As Varia
blnCanVScroll = CanVScroll(rtb)
blnScrollAtEnd = (Not blnCanVScroll) Or (lngVerticalPos = 0)

' did this RTB start invisible?
blnVisible = rtb.Visible

If (blnScrollAtEnd) Then
rtb.Visible = False

@@ -323,6 +327,8 @@ Public Sub DisplayRichText(ByRef rtb As RichTextBox, ByRef saElements() As Varia
' below causes smooth scrolling, but also screen flickers :(
'LockWindowUpdate &H0
End If

rtb.Visible = blnVisible
End If

RichTextErrorCounter = 0
@@ -1956,8 +1956,6 @@ Public Sub Event_WhisperFromUser(ByVal Username As String, ByVal Flags As Long,
frmChat.AddWhisper lCarats, "<From ", RTBColors.WhisperUsernames, _
Username, lCarats, "> ", RTBColors.WhisperText, Message

frmChat.rtbWhispers.Visible = rtbWhispersVisible

' individual whisper windows
If (Not SkipPr And frmChat.mnuToggleWWUse.Checked) Then
'If ((frmChat.mnuToggleWWUse.Checked) And _
@@ -2081,9 +2079,7 @@ Public Sub Event_WhisperToUser(ByVal Username As String, ByVal Flags As Long, By
End If

If (frmChat.mnuToggleWWUse.Checked) Then
If ((InStr(1, Message, "ß~ß") = 0) And _
(StrComp(Username, FRIEND_MSG_USER, vbBinaryCompare) <> 0)) Then

If (StrComp(Username, FRIEND_MSG_USER, vbBinaryCompare) <> 0) Then
WWIndex = AddWhisperWindow(Username)

If (frmChat.WindowState <> vbMinimized) Then
@@ -2098,11 +2094,6 @@ Public Sub Event_WhisperToUser(ByVal Username As String, ByVal Flags As Long, By
End If
End If

If (Not (rtbWhispersVisible)) Then
If (frmChat.rtbWhispers.Visible = True) Then
frmChat.rtbWhispers.Visible = False
End If
End If
Exit Sub
ERROR_HANDLER:
Call frmChat.AddChat(RTBColors.ErrorMessageText, _
@@ -12,7 +12,9 @@ Public ReconnectTimerID As Long
Public ExReconnectTimerID As Long
Public SCReloadTimerID As Long
Public QueueTimerID As Long
Public rtbWhispersVisible As Boolean

' frmchat constants
Public ShowHideChangeHeight As Boolean
Public cboSendHadFocus As Boolean
Public cboSendSelStart As Long
Public cboSendSelLength As Long

0 comments on commit 13e6c53

Please sign in to comment.
You can’t perform that action at this time.