Project

General

Profile

Actions

Feature #1815

closed

Save clock with long channels names in 2 line view

Added by fnu over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
04/29/2014
Due date:
% Done:

100%

Estimated time:

Description

In 2 line view, clock is overwritten by long channel names. Copperhead created a patch at end of 2013, what I tested up now successfully:

Index: b/watch.c
===================================================================
--- a/watch.c
+++ b/watch.c
@@ -15,6 +15,7 @@
 #include <stdint.h>
 #include <time.h>
 #include <ctype.h>
+#include <string>

 #include "watch.h" 
 #include "setup.h" 
@@ -435,9 +436,13 @@
         if(bAllowCurrentTime && currentTime) {
           int t = pFont->Width(*currentTime);
           int w = pFont->Width(*scHeader);
-          if((w + t + 3) < theSetup.m_cWidth && t < theSetup.m_cWidth) {
-            this->DrawText(theSetup.m_cWidth - t, 0, *currentTime);
-          } 
+          this->DrawText(theSetup.m_cWidth - t, 0, *currentTime);
+          std::string name(*scHeader);
+          while((w + t + 3) > theSetup.m_cWidth) {
+            name = name.substr(0,name.length()-1);
+            w = pFont->Width(name.c_str());
+          }
+          *scHeader = name.c_str();
         }
         this->DrawText(0, 0, *scHeader);
       }

So, might it be possible to bring that upstream?
Actions

Also available in: Atom PDF