pcbnew Module Editor & Viewer GALification blueprint
Maciej Sumiński/CERN <maciej.suminski@cern.ch>, May 2014
In order to complete the GALification process of pcbnew, there are three
remaining view panels that should be replaced by a GAL canvas: the pad
viewer, the library module editor & viewer (aka browser).
To keep look-and-feel of pcbnew consistent, the canvas should be
selected basing on the current view. If user sticks to the legacy view -
it should stay this way in the editor and browser as well.
Pad viewer
The pad viewer is shown when one opens properties window for a pad. It allows to see changes introduced by modification of the edited pad's properties in the real time. All operations are handled by the DIALOG_PAD_PROPERTIES class. The visualization is presented on wxPanel (m_panelShowPad). To replace it with a GAL view, I see two possible solutions (both are a bit hacky, but this is what happens when there are 2 views in parallel):
- Change m_panelShowPad type from wxPanel* to wxWindow* and if GAL is to be used - recreate it in the DIALOG_PAD_PROPERTIES constructor, fix the code in the painting routine.
- Add a DRAW_PANEL_GAL (or a simpler object that only displays BOARD_ITEMs) to the DIALOG_PAD_PROPERTIES_BASE and hide either m_panelShowPad or the GAL canvas in the DIALOG_PAD_PROPERTIES constructor.
Module viewer
The viewer owns a canvas that displays a selected part and allows to zoom in/zoom out/pan the view. Changing the legacy view to the GAL one should be a relatively easy task, considering the FOOTPRINT_VIEWER_FRAME class inherits from the EDA_DRAW_FRAME. That means, it already contains the right canvas - it just has to be explicitly shown and then a few handlers have to be extended by routines to deal with drawing and controlling the view.
Module editor
The module editor requires introduction of the same changes as the viewer, but applied to the FOOTPRINT_EDIT_FRAME. As it also allows to modify footprints, there needs to be an instance of TOOL_MANAGER that coordinates a set of tools (SELECTION_TOOL, DRAWING_TOOL, POINT_EDITOR).
Proposed improvements
* Use the tools that were created for the Tool Framework. That will allow users to have e.g. SELECTION_TOOL, all upgrades done for drawing tools, EDIT_POINTs for graphics editing.
* I have seen users asking for a possibility of drawing on layers
different than silkscreen (particularly the edge layer). There was a
comment that it may break DRC/zone filling.
Required changes for having lines on Edge.Cuts layer:
-
The zone filling algorithm requires a single change:
diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index b41d859..f2bc923 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -299,7 +299,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) { for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) {
-
if( !item->IsOnLayer( GetLayer() ) )
-
if( !item->IsOnLayer( GetLayer() ) && !item->IsOnLayer( EDGE_N ) ) continue; if( item->Type() != PCB_MODULE_EDGE_T )
-
-
Please correct me if I am wrong, but the current DRC allows to have items crossing board edges (they are not pointed out as errors). If so, then there is no modification required to the DRC algorithm.
-
Board edges stored in modules are plotted & printed correctly.
Required changes for drawings on other layers (Adhesive, Paste, Mask, Drawings, Eco, Comments are):
-
Add a layer widget, the one that is used in the board editor, as currently it is possible to have drawings on the mentioned layers, but it requires editing every item individually.
- Another requested features are tracks, vias, zones & keepout areas
stored in modules.
Required changes: - Function PCB_PARSER::parseMODULE() needs to be able to parse track/via/zone definitions from files (it is already done in PCB_PARSER::parseBOARD()).
- TODO drc/zone filling algorithms
- Another requested features are tracks, vias, zones & keepout areas
stored in modules.
- Copy & paste pads. It is less important, as the module editor saves the last pad that was placed and uses it as a template for new ones.
Other remarks
To reduce amount of replicated code, there could be created a new, simple widget which has only one purpose - draw a BOARD_ITEM and allow simple view control (zoom in/out, panning).