mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibGUI+HackStudio: Simplify TextEditor gutter & ruler calculations
- Make gutter/ruler_content_rect() return rectangles relative to the TextEditor widget. - Re-order painting code to translate the Painter after the gutter/ruler has been painted, to use those coordinates. - Consistently put gutter before ruler in code, because that's the order they physically appear.
This commit is contained in:
parent
3676f5085e
commit
1a5159df73
3 changed files with 32 additions and 31 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -264,15 +265,15 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void theme_change_event(ThemeChangeEvent&) override;
|
||||
virtual void cursor_did_change();
|
||||
Gfx::IntRect ruler_content_rect(size_t line) const;
|
||||
Gfx::IntRect gutter_content_rect(size_t line) const;
|
||||
Gfx::IntRect ruler_content_rect(size_t line) const;
|
||||
|
||||
TextPosition text_position_at(Gfx::IntPoint) const;
|
||||
bool ruler_visible() const { return m_ruler_visible; }
|
||||
bool gutter_visible() const { return m_gutter_visible; }
|
||||
Gfx::IntRect content_rect_for_position(TextPosition const&) const;
|
||||
int ruler_width() const;
|
||||
int gutter_width() const;
|
||||
int ruler_width() const;
|
||||
|
||||
virtual void highlighter_did_set_spans(Vector<TextDocumentSpan> spans) final { document().set_spans(Syntax::HighlighterClient::span_collection_index, move(spans)); }
|
||||
|
||||
|
@ -346,8 +347,8 @@ private:
|
|||
Gfx::IntRect line_widget_rect(size_t line_index) const;
|
||||
void delete_selection();
|
||||
int content_x_for_position(TextPosition const&) const;
|
||||
Gfx::IntRect ruler_rect_in_inner_coordinates() const;
|
||||
Gfx::IntRect gutter_rect_in_inner_coordinates() const;
|
||||
Gfx::IntRect ruler_rect_in_inner_coordinates() const;
|
||||
Gfx::IntRect visible_text_rect_in_inner_coordinates() const;
|
||||
void recompute_all_visual_lines();
|
||||
void ensure_cursor_is_valid();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue