Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: srm2000 on October 11, 2025, 06:32:33 am

Title: patch for [debug windows]
Post by: srm2000 on October 11, 2025, 06:32:33 am
The font size of debug windows might be to small too see it clearly.  Too much complaints from the students。
I make a patch. The debug windows' fonts inherit from the editor. Then you can change the fonts at your will.
In the future, a seperated font setting dialog might be added in the debugger configuration window.

Index: src/src/backtracedlg.cpp
===================================================================
--- src/src/backtracedlg.cpp   (rev 13745)
+++ src/src/backtracedlg.cpp   (patched)
@@ -62,6 +62,14 @@
     SetAutoLayout(true);
     SetSizer(bs);
 
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
+    m_list->SetFont(font);
+
     m_list->InsertColumn(0, _("Nr"), wxLIST_FORMAT_RIGHT);
     m_list->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT);
     m_list->InsertColumn(2, _("Function"), wxLIST_FORMAT_LEFT);
Index: src/src/breakpointsdlg.cpp
===================================================================
--- src/src/breakpointsdlg.cpp   (rev 13745)
+++ src/src/breakpointsdlg.cpp   (patched)
@@ -76,6 +76,14 @@
     SetAutoLayout(TRUE);
     SetSizer(bs);
 
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
+    m_pList->SetFont(font);
+
     wxWindow* parent = Manager::Get()->GetAppWindow();
     const double scaleFactor = cbGetContentScaleFactor(*parent);
     const int targetHeight = wxRound(12 * scaleFactor);
Index: src/src/cpuregistersdlg.cpp
===================================================================
--- src/src/cpuregistersdlg.cpp   (rev 13745)
+++ src/src/cpuregistersdlg.cpp   (patched)
@@ -27,7 +27,12 @@
     SetSizer(sizer);
     Layout();
 
-    wxFont font(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
     m_pList->SetFont(font);
 
     Clear();
Index: src/src/examinememorydlg.cpp
===================================================================
--- src/src/examinememorydlg.cpp   (rev 13745)
+++ src/src/examinememorydlg.cpp   (patched)
@@ -38,7 +38,12 @@
         return;
     m_pText = XRCCTRL(*this, "txtDump", wxTextCtrl);
 
-    wxFont font(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
     m_pText->SetFont(font);
 
     ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
Index: src/src/threadsdlg.cpp
===================================================================
--- src/src/threadsdlg.cpp   (rev 13745)
+++ src/src/threadsdlg.cpp   (patched)
@@ -44,8 +44,14 @@
     SetAutoLayout(true);
     SetSizer(bs);
 
-    wxFont font(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
     m_list->SetFont(font);
+
     m_list->InsertColumn(0, _("Active"), wxLIST_FORMAT_LEFT, 64);
     m_list->InsertColumn(1, _("Number"), wxLIST_FORMAT_RIGHT, 64);
     m_list->InsertColumn(2, _("Info"), wxLIST_FORMAT_LEFT);
Index: src/src/watchesdlg.cpp
===================================================================
--- src/src/watchesdlg.cpp   (rev 13745)
+++ src/src/watchesdlg.cpp   (patched)
@@ -403,6 +403,14 @@
     SetAutoLayout(TRUE);
     SetSizer(bs);
 
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
+    wxNativeFontInfo fontInfo;
+    fontInfo.FromString(fontstring);
+    wxFont font(fontInfo);
+
+    m_grid->SetFont(font);
+
     if (!watchesPropertyEditor)
         watchesPropertyEditor = wxPropertyGrid::RegisterEditorClass(new cbTextCtrlAndButtonTooltipEditor, true);
 
@@ -1337,9 +1345,12 @@
     m_grid->SetExtraStyle(extraStyles);
     m_grid->SetDropTarget(new WatchesDropTarget);
 
+    // use the same font as editor's
+    const wxString fontstring(Manager::Get()->GetConfigManager("editor")->Read("/font", wxEmptyString));
     wxNativeFontInfo fontInfo;
-    fontInfo.FromString(cbDebuggerCommonConfig::GetValueTooltipFont());
+    fontInfo.FromString(fontstring);
     wxFont font(fontInfo);
+
     m_grid->SetFont(font);
 
     m_grid->SetColumnCount(3);
Title: Re: patch for [debug windows]
Post by: Miguel Gimenez on October 11, 2025, 10:17:36 am
Patch (modified to take HiDPI into account) applied in r13747 (https://sourceforge.net/p/codeblocks/code/13747/), thank you.