Reload Lua scripts when a function script is changed on COLORLCD
This commit is contained in:
committed by
Peter Feerick
parent
14f72e1d82
commit
28b211ff48
@@ -184,6 +184,7 @@ class SpecialFunctionEditPage : public Page
|
|||||||
[=](std::string newValue) {
|
[=](std::string newValue) {
|
||||||
strncpy(cfn->play.name, newValue.c_str(), sizeof(cfn->play.name));
|
strncpy(cfn->play.name, newValue.c_str(), sizeof(cfn->play.name));
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
},
|
},
|
||||||
true); // strip extension
|
true); // strip extension
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
@@ -648,6 +649,8 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
menu->addLine(STR_PASTE, [=]() {
|
menu->addLine(STR_PASTE, [=]() {
|
||||||
*cfn = clipboard.data.cfn;
|
*cfn = clipboard.data.cfn;
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
|
if (CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT)
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
rebuild(window, i);
|
rebuild(window, i);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -670,7 +673,11 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
});
|
});
|
||||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION) {
|
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION) {
|
||||||
menu->addLine(STR_PASTE, [=]() {
|
menu->addLine(STR_PASTE, [=]() {
|
||||||
|
if (CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT)
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
*cfn = clipboard.data.cfn;
|
*cfn = clipboard.data.cfn;
|
||||||
|
if (CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT)
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
rebuild(window, i);
|
rebuild(window, i);
|
||||||
});
|
});
|
||||||
@@ -686,6 +693,8 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
menu->addLine(STR_CLEAR, [=]() {
|
menu->addLine(STR_CLEAR, [=]() {
|
||||||
|
if (CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT)
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
memset(cfn, 0, sizeof(CustomFunctionData));
|
memset(cfn, 0, sizeof(CustomFunctionData));
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
rebuild(window, i);
|
rebuild(window, i);
|
||||||
@@ -693,6 +702,8 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
for (int j = i; j < MAX_SPECIAL_FUNCTIONS; j++) {
|
for (int j = i; j < MAX_SPECIAL_FUNCTIONS; j++) {
|
||||||
if (!functions[j].isEmpty()) {
|
if (!functions[j].isEmpty()) {
|
||||||
menu->addLine(STR_DELETE, [=]() {
|
menu->addLine(STR_DELETE, [=]() {
|
||||||
|
if (CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT)
|
||||||
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
memmove(
|
memmove(
|
||||||
cfn, cfn + 1,
|
cfn, cfn + 1,
|
||||||
(MAX_SPECIAL_FUNCTIONS - i - 1) * sizeof(CustomFunctionData));
|
(MAX_SPECIAL_FUNCTIONS - i - 1) * sizeof(CustomFunctionData));
|
||||||
|
|||||||
Reference in New Issue
Block a user