Refined Tx Random Data (Still WIP) (#1616)

* managing initial cursor
* work on adding marked cursors
This commit is contained in:
Netro 2023-11-30 15:57:22 -05:00 committed by GitHub
parent cca0e18f5a
commit b7b4a10485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 134 additions and 26 deletions

View file

@ -59,7 +59,7 @@ class TextViewer : public Widget {
bool on_key(KeyEvent key) override;
bool on_encoder(EncoderEvent delta) override;
void redraw(bool redraw_text = false);
void redraw(bool redraw_text = false, bool redraw_marked = false);
void set_file(FileWrapper& file) { reset_file(&file); }
void clear_file() { reset_file(); }
@ -71,6 +71,11 @@ class TextViewer : public Widget {
void cursor_home();
void cursor_end();
void cursor_set(uint16_t line, uint16_t col);
void cursor_mark_selected();
typedef std::pair<uint16_t, uint16_t> LineColPair;
std::vector<LineColPair> pairedVector{};
// Gets the length of the current line.
uint16_t line_length();
@ -97,6 +102,7 @@ class TextViewer : public Widget {
void paint_text(Painter& painter, uint32_t line, uint16_t col);
void paint_cursor(Painter& painter);
void paint_marked(Painter& painter);
void reset_file(FileWrapper* file = nullptr);
@ -111,6 +117,8 @@ class TextViewer : public Widget {
uint32_t first_line{};
uint16_t first_col{};
bool redraw_text{true};
bool redraw_marked{false};
bool mark_change{true};
} paint_state_{};
struct {
@ -121,6 +129,8 @@ class TextViewer : public Widget {
// Pixel buffer used for cursor XOR'ing - Max cursor width = Max char width + 1
ColorRGB888 pixel_buffer8[ui::char_width + 1]{};
Color pixel_buffer[ui::char_width + 1]{};
bool mark_change{true};
} cursor_{};
};