const static ULONG PLAYER_EVENT = 22;
const static ULONG AUDIO_CHANGE_CHANNEL = 23;
const static ULONG CHILD_CLOSE = 24;
+ const static ULONG MOUSE_MOVE = 25;
+ const static ULONG MOUSE_LBDOWN = 26;
};
#endif
int fd;
- if ((fd = open("/dev/mtdblock1", O_RDONLY)) < 0)
+ if ((fd = open("/dev/mtd1", O_RDONLY)) < 0)
{
Log::getInstance()->log("MTD", Log::DEBUG, "Open fail");
initted = 0;
return 0;
}
+
+void VAudioSelector::processMessage(Message* m)
+{
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ sl.draw();
+ ViewMan::getInstance()->updateView(this);
+ }
+ return;
+ }
+
+ if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ { //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ }
+ return;
+ }
+}
~VAudioSelector();
int handleCommand(int command);
+ void processMessage(Message* m);
void draw();
private:
// stop command getting to any more views
return 1;
}
+
+void VChannelList::processMessage(Message* m)
+{
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ sl.draw();
+ doShowingBar();
+ ViewMan::getInstance()->updateView(this);
+ }
+ return;
+ }
+
+ if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ { //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ }
+ return;
+ }
+}
\ No newline at end of file
void setList(ChannelList* chanList);
void highlightChannel(Channel* channel);
+ void processMessage(Message* m);
int handleCommand(int command);
void draw();
return mktime(tms);
}
+void VEpg::processMessage(Message* m)
+{
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (chanListbox.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ drawData();
+ ViewMan::getInstance()->updateView(this);
+ }
+ return;
+ }
+
+ if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (chanListbox.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ {
+ //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ int keyx = chanListbox.getOffsetX();
+ int keyy = chanListbox.getOffsetY() + chanListbox.getHeight() + 2;
+
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ else if (x>=(keyx+72) && y>=(keyy+4) &&x<=(keyx+72+104) &&y<=(keyy+4+Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::RED);
+ }
+ else if (x>=(keyx+72) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+72+104) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::GREEN);
+ }
+ else if (x>=(keyx+180) && y>=(keyy+4) &&x<=(keyx+180+104) &&y<=(keyy+4+Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::YELLOW);
+ }
+ else if (x>=(keyx+180) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+180+104) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BLUE);
+ }
+ else if (x>=(keyx+290) && y>=(keyy+4) &&x<=(keyx+180+290) &&y<=(keyy+4+Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK);
+ }
+ else if (x>=(keyx+290) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+290+180) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::RECORD);
+ }
+ else if (x>=(keyx+474) && y>=(keyy+4) &&x<=(keyx+128+474) &&y<=(keyy+4+Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::PLAY);
+ }
+ else if (x>=(keyx+474) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+238+474) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::GO);
+ }
+ else if ( x>=(chanListbox.getOffsetX())
+ && y>=(chanListbox.getOffsetY() + 5)
+ // &&x<=(chanListbox.getOffsetX()+155 + WINDOW_WIDTH * MINUTE_SCALE)
+ &&y<=(chanListbox.getOffsetY() - Surface::getFontHeight()
+ - 3+chanListbox.getHeight() + Surface::getFontHeight() + 3)
+ )
+ {
+ int cy=y-(chanListbox.getOffsetY() + 5);
+ int row=cy/(Surface::getFontHeight()+2);
+ int clistTop = chanListbox.getTopOption();
+ chanListbox.hintSetCurrent(clistTop+row);
+ int cx=x-155;
+ time_t ttime = cx*60/MINUTE_SCALE+ltime;
+ //x = 155 + (MINUTE_SCALE * (event->time - ltime) / 60);
+
+ selTime = ttime;
+ drawData();
+ viewman->updateView(this);
+ }
+ }
+ return;
+ }
+}
int handleCommand(int command); // deal with commands (from remote control)
void draw(); // draw epg view
void setCurrentChannel(char* chname);
+ void processMessage(Message* m);
private:
static VEpg* instance;
return;
}
+ /* Handle mouse events*/
+ // They come in with m->to = NULL? and just need to be delivered to top view?
+ if (numViews && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
+ {
+ views[numViews-1]->processMessage(m);
+ return;
+ }
+
Log::getInstance()->log("ViewMan", Log::DEBUG, "it's for meeee!");
switch(m->message)
{
return tag;
}
+
+bool WButton::mouseMove(int x, int y)
+{
+ if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
+ && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
+ {
+ setActive(1);
+ return true;
+ }
+ return false;
+}
+
+bool WButton::mouseLBDOWN(int x, int y)
+{
+ if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
+ && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
+ {
+ return true;
+ }
+ return false;
+}
void setTag(int tag);
int getTag();
+ virtual bool mouseMove(int x, int y);
+ virtual bool mouseLBDOWN(int x, int y);
+
private:
UCHAR active;
{
return offsetX;
}
+
+bool Widget::mouseMove(int x, int y)
+{
+ return false;
+}
+
+bool Widget::mouseLBDOWN(int x, int y)
+{
+ return false;
+}
int getOffsetY();
int getOffsetX();
+ virtual bool mouseMove(int x, int y);
+ virtual bool mouseLBDOWN(int x, int y);
private:
}
currentOption = 0;
}
+
+bool WOptionBox::mouseMove(int x, int y)
+{
+ if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
+ && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
+ {
+ setActive(1);
+ return true;
+ }
+ return false;
+}
+
+bool WOptionBox::mouseLBDOWN(int x, int y)
+{
+ if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
+ && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
+ {
+ return true;
+ }
+ return false;
+}
void draw();
int getSelectedIndex();
+ virtual bool mouseMove(int x, int y);
+ virtual bool mouseLBDOWN(int x, int y);
+
const static int MODE_TEXT = 1;
const static int MODE_INT = 2;
if (topOption < 0) topOption = 0;
-
fillColour(backgroundColour);
UINT ypos = 5;
}
}
-
void WSelectList::up()
{
if (selectedOption > 0)
{
return options[selectedOption].data;
}
+
+bool WSelectList::mouseMove(int x, int y)
+{
+ int ml = getMouseLine(x-offsetX,y-offsetY);
+ if (ml>=0 && ml!=(int)selectedOption)
+ {
+ selectedOption = ml;
+ return true;
+ }
+ return false;
+}
+
+bool WSelectList::mouseLBDOWN(int x, int y)
+{
+ int ml = getMouseLine(x-offsetX, y-offsetY);
+ if (ml == (int)selectedOption)
+ {
+ /* caller should generate a OK message*/
+ return true;
+ }
+ return false;
+}
+
+int WSelectList::getMouseLine(int x,int y)
+{
+ int fontHeight = surface->getFontHeight();
+ int ySeperation = fontHeight + gap;
+
+ if (y<0) return -1;
+ if (x<0 || x>(int)area.w) return -1;
+ if (y>(int)(10+numOptionsDisplayable*ySeperation)) return -1;
+
+ int cy = y - 5;
+
+ int selected=cy/ySeperation;
+ if (y<5) selected=-1;
+ if (selected> ((int)numOptionsDisplayable)) return -1;
+ /* Important: should be the same algorithm used in draw! */
+ if (selectedOption == (topOption + numOptionsDisplayable)) topOption++;
+ if (selectedOption == ((UINT)topOption - 1)) topOption--;
+ // if still not visible...
+ if ((selectedOption < (UINT)topOption) || (selectedOption > (topOption + numOptionsDisplayable)))
+ {
+ topOption = selectedOption - (numOptionsDisplayable / 2);
+ }
+
+ if (topOption < 0) topOption = 0;
+
+ if ((selected+topOption >= (int) options.size()) ||
+ (selected + topOption < 0)) return -1;
+
+ return selected + topOption;
+}
void hintSetCurrent(int index);
void hintSetTop(int index);
+ virtual bool mouseMove(int x, int y);
+ virtual bool mouseLBDOWN(int x, int y);
+
private:
void drawOptionLine(char* text, int xpos, int ypos, Colour& colour);
+ int getMouseLine(int x, int y);
vector<wsloption> options;
UINT selectedOption;