refactor(color): classes used to manage models and labels, improve duplication UX (#7739)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
philmoz
Peter Feerick
Claude Opus 5.5
parent
61aa7a44c9
commit
6a1cf34079
@@ -2039,11 +2039,7 @@ void menuModelSetup(event_t event)
|
||||
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
uint8_t newVal = 0;
|
||||
#if defined(STORAGE_MODELSLIST)
|
||||
newVal = modelslist.findNextUnusedModelId(moduleIdx);
|
||||
#else
|
||||
newVal = findNextUnusedModelId(g_eeGeneral.currModel, moduleIdx);
|
||||
#endif
|
||||
if (newVal != g_model.header.modelId[moduleIdx]) {
|
||||
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx] = newVal;
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -173,7 +173,8 @@ void ConfirmDialog::onCancel()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LabelDialog::LabelDialog(const char *label, int length, const char* title,
|
||||
std::function<void(std::string)> _saveHandler) :
|
||||
std::function<void(std::string)> _saveHandler,
|
||||
const char* excludedChars) :
|
||||
ModalWindow(false), saveHandler(std::move(_saveHandler))
|
||||
{
|
||||
strncpy(this->label, label, std::min(length, MAX_LABEL_LENGTH));
|
||||
@@ -197,7 +198,9 @@ LabelDialog::LabelDialog(const char *label, int length, const char* title,
|
||||
lv_obj_set_flex_align(box->getLvObj(), LV_FLEX_ALIGN_CENTER,
|
||||
LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_BETWEEN);
|
||||
|
||||
new TextEdit(box, rect_t{0, 0, LV_PCT(100), 0}, this->label, length);
|
||||
auto edit = new TextEdit(box, rect_t{0, 0, LV_PCT(100), 0}, this->label, length);
|
||||
if (excludedChars)
|
||||
edit->setExcludedCharacters(excludedChars);
|
||||
|
||||
box = new Window(form, rect_t{});
|
||||
box->padAll(PAD_MEDIUM);
|
||||
|
||||
@@ -134,7 +134,8 @@ class LabelDialog : public ModalWindow
|
||||
{
|
||||
public:
|
||||
LabelDialog(const char *label, int length, const char* title,
|
||||
std::function<void(std::string)> _saveHandler = nullptr);
|
||||
std::function<void(std::string)> _saveHandler = nullptr,
|
||||
const char* excludedChars = nullptr);
|
||||
|
||||
static constexpr int MAX_LABEL_LENGTH = 255;
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@ class NumberEdit : public TextButton
|
||||
std::string prefix;
|
||||
std::string suffix;
|
||||
std::string zeroText;
|
||||
std::function<std::string(int)> displayFunction;
|
||||
std::function<bool(int)> isValueAvailable;
|
||||
std::function<std::string(int)> displayFunction = nullptr;
|
||||
std::function<bool(int)> isValueAvailable = nullptr;
|
||||
|
||||
std::string getDisplayVal();
|
||||
|
||||
|
||||
@@ -74,10 +74,21 @@ class TextArea : public FormField
|
||||
cancelHandler = std::move(handler);
|
||||
}
|
||||
|
||||
void setExcludedChars(std::string& excludedChars) {
|
||||
if (excludedChars.size() > 0) {
|
||||
for (char c = ' '; c <= '~'; c += 1) {
|
||||
if (excludedChars.find(c) == std::string::npos)
|
||||
allowedChars += c;
|
||||
}
|
||||
lv_textarea_set_accepted_chars(lvobj, allowedChars.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
char* value;
|
||||
uint8_t length;
|
||||
std::function<void(void)> cancelHandler = nullptr;
|
||||
std::string allowedChars;
|
||||
|
||||
void trim()
|
||||
{
|
||||
@@ -165,6 +176,8 @@ void TextEdit::openEdit()
|
||||
lv_group_focus_obj(lvobj);
|
||||
edit->hide();
|
||||
});
|
||||
if (excludedChars.size() > 0)
|
||||
edit->setExcludedChars(excludedChars);
|
||||
}
|
||||
edit->update();
|
||||
edit->show();
|
||||
|
||||
@@ -36,8 +36,11 @@ class TextEdit : public TextButton
|
||||
void preview(bool edited, char* text, uint8_t length);
|
||||
void update();
|
||||
|
||||
void setExcludedCharacters(const char* chars) { excludedChars = chars; }
|
||||
|
||||
protected:
|
||||
std::function<void(void)> updateHandler = nullptr;
|
||||
std::string excludedChars = "";
|
||||
TextArea* edit = nullptr;
|
||||
char* text;
|
||||
uint8_t length;
|
||||
|
||||
@@ -98,7 +98,7 @@ class ModelButton : public Button
|
||||
}
|
||||
lv_label_set_long_mode(modelName->getLvObj(), LV_LABEL_LONG_DOT);
|
||||
|
||||
bool chk = (modelCell == modelslist.getCurrentModel());
|
||||
bool chk = (modelCell == modelCellManager.getCurrentModel());
|
||||
if (chk != checked()) {
|
||||
check(chk);
|
||||
if (chk)
|
||||
@@ -197,15 +197,15 @@ class ModelsPageBody : public Window
|
||||
|
||||
ModelsVector models;
|
||||
if (selectedLabels.size()) {
|
||||
models = modelslabels.getModelsInLabels(selectedLabels);
|
||||
models = modelCellManager.getFilteredModelList(selectedLabels);
|
||||
} else {
|
||||
models = modelslabels.getAllModels();
|
||||
models = modelCellManager.getAllModels();
|
||||
}
|
||||
|
||||
// Used to work out which button to set focus to.
|
||||
// Priority -
|
||||
// current active model
|
||||
// previously selected model
|
||||
// current active model
|
||||
// first model in the list
|
||||
ModelButton *firstButton = nullptr;
|
||||
ModelButton *focusedButton = nullptr;
|
||||
@@ -238,8 +238,8 @@ class ModelsPageBody : public Window
|
||||
}
|
||||
|
||||
if (!firstButton) firstButton = button;
|
||||
if (model == modelslist.getCurrentModel()) focusedButton = button;
|
||||
if (model == focusedModel && !focusedButton) focusedButton = button;
|
||||
if (model == focusedModel) focusedButton = button;
|
||||
if (model == modelCellManager.getCurrentModel() && !focusedButton) focusedButton = button;
|
||||
|
||||
// Press Handler for Models
|
||||
button->setPressHandler([=]() -> uint8_t {
|
||||
@@ -251,7 +251,7 @@ class ModelsPageBody : public Window
|
||||
} else {
|
||||
focusedModel = model;
|
||||
}
|
||||
return model == modelslist.getCurrentModel();
|
||||
return model == modelCellManager.getCurrentModel();
|
||||
});
|
||||
|
||||
// Long Press Handler for Models
|
||||
@@ -261,7 +261,7 @@ class ModelsPageBody : public Window
|
||||
focusedModel = model;
|
||||
}
|
||||
openMenu();
|
||||
return model == modelslist.getCurrentModel();
|
||||
return model == modelCellManager.getCurrentModel();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -293,11 +293,11 @@ class ModelsPageBody : public Window
|
||||
|
||||
inline void setSortOrder(ModelsSortBy sortOrder)
|
||||
{
|
||||
modelslabels.setSortOrder(sortOrder);
|
||||
modelCellManager.setSortOrder(sortOrder);
|
||||
update();
|
||||
}
|
||||
|
||||
ModelsSortBy getSortOrder() const { return modelslabels.sortOrder(); }
|
||||
ModelsSortBy getSortOrder() const { return modelCellManager.sortOrder(); }
|
||||
|
||||
void setLblRefreshFunc(std::function<void()> fnc)
|
||||
{
|
||||
@@ -305,7 +305,6 @@ class ModelsPageBody : public Window
|
||||
}
|
||||
|
||||
protected:
|
||||
ModelsSortBy _sortOrder;
|
||||
bool isDirty = false;
|
||||
bool refresh = false;
|
||||
std::string selectedLabel;
|
||||
@@ -328,13 +327,13 @@ class ModelsPageBody : public Window
|
||||
Menu *menu = new Menu();
|
||||
menu->setTitle(focusedModel->modelName);
|
||||
if (g_eeGeneral.modelQuickSelect ||
|
||||
focusedModel != modelslist.getCurrentModel()) {
|
||||
focusedModel != modelCellManager.getCurrentModel()) {
|
||||
menu->addLine(STR_SELECT_MODEL, [=]() { selectModel(focusedModel); });
|
||||
}
|
||||
menu->addLine(STR_DUPLICATE_MODEL, [=]() { duplicateModel(focusedModel); });
|
||||
menu->addLine(STR_LABEL_MODEL, [=]() { editLabels(focusedModel); });
|
||||
menu->addLine(STR_SAVE_TEMPLATE, [=]() { saveAsTemplate(focusedModel); });
|
||||
if (focusedModel != modelslist.getCurrentModel()) {
|
||||
if (focusedModel != modelCellManager.getCurrentModel()) {
|
||||
menu->addLine(STR_DELETE_MODEL, [=]() { deleteModel(focusedModel); });
|
||||
}
|
||||
}
|
||||
@@ -343,7 +342,7 @@ class ModelsPageBody : public Window
|
||||
{
|
||||
// Don't need to check connection to receiver if re-selecting the active
|
||||
// model
|
||||
if (model != modelslist.getCurrentModel()) {
|
||||
if (model != modelCellManager.getCurrentModel()) {
|
||||
bool modelConnected =
|
||||
TELEMETRY_STREAMING() && !g_eeGeneral.disableRssiPoweroffAlarm;
|
||||
if (modelConnected) {
|
||||
@@ -364,7 +363,7 @@ class ModelsPageBody : public Window
|
||||
closeHandler();
|
||||
|
||||
// Skip reloading model if re-selecting the active model
|
||||
if (model != modelslist.getCurrentModel()) {
|
||||
if (model != modelCellManager.getCurrentModel()) {
|
||||
// store changes (if any) and load selected model
|
||||
storageFlushCurrentModel();
|
||||
storageCheck(true);
|
||||
@@ -382,7 +381,7 @@ class ModelsPageBody : public Window
|
||||
LayoutFactory::deleteTopBarWidgets();
|
||||
|
||||
loadModel(g_eeGeneral.currModelFilename, true);
|
||||
modelslist.setCurrentModel(model);
|
||||
modelCellManager.setCurrentModel(model);
|
||||
|
||||
// Load new main view layout
|
||||
LayoutFactory::loadCustomScreens();
|
||||
@@ -413,10 +412,12 @@ class ModelsPageBody : public Window
|
||||
// Make a new model which is a copy of the selected one, set the
|
||||
// same labels
|
||||
auto new_model =
|
||||
modelslist.addModel(duplicatedFilename, true, model);
|
||||
for (const auto &lbl : modelslabels.getLabelsByModel(model)) {
|
||||
modelslabels.addLabelToModel(lbl, new_model);
|
||||
}
|
||||
modelCellManager.addModel(duplicatedFilename, true, model);
|
||||
// Give the copy a unique name and save it to disk
|
||||
new_model->setUniqueName();
|
||||
new_model->updateModelFile();
|
||||
// Set new model as focused button
|
||||
focusedModel = new_model;
|
||||
update();
|
||||
} else {
|
||||
TRACE("ModelsListError: Invalid File");
|
||||
@@ -429,7 +430,7 @@ class ModelsPageBody : public Window
|
||||
new ConfirmDialog(
|
||||
STR_DELETE_MODEL,
|
||||
std::string(model->modelName, sizeof(model->modelName)).c_str(), [=] {
|
||||
modelslist.removeModel(model);
|
||||
modelCellManager.removeModel(model);
|
||||
if (refreshLabels != nullptr) refreshLabels();
|
||||
|
||||
update();
|
||||
@@ -438,7 +439,7 @@ class ModelsPageBody : public Window
|
||||
|
||||
void editLabels(ModelCell *model)
|
||||
{
|
||||
auto labels = modelslabels.getLabels();
|
||||
auto labels = modelCellManager.getLabels();
|
||||
|
||||
// dont display menu if there will be no labels
|
||||
if (labels.size()) {
|
||||
@@ -451,18 +452,18 @@ class ModelsPageBody : public Window
|
||||
}
|
||||
});
|
||||
|
||||
for (auto &label : modelslabels.getLabels()) {
|
||||
for (auto &label : modelCellManager.getLabels()) {
|
||||
menu->addLineBuffered(
|
||||
label,
|
||||
[=]() {
|
||||
if (!modelslabels.isLabelSelected(label, model))
|
||||
modelslabels.addLabelToModel(label, model, true);
|
||||
if (!model->hasLabel(label))
|
||||
modelCellManager.addLabelToModel(label, model);
|
||||
else
|
||||
modelslabels.removeLabelFromModel(label, model, true);
|
||||
modelCellManager.removeLabelFromModel(label, model);
|
||||
isDirty = true;
|
||||
if (refreshLabels != nullptr) refreshLabels();
|
||||
},
|
||||
[=]() { return modelslabels.isLabelSelected(label, model); });
|
||||
[=]() { return model->hasLabel(label); });
|
||||
}
|
||||
menu->updateLines();
|
||||
}
|
||||
@@ -537,9 +538,9 @@ ModelLabelsWindow::ModelLabelsWindow() : Page(ICON_MODEL_SELECT, PAD_ZERO, true)
|
||||
buildBody(body);
|
||||
|
||||
// find the first label of the current model and make that label active
|
||||
auto currentModel = modelslist.getCurrentModel();
|
||||
auto currentModel = modelCellManager.getCurrentModel();
|
||||
if (currentModel != nullptr) {
|
||||
auto modelLabels = modelslabels.getLabelsByModel(currentModel);
|
||||
auto modelLabels = currentModel->getLabels();
|
||||
if (modelLabels.size() > 0) {
|
||||
auto allLabels = getLabels();
|
||||
auto found =
|
||||
@@ -613,8 +614,8 @@ void ModelLabelsWindow::newModel()
|
||||
new SelectTemplateFolder([=](std::string folder, std::string name) {
|
||||
// Create a new blank ModelCell and activate it first, createmodel() will
|
||||
// modify the model in memory.
|
||||
auto newCell = modelslist.addModel("", false);
|
||||
modelslist.setCurrentModel(newCell);
|
||||
auto newCell = modelCellManager.addModel("", false);
|
||||
modelCellManager.setCurrentModel(newCell);
|
||||
|
||||
// Make the new model
|
||||
createModel();
|
||||
@@ -638,7 +639,7 @@ void ModelLabelsWindow::newModel()
|
||||
storageCheck(true);
|
||||
|
||||
// Update the current cell's data
|
||||
modelslist.updateCurrentModelCell();
|
||||
modelCellManager.updateCurrentModelCell();
|
||||
|
||||
#if defined(LUA)
|
||||
// If there is a wizard Lua script, fire it up
|
||||
@@ -661,12 +662,12 @@ void ModelLabelsWindow::newLabel()
|
||||
{
|
||||
tmpLabel[0] = '\0';
|
||||
new LabelDialog(tmpLabel, LABEL_LENGTH, STR_ENTER_LABEL, [=](std::string label) {
|
||||
int newlabindex = modelslabels.addLabel(label);
|
||||
int newlabindex = modelCellManager.addLabel(label);
|
||||
if (newlabindex >= 0) {
|
||||
auto labels = getLabels();
|
||||
lblselector->setNames(labels);
|
||||
}
|
||||
});
|
||||
}, labelExcludedChars);
|
||||
}
|
||||
|
||||
void ModelLabelsWindow::buildHead(Window *hdr)
|
||||
@@ -747,14 +748,14 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
});
|
||||
#endif
|
||||
|
||||
std::set<uint32_t> filteredLabels = modelslabels.filteredLabels();
|
||||
std::set<uint32_t> filteredLabels = modelCellManager.filteredLabels();
|
||||
|
||||
if (g_eeGeneral.labelSingleSelect == 0) {
|
||||
lblselector->setMultiSelect(true);
|
||||
lblselector->setSelected(filteredLabels);
|
||||
lblselector->setMultiSelectHandler([=](std::set<uint32_t> selected,
|
||||
std::set<uint32_t> oldselection) {
|
||||
if (modelslabels.getUnlabeledModels().size() != 0) {
|
||||
if (modelCellManager.getUnlabeledModels().size() != 0) {
|
||||
// Special case for mutually exclusive Unsorted
|
||||
bool unsrt_is_selected =
|
||||
selected.find(lblselector->getRowCount() - 1) != selected.end();
|
||||
@@ -831,7 +832,7 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
if (newLabel.size() > 0) {
|
||||
auto rndialog =
|
||||
new ProgressDialog(STR_RENAME_LABEL, [=]() {});
|
||||
modelslabels.renameLabel(
|
||||
modelCellManager.renameLabel(
|
||||
oldLabel, newLabel, [=](const char *name, int percentage) {
|
||||
rndialog->setTitle(std::string(STR_RENAME_LABEL) + " " +
|
||||
name);
|
||||
@@ -840,8 +841,7 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
});
|
||||
auto labels = getLabels();
|
||||
lblselector->setNames(labels);
|
||||
mdlselector->clearButtons();
|
||||
updateFilteredLabels(modelslabels.filteredLabels(), false);
|
||||
updateFilteredLabels(modelCellManager.filteredLabels(), false);
|
||||
}
|
||||
});
|
||||
return 0;
|
||||
@@ -852,7 +852,7 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
STR_DELETE_LABEL, labelToDelete.c_str(), [=]() {
|
||||
auto deldialog =
|
||||
new ProgressDialog(STR_DELETE_LABEL, [=]() {});
|
||||
modelslabels.removeLabel(
|
||||
modelCellManager.removeLabel(
|
||||
labelToDelete, [=](const char *name, int percentage) {
|
||||
deldialog->setTitle(std::string(STR_DELETE_LABEL) + " " +
|
||||
name);
|
||||
@@ -869,19 +869,18 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
else
|
||||
newset.insert(lblselector->getActiveItem());
|
||||
}
|
||||
mdlselector->clearButtons();
|
||||
updateFilteredLabels(newset);
|
||||
});
|
||||
return 0;
|
||||
});
|
||||
if (modelslabels.getLabels().size() > 1) {
|
||||
if (modelCellManager.getLabels().size() > 1) {
|
||||
if (selected != 0) {
|
||||
menu->addLine(STR_MOVE_UP, [=]() {
|
||||
moveLabel(selected, -1);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
if (selected != (int)modelslabels.getLabels().size() - 1) {
|
||||
if (selected != (int)modelCellManager.getLabels().size() - 1) {
|
||||
menu->addLine(STR_MOVE_DOWN, [=]() {
|
||||
moveLabel(selected, 1);
|
||||
return 0;
|
||||
@@ -897,7 +896,7 @@ void ModelLabelsWindow::moveLabel(int selected, int direction)
|
||||
{
|
||||
int swapSelected = selected + direction;
|
||||
|
||||
modelslabels.moveLabelTo(selected, swapSelected);
|
||||
modelCellManager.moveLabelUp(selected > swapSelected ? selected : swapSelected);
|
||||
|
||||
std::set<uint32_t> newset = lblselector->getSelection();
|
||||
bool isSelected = newset.find(selected) != newset.end();
|
||||
@@ -937,10 +936,8 @@ void ModelLabelsWindow::updateFilteredLabels(std::set<uint32_t> selected,
|
||||
for (auto sel : selected) {
|
||||
if (sel < labels.size()) sellabels.push_back(labels[sel]);
|
||||
}
|
||||
if (setdirty) { // Save to file?
|
||||
modelslabels.setFilteredLabels(selected);
|
||||
modelslabels.setDirty();
|
||||
}
|
||||
if (setdirty) // Save to file?
|
||||
modelCellManager.setFilteredLabels(selected);
|
||||
mdlselector->setLabels(sellabels); // Update the list
|
||||
}
|
||||
|
||||
@@ -952,7 +949,7 @@ void ModelLabelsWindow::labelRefreshRequest()
|
||||
|
||||
void ModelLabelsWindow::setTitle()
|
||||
{
|
||||
auto curModel = modelslist.getCurrentModel();
|
||||
auto curModel = modelCellManager.getCurrentModel();
|
||||
auto modelName = curModel != nullptr ? curModel->modelName : STR_NONE;
|
||||
|
||||
std::string title2 = STR_ACTIVE;
|
||||
|
||||
@@ -58,8 +58,8 @@ class ModelLabelsWindow : public Page
|
||||
|
||||
LabelsVector getLabels()
|
||||
{
|
||||
auto labels = modelslabels.getLabels();
|
||||
if (modelslabels.getUnlabeledModels().size() > 0)
|
||||
auto labels = modelCellManager.getLabels();
|
||||
if (modelCellManager.getUnlabeledModels().size() > 0)
|
||||
labels.emplace_back(STR_UNLABELEDMODEL);
|
||||
return labels;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ const static SetupLineDef setupLines[] = {
|
||||
new ModelTextEdit(parent, {x, y, ModelSetupPage::NAM_W, 0},
|
||||
g_model.header.name, sizeof(g_model.header.name),
|
||||
[=]() {
|
||||
auto model = modelslist.getCurrentModel();
|
||||
auto model = modelCellManager.getCurrentModel();
|
||||
if (model) {
|
||||
model->setModelName(g_model.header.name);
|
||||
}
|
||||
@@ -403,29 +403,23 @@ const static SetupLineDef setupLines[] = {
|
||||
// Model labels
|
||||
STR_DEF(STR_LABELS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto curmod = modelslist.getCurrentModel();
|
||||
TextButton* btn = new TextButton(parent, {x, y, 0, 0}, modelslabels.getBulletLabelString(curmod, STR_UNLABELEDMODEL));
|
||||
auto curmod = modelCellManager.getCurrentModel();
|
||||
TextButton* btn = new TextButton(parent, {x, y, 0, 0}, curmod->getBulletLabelString(STR_UNLABELEDMODEL));
|
||||
btn->setPressHandler([=]() {
|
||||
Menu *menu = new Menu(true);
|
||||
menu->setTitle(STR_LABELS);
|
||||
for (auto &label : modelslabels.getLabels()) {
|
||||
for (auto &label : modelCellManager.getLabels()) {
|
||||
menu->addLineBuffered(
|
||||
label,
|
||||
[=]() {
|
||||
if (!modelslabels.isLabelSelected(label, curmod))
|
||||
modelslabels.addLabelToModel(label, curmod);
|
||||
if (!curmod->hasLabel(label))
|
||||
modelCellManager.addLabelToModel(label, curmod);
|
||||
else
|
||||
modelslabels.removeLabelFromModel(label, curmod);
|
||||
btn->setText(modelslabels.getBulletLabelString(
|
||||
curmod, STR_UNLABELEDMODEL));
|
||||
strncpy(g_model.header.labels,
|
||||
ModelMap::toCSV(modelslabels.getLabelsByModel(curmod))
|
||||
.c_str(),
|
||||
sizeof(g_model.header.labels));
|
||||
g_model.header.labels[sizeof(g_model.header.labels) - 1] = '\0';
|
||||
modelCellManager.removeLabelFromModel(label, curmod);
|
||||
btn->setText(curmod->getBulletLabelString(STR_UNLABELEDMODEL));
|
||||
SET_DIRTY();
|
||||
},
|
||||
[=]() { return modelslabels.isLabelSelected(label, curmod); });
|
||||
[=]() { return curmod->hasLabel(label); });
|
||||
}
|
||||
menu->updateLines();
|
||||
return 0;
|
||||
@@ -442,7 +436,7 @@ const static SetupLineDef setupLines[] = {
|
||||
},
|
||||
[=](std::string newValue) {
|
||||
strncpy(g_model.header.bitmap, newValue.c_str(), LEN_BITMAP_NAME);
|
||||
auto model = modelslist.getCurrentModel();
|
||||
auto model = modelCellManager.getCurrentModel();
|
||||
if (model) {
|
||||
strncpy(model->modelBitmap, newValue.c_str(), LEN_BITMAP_NAME);
|
||||
model->modelBitmap[LEN_BITMAP_NAME] = '\0';
|
||||
|
||||
@@ -233,7 +233,7 @@ class ModuleWindow : public Window
|
||||
GET_DEFAULT(*modelId), [=](int32_t newValue) {
|
||||
if (newValue != *modelId) {
|
||||
*modelId = newValue;
|
||||
modelslist.updateCurrentModelCell();
|
||||
modelCellManager.updateCurrentModelCell();
|
||||
updateIDStaticText(moduleIdx);
|
||||
#if defined(CROSSFIRE)
|
||||
if (isModuleCrossfire(moduleIdx)) {
|
||||
@@ -546,7 +546,7 @@ class ModuleWindow : public Window
|
||||
if (idUnique == nullptr) return;
|
||||
char buffer[50];
|
||||
std::string idStr = STR_MODELIDUNIQUE;
|
||||
if (!modelslist.isModelIdUnique(mdIdx, buffer, sizeof(buffer))) {
|
||||
if (!modelCellManager.isModelIdUnique(mdIdx, buffer, sizeof(buffer))) {
|
||||
idStr = STR_MODELIDUSED;
|
||||
idStr = idStr + buffer;
|
||||
lv_obj_add_state(idUnique->getLvObj(), ETX_STATE_UNIQUE_ID_WARN);
|
||||
|
||||
@@ -754,7 +754,7 @@ const static SetupLineDef manageModelsSetupLines[] = {
|
||||
GET_DEFAULT(g_eeGeneral.labelSingleSelect),
|
||||
[=](int newValue) {
|
||||
g_eeGeneral.labelSingleSelect = newValue;
|
||||
modelslabels.clearFilter();
|
||||
modelCellManager.clearFilter();
|
||||
Messaging::send(Messaging::REFRESH);
|
||||
SET_DIRTY();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user