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));
122 int VOptions::handleCommand(int command)
129 if (selectedOption > 0)
131 optionBox[selectedOption].setActive(0);
133 optionBox[selectedOption].setActive(1);
139 case Remote::DF_DOWN:
142 if (selectedOption < (numOptions - 1))
144 optionBox[selectedOption].setActive(0);
146 optionBox[selectedOption].setActive(1);
152 case Remote::DF_LEFT:
155 optionBox[selectedOption].left();
160 case Remote::DF_RIGHT:
163 optionBox[selectedOption].right();
175 optionBox[selectedOption].cycle();
184 void VOptions::doSave()
186 int result[numOptions];
188 for (UINT i = 0; i < numOptions; i++)
190 result[i] = optionBox[i].getSelectedIndex();
192 if (result[i] != optionsAtStart[i])
194 Log::getInstance()->log("Options", Log::DEBUG, "Option %i has changed", i);
196 vdr->configSave(optionData[i].configSection, optionData[i].configParam,
197 optionData[i].options[result[i]]);
202 Video* video = Video::getInstance();
204 if (result[0] != optionsAtStart[0])
208 Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote");
209 Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
213 Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote");
214 Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
218 if (result[1] != optionsAtStart[1])
221 Message *m = new Message();
222 m->to = VWelcome::getInstance();
223 m->message = Message::REDRAW_LANG;
224 ViewMan::getInstance()->postMessage(m);
227 if (result[2] != optionsAtStart[2])
231 Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video");
232 video->setConnection(Video::SVIDEO);
236 Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite");
237 video->setConnection(Video::COMPOSITERGB);
241 if (result[3] != optionsAtStart[3])
245 Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV");
246 video->setTVsize(Video::ASPECT16X9);
250 Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV");
251 video->setTVsize(Video::ASPECT4X3);
255 if (result[4] != optionsAtStart[4])
259 Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
260 video->setMode(Video::LETTERBOX);
264 Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
265 video->setMode(Video::NORMAL);