5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _MODELSLIST_H_
22 #define _MODELSLIST_H_
28 #define MODELCELL_WIDTH 172
29 #define MODELCELL_HEIGHT 59
31 // modelXXXXXXX.bin F,FF F,3F,FF\r\n
32 #define LEN_MODELS_IDX_LINE (LEN_MODEL_FILENAME + sizeof(" F,FF F,3F,FF\r\n")-1)
34 struct SimpleModuleData
43 char modelFilename
[LEN_MODEL_FILENAME
+1];
44 char modelName
[LEN_MODEL_NAME
+1];
45 BitmapBuffer
* buffer
;
48 uint8_t modelId
[NUM_MODULES
];
49 SimpleModuleData moduleData
[NUM_MODULES
];
51 ModelCell(const char * name
);
56 void setModelName(char* name
);
57 void setRfData(ModelData
* model
);
59 void setModelId(uint8_t moduleIdx
, uint8_t id
);
60 void setRfModuleData(uint8_t moduleIdx
, ModuleData
* modData
);
64 const BitmapBuffer
* getBuffer();
68 class ModelsCategory
: public std::list
<ModelCell
*>
71 char name
[LEN_MODEL_FILENAME
+1];
73 ModelsCategory(const char * name
);
76 ModelCell
* addModel(const char * name
);
77 void removeModel(ModelCell
* model
);
78 void moveModel(ModelCell
* model
, int8_t step
);
79 void save(FIL
* file
);
85 std::list
<ModelsCategory
*> categories
;
86 ModelsCategory
* currentCategory
;
87 ModelCell
* currentModel
;
88 unsigned int modelsCount
;
101 const std::list
<ModelsCategory
*>& getCategories() const {
105 void setCurrentCategorie(ModelsCategory
* cat
);
106 ModelsCategory
* getCurrentCategory() const {
107 return currentCategory
;
110 void setCurrentModel(ModelCell
* cell
);
111 ModelCell
* getCurrentModel() const {
115 unsigned int getModelsCount() const {
119 bool readNextLine(char * line
, int maxlen
);
121 ModelsCategory
* createCategory();
122 void removeCategory(ModelsCategory
* category
);
124 ModelCell
* addModel(ModelsCategory
* category
, const char * name
);
125 void removeModel(ModelsCategory
* category
, ModelCell
* model
);
126 void moveModel(ModelsCategory
* category
, ModelCell
* model
, int8_t step
);
127 void moveModel(ModelCell
* model
, ModelsCategory
* previous_category
, ModelsCategory
* new_category
);
129 bool isModelIdUnique(uint8_t moduleIdx
, char* warn_buf
, size_t warn_buf_len
);
130 uint8_t findNextUnusedModelId(uint8_t moduleIdx
);
132 void onNewModelCreated(ModelCell
* cell
, ModelData
* model
);
139 extern ModelsList modelslist
;
141 #endif // _MODELSLIST_H_