commit 57a24fbe27e06ed628a61667205f57e8a76306ae
Author: Koji Yokota <[email protected]>
Date:   Tue Jul 15 22:23:43 2025 +0900

    Fix warnings from -Woverloaded-virtual
---
 src/MetricsInfo.cpp             | 16 ++++++++++------
 src/MetricsInfo.h               |  8 +++++---
 src/RowPainter.cpp              |  2 +-
 src/frontends/NullPainter.h     |  7 ++++---
 src/frontends/Painter.h         | 17 ++++++++++-------
 src/frontends/qt/GuiPainter.cpp | 19 ++++++++++---------
 src/frontends/qt/GuiPainter.h   | 18 ++++++++++--------
 src/insets/Inset.h              |  3 ---
 src/mathed/InsetMathChar.cpp    | 18 +++++++++---------
 src/mathed/InsetMathChar.h      |  6 +++---
 src/mathed/MathRow.cpp          |  5 ++++-
 11 files changed, 66 insertions(+), 53 deletions(-)

diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index c3e4fe878b..c7a5ab2a82 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -167,13 +167,9 @@ PainterInfo::PainterInfo(BufferView * bv, 
lyx::frontend::Painter & painter)
 }
 
 
-void PainterInfo::draw(int x, int y, char_type c, frontend::InputMethod const 
* im,
-                       pos_type const char_format_index)
+void PainterInfo::draw(int x, int y, char_type c)
 {
-       if (im == nullptr)
-               pain.text(x, y, c, base.font);
-       else
-               pain.text(x, y, c, im, char_format_index);
+       pain.text(x, y, c, base.font);
 }
 
 
@@ -183,6 +179,14 @@ void PainterInfo::draw(int x, int y, docstring const & str)
 }
 
 
