← Back to team overview

kicad-developers team mailing list archive

Assumptions about EDA_DRAW_FRAME in pcbnew


Noting that the PCB_BASE_FRAME class is derived from the EDA_DRAW_FRAME class, is it acceptable to assume that the EDA_DRAW_FRAME pointer parameters passed to functions in Pcbnew classes are actually pointers to a PCB_BASE_FRAME?


 * The UNIT_BINDER class constructor
 * The classes implementing the GetMsgPanelInfo function
 * The classes implementing the GetSelectMenuText function

The reason I'm asking is that to implement origin transforms these functions need access to the user's display option that chooses the display origin. This needs access to a function defined in the PCB_BASE_FRAME class. I can make that a common function defined in EDU_DRAW_FRAME and overridden in PCB_BASE_FRAME, or the code needs to know that parameter is really a pointer to a PCB_BASE_FRAME object.

If the functions defined in PCB-specific classes are defined to be getting pointers to PCB_BASE_FRAME classes, I can just change the parameter type and avoid the need to play games with dynamic casts.



Follow ups