Skip to content

Commit

Permalink
fix delete_preset
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Sep 3, 2024
1 parent 59e43d7 commit 7db49a7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions modes/menu_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ template<class CMD, class ARG, class SOUND>
struct CommandMenuEntry : public MenuEntry {
void say(int entry) override { SOUND::say(); }
void select(int entry) override {
SoundLibrary::tSelect::say();
CommandParser::DoParse(CMD::str, ARG::str);
}
};
Expand Down
23 changes: 20 additions & 3 deletions modes/preset_modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ class ConfirmMenu : public MenuEntryMenu<SPEC,
ACTION_ENTRY,
PopMenuEntry<typename SPEC::SoundLibrary::tCancel>,
PopMenuEntry<typename SPEC::SoundLibrary::tCancel>
> {};
> {
// Don't remember position for this menu.
void mode_deactivate() override {
this->pos_ = 0;
}
};

template<class SPEC, class ACTION_ENTRY>
struct ConfirmDeletePresetMenu : public ConfirmMenu<SPEC, ACTION_ENTRY> {
Expand Down Expand Up @@ -46,8 +51,20 @@ using ConfirmCommandMenuEntry =
SubMenuEntry<ConfirmMenu<SPEC, CommandMenuEntry<CMD, ARG, SOUND>>, SOUND>;

template<class SPEC>
class DeletePresetSubMenuEntry : public SubMenuEntry<ConfirmDeletePresetMenu<SPEC, CommandMenuEntry<STRTYPE("delete_preset"), STRTYPE(""), typename SPEC::SoundLibrary::tDeletePreset>>, typename SPEC::SoundLibrary::tDeletePreset> {};

struct DeletePresetMenuEntry : public MenuEntry {
void say(int entry) override {
getSL<SPEC>()->SayDeletePreset();
}
void select(int entry) override {
getSL<SPEC>()->SaySelect();
CommandParser::DoParse("delete_preset", nullptr);
popMode();
popMode();
}
};

template<class SPEC>
class DeletePresetSubMenuEntry : public SubMenuEntry<ConfirmDeletePresetMenu<SPEC, DeletePresetMenuEntry<SPEC>>, typename SPEC::SoundLibrary::tDeletePreset> {};

int menu_selected_preset = -1;

Expand Down
2 changes: 1 addition & 1 deletion props/prop_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac
return true;
}

if (!strcmp(cmd, "delete_preset") && arg) {
if (!strcmp(cmd, "delete_preset")) {
current_preset_.SaveAt(-1);
return true;
}
Expand Down

0 comments on commit 7db49a7

Please sign in to comment.