+void PainterInfo::drawWithInputMethod(int x, int y, char_type c,
+                                      frontend::InputMethod const * im,
+                                      pos_type const char_format_index)
+{
+       pain.textWithInputMethod(x, y, c, im, char_format_index);
+}
+
+
 ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const
 {
        if (selected && sel)
diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h
index 064448c53a..061309d3e5 100644
--- a/src/MetricsInfo.h
+++ b/src/MetricsInfo.h
@@ -124,11 +124,13 @@ public:
        ///
        PainterInfo(BufferView * bv, frontend::Painter & pain);
        ///
-       void draw(int x, int y, char_type c,
-                 frontend::InputMethod const * im = nullptr,
-                 pos_type const char_format_index = 0);
+       void draw(int x, int y, char_type c);
        ///
        void draw(int x, int y, docstring const & str);
+       ///
+       void drawWithInputMethod(int x, int y, char_type c,
+                                frontend::InputMethod const * im,
+                                pos_type const char_format_index);
 
        /// Determines the background color based on the
        /// selection state, the background color inherited from the parent 
inset
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 3ee26b6096..4bafe87f58 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -256,7 +256,7 @@ void RowPainter::paintStringAndSel(Row::Element const & e) 
const
 
        if (e.type == Row::PREEDIT) {
                // the case of the preedit element
-               pi_.pain.text(int(x_), yo_, e.str, e.im, e.char_format_index);
+               pi_.pain.textWithInputMethod(int(x_), yo_, e.str, e.im, 
e.char_format_index);
        } else if (all_sel || e.change.changed()) {
                Font copy = e.font;
                Color const col = e.change.changed() ? e.change.color()
diff --git a/src/frontends/NullPainter.h b/src/frontends/NullPainter.h
index 9c656907b1..0c057dcf6a 100644
--- a/src/frontends/NullPainter.h
+++ b/src/frontends/NullPainter.h
@@ -66,9 +66,6 @@ public:
 
        /// draw a string
        void text(int, int, docstring const &, FontInfo const &, Direction 
const = Auto) override {}
-       /// draw a string with input method
-       void text(int, int, docstring const &, InputMethod const *, pos_type 
const,
-                 Direction const = Auto) override {}
 
        /// draw a char
        void text(int, int, char_type, FontInfo const &, Direction const = 
Auto) override {}
@@ -80,6 +77,10 @@ public:
        void text(int, int, docstring const &, Font const &,
                  Color, size_type, size_type, double, double) override {}
 
+       /// draw a string with input method
+       void textWithInputMethod(int, int, docstring const &, InputMethod const 
*,
+                                pos_type const, Direction const = Auto) 
override {}
+
        /// This painter does not paint
        bool isNull() const override { return true; }
 
diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h
index d10e4db8f6..aa2ec4303d 100644
--- a/src/frontends/Painter.h
+++ b/src/frontends/Painter.h
@@ -142,17 +142,10 @@ public:
        /// draw a string at position x, y (y is the baseline).
        virtual void text(int x, int y, docstring const & str, FontInfo const & 
f,
                          Direction const dir = Auto) = 0;
-       /// draw a string at position x, y (y is the baseline) using input 
method.
-       virtual void text(int x, int y, docstring const & str,
-                         InputMethod const * im, pos_type const 
char_format_index,
-                         Direction const dir = Auto) = 0;
 
        /// draw a char at position x, y (y is the baseline)
        virtual void text(int x, int y, char_type c, FontInfo const & f,
                          Direction const dir = Auto) = 0;
-       /// draw a char at position x, y (y is the baseline) using input method
-       virtual void text(int, int, char_type, InputMethod const *,
-                         pos_type const, Direction const = Auto) {}
        /** draw a string at position x, y (y is the baseline). The
         * text direction is enforced by the \c Font.
         */
@@ -167,6 +160,16 @@ public:
                          Color other, size_type from, size_type to,
                       double wordspacing, double textwidth) = 0;
 
+       /// draw a char at position x, y (y is the baseline) using input method
+       virtual void textWithInputMethod(int, int, char_type, InputMethod const 
*,
+                                        pos_type const, Direction const = 
Auto) {}
+
+       /// draw a string at position x, y (y is the baseline) using input 
method.
+       virtual void textWithInputMethod(int x, int y, docstring const & str,
+                                        InputMethod const * im,
+                                        pos_type const char_format_index,
+                                        Direction const dir = Auto) = 0;
+
        // Returns true if the painter does not actually paint.
        virtual bool isNull() const = 0;
 
diff --git a/src/frontends/qt/GuiPainter.cpp b/src/frontends/qt/GuiPainter.cpp
index 0e705dcaf3..c16a1dc86a 100644
--- a/src/frontends/qt/GuiPainter.cpp
+++ b/src/frontends/qt/GuiPainter.cpp
@@ -288,13 +288,6 @@ void GuiPainter::text(int x, int y, char_type c, FontInfo 
const & f, Direction c
 }
 
 
-void GuiPainter::text(int x, int y, char_type c, InputMethod const * im,
-                      pos_type const char_format_index, Direction const dir)
-{
-       text(x, y, docstring(1, c), im, char_format_index, dir);
-}
-
-
 void GuiPainter::text(int x, int y, docstring const & s, FontInfo const & f, 
Direction const dir)
 {
        text(x, y, s, f, dir, 0.0, 0.0);
@@ -351,9 +344,17 @@ void GuiPainter::text(int x, int y, docstring const & s,
 }
 
 
-void GuiPainter::text(int x, int y, docstring const & s,
-                      InputMethod const * im,
+void GuiPainter::textWithInputMethod(int x, int y, char_type c, InputMethod 
const * im,
                       pos_type const char_format_index, Direction const dir)
+{
+       textWithInputMethod(x, y, docstring(1, c), im, char_format_index, dir);
+}
+
+
+void GuiPainter::textWithInputMethod(int x, int y, docstring const & s,
+                                     InputMethod const * im,
+                                     pos_type const char_format_index,
+                                     Direction const dir)
 {
        if (s.empty())
                return;
diff --git a/src/frontends/qt/GuiPainter.h b/src/frontends/qt/GuiPainter.h
index 88b102102d..fb98fd3c89 100644
--- a/src/frontends/qt/GuiPainter.h
+++ b/src/frontends/qt/GuiPainter.h
@@ -117,18 +117,10 @@ public:
        /// draw a string at position x, y (y is the baseline).
        void text(int x, int y, docstring const & str, FontInfo const & f,
                  Direction const dir = Auto) override;
-       /// draw a string at position x, y (y is the baseline) using input 
method.
-       void text(int x, int y, docstring const & str, InputMethod const * im,
-                 pos_type const char_format_index,
-                 Direction const dir = Auto) override;
 
        /// draw a char at position x, y (y is the baseline)
        void text(int x, int y, char_type c, FontInfo const & f,
                  Direction const dir = Auto) override;
-       /// draw a char at position x, y (y is the baseline) using input method
-       void text(int x, int y, char_type c, InputMethod const * im,
-                 pos_type const char_format_index,
-                 Direction const dir = Auto) override;
 
        /** draw a string at position x, y (y is the baseline). The
         * text direction is enforced by the \c Font.
@@ -144,6 +136,16 @@ public:
                          Color other, size_type from, size_type to,
                       double wordspacing, double textwidth) override;
 
+       /// draw a string at position x, y (y is the baseline) using input 
method.
+       void textWithInputMethod(int x, int y, docstring const & str,
+                                InputMethod const * im,
+                                pos_type const char_format_index,
+                                Direction const dir = Auto) override;
+       /// draw a char at position x, y (y is the baseline) using input method
+       void textWithInputMethod(int x, int y, char_type c, InputMethod const * 
im,
+                                pos_type const char_format_index,
+                                Direction const dir = Auto) override;
+
        ///
        void textDecoration(FontInfo const & f, int x, int y, int width) 
override;
 
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 1392223d5d..2033ffd204 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -213,9 +213,6 @@ public:
        virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
        /// draw inset and update (xo, yo)-cache
        virtual void draw(PainterInfo & pi, int x, int y) const = 0;
-       /// draw inset and update (xo, yo)-cache
-       virtual void draw(PainterInfo &, int, int, frontend::InputMethod const 
*,
-                         pos_type const) const {}
        /// draw inset selection if necessary
        virtual void drawSelection(PainterInfo &, int, int) const {}
        /// draw inset background if the inset has an own background and a
diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp
index a18520633a..3179589fd5 100644
--- a/src/mathed/InsetMathChar.cpp
+++ b/src/mathed/InsetMathChar.cpp
@@ -155,14 +155,6 @@ void InsetMathChar::metrics(MetricsInfo & mi, Dimension & 
dim) const
 
 
 void InsetMathChar::draw(PainterInfo & pi, int x, int y) const
-{
-       draw(pi, x, y, nullptr, 0);
-}
-
-
-void InsetMathChar::draw(PainterInfo & pi, int x, int y,
-                         frontend::InputMethod const * im,
-                         pos_type const char_format_index) const
 {
        // lyxerr << "drawing '" << char_ << "' font: " << pi.base.fontname << 
std::endl;
        if (isMathFont(pi.base.fontname)) {
@@ -195,7 +187,15 @@ void InsetMathChar::draw(PainterInfo & pi, int x, int y,
        if (pi.base.fontname == "mathnormal") {
                x += max(-theFontMetrics(pi.base.font).lbearing(char_), 0);
        }
-       pi.draw(x, y, char_, im, char_format_index);
+       pi.draw(x, y, char_);
+}
+
+
+void InsetMathChar::drawWithInputMethod(PainterInfo & pi, int x, int y,
+                         frontend::InputMethod const * im,
+                         pos_type const char_format_index) const
+{
+       pi.drawWithInputMethod(x, y, char_, im, char_format_index);
 }
 
 
diff --git a/src/mathed/InsetMathChar.h b/src/mathed/InsetMathChar.h
index de7937d939..9ceaa3dff1 100644
--- a/src/mathed/InsetMathChar.h
+++ b/src/mathed/InsetMathChar.h
@@ -28,9 +28,9 @@ public:
        ///
        void draw(PainterInfo & pi, int x, int y) const override;
        ///
-       void draw(PainterInfo & pi, int x, int y,
-                 frontend::InputMethod const * im,
-                 pos_type const char_format_index) const override;
+       void drawWithInputMethod(PainterInfo & pi, int x, int y,
+                                frontend::InputMethod const * im,
+                                pos_type const char_format_index) const;
        ///
        void metricsT(TextMetricsInfo const & mi, Dimension & dim) const 
override;
        ///
diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index aca6a3d805..2507f23199 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -12,6 +12,7 @@
 
 #include "MathRow.h"
 
+#include "InsetMathChar.h"
 #include "MathData.h"
 #include "MathSupport.h"
 
@@ -344,7 +345,9 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) 
const
                        if (e.im == nullptr)
                                e.inset->draw(pi, x + e.before, y);
                        else
-                               e.inset->draw(pi, x + e.before, y, e.im, 
e.char_format_index);
+                               e.inset->asInsetMath()->asCharInset()
+                                      ->drawWithInputMethod(pi, x + e.before, 
y, e.im,
+                                                            
e.char_format_index);
                        g.pos = {x, y};
                        g.dim.wid += e.before + e.after;
                        drawMarkers(pi, e, x, y);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to