Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

patch for [debug windows]

(1/2) > >>

srm2000:
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);

Miguel Gimenez:
Patch (modified to take HiDPI into account) applied in r13747, thank you.

srm2000:

--- Quote from: Miguel Gimenez on October 11, 2025, 10:17:36 am ---Patch (modified to take HiDPI into account) applied in r13747, thank you.

--- End quote ---

The new patch of r13747 makes the fonts of debugging windows especially large. It doesn't match well with the GUI's font at all.

So, my suggestion is,  calling SetFont in the released patch such as,

--- Code: ---m_pText->SetFont(font.Scaled(cbGetContentScaleFactor(*this)));
--- End code ---
might be much better like this, just as my original patch.

--- Code: ---m_pText->SetFont(font);
--- End code ---

The users can change the editor's font to ensure the debugging windows' font size is right.

Miguel Gimenez:
What scale factor are you using?.

srm2000:

--- Quote from: Miguel Gimenez on Yesterday at 04:13:28 pm ---What scale factor are you using?.

--- End quote ---
the scale factor is 2.0 .

Navigation

[0] Message Index

[#] Next page

Go to full version