mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Made back button always focusable with left key
This commit is contained in:
parent
6464cfeaef
commit
eff96276c3
@ -89,6 +89,7 @@ SystemStatusView::SystemStatusView() {
|
|||||||
&sd_card_status_view,
|
&sd_card_status_view,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
button_back.id = -1; // Special ID used by FocusManager
|
||||||
title.set_style(&style_systemstatus);
|
title.set_style(&style_systemstatus);
|
||||||
|
|
||||||
if (!portapack::persistent_memory::ui_config_textentry())
|
if (!portapack::persistent_memory::ui_config_textentry())
|
||||||
|
@ -49,8 +49,6 @@ size_t StreamOutput::read(void* const data, const size_t length) {
|
|||||||
// We need a full buffer...
|
// We need a full buffer...
|
||||||
if( !fifo_buffers_full.out(active_buffer) ) {
|
if( !fifo_buffers_full.out(active_buffer) ) {
|
||||||
// ...but none are available. Samples were dropped.
|
// ...but none are available. Samples were dropped.
|
||||||
//active_buffer = nullptr; // Testing ! Jumpstart
|
|
||||||
creg::m4txevent::assert();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,12 @@ private:
|
|||||||
|
|
||||||
FIFO<StreamBuffer*> fifo_buffers_empty;
|
FIFO<StreamBuffer*> fifo_buffers_empty;
|
||||||
FIFO<StreamBuffer*> fifo_buffers_full;
|
FIFO<StreamBuffer*> fifo_buffers_full;
|
||||||
std::array<StreamBuffer, buffer_count_max> buffers;
|
std::array<StreamBuffer, buffer_count_max> buffers { };
|
||||||
std::array<StreamBuffer*, buffer_count_max> buffers_empty;
|
std::array<StreamBuffer*, buffer_count_max> buffers_empty { };
|
||||||
std::array<StreamBuffer*, buffer_count_max> buffers_full;
|
std::array<StreamBuffer*, buffer_count_max> buffers_full { };
|
||||||
StreamBuffer* active_buffer { nullptr };
|
StreamBuffer* active_buffer { nullptr };
|
||||||
ReplayConfig* const config { nullptr };
|
ReplayConfig* const config { nullptr };
|
||||||
std::unique_ptr<uint8_t[]> data;
|
std::unique_ptr<uint8_t[]> data { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif/*__STREAM_OUTPUT_H__*/
|
#endif/*__STREAM_OUTPUT_H__*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -162,6 +163,13 @@ void FocusManager::update(
|
|||||||
|
|
||||||
return { nullptr, 0 };
|
return { nullptr, 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto find_back_fn = [](ui::Widget* const w) -> test_result_t {
|
||||||
|
if( w->focusable() && (w->id == -1) )
|
||||||
|
return { w, 0 };
|
||||||
|
else
|
||||||
|
return { nullptr, 0 };
|
||||||
|
};
|
||||||
|
|
||||||
test_collection_t collection;
|
test_collection_t collection;
|
||||||
widget_collect_visible(top_widget, test_fn, collection);
|
widget_collect_visible(top_widget, test_fn, collection);
|
||||||
@ -175,6 +183,14 @@ void FocusManager::update(
|
|||||||
//focus->blur();
|
//focus->blur();
|
||||||
const auto new_focus = (*nearest).first;
|
const auto new_focus = (*nearest).first;
|
||||||
set_focus_widget(new_focus);
|
set_focus_widget(new_focus);
|
||||||
|
} else {
|
||||||
|
if ((focus_widget()->id >= 0) && (event == KeyEvent::Left)) {
|
||||||
|
// Stuck left, move to back button
|
||||||
|
collection.clear();
|
||||||
|
widget_collect_visible(top_widget, find_back_fn, collection);
|
||||||
|
if (!collection.empty())
|
||||||
|
set_focus_widget(collection[0].first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public:
|
|||||||
void set_style(const Style* new_style);
|
void set_style(const Style* new_style);
|
||||||
|
|
||||||
const Style& style() const;
|
const Style& style() const;
|
||||||
uint16_t id = 0;
|
int16_t id = 0;
|
||||||
|
|
||||||
// State management methods.
|
// State management methods.
|
||||||
void set_dirty();
|
void set_dirty();
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user