Skip to content

Commit

Permalink
Font settings in game now work for the journal also
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Mar 5, 2023
1 parent 08b327d commit d1e21b5
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/ClassicUO.Client/Game/UI/Gumps/ResizableJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public ResizableJournal() : base(_lastWidth, _lastHeight, MIN_WIDTH, MIN_HEIGHT,
X = BORDER_WIDTH,
Y = BORDER_WIDTH,
};
_tabBackground.Width = MIN_WIDTH - (BORDER_WIDTH*2);
_tabBackground.Width = MIN_WIDTH - (BORDER_WIDTH * 2);
_tabBackground.Height = TAB_HEIGHT;

AddTab("All", new MessageType[] {
MessageType.Alliance, MessageType.Command, MessageType.Emote,
MessageType.Encoded, MessageType.Focus, MessageType.Guild,
Expand Down Expand Up @@ -104,7 +104,7 @@ public ResizableJournal() : base(_lastWidth, _lastHeight, MIN_WIDTH, MIN_HEIGHT,
this);
_journalArea.CanCloseWithRightClick = true;
_journalArea.DragBegin += (sender, e) => { InvokeDragBegin(e.Location); };
#endregion
#endregion

Add(_background);
Add(_scrollBarBase);
Expand All @@ -114,10 +114,10 @@ public ResizableJournal() : base(_lastWidth, _lastHeight, MIN_WIDTH, MIN_HEIGHT,
for (int i = 0; i < _tab.Count; i++)
{
Add(_tab[i]);
// _tab[i].MouseUp += (sender, e) => {
// if (e.Button == MouseButtonType.Left)
// OnButtonClick(_tab[i].ButtonParameter);
// };
// _tab[i].MouseUp += (sender, e) => {
// if (e.Button == MouseButtonType.Left)
// OnButtonClick(_tab[i].ButtonParameter);
// };
}

InitJournalEntries();
Expand All @@ -129,7 +129,7 @@ public ResizableJournal() : base(_lastWidth, _lastHeight, MIN_WIDTH, MIN_HEIGHT,
protected override void OnMouseWheel(MouseEventType delta)
{
base.OnMouseWheel(delta);
if(_scrollBarBase != null)
if (_scrollBarBase != null)
_scrollBarBase.InvokeMouseWheel(delta);
}

Expand All @@ -154,7 +154,15 @@ private void AddJournalEntry(JournalEntry journalEntry)
{
if (journalEntry == null)
return;
_journalArea.AddEntry($"{journalEntry.Name}: {journalEntry.Text}", journalEntry.Font, journalEntry.Hue, journalEntry.IsUnicode, journalEntry.Time, journalEntry.TextType, journalEntry.MessageType);
byte font = journalEntry.Font;
bool unicode = journalEntry.IsUnicode;
if (ProfileManager.CurrentProfile.ForceUnicodeJournal)
{
font = ProfileManager.CurrentProfile.ChatFont;
unicode = true;
}

_journalArea.AddEntry($"{journalEntry.Name}: {journalEntry.Text}", font, journalEntry.Hue, unicode, journalEntry.Time, journalEntry.TextType, journalEntry.MessageType);
}

private void InitJournalEntries()
Expand Down Expand Up @@ -344,7 +352,14 @@ public override void Update()
for (int i = 0; i < _entries.Count; i++)
{
RenderedText t = _entries[i];
newList.AddToBack(RenderedText.Create(t.Text, t.Hue, t.Font, t.IsUnicode, t.FontStyle, t.Align, Width - SCROLL_BAR_WIDTH - BORDER_WIDTH - _hours[i].Width));
byte font = t.Font;
bool unicode = t.IsUnicode;
if (ProfileManager.CurrentProfile.ForceUnicodeJournal)
{
font = ProfileManager.CurrentProfile.ChatFont;
unicode = true;
}
newList.AddToBack(RenderedText.Create(t.Text, t.Hue, font, unicode, t.FontStyle, t.Align, Width - SCROLL_BAR_WIDTH - BORDER_WIDTH - _hours[i].Width));
}
_entries = newList;

Expand Down

0 comments on commit d1e21b5

Please sign in to comment.