-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMainMenu.h
executable file
·110 lines (81 loc) · 2.87 KB
/
MainMenu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef MainMenu_H
#define MainMenu_H
#include "AppData.h"
#include <stdint.h>
#include <string>
#include <vector>
#define MAX_MENU_ENTRIES 1024
class MainMenu
{
public:
MainMenu();
// encoder events
void encoderPress(void);
void encoderRelease(void);
void encoderUp(void);
void encoderDown(void);
void programChange(int pgm);
void nextProgram();
void buildMenu(int = -1);
void reload();
void reloadNoRemount();
bool loadPatch(const char* patchname);
void runShutdown(const char* name,const char* arg);
enum MenuMode {
M_MAIN,
M_STORAGE,
M_SETTINGS,
M_EXTRA,
M_MAX_ENTRIES
};
private:
void drawPatchList(void);
int checkFileExists (const std::string& file);
int execShell(const std::string& cmd, const std::string& wd);
int execScript(const std::string& script);
int execPython(const std::string& pyscript, const std::string& wd);
void setEnv(const std::string& workdir);
bool isMotherPdCompatible(const std::string& motherpd);
void addMenuItem(int i, const char* name, const char* arg, void (MainMenu::* func) (const char*, const char*));
std::string getCmdOptions(const std::string& file);
struct MenuItem {
char name[22];
char arg[256];
void (MainMenu::* func) (const char*, const char*);
};
void runPatch(const char* name,const char*);
void runScriptCommand(const char* name,const char* arg);
void runScriptPython(const char* name,const char* arg);
void runSystemCommand(const char* name,const char*);
void runSystemPython(const char* name,const char*);
void runDoNothing(const char* name,const char*);
void runReload(const char* name,const char* arg);
void runEject(const char* name,const char* arg);
void runCdPatchDirectory(const char* name,const char*);
void runCdPatchHome(const char* name,const char*);
void runCdSystemDirectory(const char* name,const char*);
void runCdSystemHome(const char* name,const char*);
void runInstaller(const char* name,const char*);
void runFavourite(const char* name,const char*);
void runToggleFavourites(const char* name,const char*);
void runCdMenu(const char*,const char*);
void runAddToFavourite(const char* name,const char*);
void runDelFromFavourite(const char* name,const char*);
MenuItem menuItems[MAX_MENU_ENTRIES];
int numMenuEntries;
int selectedEntry; // index in patches
int menuOffset; // position of cursor
int cursorOffset;
int systemMenuOffset;
int systemUserMenuOffset;
int patchMenuOffset;
int presetMenuOffset;
int numSystemItems;
int numPatches;
int numPresets;
bool actionTrigger;
MenuMode currentMenu;
bool favouriteMenu;
void executeAction(void (MainMenu::*)(const char*, const char*),const char*, const char*);
};
#endif