News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

CodeBlocks and Fira Code issues

Started by sodev, May 22, 2019, 09:13:39 PM

Previous topic - Next topic

ollydbg

#30

src/sdk/wxscintilla/src/PlatWX.cpp | 30 ++++++++++++++++++++++++++++--
src/sdk/wxscintilla/src/PlatWX.h   |  3 +++
2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/sdk/wxscintilla/src/PlatWX.cpp b/src/sdk/wxscintilla/src/PlatWX.cpp
index 8919929b..871d513b 100644
--- a/src/sdk/wxscintilla/src/PlatWX.cpp
+++ b/src/sdk/wxscintilla/src/PlatWX.cpp
@@ -2415,6 +2415,9 @@ ListBoxImpl::ListBoxImpl()
     : lineHeight(10), unicodeMode(false),
       desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0),
       imgList(NULL), imgTypeMap(NULL)
+/* C::B begin */
+      , technology(wxSCI_TECHNOLOGY_DEFAULT)
+/* C::B end */
{
}

@@ -2425,14 +2428,28 @@ ListBoxImpl::~ListBoxImpl() {


void ListBoxImpl::SetFont(Font &font) {
-    GETLB(wid)->SetFont(*((wxFont*)font.GetID()));
+/* C::B begin */
+    // GETLB(wid)->SetFont(*((wxFont*)font.GetID()));
+    wxFont *NewFont = (wxFont*)font.GetID();
+    if (technology == wxSCI_TECHNOLOGY_DEFAULT)
+        GETLB(wid)->SetFont(*NewFont);
+    else
+    {
+        double scale = GETLB(wid)->GetDPIScaleFactor();
+        GETLB(wid)->SetFont(NewFont->Scaled(72.0/(96.0*scale)));
+    }
+
+/* C::B end */
}


-void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int WXUNUSED(technology_)) {
+void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) {
     location = location_;
     lineHeight =  lineHeight_;
     unicodeMode = unicodeMode_;
+/* C::B begin */
+    technology = technology_;
+/* C::B end */
     maxStrWidth = 0;
     wid = new wxSCIListBoxWin(GETWIN(parent.GetID()), ctrlID, location);
     if (imgList != NULL)
@@ -2463,6 +2480,14 @@ PRectangle ListBoxImpl::GetDesiredRect() {
     // wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of
     // the max size in Append and calculate it here...
     int maxw = maxStrWidth * aveCharWidth;
+/* C::B begin */
+    if (technology == wxSCI_TECHNOLOGY_DIRECTWRITE)
+    {
+        double scale = GETLB(wid)->GetDPIScaleFactor();
+        maxw = (maxw*96*scale)/72;
+    }
+
+/* C::B end */
     int maxh ;

     // give it a default if there are no lines, and/or add a bit more
@@ -2497,6 +2522,7 @@ PRectangle ListBoxImpl::GetDesiredRect() {
     rc.left = 0;
     rc.right = maxw;
     rc.bottom = maxh;
+
     return rc;
}

diff --git a/src/sdk/wxscintilla/src/PlatWX.h b/src/sdk/wxscintilla/src/PlatWX.h
index 44538ea1..7fe41e9d 100644
--- a/src/sdk/wxscintilla/src/PlatWX.h
+++ b/src/sdk/wxscintilla/src/PlatWX.h
@@ -26,6 +26,9 @@ private:
     Point               location;       // Caret location at which the list is opened
     wxImageList*        imgList;
     wxArrayInt*         imgTypeMap;
+/* C::B begin */
+    int                 technology;
+/* C::B end */

public:
     ListBoxImpl();



This is the patch I use. I tested it under with scale 100% and scale 125, and it works OK.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.