mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-04-18 06:56:03 -04:00
format
This commit is contained in:
parent
de07691420
commit
502f39b141
@ -566,7 +566,7 @@ void FileManagerView::on_rename(std::string_view hint) {
|
||||
cursor_pos = pos;
|
||||
|
||||
text_prompt(
|
||||
nav_, name_buffer, cursor_pos, max_filename_length,0,
|
||||
nav_, name_buffer, cursor_pos, max_filename_length, 0,
|
||||
[this](std::string& renamed) {
|
||||
auto renamed_path = fs::path{renamed};
|
||||
rename_file(get_selected_full_path(), current_path / renamed_path);
|
||||
@ -640,7 +640,7 @@ void FileManagerView::on_clean() {
|
||||
|
||||
void FileManagerView::on_new_dir() {
|
||||
name_buffer = "";
|
||||
text_prompt(nav_, name_buffer, max_filename_length,0, [this](std::string& dir_name) {
|
||||
text_prompt(nav_, name_buffer, max_filename_length, 0, [this](std::string& dir_name) {
|
||||
make_new_directory(current_path / dir_name);
|
||||
reload_current(true);
|
||||
});
|
||||
@ -671,7 +671,7 @@ void FileManagerView::on_paste() {
|
||||
|
||||
void FileManagerView::on_new_file() {
|
||||
name_buffer = "";
|
||||
text_prompt(nav_, name_buffer, max_filename_length,0, [this](std::string& file_name) {
|
||||
text_prompt(nav_, name_buffer, max_filename_length, 0, [this](std::string& file_name) {
|
||||
make_new_file(current_path / file_name);
|
||||
reload_current(true);
|
||||
});
|
||||
|
@ -240,7 +240,7 @@ void FrequencyManagerView::on_edit_freq() {
|
||||
|
||||
void FrequencyManagerView::on_edit_desc() {
|
||||
temp_buffer_ = current_entry().description;
|
||||
text_prompt(nav_, temp_buffer_, freqman_max_desc_size,0, [this](std::string& new_desc) {
|
||||
text_prompt(nav_, temp_buffer_, freqman_max_desc_size, 0, [this](std::string& new_desc) {
|
||||
auto entry = current_entry();
|
||||
entry.description = std::move(new_desc);
|
||||
db_.replace_entry(current_index(), entry);
|
||||
@ -250,7 +250,7 @@ void FrequencyManagerView::on_edit_desc() {
|
||||
|
||||
void FrequencyManagerView::on_add_category() {
|
||||
temp_buffer_.clear();
|
||||
text_prompt(nav_, temp_buffer_, 20,0, [this](std::string& new_name) {
|
||||
text_prompt(nav_, temp_buffer_, 20, 0, [this](std::string& new_name) {
|
||||
if (!new_name.empty()) {
|
||||
create_freqman_file(new_name);
|
||||
refresh_categories();
|
||||
|
@ -153,7 +153,7 @@ void POCSAGTXView::paint(Painter&) {
|
||||
}
|
||||
|
||||
void POCSAGTXView::on_set_text(NavigationView& nav) {
|
||||
text_prompt(nav, buffer, MAX_POCSAG_LENGTH,0);
|
||||
text_prompt(nav, buffer, MAX_POCSAG_LENGTH, 0);
|
||||
}
|
||||
|
||||
POCSAGTXView::POCSAGTXView(
|
||||
|
@ -82,7 +82,7 @@ ReconSetupViewMain::ReconSetupViewMain(NavigationView& nav, Rect parent_rect, st
|
||||
};
|
||||
|
||||
button_choose_output_name.on_select = [this, &nav](Button&) {
|
||||
text_prompt(nav, _output_file, 28, 0,[this](std::string& buffer) {
|
||||
text_prompt(nav, _output_file, 28, 0, [this](std::string& buffer) {
|
||||
_output_file = buffer;
|
||||
button_choose_output_name.set_text(_output_file);
|
||||
});
|
||||
|
@ -105,7 +105,7 @@ void bind(TextField& field, T& value, NavigationView& nav, Fn fn = Fn{}) {
|
||||
// Capture a new string and make the lambda mutable so it can be modified.
|
||||
field.on_select = [&nav, buf = std::string{}](TextField& tf) mutable {
|
||||
buf = tf.get_text();
|
||||
text_prompt(nav, buf, /*max_length*/ 255,0,
|
||||
text_prompt(nav, buf, /*max_length*/ 255, 0,
|
||||
[&tf](std::string& str) {
|
||||
tf.set_text(str);
|
||||
});
|
||||
|
@ -212,7 +212,7 @@ MetronomeTapTempoView::MetronomeTapTempoView(NavigationView& nav, uint16_t bpm)
|
||||
nav_,
|
||||
input_buffer,
|
||||
3,
|
||||
1,
|
||||
1, /*enter number*/
|
||||
[this](std::string& buffer) {
|
||||
if (buffer.empty()) {
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ static msg_t loopthread_fn(void* arg) {
|
||||
}
|
||||
|
||||
void MorseView::on_set_text(NavigationView& nav) {
|
||||
text_prompt(nav, buffer, 28,0);
|
||||
text_prompt(nav, buffer, 28, 0);
|
||||
}
|
||||
|
||||
void MorseView::focus() {
|
||||
|
@ -264,7 +264,7 @@ OOKEditorAppView::OOKEditorAppView(NavigationView& nav)
|
||||
nav,
|
||||
ook_data.payload,
|
||||
100,
|
||||
1,
|
||||
1, /* enter number */
|
||||
[this](std::string& s) {
|
||||
text_payload.set(s);
|
||||
draw_waveform();
|
||||
|
@ -83,7 +83,7 @@ OOKBruteView::OOKBruteView(NavigationView& nav)
|
||||
nav_,
|
||||
text_input_buffer,
|
||||
8, // currently longest is princeton
|
||||
1, /*enter number*/
|
||||
1, /*enter number*/
|
||||
[this](std::string& buffer) {
|
||||
field_start.set_value(atoi(buffer.c_str()));
|
||||
validate_start_stop();
|
||||
@ -101,7 +101,7 @@ OOKBruteView::OOKBruteView(NavigationView& nav)
|
||||
nav_,
|
||||
text_input_buffer,
|
||||
8, // currently longest is princeton
|
||||
0,/*enter number*/
|
||||
0, /*enter number*/
|
||||
[this](std::string& buffer) {
|
||||
field_stop.set_value(atoi(buffer.c_str()));
|
||||
validate_start_stop();
|
||||
|
@ -330,7 +330,7 @@ RemoteAppView::RemoteAppView(
|
||||
|
||||
field_title.on_select = [this, &nav](TextField&) {
|
||||
temp_buffer_ = model_.name;
|
||||
text_prompt(nav_, temp_buffer_, text_edit_max, 0,[this](std::string& new_name) {
|
||||
text_prompt(nav_, temp_buffer_, text_edit_max, 0, [this](std::string& new_name) {
|
||||
model_.name = new_name;
|
||||
refresh_ui();
|
||||
set_needs_save();
|
||||
@ -339,7 +339,7 @@ RemoteAppView::RemoteAppView(
|
||||
|
||||
field_filename.on_select = [this, &nav](TextField&) {
|
||||
temp_buffer_ = remote_path_.stem().string();
|
||||
text_prompt(nav_, temp_buffer_, text_edit_max,0, [this](std::string& new_name) {
|
||||
text_prompt(nav_, temp_buffer_, text_edit_max, 0, [this](std::string& new_name) {
|
||||
rename_remote(new_name);
|
||||
refresh_ui();
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ SpectrumInputTextView::~SpectrumInputTextView() {
|
||||
}
|
||||
|
||||
void SpectrumInputTextView::on_set_text(NavigationView& nav) {
|
||||
text_prompt(nav, buffer, 300,0);
|
||||
text_prompt(nav, buffer, 300, 0);
|
||||
}
|
||||
|
||||
void SpectrumInputTextView::focus() {
|
||||
|
@ -37,7 +37,7 @@ namespace ui {
|
||||
|
||||
class AlphanumView : public TextEntryView {
|
||||
public:
|
||||
AlphanumView(NavigationView& nav, std::string& str, size_t max_length,uint8_t enter_mode);
|
||||
AlphanumView(NavigationView& nav, std::string& str, size_t max_length, uint8_t enter_mode);
|
||||
|
||||
AlphanumView(const AlphanumView&) = delete;
|
||||
AlphanumView(AlphanumView&&) = delete;
|
||||
|
@ -33,7 +33,7 @@ void text_prompt(
|
||||
size_t max_length,
|
||||
uint8_t mode,
|
||||
std::function<void(std::string&)> on_done) {
|
||||
text_prompt(nav, str, str.length(), max_length, mode,on_done);
|
||||
text_prompt(nav, str, str.length(), max_length, mode, on_done);
|
||||
}
|
||||
|
||||
void text_prompt(
|
||||
@ -43,7 +43,7 @@ void text_prompt(
|
||||
size_t max_length,
|
||||
uint8_t mode,
|
||||
std::function<void(std::string&)> on_done) {
|
||||
auto te_view = nav.push<AlphanumView>(str, max_length,mode);
|
||||
auto te_view = nav.push<AlphanumView>(str, max_length, mode);
|
||||
te_view->set_cursor(cursor_pos);
|
||||
te_view->on_changed = [on_done](std::string& value) {
|
||||
if (on_done)
|
||||
|
@ -70,7 +70,7 @@ void text_prompt(
|
||||
std::string& str,
|
||||
uint32_t cursor_pos,
|
||||
size_t max_length,
|
||||
uint8_t mode, // enter mode: 123 abc etc
|
||||
uint8_t mode, // enter mode: 123 abc etc
|
||||
std::function<void(std::string&)> on_done = nullptr);
|
||||
|
||||
} /* namespace ui */
|
||||
|
Loading…
x
Reference in New Issue
Block a user