@@ -95,11 +95,10 @@ void setCurrentCategory(unsigned int index)
|
||||
if (currentCategory->size() > 0)
|
||||
setCurrentModel(0);
|
||||
else
|
||||
currentModel = NULL;
|
||||
currentModel = nullptr;
|
||||
}
|
||||
|
||||
#if defined(LUA)
|
||||
|
||||
#define MAX_WIZARD_NAME_LEN (sizeof(WIZARD_PATH)+20)
|
||||
#define WIZARD_SPACING 40
|
||||
#define WIZARD_LEFT_SPACING 30
|
||||
@@ -248,6 +247,7 @@ void onModelSelectMenu(const char * result)
|
||||
storageCheck(true);
|
||||
memcpy(g_eeGeneral.currModelFilename, currentModel->modelFilename, LEN_MODEL_FILENAME);
|
||||
modelslist.setCurrentModel(currentModel);
|
||||
modelslist.setCurrentCategory(currentCategory);
|
||||
loadModel(g_eeGeneral.currModelFilename, true);
|
||||
storageDirty(EE_GENERAL);
|
||||
storageCheck(true);
|
||||
@@ -264,6 +264,7 @@ void onModelSelectMenu(const char * result)
|
||||
selectMode = MODE_SELECT_MODEL;
|
||||
setCurrentModel(currentCategory->size() - 1);
|
||||
modelslist.setCurrentModel(currentModel);
|
||||
modelslist.setCurrentCategory(currentCategory);
|
||||
modelslist.onNewModelCreated(currentModel, &g_model);
|
||||
#if defined(LUA)
|
||||
chainMenu(menuModelWizard);
|
||||
@@ -274,7 +275,7 @@ void onModelSelectMenu(const char * result)
|
||||
memcpy(duplicatedFilename, currentModel->modelFilename, sizeof(duplicatedFilename));
|
||||
if (findNextFileIndex(duplicatedFilename, LEN_MODEL_FILENAME, MODELS_PATH)) {
|
||||
sdCopyFile(currentModel->modelFilename, MODELS_PATH, duplicatedFilename, MODELS_PATH);
|
||||
ModelCell* dup_model = modelslist.addModel(currentCategory, duplicatedFilename);
|
||||
ModelCell * dup_model = modelslist.addModel(currentCategory, duplicatedFilename);
|
||||
dup_model->fetchRfData();
|
||||
setCurrentModel(currentCategory->size() - 1);
|
||||
}
|
||||
@@ -344,7 +345,7 @@ void initModelsList()
|
||||
bool menuModelSelect(event_t event)
|
||||
{
|
||||
const std::list<ModelsCategory*>& cats = modelslist.getCategories();
|
||||
switch(event) {
|
||||
switch (event) {
|
||||
case 0:
|
||||
// no need to refresh the screen
|
||||
return false;
|
||||
@@ -387,7 +388,7 @@ bool menuModelSelect(event_t event)
|
||||
categoriesVerticalPosition -= 1;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
modelslist.moveModel(model, previous_category, currentCategory);
|
||||
setCurrentModel(currentCategory->size()-1);
|
||||
setCurrentModel(currentCategory->size() - 1);
|
||||
}
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
@@ -288,8 +288,8 @@ ModelsList::~ModelsList()
|
||||
void ModelsList::init()
|
||||
{
|
||||
loaded = false;
|
||||
currentCategory = NULL;
|
||||
currentModel = NULL;
|
||||
currentCategory = nullptr;
|
||||
currentModel = nullptr;
|
||||
modelsCount = 0;
|
||||
}
|
||||
|
||||
@@ -368,12 +368,12 @@ void ModelsList::save()
|
||||
f_close(&file);
|
||||
}
|
||||
|
||||
void ModelsList::setCurrentCategorie(ModelsCategory* cat)
|
||||
void ModelsList::setCurrentCategory(ModelsCategory * cat)
|
||||
{
|
||||
currentCategory = cat;
|
||||
}
|
||||
|
||||
void ModelsList::setCurrentModel(ModelCell* cell)
|
||||
void ModelsList::setCurrentModel(ModelCell * cell)
|
||||
{
|
||||
currentModel = cell;
|
||||
if (!currentModel->valid_rfData)
|
||||
|
||||
@@ -40,8 +40,8 @@ struct SimpleModuleData
|
||||
class ModelCell
|
||||
{
|
||||
public:
|
||||
char modelFilename[LEN_MODEL_FILENAME+1];
|
||||
char modelName[LEN_MODEL_NAME+1];
|
||||
char modelFilename[LEN_MODEL_FILENAME + 1];
|
||||
char modelName[LEN_MODEL_NAME + 1];
|
||||
BitmapBuffer * buffer;
|
||||
|
||||
bool valid_rfData;
|
||||
@@ -51,10 +51,10 @@ public:
|
||||
ModelCell(const char * name);
|
||||
~ModelCell();
|
||||
|
||||
void save(FIL* file);
|
||||
void save(FIL * file);
|
||||
|
||||
void setModelName(char* name);
|
||||
void setRfData(ModelData* model);
|
||||
void setModelName(char * name);
|
||||
void setRfData(ModelData * model);
|
||||
|
||||
void setModelId(uint8_t moduleIdx, uint8_t id);
|
||||
void setRfModuleData(uint8_t moduleIdx, ModuleData* modData);
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
class ModelsCategory: public std::list<ModelCell *>
|
||||
{
|
||||
public:
|
||||
char name[LEN_MODEL_FILENAME+1];
|
||||
char name[LEN_MODEL_FILENAME + 1];
|
||||
|
||||
ModelsCategory(const char * name);
|
||||
~ModelsCategory();
|
||||
@@ -98,21 +98,25 @@ public:
|
||||
void save();
|
||||
void clear();
|
||||
|
||||
const std::list<ModelsCategory *>& getCategories() const {
|
||||
const std::list<ModelsCategory *> & getCategories() const
|
||||
{
|
||||
return categories;
|
||||
}
|
||||
|
||||
void setCurrentCategorie(ModelsCategory* cat);
|
||||
ModelsCategory* getCurrentCategory() const {
|
||||
void setCurrentCategory(ModelsCategory * cat);
|
||||
ModelsCategory * getCurrentCategory() const
|
||||
{
|
||||
return currentCategory;
|
||||
}
|
||||
|
||||
void setCurrentModel(ModelCell* cell);
|
||||
ModelCell* getCurrentModel() const {
|
||||
void setCurrentModel(ModelCell * cell);
|
||||
ModelCell * getCurrentModel() const
|
||||
{
|
||||
return currentModel;
|
||||
}
|
||||
|
||||
unsigned int getModelsCount() const {
|
||||
unsigned int getModelsCount() const
|
||||
{
|
||||
return modelsCount;
|
||||
}
|
||||
|
||||
@@ -133,7 +137,6 @@ public:
|
||||
|
||||
protected:
|
||||
FIL file;
|
||||
|
||||
};
|
||||
|
||||
extern ModelsList modelslist;
|
||||
|
||||
Reference in New Issue
Block a user