2006-03-04 18:16:49 +00:00
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
#include "CategoriesPanel.h"
|
|
|
|
#include "AvailableMetersPanel.h"
|
|
|
|
#include "MetersPanel.h"
|
|
|
|
#include "DisplayOptionsPanel.h"
|
|
|
|
#include "ColumnsPanel.h"
|
|
|
|
#include "ColorsPanel.h"
|
|
|
|
#include "AvailableColumnsPanel.h"
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
#include "Panel.h"
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
/*{
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
typedef struct CategoriesPanel_ {
|
|
|
|
Panel super;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
Settings* settings;
|
|
|
|
ScreenManager* scr;
|
2006-05-30 13:47:28 +00:00
|
|
|
} CategoriesPanel;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
}*/
|
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* MetersFunctions[10] = {" ", " ", " ", "Type ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* AvailableMetersFunctions[10] = {" ", " ", " ", " ", "Add L ", "Add R ", " ", " ", " ", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* DisplayOptionsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* ColumnsFunctions[10] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* ColorsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
static char* AvailableColumnsFunctions[10] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done "};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr) {
|
|
|
|
CategoriesPanel* this = (CategoriesPanel*) malloc(sizeof(CategoriesPanel));
|
|
|
|
Panel* super = (Panel*) this;
|
|
|
|
Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
|
|
|
|
((Object*)this)->delete = CategoriesPanel_delete;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
this->settings = settings;
|
|
|
|
this->scr = scr;
|
2006-05-30 13:47:28 +00:00
|
|
|
super->eventHandler = CategoriesPanel_eventHandler;
|
|
|
|
Panel_setHeader(super, "Setup");
|
|
|
|
Panel_add(super, (Object*) ListItem_new("Meters", 0));
|
|
|
|
Panel_add(super, (Object*) ListItem_new("Display options", 0));
|
|
|
|
Panel_add(super, (Object*) ListItem_new("Colors", 0));
|
|
|
|
Panel_add(super, (Object*) ListItem_new("Columns", 0));
|
2006-03-04 18:16:49 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
void CategoriesPanel_delete(Object* object) {
|
|
|
|
Panel* super = (Panel*) object;
|
|
|
|
CategoriesPanel* this = (CategoriesPanel*) object;
|
|
|
|
Panel_done(super);
|
2006-03-04 18:16:49 +00:00
|
|
|
free(this);
|
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
|
|
|
|
CategoriesPanel* this = (CategoriesPanel*) super;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
HandlerResult result = IGNORED;
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
int previous = Panel_getSelectedIndex(super);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
switch (ch) {
|
|
|
|
case KEY_UP:
|
|
|
|
case KEY_DOWN:
|
|
|
|
case KEY_NPAGE:
|
|
|
|
case KEY_PPAGE:
|
|
|
|
case KEY_HOME:
|
|
|
|
case KEY_END: {
|
2006-05-30 13:47:28 +00:00
|
|
|
Panel_onKey(super, ch);
|
|
|
|
int selected = Panel_getSelectedIndex(super);
|
2006-03-04 18:16:49 +00:00
|
|
|
if (previous != selected) {
|
|
|
|
int size = ScreenManager_size(this->scr);
|
|
|
|
for (int i = 1; i < size; i++)
|
|
|
|
ScreenManager_remove(this->scr, 1);
|
|
|
|
switch (selected) {
|
|
|
|
case 0:
|
2006-05-30 13:47:28 +00:00
|
|
|
CategoriesPanel_makeMetersPage(this);
|
2006-03-04 18:16:49 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2006-05-30 13:47:28 +00:00
|
|
|
CategoriesPanel_makeDisplayOptionsPage(this);
|
2006-03-04 18:16:49 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2006-05-30 13:47:28 +00:00
|
|
|
CategoriesPanel_makeColorsPage(this);
|
2006-03-04 18:16:49 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2006-05-30 13:47:28 +00:00
|
|
|
CategoriesPanel_makeColumnsPage(this);
|
2006-03-04 18:16:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result = HANDLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
void CategoriesPanel_makeMetersPage(CategoriesPanel* this) {
|
2006-05-30 14:02:43 +00:00
|
|
|
Panel* leftMeters = (Panel*) MetersPanel_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr);
|
|
|
|
Panel* rightMeters = (Panel*) MetersPanel_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr);
|
|
|
|
Panel* availableMeters = (Panel*) AvailableMetersPanel_new(this->settings, leftMeters, rightMeters, this->scr);
|
|
|
|
ScreenManager_add(this->scr, leftMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20);
|
|
|
|
ScreenManager_add(this->scr, rightMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20);
|
|
|
|
ScreenManager_add(this->scr, availableMeters, FunctionBar_new(10, AvailableMetersFunctions, NULL, NULL), -1);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
void CategoriesPanel_makeDisplayOptionsPage(CategoriesPanel* this) {
|
2006-05-30 14:02:43 +00:00
|
|
|
Panel* displayOptions = (Panel*) DisplayOptionsPanel_new(this->settings, this->scr);
|
|
|
|
ScreenManager_add(this->scr, displayOptions, FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL), -1);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
void CategoriesPanel_makeColorsPage(CategoriesPanel* this) {
|
2006-05-30 14:02:43 +00:00
|
|
|
Panel* colors = (Panel*) ColorsPanel_new(this->settings, this->scr);
|
|
|
|
ScreenManager_add(this->scr, colors, FunctionBar_new(10, ColorsFunctions, NULL, NULL), -1);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2006-05-30 13:47:28 +00:00
|
|
|
void CategoriesPanel_makeColumnsPage(CategoriesPanel* this) {
|
2006-05-30 14:02:43 +00:00
|
|
|
Panel* columns = (Panel*) ColumnsPanel_new(this->settings, this->scr);
|
|
|
|
Panel* availableColumns = (Panel*) AvailableColumnsPanel_new(this->settings, columns, this->scr);
|
|
|
|
ScreenManager_add(this->scr, columns, FunctionBar_new(10, ColumnsFunctions, NULL, NULL), 20);
|
|
|
|
ScreenManager_add(this->scr, availableColumns, FunctionBar_new(10, AvailableColumnsFunctions, NULL, NULL), -1);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|