Re: subclassing fp_Run (was) Re: Backend changes ready for commit -please test it!


Subject: Re: subclassing fp_Run (was) Re: Backend changes ready for commit -please test it!
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Wed Feb 21 2001 - 21:00:28 CST


On Thu, 22 Feb 2001, Mike Nordell wrote:

> Martin Sevior wrote:
> > OK I've thought about this a bit more and unless I misunderstand something
> > about C++ subclassing I think your solution is a much bigger maintenance
> > issue.
>
> Perhaps the design is flawed? Perhaps some work is done in the wrong class?
> What about not giving runs even more members, but letting the HdrFtrLayout
> not forward the draw() calls to the runs it is responsible for? Am I
> understanding the issue here, a run should often not be drawn when layed out
> by a HdrFtrLayout?
> This would void the need for new run and line types.

That is exactly the point. As I've said it would be easy to do this by
inventing a m_bIsVirtual member variable for BlockLayout then pasing this
to runs and lines.

>
> But this also raises a more serious issue: Should a run really know anything
> about the world which it lives in?
>

As things stand now, runs need to know their block and line. Lines need
to know their pages but runs draw themselves.

>
> I don't think we really care _what_ type of run we have created once we have
> created it, why the following possibly would suffice:
>
> fp_Run* pRun = m_bIsHdrFtr ? new fp_HdrFtrTextRun(...) : new
> fp_TextRun(...);
>
> or even better, create a factory for runs:
>
> fp_Run* = CreateTextRun(m_bIsHdrFtr);
>

OK much nicer.

> > Now I think about it I don't think we should call the variable
> > m_bisHdrFtr.
>
> Agreed.
>
> > I think it should be called m_bisVirtual because this means
> > this block/line/run is never drawn on the screen.
>
> <sigh>
> The draw method of runs are to be called by, whom? Any of the layout
> classes? This is at least in my mind the only reasonable implementation and
> logic. Then, it's as simple as falling off a log for the HdrFtrLayout class
> to _not_ call the draw() method of the runs.
>

Of Course! I'm stupid. We just override the updateLayout methods in the
HdrFtrSectionLayout so draws are never called. MUCH more sensible.

Right now they're inherited from fl_SectionLayout so of course stuff gets
drawn.

Thanks Mike. I did not see the Woods for the trees.

I'll follow this up now.

Martin



This archive was generated by hypermail 2b25 : Wed Feb 21 2001 - 21:00:38 CST