2 Copyright 2006 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
23 VRecMove::VRecMove(RecMan* trecman)
28 if (Video::getInstance()->getFormat() == Video::PAL)
30 setScreenPos(220, 160);
34 setScreenPos(210, 130);
37 setBackgroundColour(Colour::VIEWBACKGROUND);
40 setTitleText(tr("Move recording"));
41 setTitleBarColour(Colour::TITLEBARBACKGROUND);
43 sl.setSurface(surface);
44 sl.setSurfaceOffset(10, 30 + 5);
45 sl.setDimensions(area.w - 40, area.h - 30 - 15);
47 Directory* dir = recman->getRootDir();
48 sl.addOption("/", (ULONG)dir, 1);
56 void VRecMove::setParent(View* tparent)
61 void VRecMove::addDirs(Directory* dir, char* prefix)
63 Directory* currentDir;
64 for(DirectoryList::iterator i = dir->dirList.begin(); i != dir->dirList.end(); i++)
67 char* title = new char[strlen(prefix) + strlen(currentDir->name) + 2]; // one for the null, one for '/'
68 sprintf(title, "%s%s", prefix, currentDir->name);
69 sl.addOption(title, (ULONG)currentDir, 0);
82 rectangle(area.w - 30, 30 + 5, 20, area.h - 30 - 15, Colour::VIEWBACKGROUND);
84 w.setSurface(surface);
86 w.nextSymbol = WSymbol::SMALLUP;
87 w.setSurfaceOffset(area.w - 28, 30 + 7);
90 w.nextSymbol = WSymbol::SMALLDOWN;
91 w.setSurfaceOffset(area.w - 28, area.h - 26);
95 int VRecMove::handleCommand(int command)
104 ViewMan::getInstance()->updateView(this);
107 case Remote::DF_DOWN:
112 ViewMan::getInstance()->updateView(this);
117 Message* m = new Message();
118 m->message = Message::MOVE_RECORDING;
120 m->parameter = sl.getCurrentOptionData();
121 Command::getInstance()->postMessageNoLock(m);
130 // stop command getting to any more views
134 void VRecMove::processMessage(Message* m)
136 if (m->message == Message::MOUSE_MOVE)
138 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
141 ViewMan::getInstance()->updateView(this);
144 else if (m->message == Message::MOUSE_LBDOWN)
146 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
148 ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
152 //check if press is outside this view! then simulate cancel
153 int x=(m->parameter>>16)-getScreenX();
154 int y=(m->parameter&0xFFFF)-getScreenY();
155 if (x<0 || y <0 || x>getWidth() || y>getHeight())
157 ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press