add(&summary);
-
- buttonPlay.setPosition(10, area.h - 40);
- buttonResume.setPosition(150, area.h - 40);
- buttonMove.setPosition(290, area.h - 40);
- buttonDelete.setPosition(430, area.h - 40);
-
int sfh = getFontHeight();
-
- buttonPlay.setSize(130, sfh);
- buttonResume.setSize(130, sfh);
- buttonMove.setSize(130, sfh);
- buttonDelete.setSize(130, sfh);
-
buttonRegion.x = 10;
buttonRegion.y = area.h - 40;
buttonRegion.w = 550;
buttonRegion.h = sfh;
- buttonPlay.setText(tr("Play"));
- buttonResume.setText(tr("Resume"));
- buttonMove.setText(tr("Move"));
- buttonDelete.setText(tr("Delete"));
+ button[PLAY].setText(tr("Play"));
+ button[RESUME].setText(tr("Resume"));
+ button[MOVE].setText(tr("Move"));
+ button[DELETE].setText(tr("Delete"));
- add(&buttonPlay);
- add(&buttonResume);
- add(&buttonMove);
- add(&buttonDelete);
+ for (int i=PLAY, hor=10; i<last; i++, hor+= 140)
+ {
+ button[i].setPosition(hor, area.h - 40);
+ button[i].setSize(130, sfh);
+ add(&button[i]);
+ }
- buttonPlay.setActive(1);
- selected = 1;
+ selected = RESUME;
+ button[selected].setActive(1);
}
VRecording::~VRecording()
case Remote::DF_UP:
case Remote::UP:
{
- doLeft();
+ moveCursor(LEFT);
return 2;
}
case Remote::RIGHT:
case Remote::DF_DOWN:
case Remote::DOWN:
{
- doRight();
+ moveCursor(RIGHT);
return 2;
}
case Remote::OK:
{
- if (selected == 1)
+ if (selected == PLAY)
{
Message* m = new Message(); // Must be done after this view deleted
m->from = this;
return 4;
}
- if (selected == 2)
+ if (selected == RESUME)
{
Message* m = new Message(); // Must be done after this view deleted
m->from = this;
return 4;
}
- if (selected == 3)
+ if (selected == MOVE)
{
VRecMove* vrm = new VRecMove(recman);
vrm->setParent(this);
return 2;
}
- if (selected == 4)
+ if (selected == DELETE)
{
VQuestion* v = new VQuestion(this);
v->setSize(260, 180);
return 1;
}
-void VRecording::doRight()
+void VRecording::moveCursor(Direction direction)
{
- switch(selected)
- {
- case 1:
- buttonPlay.setActive(0);
- buttonResume.setActive(1);
- buttonPlay.draw();
- buttonResume.draw();
- break;
- case 2:
- buttonResume.setActive(0);
- buttonMove.setActive(1);
- buttonResume.draw();
- buttonMove.draw();
- break;
- case 3:
- buttonMove.setActive(0);
- buttonDelete.setActive(1);
- buttonMove.draw();
- buttonDelete.draw();
- break;
- case 4:
- buttonDelete.setActive(0);
- buttonPlay.setActive(1);
- buttonDelete.draw();
- buttonPlay.draw();
- break;
+ button[selected].setActive(0);
+ button[selected].draw();
+ if (direction == RIGHT)
+ {
+ if (++selected == last) selected = PLAY;
}
-
- if (++selected == 5) selected = 1;
-
- BoxStack::getInstance()->update(this, &buttonRegion);
-}
-
-void VRecording::doLeft()
-{
- switch(selected)
+ else
{
- case 1:
- buttonPlay.setActive(0);
- buttonDelete.setActive(1);
- buttonPlay.draw();
- buttonDelete.draw();
- break;
- case 2:
- buttonResume.setActive(0);
- buttonPlay.setActive(1);
- buttonResume.draw();
- buttonPlay.draw();
- break;
- case 3:
- buttonMove.setActive(0);
- buttonResume.setActive(1);
- buttonMove.draw();
- buttonResume.draw();
- break;
- case 4:
- buttonDelete.setActive(0);
- buttonMove.setActive(1);
- buttonDelete.draw();
- buttonMove.draw();
- break;
+ if (--selected < 0) selected = last - 1;
}
-
- if (--selected == 0) selected = 4;
-
+ button[selected].setActive(1);
+ button[selected].draw();
BoxStack::getInstance()->update(this, &buttonRegion);
}
{
if (m->message == Message::MOUSE_MOVE)
{
- if (buttonPlay.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ for (int i = PLAY; i < last; i++)
{
- buttonPlay.setActive(1);
- buttonResume.setActive(0);
- buttonMove.setActive(0);
- buttonDelete.setActive(0);
- selected=1;
- draw();
- BoxStack::getInstance()->update(this);
- }
- else if (buttonResume.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- buttonPlay.setActive(0);
- buttonResume.setActive(1);
- buttonMove.setActive(0);
- buttonDelete.setActive(0);
- selected=2;
- draw();
- BoxStack::getInstance()->update(this);
- }
- else if (buttonMove.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- buttonPlay.setActive(0);
- buttonResume.setActive(0);
- buttonMove.setActive(1);
- buttonDelete.setActive(0);
- selected=3;
- draw();
- BoxStack::getInstance()->update(this);
- }
- else if (buttonDelete.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- buttonPlay.setActive(0);
- buttonResume.setActive(0);
- buttonMove.setActive(0);
- buttonDelete.setActive(1);
- selected=4;
- draw();
- BoxStack::getInstance()->update(this);
+ if (button[i].mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ for (int j = PLAY; j < last; j++)
+ button[j].setActive(0);
+ button[i].setActive(1);
+ selected=i;
+ draw();
+ BoxStack::getInstance()->update(this);
+ break;
+ }
}
}
else if (m->message == Message::MOUSE_LBDOWN)
{
- if (buttonPlay.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ int cancel = true;
+ for (int i = PLAY; i < last; i++)
{
- BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
- }
- else if (buttonResume.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
- }
- else if (buttonMove.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
- }
- else if (buttonDelete.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
- {
- BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ if (button[i].mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ cancel = false;
+ break;
+ }
}
- else
+ if (cancel)
{
//check if press is outside this view! then simulate cancel
int x=(m->parameter>>16)-getScreenX();
}
else if (m->message == Message::QUESTION_YES)
{
- if (selected == 4)
+ if (selected == DELETE)
{
Message* m2 = new Message(); // Delete self
m2->from = this;