News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Loggers font change patch

Started by Pecan, August 17, 2008, 03:15:14 PM

Previous topic - Next topic

Pecan

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)

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)




killerbot

Thanks Pecan, applied : rev 5186