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
25 create(530, 85+(NUM_OPTIONS*30));
26 if (Video::getInstance()->getFormat() == Video::PAL)
28 setScreenPos(104, 130);
35 setBackgroundColour(Colour::VIEWBACKGROUND);
37 setTitleBarColour(Colour::TITLEBARBACKGROUND);
38 setTitleText(tr("Options"));
40 int fontHeight = surface->getFontHeight();
43 for (i = 0; i < numOptions; i++)
45 optionBox[i].setSurface(surface);
46 optionBox[i].setSurfaceOffset(346, 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: %s", optionData[i].options[j]);
51 optionBox[i].addOption(tr((char*)optionData[i].options[j]));
56 vdr = VDR::getInstance();
58 for (i = 0; i < numOptions; i++)
60 optionBox[i].setSelected(tr((char*)optionData[i].options[optionData[i].defaultOption]));
61 config = vdr->configLoad(optionData[i].configSection, optionData[i].configParam);
64 for (UINT j = 0; j < optionData[i].optionCount; j++)
66 if (!strcasecmp(config, optionData[i].options[j]))
68 optionBox[i].setSelected(tr((char*)optionData[i].options[j]));
75 // After setup, save all current indexes
76 optionsAtStart = new int[numOptions];
78 for (i = 0; i < numOptions; i++)
80 optionsAtStart[i] = optionBox[i].getSelectedIndex();
84 optionBox[0].setActive(1);
89 delete[] optionsAtStart;
99 drawText(tr("Press back to exit, <, > or [ok] to change"), 10, 55+numOptions*30, Colour::LIGHTTEXT);
101 wsy.setSurface(surface);
103 for (UINT i = 0; i < numOptions; i++)
105 drawText(tr(optionData[i].title), 10, 45+i*30, Colour::LIGHTTEXT);
107 if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
108 else cl = Colour::BUTTONBACKGROUND;
110 wsy.nextSymbol = WSymbol::LEFTARROW;
113 wsy.setSurfaceOffset(328, 47 + (i * 30));
115 wsy.nextSymbol = WSymbol::RIGHTARROW;
116 wsy.setSurfaceOffset(498, 47 + (i * 30));
123 int VOptions::handleCommand(int command)
130 if (selectedOption > 0)
132 optionBox[selectedOption].setActive(0);
134 optionBox[selectedOption].setActive(1);
140 case Remote::DF_DOWN:
143 if (selectedOption < (numOptions - 1))
145 optionBox[selectedOption].setActive(0);
147 optionBox[selectedOption].setActive(1);
153 case Remote::DF_LEFT:
156 optionBox[selectedOption].left();
161 case Remote::DF_RIGHT:
164 optionBox[selectedOption].right();
176 optionBox[selectedOption].cycle();
185 void VOptions::doSave()
187 int result[numOptions];
189 for (UINT i = 0; i < numOptions; i++)
191 result[i] = optionBox[i].getSelectedIndex();
193 if (result[i] != optionsAtStart[i])
195 Log::getInstance()->log("Options", Log::DEBUG, "Option %i has changed", i);
197 vdr->configSave(optionData[i].configSection, optionData[i].configParam,
198 optionData[i].options[result[i]]);
203 Video* video = Video::getInstance();
205 if (result[0] != optionsAtStart[0])
209 Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote");
210 Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
214 Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote");
215 Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
219 if (result[1] != optionsAtStart[1])
222 Message *m = new Message();
223 m->to = VWelcome::getInstance();
224 m->message = Message::REDRAW_LANG;
225 ViewMan::getInstance()->postMessage(m);
228 if (result[2] != optionsAtStart[2])
232 Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video");
233 video->setConnection(Video::SVIDEO);
237 Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite");
238 video->setConnection(Video::COMPOSITERGB);
242 if (result[3] != optionsAtStart[3])
246 Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV");
247 video->setTVsize(Video::ASPECT16X9);
251 Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV");
252 video->setTVsize(Video::ASPECT4X3);
256 if (result[4] != optionsAtStart[4])
260 Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
261 video->setMode(Video::LETTERBOX);
265 Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
266 video->setMode(Video::NORMAL);