lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2a7a791a 2/5: Don't use wxClientDC class unne


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2a7a791a 2/5: Don't use wxClientDC class unnecessarily
Date: Tue, 14 Feb 2023 19:30:36 -0500 (EST)

branch: master
commit 2a7a791a357db73c46282422cfb21eed6894f3c3
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Don't use wxClientDC class unnecessarily
    
    It is not really needed here as wxWindow itself provides the same
    GetTextExtent() function too and not using it makes the code shorter and
    simpler.
    
    No real changes.
---
 rounding_view_editor.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/rounding_view_editor.cpp b/rounding_view_editor.cpp
index cfe7b57f..a4e7a4d8 100644
--- a/rounding_view_editor.cpp
+++ b/rounding_view_editor.cpp
@@ -29,7 +29,6 @@
 
 #include <wx/bitmap.h>
 #include <wx/bmpbuttn.h>
-#include <wx/dcclient.h>                // class wxClientDC
 #include <wx/sizer.h>
 #include <wx/spinctrl.h>
 #include <wx/tglbtn.h>
@@ -228,12 +227,9 @@ wxSize RoundingButtons::CalculateMinimumTextControlSize
     ,unsigned int n
     )
 {
-    wxClientDC dc(window);
-    dc.SetFont(window->GetFont());
-
     wxCoord w, h;
     // Assume that 'W' is the widest letter.
-    dc.GetTextExtent("W", &w, &h);
+    window->GetTextExtent("W", &w, &h);
 
     wxSize size(w * n, h);
     size += window->GetSize() - window->GetClientSize();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]