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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "recording.h"
33 #include "directory.h"
37 VRecMove::VRecMove(RecMan* trecman)
43 if (Video::getInstance()->getFormat() == Video::PAL)
45 setPosition(220, 160);
49 setPosition(210, 130);
54 setTitleText(tr("Move recording"));
55 setTitleBarColour(Colour::TITLEBARBACKGROUND);
57 sl.setPosition(10, 30 + 5);
58 sl.setSize(area.w - 40, area.h - 30 - 15);
61 Directory* dir = recman->getRootDir();
62 sl.addOption("/", (ULONG)dir, 1);
70 void VRecMove::setParent(void* tparent)
75 void VRecMove::addDirs(Directory* dir,const char* prefix)
77 Directory* currentDir;
78 for(DirectoryList::iterator i = dir->dirList.begin(); i != dir->dirList.end(); i++)
81 char* title = new char[strlen(prefix) + strlen(currentDir->name) + 2]; // one for the null, one for '/'
82 sprintf(title, "%s%s", prefix, currentDir->name);
83 sl.addOption(title, (ULONG)currentDir, 0);
95 rectangle(area.w - 30, 30 + 5, 20, area.h - 30 - 15, Colour::VIEWBACKGROUND);
99 w.nextSymbol = WSymbol::SMALLUP;
100 w.setPosition(area.w - 28, 30 + 7);
103 w.nextSymbol = WSymbol::SMALLDOWN;
104 w.setPosition(area.w - 28, area.h - 26);
108 int VRecMove::handleCommand(int command)
117 BoxStack::getInstance()->update(this);
120 case Remote::DF_DOWN:
125 BoxStack::getInstance()->update(this);
130 Message* m = new Message();
131 m->message = Message::MOVE_RECORDING;
133 m->parameter = sl.getCurrentOptionData();
134 Command::getInstance()->postMessageNoLock(m);
143 // stop command getting to any more views
147 void VRecMove::processMessage(Message* m)
149 if (m->message == Message::MOUSE_MOVE)
151 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
154 BoxStack::getInstance()->update(this);
157 else if (m->message == Message::MOUSE_LBDOWN)
159 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
161 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
165 //check if press is outside this view! then simulate cancel
166 int x=(m->parameter>>16)-getScreenX();
167 int y=(m->parameter&0xFFFF)-getScreenY();
168 if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
170 BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press