mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 09:57:50 +00:00
fixing edit freq,edit desc, delete freq (#1117)
* fixing edit freq,edit desc, delete freq * fixing scrolling issues * fixing indent
This commit is contained in:
@@ -108,8 +108,19 @@ void FreqManUIList::paint(Painter& painter) {
|
||||
|
||||
void FreqManUIList::set_db(freqman_db& db) {
|
||||
freqlist_db = db;
|
||||
current_index = 0;
|
||||
highlighted_index = 0;
|
||||
if (db.size() == 0) {
|
||||
current_index = 0;
|
||||
highlighted_index = 0;
|
||||
} else {
|
||||
if ((unsigned)(current_index + highlighted_index) >= db.size()) {
|
||||
current_index = db.size() - 1 - highlighted_index;
|
||||
}
|
||||
if (current_index < 0) {
|
||||
current_index = 0;
|
||||
if (highlighted_index > 0)
|
||||
highlighted_index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FreqManUIList::on_focus() {
|
||||
|
@@ -56,8 +56,9 @@ class FreqManUIList : public Widget {
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_encoder(EncoderEvent delta) override;
|
||||
|
||||
void set_highlighted_index(int index); // set highlighted_index and return capped highlighted_index value to set in caller
|
||||
void set_highlighted_index(int index); // internal set highlighted_index in list handler
|
||||
uint8_t get_index(); // return highlighed + index
|
||||
uint8_t set_index(uint8_t index); // try to set current_index + highlighed from index, return capped index
|
||||
void set_db(freqman_db& db);
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user