Text entry should be more stable

Text entry now allows for strings greater than 28 chars
Frequency manager save with name bugfix
This commit is contained in:
furrtek 2017-06-11 02:53:06 +01:00
parent b3aa4bf0b9
commit 042d271a9f
15 changed files with 116 additions and 125 deletions

View file

@ -33,9 +33,9 @@ namespace ui {
class HandWriteView : public View {
public:
std::function<void(std::string)> on_changed { };
std::function<void(std::string*)> on_changed { };
HandWriteView(NavigationView& nav, std::string& txt, size_t max_length);
HandWriteView(NavigationView& nav, std::string * str, size_t max_length);
HandWriteView(const HandWriteView&) = delete;
HandWriteView(HandWriteView&&) = delete;
@ -45,19 +45,19 @@ public:
void paint(Painter& painter) override;
void on_show() override;
bool on_touch(const TouchEvent event) override;
std::string value();
std::string title() const override { return "Text entry"; };
private:
const char special_chars[5] = {'\'', '.', '?', '!', '='};
const HandWriting * handwriting { };
Painter * _painter { };
size_t _max_length;
uint8_t dir_cnt { 0 };
uint8_t dir_prev { 0 };
uint8_t flash_timer { 0 };
uint8_t txtidx { 0 };
uint32_t cursor_pos { 0 };
bool cursor { false };
bool tracing { false };
uint8_t stroke_index { 0 };
@ -65,7 +65,7 @@ private:
uint8_t stroke_list[8];
Point start_pos { }, current_pos { }, last_pos { };
bool _lowercase = false;
std::string txtinput { "" }; // 28 chars max
std::string * _str { };
void sample_pen();
void add_stroke(uint8_t dir);