]> git.vomp.tv Git - vompclient.git/commitdiff
Patch from Philipp Mueller for long drawText lines
authorChris Tallon <chris@vomp.tv>
Sat, 12 Jan 2008 16:58:31 +0000 (16:58 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 12 Jan 2008 16:58:31 +0000 (16:58 +0000)
boxx.cc
boxx.h
surface.cc
surface.h
vvideorec.cc
wselectlist.cc
wselectlist.h

diff --git a/boxx.cc b/boxx.cc
index 17e6dd1e9979c0eb5c6ee3f274b51f11a025eee4..7c880472207dda9f422c7459bdfcfa2bfe9d1602 100644 (file)
--- a/boxx.cc
+++ b/boxx.cc
@@ -321,6 +321,12 @@ void Boxx::drawText(const char* text, int x, int y, Colour& colour)
   else surface->drawText(text, x, y, colour.rgba());
 }
 
+void Boxx::drawText(const char* text, int x, int y, int width, Colour& colour)
+{
+  if (parent) parent->drawText(text, area.x + x, area.y + y, width, colour);
+  else surface->drawText(text, x, y, width, colour.rgba());
+}
+
 void Boxx::drawTextRJ(const char* text, int x, int y, Colour& colour)
 {
   if (parent) parent->drawTextRJ(text, area.x + x, area.y + y, colour);
diff --git a/boxx.h b/boxx.h
index 929e654a7a2789fbf75de7a5af1d471dda75bac5..d8fc18efb40a63a2863528145c50392e1c5b3d2c 100644 (file)
--- a/boxx.h
+++ b/boxx.h
@@ -87,6 +87,7 @@ class Boxx
     void rectangle(Region& region, Colour& colour);
 
     void drawText(const char* text, int x, int y, Colour& colour);
+    void drawText(const char* text, int x, int y, int width, Colour& colour);
     void drawTextRJ(const char* text, int x, int y, Colour& colour);
     void drawTextCentre(const char* text, int x, int y, Colour& colour);
     void drawPixel(UINT x, UINT y, Colour& colour);
index fc69577db374b85547b6bc091d2402cda592528a..eabbae129dc9124f28f1e840722bdc562b3b0870 100644 (file)
@@ -41,6 +41,11 @@ Surface* Surface::getScreen()
 }
 
 int Surface::drawText(const char* text, int x, int y, ULONG rgba)
+{
+  return drawText(text, x, y, 2000, rgba);
+}
+
+int Surface::drawText(const char* text, int x, int y, int width, ULONG rgba)
 {
   int h, n, i;
   int Y, X, cx;
@@ -57,7 +62,7 @@ int Surface::drawText(const char* text, int x, int y, ULONG rgba)
     int w = font->width[c];
     int pixels = 0;
 
-    for (X=0; X<w; X++)
+    for (X=0; (X<w) && (X + cx < width); X++)
     {
       for (Y=0; Y<h; Y++)
       {
index df8c313bbcdfe8c485f6ce20f7e0ab03119f2d68..9a15f6dc173d25dffbc3dbf1eb44cfafd1807120 100644 (file)
--- a/surface.h
+++ b/surface.h
@@ -50,6 +50,7 @@ class Surface
     int getCharWidth(char c);
 
     int drawText(const char* text, int x, int y, ULONG rgba);
+    int drawText(const char* text, int x, int y, int width, ULONG rgba);
     int drawTextRJ(const char* text, int x, int y, ULONG rgba);
     int drawTextCentre(const char* text, int x, int y, ULONG rgba);
 
index 9faad22d22445bd17f9c1ec558c7e8e592082f54..9992e0337b8c630387c9f0e98b5a8f8e63efd075 100644 (file)
@@ -95,7 +95,8 @@ VVideoRec::VVideoRec(Recording* rec)
   clocksRegion.h = surface->getFontHeight();
 
 
-  barBlue.set(0, 0, 150, 150);
+//  barBlue.set(0, 0, 150, 150);
+  barBlue.set(0, 0, 0, 128);
 
   barShowing = false;
   barGenHold = false;
index 9295324b76ccb9a9d23b5be3bbd41b31dcd0bd85..b961523df54f28ffe1571ff9ab43925e27849c45 100644 (file)
@@ -117,11 +117,11 @@ void WSelectList::draw()
     if (i == selectedOption && showseloption)
     {
       rectangle(0, ypos, area.w, fontHeight, Colour::SELECTHIGHLIGHT);
-      drawOptionLine(options[i].text, 5, ypos, Colour::DARKTEXT);
+      drawOptionLine(options[i].text, 5, ypos, area.w - 5, Colour::DARKTEXT);
     }
     else
     {
-      drawOptionLine(options[i].text, 5, ypos, Colour::LIGHTTEXT);
+      drawOptionLine(options[i].text, 5, ypos, area.w - 5, Colour::LIGHTTEXT);
     }
     ypos += ySeperation;
   }
@@ -133,11 +133,11 @@ void WSelectList::addColumn(int x)
   columns[numColumns++] = x;
 }
 
-void WSelectList::drawOptionLine(char* text, int xpos, int ypos, Colour& colour)
+void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, Colour& colour)
 {
   if (!numColumns)
   {
-    drawText(text, xpos, ypos, colour);
+    drawText(text, xpos, ypos, width, colour);
   }
   else
   {
@@ -149,7 +149,7 @@ void WSelectList::drawOptionLine(char* text, int xpos, int ypos, Colour& colour)
     pointer = strtok(buffer, "\t");
     while(pointer)
     {
-      drawText(pointer, xpos + columns[currentColumn], ypos, colour);
+      drawText(pointer, xpos + columns[currentColumn], ypos, width - columns[currentColumn], colour);
       currentColumn++;
       if (currentColumn == 10) return;
       pointer = strtok(NULL, "\t");
index dbd1b9e9037dffa47783ea6d6056a585fa4778e1..008d8945aec7072a5732749b51d15664362f8b95 100644 (file)
@@ -69,7 +69,7 @@ class WSelectList : public Boxx
     virtual bool mouseLBDOWN(int x, int y);
 
   private:
-    void drawOptionLine(char* text, int xpos, int ypos, Colour& colour);
+    void drawOptionLine(char* text, int xpos, int ypos, int width, Colour& colour);
     int getMouseLine(int x, int y);
 
     vector<wsloption> options;