On 04/04/13 14:32, Greg Ercolano wrote:
> On 04/04/13 09:44, Manolo Gouy wrote:
>> I've seen that commenting out line 657 of file src/Fl_Help_View.cxx
>> seems to fix this problem. But does this have other negative effects?
> [..]
>       That does seem to allow multiple <BR>s to work.
> 
>       But also seems to badly affect the document height calculations
>       such that the scrollbar doesn't let one reach the bottom of the 
> document.
> [..]
>       Perhaps block->h needs to be adjusted for this to work correctly.

    OK, looks like to solve the scrollbar issue, one has to comment out
    the corresponding "hh = 0;" line in the Fl_Help_View::format() function.

    So I think together these two changes work a bit better (still not sure
    if there are other negative effects):
_____________________________________________________________________________

--- Fl_Help_View.cxx    (revision 9857)
+++ Fl_Help_View.cxx    (working copy)
@@ -654,7 +654,7 @@
              line ++;
            xx = block->line[line];
             yy += hh;
-           hh = 0;
+           //hh = 0;
          }
          else if (strcasecmp(buf, "HR") == 0)
          {
@@ -1298,7 +1298,7 @@
           xx       = block->x;
          block->h += hh;
           yy       += hh;
-         hh       = 0;
+         //hh       = 0;
        }
        else if (strcasecmp(buf, "CENTER") == 0 ||
                 strcasecmp(buf, "P") == 0 ||
_____________________________________________________________________________

        It looks like Help_View::format() and Help_View::draw() methods
        depend on each other's code to be symmetrical.

        I usually find code like this hard to maintain if managed in separate
        functions, because it's too easy for the code to get out of sync.

        I usually try to keep symmetrical code designs such that each block
        of code is kept close together, so other programmers can clearly
        see modifying one code block affects the other, eg:


void HtmlClass::Handle_BR(..) {
  if (formatting) {
    ..code to handle <BR> formatting..
  } else {
    ..code to handle <BR> drawing..
  }
}

        I've had to do this sort of thing with complex state machines
        and receive/transmit code.. works well when the code blocks are short,
        so it's easy to see matching code in a single page.
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to