Hi Mitchell,
> Attached is a patch and zip against Scintilla 5.5.6 that implements ...
There are some warnings from compilers and linters so I made some more
changes that silenced these.
Type warnings and missing break from compilers:
--- a/src/ScintillaBase.cxx Mon May 12 11:38:13 2025 +1000
+++ b/src/ScintillaBase.cxx Mon May 12 13:20:11 2025 +1000
@@ -974,10 +974,11 @@
return vs.autocStyle;
case Message::AutoCSetImageScale:
- ac.imageScale = static_cast<int>(wParam) / 100.0;
+ ac.imageScale = static_cast<float>(wParam) / 100.0f;
+ break;
case Message::AutoCGetImageScale:
- return ac.imageScale * 100;
+ return static_cast<int>(ac.imageScale * 100);
case Message::RegisterImage:
ac.lb->RegisterImage(static_cast<int>(wParam), ConstCharPtrFromSPtr(lParam));
No initialisation from cppcheck:
--- a/src/Platform.h Mon May 12 11:38:13 2025 +1000
+++ b/src/Platform.h Mon May 12 13:20:11 2025 +1000
@@ -317,7 +317,7 @@
std::optional<ColourRGBA> foreSelected;
std::optional<ColourRGBA> backSelected;
AutoCompleteOption options=AutoCompleteOption::Normal;
- float imageScale;
+ float imageScale=1.0f;
};
class ListBox : public Window {
scripts/HeaderCheck.py:
--- a/scripts/HeaderOrder.txt Mon May 12 11:38:13 2025 +1000
+++ b/scripts/HeaderOrder.txt Mon May 12 13:20:11 2025 +1000
@@ -71,6 +71,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkwayland.h>
#include <gtk/gtk-a11y.h>
+#include <cairo/cairo-gobject.h>
// Windows headers
#include <windows.h>
> The only questionable bit in my opinion is the GTK implementation switches the list store image column type to CAIRO_GOBJECT_TYPE_SURFACE from GDK_TYPE_PIXBUF. Not only does this require the <cairo/cairo-gobject.h> header (which is included with my default libgtk-3-dev installation),
If this may be missing, there may be a need for a more complex check
with a __has_include(<cairo/cairo-gobject.h>)
> but it also performs a copy for each pixbuf to be included in the list. This copy is necessary because Cairo surfaces store device scale, not GDK Pixbufs[2]. The list store takes ownership of the surface (it’s a boxed pointer), and will free it when done[3]. I was not able to figure out how to create a Cairo surface from an incoming pixbuf, g_object_ref() it, and pass it to the list store directly (thus avoiding copies and a premature deallocation).
I was originally unconcerned but this is a new allocation for each row
that shows an image. Probably not too bad in normal use.
Neil