On Aug 15, 2008, at 11:21 AM, Maximilian Albert wrote:
> Hi all,
>
> there is a large chunk of code (~ 130 lines) that is essentially
> duplicated in both dyna-draw-context.cpp and eraser-context.cpp,
> namely
> the function fit_and_split(). The two versions only really differ in a
> few lines, but they also contains a couple of #ifdef switches that are
> used for debugging. The problem is that these are also dependent on
> the
> file (to wit, #ifdef ERASER_VERBOSE and #ifdef DYNA_DRAW_VERBOSE). I
> believe it would make sense to melt these two functions together, but
> how can this be done while at the same time respecting the #ifdefs? Is
> there a kind of #or directive?
>
> Max
>
> P.S.: It just occurred to me that the two contexts might share other
> code, too (although I haven't checked). Perhaps they could even be
> merged to a larger extent.
Actually what happened is that the eraser code was copied from the
dyna-draw code. Then as we go that is being refactored, with common
code going into a common base class and the specific code being
retuned and left different in each of the two original classes
So yes, you did spot a bit of duplication that needs refactoring.
However it is an area that I'm working on incrementally, so you won't
have to do direct cleanup yourself.
Thanks.
|