Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: yaepg feature an event timer flag



Now it draws a red line in the event box from timer start to end time.
It works great now :-)

--- yaepg-0.0.2/yaepg.c   2005-02-11 04:16:32.000000000 -0500
+++ yaepg-0.0.2.1-mod/yaepg.c     2005-02-11 15:39:56.808105360 -0500
@@ -15,6 +15,7 @@
 static const tColor tint               = (tColor) 0xFF002850;
 static const tColor highlight          = (tColor) 0xFF505050;
 static const tColor lightgrey          = (tColor) 0xFFAAAAAA;
+static const tColor red                        = (tColor) 0xFFFF0066;

 #define fontChanBox                    fontYaepg
 #define fontTimeBox                    fontYaepg
@@ -114,6 +115,8 @@
 protected:
        bool            initialized;
        int             arrow;
+       int             timerlinestart;
+       int             timerlineend;

 public:
        cTextBox(void);
@@ -167,6 +170,8 @@

        initialized = true;
        arrow = 0;
+       timerlinestart = 0;
+       timerlineend = 0;
 }

 cTextBox::~cTextBox()
@@ -213,6 +218,8 @@

        initialized = true;
        arrow = 0;
+       timerlinestart = 0;
+       timerlineend = 0;
 }

 int
@@ -344,6 +351,13 @@
                DrawLine(width-2, height/2, width-10, height, lightgrey);
        }

+       /*
+        * Show timer line
+        */
+       if (timerlinestart != timerlineend) {
+               for (i = timerlinestart; i <= timerlineend; i++)
DrawLine(i, height-4, i, height-3, red);
+       }
+
        destBmp->DrawBitmap(bx, by, *bitmap);

        return (0);
@@ -605,10 +619,25 @@
 {
        time_t tLen;
        int w, arrowFlag = 0;
+       int TimerMatch;
+       time_t tOffsetStart = time(NULL);
+       time_t tOffsetEnd = time(NULL);

        event = e;

        /*
+        * Is there a timer for this event?
+        * and where do we start and stop drawing the timer line?
+        */
+       cTimer *Tmatch = Timers.GetMatch(e, &TimerMatch);
+       if (TimerMatch != tmNone) {
+               tOffsetStart = Tmatch->StartTime() - e->StartTime() - 60;
+               tOffsetEnd = e->EndTime() - Tmatch->StopTime() + 60;
+               if (tOffsetStart < 0) tOffsetStart = 0;
+               if (tOffsetEnd < 0) tOffsetEnd = 0;
+       }
+
+       /*
         * Figure out how long the event is.  The length is adjusted to ensure
         * that it fits on the screen.
         */
@@ -654,6 +683,8 @@
        arrow = arrowFlag;
        SetHLColor(highlight);
        SetText(1, e->Title());
+       timerlinestart = tOffsetStart / 60 * 5;
+       timerlineend = ( e->Duration() - tOffsetEnd ) / 60 * 5;
 }

 cEventBox::~cEventBox()




Home | Main Index | Thread Index