[LyX/master] Simplify notation to use Point class and mark a function const
Koji Yokota <[email protected]> Thu, 25 Jun 2026 00:59:27 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit eb9679b74d794a8b26eaa0b9132b486b0f0ec03b Author: Koji Yokota <[email protected]> Date: Thu Jun 25 09:40:44 2026 +0900 Simplify notation to use Point class and mark a function const --- src/frontends/InputMethod.h | 3 ++- src/frontends/qt/GuiInputMethod.cpp | 16 ++++++++-------- src/frontends/qt/GuiInputMethod.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/frontends/InputMethod.h b/src/frontends/InputMethod.h index cd5e1845a0..6cc45876d3 100644 --- a/src/frontends/InputMethod.h +++ b/src/frontends/InputMethod.h @@ -12,6 +12,7 @@ #ifndef INPUTMETHOD_H #define INPUTMETHOD_H +#include "Dimension.h" #include "support/docstring.h" #include "support/types.h" #include <vector> @@ -89,7 +90,7 @@ public: /// virtual void clearElemsCoordinates() = 0; /// - virtual std::vector<std::array<int,2>> elemsCoordinates() = 0; + virtual std::vector<Point> elemsCoordinates() const = 0; #ifdef Q_DEBUG /// virtual void setHint(Hint) = 0; diff --git a/src/frontends/qt/GuiInputMethod.cpp b/src/frontends/qt/GuiInputMethod.cpp index 79fea2e7ae..9f1d050967 100644 --- a/src/frontends/qt/GuiInputMethod.cpp +++ b/src/frontends/qt/GuiInputMethod.cpp @@ -93,7 +93,7 @@ struct GuiInputMethod::Private pos_type anchor_pos_ = 0; pos_type abs_pos_; - std::vector<std::array<int,2>> elems_coords_; + std::vector<Point> elems_coords_; bool real_boundary_ = false; bool virtual_boundary_ = false; @@ -816,14 +816,14 @@ void GuiInputMethod::setCaretRectangle() LASSERT(d->caret_elem_.index < (pos_type)d->elems_coords_.size(), return); if (d->im_state_.composing_mode_) { - x = d->elems_coords_[d->caret_elem_.index][0] + preeditCaretOffset(); - y = d->elems_coords_[d->caret_elem_.index][1]; + x = d->elems_coords_[d->caret_elem_.index].x + preeditCaretOffset(); + y = d->elems_coords_[d->caret_elem_.index].y; } else { - x = d->elems_coords_[d->caret_elem_.index][0]; - y = d->elems_coords_[d->caret_elem_.index][1]; + x = d->elems_coords_[d->caret_elem_.index].x; + y = d->elems_coords_[d->caret_elem_.index].y; } - d->im_state_.anchor_rect_.setRect(d->elems_coords_[0][0], - d->elems_coords_[0][1], + d->im_state_.anchor_rect_.setRect(d->elems_coords_[0].x, + d->elems_coords_[0].y, d->cur_dim_.width(), d->cur_dim_.height()); d->im_state_.cursor_rect_.setRect(x, y, d->cur_dim_.width(), @@ -891,7 +891,7 @@ void GuiInputMethod::setElemsCoordinates(int x, int y) d->elems_coords_.push_back({x,y}); } -std::vector<std::array<int, 2> > GuiInputMethod::elemsCoordinates() +std::vector<Point> GuiInputMethod::elemsCoordinates() const { return d->elems_coords_; } diff --git a/src/frontends/qt/GuiInputMethod.h b/src/frontends/qt/GuiInputMethod.h index 8c02673af4..9945b7f4b5 100644 --- a/src/frontends/qt/GuiInputMethod.h +++ b/src/frontends/qt/GuiInputMethod.h @@ -123,7 +123,7 @@ public: /// Whether the segment contains language that allows wrapping anywhere bool canWrapAnywhere(pos_type const) override; void setElemsCoordinates(int x, int y) override; - std::vector<std::array<int,2>> elemsCoordinates() override; + std::vector<Point> elemsCoordinates() const override; void clearElemsCoordinates() override; Q_SIGNALS: void preeditProcessed(QInputMethodEvent* ev); -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs