Author Topic: Loggers font change patch  (Read 4661 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2809
Loggers font change patch
« on: August 17, 2008, 03:15:14 pm »
When the user changes Settings/Environment/view/log font, the logger control is never told about the font change.

So on the next write, the log spacing and font is clipped as follows:

Log font is changed to larger font:


Log font is changed to smaller font: spacing is incorrect


This is because loggers::UpdateSettings() never tells the contol to reset its window font or list items. So when the logger does the next write, the  text is clipped or doesn't fill the available font size.

Patch: (Patch #2544)
Code
Index: src/sdk/loggers.cpp
===================================================================
--- src/sdk/loggers.cpp (revision 5177)
+++ src/sdk/loggers.cpp (working copy)
@@ -87,6 +87,9 @@
     style[critical].SetTextColour(*wxWHITE);
     style[critical].SetBackgroundColour(*wxRED);
     style[spacer].SetFont(small_font);
+
+    // Tell control about the font change
+    control->SetFont(default_font);
 };
 
 void TextCtrlLogger::Append(const wxString& msg, Logger::level lv)
@@ -234,6 +237,16 @@
 
     style[spacer].font = small_font;
     style[pagetitle] = style[caption];
+
+    // Tell control and items about the font change
+    control->SetFont(default_font);
+    for (int i=0; i<control->GetItemCount(); ++i)
+    {
+        wxFont font = control->GetItemFont(i);
+        font.SetPointSize(size);
+        control->SetItemFont( i, font );
+    }//for
+
 }
 
 void ListCtrlLogger::Append(const wxString& msg, Logger::level lv)


« Last Edit: August 17, 2008, 03:22:49 pm by Pecan »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5516
Re: Loggers font change patch
« Reply #1 on: August 17, 2008, 03:44:08 pm »
Thanks Pecan, applied : rev 5186