[PATCH] Unreadable zoom-in using dark backgrounds

ZoiDiCabra <[email protected]> Tue, 3 May 2022 11:16:02 -0300
Newsgroups gmane.comp.graphics.gnuplot.bugs
Message-ID <CAJKZumwueaY2yXpkbR4xDMkGnenzEPe9ZYMSO4OG8xTc2HwctQ@mail.gmail.com>
I was doing some experiments with dark mode graphs and realized that the
zoom selection box is not visible (black on black) in wxt if the background
is set to '#000000'. So here's a patch:

diff --git a/src/wxterminal/wxt_gui.cpp b/src/wxterminal/wxt_gui.cpp
index 20efa9ae3..caac6e2c1 100644
--- a/src/wxterminal/wxt_gui.cpp
+++ b/src/wxterminal/wxt_gui.cpp
@@ -1088,14 +1088,18 @@ void wxtPanel::DrawToDC(wxDC &dc, wxRegion &region)

 #ifdef USE_MOUSE
        if (wxt_zoombox) {
-               tmp_pen = wxPen(wxT("black"), 1, wxPENSTYLE_SOLID);
-               tmp_pen.SetCap( wxCAP_ROUND );
-               dc.SetPen( tmp_pen );
 #ifndef __WXOSX_COCOA__
                /* wx 2.9 Cocoa bug workaround, which has no logical
functions support */
 #if (GTK_MAJOR_VERSION < 3)
+               tmp_pen = wxPen(wxT("white"), 1, wxPENSTYLE_SOLID);
+               tmp_pen.SetCap( wxCAP_ROUND );
+               dc.SetPen( tmp_pen );
                dc.SetLogicalFunction( wxINVERT );
 #endif
+#else
+               tmp_pen = wxPen(wxT("black"), 1, wxPENSTYLE_SOLID);
+               tmp_pen.SetCap( wxCAP_ROUND );
+               dc.SetPen( tmp_pen );
 #endif
                dc.DrawLine( zoom_x1, zoom_y1, mouse_x, zoom_y1 );
                dc.DrawLine( mouse_x, zoom_y1, mouse_x, mouse_y );

Details:
system: gnuplot 5.4 patchlevel 3 (Arch Linux)
patched branch: gnuplot branch-5-4-stable

Testing process:

$ gnuplot -e "set term wxt background '#000000'" -c demo/airfoil.dem

Verified that the zoom selection box is not visible (black on black)

$ gnuplot -e "set term wxt" -c demo/airfoil.dem

Verified that the zoom selection box is visible (black on white).

Patched the file src/wxterminal/wxt_gui.cpp

$ ./src/gnuplot -e "set term wxt background '#000000'" -c demo/airfoil.dem

Verified that the zoom selection box is now visible (white on black).

./src/gnuplot -e "set term wxt" -c demo/airfoil.dem

Verified that the zoom selection box is still visible (different blending
mode though).
I'm not able to test in a macOS environment.

I can provide screenshots and other details if required

_______________________________________________
gnuplot-bugs mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-bugs