{
char str[500];
+ sl.addColumn(0);
+ sl.addColumn(50);
+
chanList = tlist;
Channel* chan;
while((chan = (Channel*)chanList->getCurrent()))
{
- sprintf(str, "%lu. %s", chan->number, chan->name);
+ sprintf(str, "%lu\t%s", chan->number, chan->name);
chan->index = sl.addOption(str, first);
first = 0;
chanList->next();
void VRecordingList::drawData()
{
sl.clear();
+ sl.addColumn(0);
+ sl.addColumn(110);
int first = 1;
char tempB[300]; // FIXME
struct tm* btime;
- char spaces[13];
- char theNumber[10];
- int theNumberLength;
-
Directory* dir;
recDir->dirList->reset();
while((dir = (Directory*)recDir->dirList->getCurrent()))
continue;
}
- strcpy(spaces, " ");
- theNumberLength = snprintf(theNumber, 9, "%lu", dir->getNumRecordings());
-
- spaces[11 - theNumberLength] = '\0';
-
- //snprintf(tempA, 299, "<dir> %s", dir->name);
- snprintf(tempA, 299, "<dir> %s%s%s", theNumber, spaces, dir->name);
- //int numSize = snprintf(tempA
+ snprintf(tempA, 299, "<dir> %lu\t%s", dir->getNumRecordings(), dir->name);
dir->index = sl.addOption(tempA, first);
first = 0;
{
btime = localtime((time_t*)&rec->start);
strftime(tempA, 299, "%0d/%0m %0H:%0M ", btime);
- sprintf(tempB, "%s %s", tempA, rec->getProgName());
+ sprintf(tempB, "%s\t%s", tempA, rec->getProgName());
rec->index = sl.addOption(tempB, first);
first = 0;
recList->next();
selectedOption = 0;
topOption = 0;
numOptionsDisplayable = 0;
+ numColumns = 0;
}
WSelectList::~WSelectList()
selectedOption = 0;
topOption = 0;
numOptionsDisplayable = 0;
+ numColumns = 0;
}
void WSelectList::hintSetCurrent(int index)
if (i == selectedOption)
{
rectangle(0, ypos, width, fontHeight, Colour::SELECTHIGHLIGHT);
- drawText(options[i], 5, ypos, Colour::DARKTEXT);
+ drawOptionLine(options[i], 5, ypos, Colour::DARKTEXT);
}
else
{
- drawText(options[i], 5, ypos, Colour::LIGHTTEXT);
+ drawOptionLine(options[i], 5, ypos, Colour::LIGHTTEXT);
}
ypos += ySeperation;
}
}
+void WSelectList::addColumn(int x)
+{
+ if (numColumns == 10) return;
+ columns[numColumns++] = x;
+}
+
+void WSelectList::drawOptionLine(char* text, int xpos, int ypos, Colour& colour)
+{
+ if (!numColumns)
+ {
+ drawText(text, xpos, ypos, colour);
+ }
+ else
+ {
+ char buffer[200];
+ strncpy(buffer, text, 199);
+ int currentColumn = 0;
+ char* pointer;
+
+ pointer = strtok(buffer, "\t");
+ while(pointer)
+ {
+ drawText(pointer, xpos + columns[currentColumn], ypos, colour);
+ currentColumn++;
+ if (currentColumn == 10) return;
+ pointer = strtok(NULL, "\t");
+ }
+ }
+}
+
+
void WSelectList::up()
{
if (selectedOption > 0)
WSelectList();
~WSelectList();
void clear();
+ void addColumn(int x);
int addOption(char* text, int selected);
void draw();
void hintSetTop(int index);
private:
+ void drawOptionLine(char* text, int xpos, int ypos, Colour& colour);
+
char* options[500];
int numOptions;
int selectedOption;
int topOption;
int numOptionsDisplayable;
+ int columns[10];
+ int numColumns;
};
#endif