kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #44109
Re: Assumptions about EDA_DRAW_FRAME in pcbnew
On 2020-07-03 16:31, Reece R. Pollack wrote:
> My submission last year was intended to allow any or all of the KiCad subsystems (eeschema, pcbnew, gerbview, etc.) make use of origin transforms. Gerbview could benefit, because if you set the place and drill origin to the lower left of you design when you generate Gerbers, Gerbview displays the page border below the displayed board. I'd thought about how to do this in eeschema, considering an origin at any of the four corners or at the aux origin (which is defined in eeschema but is not settable). But I did a full implementation on pcbnew because that was what I felt really needed it.That implementation added a parameter to the functions I mentioned above, which resulted in the eeschema functions also having that parameter even though they didn't use it.
>
> When Wayne sent out his last call for comments before he merged the changes, Seth complained that since I didn't implement support in eeschema then these changes should not affect any code in the eeschema directory. His suggestion was to use function overloading, but that would result in having two interfaces visible in the both eeschema and pcbnew, one that worked in that context and one that didn't. You wouldn't know that the code called the wrong function until you noticed broken behavior. I don't consider that an acceptable situation just to avoid a trivial parameter list change.
Hi Reece-
I think I mentioned back then that I'm happy to help with the
implementation. The offer remains if you are interested.
It is easy enough to overload with a pure virtual function in the base
class. The derived classes can override (not overload) the virtual
functions that apply to each. So pcbnew gets one viable function
signature and eeschema gets the other. Misusing this gets an error in
compiling, which keeps errors from creeping down to the user.
One aspect of dynamic_cast that is sometimes overlooked is that casts to
the base class are optimized out by the compiler. I think that might
save your implementation (if I understand your intention correctly)
Best-
Seth
Seth Hillbrand
KiCad Services Corporation
https://www.kipro-pcb.com
+1 530 302 5483 | +1 212 603 9372
Follow ups
References