Author Topic: Patch: Fix drawing of too long lines  (Read 6582 times)

Offline muellerph

  • Full Member
  • ***
  • Posts: 136
    • View Profile
    • Email
Patch: Fix drawing of too long lines
« on: July 07, 2007, 23:31:02 »
Hello,

I attached a (small) patch to fix 2 drawing issues:

1. Recordlist: Endings of long recordingnames are not deleted when scrolled http://www.loggytronic.com/forum/index.php?PHPSESSID=8qoviesscgemsrti29so1ekn13&topic=232.0

2. Titlebars: In case the titelbar content is too long, the text had 5 pixels at left end, but not on the right end. Currently wasn't ugly like 1., but I still like it better this way.

How this was fixed:
I added implemented in the drawText function in surface.cc a width check and added the necessary functions with the new argument. All current drawText function still work, as with a width of 0, no length check is done.

Remarks:
1, Currently it is only a width check as I don't think that a height check makes sense
2. I didn't implemented a check for right aligned or centered text yet. Chris: If you want these as well, I will implement it for sure.
3. This check can now be used at other places as well, like for fixing e.g. http://sourceforge.net/tracker/index.php?func=detail&aid=1453263&group_id=139484&atid=743655, but I wait till you say you accept the implementation


(Changed: attachement removed because of new version available)
« Last Edit: November 12, 2007, 08:39:58 by muellerph »

Offline muellerph

  • Full Member
  • ***
  • Posts: 136
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #1 on: November 11, 2007, 22:13:07 »
I have updated the patch against current CVS.
Also I changed the logic a bit. A check against 0 is ugly (C), so I defined default maximum width with 2000.

(changed: removed wrong patch)
« Last Edit: November 13, 2007, 00:38:19 by muellerph »

Offline hondansx

  • Full Member
  • ***
  • Posts: 169
    • ICQ Messenger - 178471580
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #2 on: November 12, 2007, 19:51:00 »
Hi,

are you sure this is the right new patch?  ;)

Code: [Select]
--- box.cc      20 May 2006 20:17:28 -0000      1.13
+++ box.cc      7 Jul 2007 21:57:10 -0000

Thanks a lot
Walter
« Last Edit: November 12, 2007, 19:52:42 by hondansx »
GA-EP43 | headless | 1xCineS2 Dual | 1xSkystar 2.6D | VDR 1.7.37 
Frontend: 1xRasperry | 1xION3

Offline muellerph

  • Full Member
  • ***
  • Posts: 136
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #3 on: November 13, 2007, 00:37:36 »
Arg,

you are right. I uploaded the old one twice. Now attached the correct one.

Sorry,

Philipp

Offline Chris

  • Administrator
  • Hero Member
  • *****
  • Posts: 543
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #4 on: January 12, 2008, 17:08:09 »
This patch is now in CVS, thanks Philipp!

It's not been that long has it ???  :o

Offline muellerph

  • Full Member
  • ***
  • Posts: 136
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #5 on: January 15, 2008, 08:03:08 »
It's not been that long has it ???  :o
No issue with the timing. It's rather that I'm now not sure anymore if it is the right fix.

While I was playing with the scrollbar stuff I assume I got the right clue. There is no need to limit text drawing, as this should be handled automatically by WTextBox (or similar classes). WTextBox drawing is anyway limited by area (as all drawing widgets), so we just need to use the area limitation correctly.

The sad side is that if I only use area the text is drawn in the whole are. So no margin on left/right/top/bottom side.
Okay, we have wtextbox->settestpos, but this only works on top/left, but not on right/bottom (which would be needed for this fix).

So I'm only sure this fix is not really correct, while still thinking about a correct solution.

So not too late, but too late from my side to give these comments.

Anyway, better to have a fix for the drawing error now than to have just ideas for a correct solution ;)

Offline Chris

  • Administrator
  • Hero Member
  • *****
  • Posts: 543
    • View Profile
    • Email
Re: Patch: Fix drawing of too long lines
« Reply #6 on: January 15, 2008, 13:37:24 »
Yeeeah, it's fine! Ok, you might change it later, fine!

When I write most of my code I fully intend to replace it one day!