2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 if (Video::getInstance()->getFormat() == Video::PAL)
28 setScreenPos(120, 140);
32 setScreenPos(110, 110);
35 setBackgroundColour(Colour::VIEWBACKGROUND);
37 setTitleBarColour(Colour::TITLEBARBACKGROUND);
38 setTitleText("Options");
40 int fontHeight = surface->getFontHeight();
43 for (i = 0; i < numOptions; i++)
45 optionBox[i].setSurface(surface);
46 optionBox[i].setSurfaceOffset(330, 45 + (i * 30));
47 optionBox[i].setDimensions(150, fontHeight);
48 for (UINT j = 0; j < optionData[i].optionCount; j++)
50 Log::getInstance()->log("Options", Log::DEBUG, "Add option");
51 Log::getInstance()->log("Options", Log::DEBUG, "Add option: %s", optionData[i].options[j]);
52 optionBox[i].addOption(optionData[i].options[j]);
53 Log::getInstance()->log("Options", Log::DEBUG, "Done add option");
58 vdr = VDR::getInstance();
60 for (i = 0; i < numOptions; i++)
62 optionBox[i].setSelected(optionData[i].options[optionData[i].defaultOption]);
63 config = vdr->configLoad(optionData[i].configSection, optionData[i].configParam);
66 for (UINT j = 0; j < optionData[i].optionCount; j++)
68 if (!strcasecmp(config, optionData[i].options[j]))
70 optionBox[i].setSelected(optionData[i].options[j]);
78 optionBox[0].setActive(1);
92 drawText("Press back to exit, <, > or [ok] to change", 10, 255, Colour::LIGHTTEXT);
94 wsy.setSurface(surface);
96 for (UINT i = 0; i < numOptions; i++)
98 drawText(optionData[i].title, 10, 45+i*30, Colour::LIGHTTEXT);
100 if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
101 else cl = Colour::BUTTONBACKGROUND;
103 wsy.nextSymbol = WSymbol::LEFTARROW;
106 wsy.setSurfaceOffset(312, 47 + (i * 30));
108 wsy.nextSymbol = WSymbol::RIGHTARROW;
109 wsy.setSurfaceOffset(482, 47 + (i * 30));
116 int VOptions::handleCommand(int command)
123 if (selectedOption > 0)
125 optionBox[selectedOption].setActive(0);
127 optionBox[selectedOption].setActive(1);
133 case Remote::DF_DOWN:
136 if (selectedOption < (numOptions - 1))
138 optionBox[selectedOption].setActive(0);
140 optionBox[selectedOption].setActive(1);
146 case Remote::DF_LEFT:
149 optionBox[selectedOption].left();
154 case Remote::DF_RIGHT:
157 optionBox[selectedOption].right();
169 optionBox[selectedOption].cycle();
178 void VOptions::doSave()
180 char* result[numOptions];
182 for (UINT i = 0; i < numOptions; i++)
184 result[i] = optionBox[i].getSelected();
185 vdr->configSave(optionData[i].configSection, optionData[i].configParam, result[i]);
189 Video* video = Video::getInstance();
191 if (!strcmp(result[0], optionData[0].options[1]))
193 Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote");
194 Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
198 Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote");
199 Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
202 if (!strcmp(result[1], optionData[1].options[1]))
204 Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video");
205 video->setConnection(Video::SVIDEO);
209 Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite");
210 video->setConnection(Video::COMPOSITERGB);
213 if (!strcmp(result[2], optionData[2].options[1]))
215 Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV");
216 video->setTVsize(Video::ASPECT16X9);
220 Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV");
221 video->setTVsize(Video::ASPECT4X3);
224 if (!strcmp(result[3], optionData[3].options[1]))
226 Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
227 video->setMode(Video::LETTERBOX);
231 Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
232 video->setMode(Video::NORMAL);