mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-25 15:20:31 -04:00
Add APRS Receiving App
This commit is contained in:
parent
de92faf67b
commit
f15cf78101
18 changed files with 1722 additions and 16 deletions
|
@ -597,11 +597,14 @@ Console::Console(
|
|||
void Console::clear(bool clear_buffer = false) {
|
||||
if(clear_buffer)
|
||||
buffer.clear();
|
||||
|
||||
display.fill_rectangle(
|
||||
screen_rect(),
|
||||
Color::black()
|
||||
);
|
||||
|
||||
if(!hidden() && visible()){
|
||||
display.fill_rectangle(
|
||||
screen_rect(),
|
||||
Color::black()
|
||||
);
|
||||
}
|
||||
|
||||
pos = { 0, 0 };
|
||||
}
|
||||
|
||||
|
@ -648,8 +651,7 @@ void Console::write(std::string message) {
|
|||
}
|
||||
|
||||
void Console::writeln(std::string message) {
|
||||
write(message);
|
||||
write("\n");
|
||||
write(message + "\n");
|
||||
//crlf();
|
||||
}
|
||||
|
||||
|
@ -658,18 +660,31 @@ void Console::paint(Painter&) {
|
|||
}
|
||||
|
||||
void Console::on_show() {
|
||||
const auto screen_r = screen_rect();
|
||||
display.scroll_set_area(screen_r.top(), screen_r.bottom());
|
||||
display.scroll_set_position(0);
|
||||
enable_scrolling(true);
|
||||
clear();
|
||||
//visible = true;
|
||||
}
|
||||
|
||||
bool Console::scrolling_enabled = false;
|
||||
|
||||
void Console::enable_scrolling(bool enable){
|
||||
if(enable){
|
||||
const auto screen_r = screen_rect();
|
||||
display.scroll_set_area(screen_r.top(), screen_r.bottom());
|
||||
display.scroll_set_position(0);
|
||||
scrolling_enabled = true;
|
||||
}
|
||||
else {
|
||||
display.scroll_disable();
|
||||
scrolling_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Console::on_hide() {
|
||||
/* TODO: Clear region to eliminate brief flash of content at un-shifted
|
||||
* position?
|
||||
*/
|
||||
display.scroll_disable();
|
||||
enable_scrolling(false);
|
||||
//visible = false;
|
||||
}
|
||||
|
||||
|
@ -682,6 +697,9 @@ void Console::crlf() {
|
|||
pos = { 0, pos.y() + line_height };
|
||||
const int32_t y_excess = pos.y() + line_height - sr.height();
|
||||
if( y_excess > 0 ) {
|
||||
if(!scrolling_enabled){
|
||||
enable_scrolling(true);
|
||||
}
|
||||
display.scroll(-y_excess);
|
||||
pos = { pos.x(), pos.y() - y_excess };
|
||||
|
||||
|
@ -1293,9 +1311,9 @@ size_t OptionsField::selected_index_value() const {
|
|||
return options[selected_index_].second;
|
||||
}
|
||||
|
||||
void OptionsField::set_selected_index(const size_t new_index) {
|
||||
void OptionsField::set_selected_index(const size_t new_index, bool trigger_change) {
|
||||
if( new_index < options.size() ) {
|
||||
if( new_index != selected_index() ) {
|
||||
if( new_index != selected_index() || trigger_change) {
|
||||
selected_index_ = new_index;
|
||||
if( on_change ) {
|
||||
on_change(selected_index(), options[selected_index()].second);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue