Log* logger = Log::getInstance();
logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
+ // Draw RTC
+ // Blank the area first
+ rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
+ char timeString[20];
+ time_t t;
+ time(&t);
+ struct tm* tms = localtime(&t);
+ strftime(timeString, 19, "%H:%M", tms);
+ drawText(timeString, barRegion.x + 624, barRegion.y + 12, Colour::LIGHTTEXT);
+
+ // Draw clocks
+
rectangle(clocksRegion, barBlue);
ULONG currentFrameNum = player->getCurrentFrameNum();
hmsf lengthHMSF = video->framesToHMSF(lengthFrames);
char buffer[100];
-// strcpy(buffer, "-:--:-- / -:--:--");
-// else
-// {
+ if (currentFrameNum >= lengthFrames)
+ {
+ strcpy(buffer, "-:--:-- / -:--:--");
+ }
+ else
+ {
SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
logger->log("VVideoRec", Log::DEBUG, buffer);
-// }
+ }
drawText(buffer, clocksRegion.x, clocksRegion.y, Colour::LIGHTTEXT);
- // Draw clock
- // Blank the area first
- rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
- char timeString[20];
- time_t t;
- time(&t);
- struct tm* tms = localtime(&t);
- strftime(timeString, 19, "%H:%M", tms);
- drawText(timeString, barRegion.x + 624, barRegion.y + 12, Colour::LIGHTTEXT);
-
rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, Colour::LIGHTTEXT);
rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
- int progressWidth = 302 * currentFrameNum / lengthFrames;
+ if (currentFrameNum < lengthFrames)
+ {
+
+ int progressWidth = 302 * currentFrameNum / lengthFrames;
- rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, Colour::SELECTHIGHLIGHT);
+ rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, Colour::SELECTHIGHLIGHT);
- // Now calc position for start margin blips
- int posPix;
+ // Now calc position for start margin blips
+ int posPix;
- posPix = 302 * startMargin * video->getFPS() / lengthFrames;
+ posPix = 302 * startMargin * video->getFPS() / lengthFrames;
- rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT);
- rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT);
+ rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT);
+ rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT);
- posPix = 302 * (lengthFrames - endMargin * video->getFPS()) / lengthFrames;
+ posPix = 302 * (lengthFrames - endMargin * video->getFPS()) / lengthFrames;
- rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT);
- rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT);
+ rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT);
+ rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT);
+ }
}
void VVideoRec::removeBar()