]> git.vomp.tv Git - vompclient-marten.git/commitdiff
More timers display code
authorChris Tallon <chris@vomp.tv>
Sun, 8 Jan 2006 23:02:26 +0000 (23:02 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 8 Jan 2006 23:02:26 +0000 (23:02 +0000)
vtimerlist.cc
vtimerlist.h
wselectlist.h

index 19ffbab5568cd630c8cd845c9a4b4371e5076a43..ad25bc95704c1aca12bc5bb758dd9f67395e4f0a 100644 (file)
@@ -29,6 +29,13 @@ VTimerList::VTimerList(RecTimerList* trtl)
   clockRegion.w = 150;
   clockRegion.h = 30;
 
+  indicatorsRegion.x = 6;
+  indicatorsRegion.y = 44;
+  indicatorsRegion.w = 18;
+  indicatorsRegion.h = 15 * (surface->getFontHeight() + 1);
+
+  flipflop = true;
+
   create(570, 420);
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
@@ -46,8 +53,8 @@ VTimerList::VTimerList(RecTimerList* trtl)
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
   sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
+  sl.setSurfaceOffset(30, 30 + 5);
+  sl.setDimensions(area.w - 40, area.h - 30 - 15 - 30);
 
   // Draw statics
 
@@ -78,6 +85,7 @@ VTimerList::VTimerList(RecTimerList* trtl)
   insertData();
   sl.draw();
   drawShowing();
+  drawIndicators();
   drawClock();
 }
 
@@ -100,14 +108,13 @@ void VTimerList::insertData()
 {
   char strA[300];
   char strB[300];
-  char status;
 
   struct tm* btime;
 
   // FIXME all drawing stuff in this class and sl.clear somewhere?!
 
   sl.addColumn(0);
-  sl.addColumn(130);
+  sl.addColumn(110);
 
   RecTimer* recTimer;
   int first = 1;
@@ -115,26 +122,10 @@ void VTimerList::insertData()
   for (UINT i = 0; i < recTimerList->size(); i++)
   {
     recTimer = (*recTimerList)[i];
-    if (recTimer->recording)
-    {
-      status = 'R';
-    }
-    else if (recTimer->pending)
-    {
-      status = 'X';
-    }
-    else if (recTimer->active == 0)
-    {
-      status = 'N';
-    }
-    else
-    {
-      status = 'O';
-    }
 
     btime = localtime((time_t*)&recTimer->startTime);
     strftime(strA, 299, "%d/%m %H:%M ", btime);
-    snprintf(strB, 299, "%c %s\t%s", status, strA, recTimer->getName());
+    snprintf(strB, 299, "%s\t%s", strA, recTimer->getName());
     recTimer->index = sl.addOption(strB, first);
     first = 0;
   }
@@ -166,10 +157,60 @@ void VTimerList::drawShowing()
   drawText(showing, 220, 385, Colour::LIGHTTEXT);
 }
 
+void VTimerList::drawIndicators()
+{
+  int top = sl.getTopOption();
+  int bottom = sl.getBottomOption();
+  int yinc = surface->getFontHeight() + 1;
+  RecTimer* recTimer;
+
+  rectangle(6, 44, 18, 15*yinc, Colour::VIEWBACKGROUND);
+
+  // The indexes recorded from the wselectlist into the index member of the RecTimer
+  // Is the same as the position in the vector of RecTimers
+  // Because they are in order, they don't change order and wselectlist starts from 0 up consecutively
+
+  int ypos = 44;
+  for (int current = top; current < bottom; current++)
+  {
+    recTimer = (*recTimerList)[current];
+
+    if (recTimer->recording) // Flashing red square
+    {
+      if (flipflop)
+      {
+        //rectangle(6, ypos, 18, 16, Colour::RED);
+        rectangle(6, ypos, 18, 16, Colour::RED);
+        drawText("R", 8, ypos-3, Colour::LIGHTTEXT);
+      }
+    }
+    else if (recTimer->pending)
+    {
+      rectangle(6, ypos, 18, 16, Colour::RED);
+      drawText("X", 8, ypos-3, Colour::BLACK);
+    }
+    else if (recTimer->active == 0)
+    {
+      rectangle(6, ypos, 18, 16, Colour::SELECTHIGHLIGHT);
+      drawText("X", 8, ypos-3, Colour::BLACK);
+    }
+    else
+    {
+//      if (flipflop) rectangle(6, ypos, 18, 16, Colour::GREEN);
+    }
+
+    ypos += yinc;
+  }
+}
+
 void VTimerList::timercall(int clientReference)
 {
   drawClock();
   ViewMan::getInstance()->updateView(this, &clockRegion);
+
+  flipflop = !flipflop;
+  drawIndicators();
+  ViewMan::getInstance()->updateView(this, &indicatorsRegion);
 }
 
 int VTimerList::handleCommand(int command)
@@ -182,6 +223,7 @@ int VTimerList::handleCommand(int command)
       sl.up();
       sl.draw();
       drawShowing();
+      drawIndicators();
       ViewMan::getInstance()->updateView(this);
       return 2;
     }
@@ -191,6 +233,7 @@ int VTimerList::handleCommand(int command)
       sl.down();
       sl.draw();
       drawShowing();
+      drawIndicators();
       ViewMan::getInstance()->updateView(this);
       return 2;
     }
@@ -199,6 +242,7 @@ int VTimerList::handleCommand(int command)
       sl.pageUp();
       sl.draw();
       drawShowing();
+      drawIndicators();
       ViewMan::getInstance()->updateView(this);
       return 2;
     }
@@ -207,6 +251,7 @@ int VTimerList::handleCommand(int command)
       sl.pageDown();
       sl.draw();
       drawShowing();
+      drawIndicators();
       ViewMan::getInstance()->updateView(this);
       return 2;
     }
index 415f561230f6a0fc92b47fd69b411c7728567511..3fa0b8101bd621f834b81406a7e3fd39dacf2f39 100644 (file)
@@ -55,8 +55,12 @@ class VTimerList : public View, public TimerReceiver
     void drawClock();
     void drawShowing();
     void drawData();
+    void drawIndicators();
 
     Region clockRegion;
+    Region indicatorsRegion;
+
+    bool flipflop;
 };
 
 #endif
index c411cb7a66f0d76741e4837da7a9f5ccbdcccba5..a556af8484264588cb0be2f1ff629434a79571e6 100644 (file)
@@ -51,7 +51,7 @@ class WSelectList : public Widget
 
     int getTopOption();
     int getNumOptions();
-    int getBottomOption();
+    int getBottomOption();     // actually returns bottom + 1 i.e. the one just past display ?!
     int getCurrentOption();
 
     void hintSetCurrent(int index);