From 5dbcca154323faf980609bb26cf067397cecb7ab Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 23 Sep 2011 09:57:12 -0400 Subject: [PATCH] PCB common library header rationalization. * All header files used to create the PCB common library now compile as stand alone code. This prevents the need to define them in a specific order to make source code compile properly. It should also now be possible to relocate the source code to build the common PCB library to a separate folder. --- 3d-viewer/3d_aux.cpp | 8 + 3d-viewer/3d_draw.cpp | 10 + 3d-viewer/3d_struct.h | 7 +- 3d-viewer/3d_viewer.h | 11 +- common/class_layer_box_selector.cpp | 5 +- common/footprint_info.cpp | 6 +- common/pcbcommon.cpp | 6 + cvpcb/autosel.cpp | 3 +- cvpcb/class_DisplayFootprintsFrame.cpp | 4 +- cvpcb/class_DisplayFootprintsFrame.h | 16 +- cvpcb/class_footprints_listbox.cpp | 1 + cvpcb/cvpcb.cpp | 1 + cvpcb/cvpcb_mainframe.h | 6 +- cvpcb/dialogs/dialog_cvpcb_config.cpp | 1 + cvpcb/init.cpp | 10 +- cvpcb/listboxes.cpp | 8 +- cvpcb/loadcmp.cpp | 15 +- cvpcb/setvisu.cpp | 12 +- gerbview/block.cpp | 1 + gerbview/class_aperture_macro.cpp | 2 + gerbview/class_gerber_draw_item.cpp | 1 + gerbview/class_gerbview_layer_widget.cpp | 8 +- gerbview/dcode.cpp | 1 + gerbview/events_called_functions.cpp | 143 +++++----- gerbview/export_to_pcbnew.cpp | 11 +- gerbview/files.cpp | 1 + gerbview/gerbview.cpp | 7 +- gerbview/gerbview_config.cpp | 16 +- gerbview/gerbview_frame.cpp | 12 +- gerbview/gerbview_frame.h | 47 ++-- gerbview/hotkeys.cpp | 44 ++-- gerbview/initpcb.cpp | 7 +- gerbview/onrightclick.cpp | 4 +- gerbview/rs274x.cpp | 17 +- include/build_version.h | 3 + include/class_board_design_settings.h | 48 ++-- include/dlist.h | 3 + include/pcbcommon.h | 17 +- include/pcbstruct.h | 60 +---- pcbnew/ar_protos.h | 1 + pcbnew/attribut.cpp | 6 +- pcbnew/automove.cpp | 5 +- pcbnew/autoplac.cpp | 9 +- pcbnew/autorout.cpp | 6 +- pcbnew/autorout.h | 3 + pcbnew/basepcbframe.cpp | 4 +- pcbnew/block.cpp | 33 ++- pcbnew/block_module_editor.cpp | 12 +- pcbnew/board.cpp | 8 + ...board_items_to_polygon_shape_transform.cpp | 7 + pcbnew/board_undo_redo.cpp | 11 + pcbnew/build_BOM_from_board.cpp | 4 + pcbnew/class_board.cpp | 33 ++- pcbnew/class_board.h | 18 +- pcbnew/class_board_connected_item.cpp | 10 +- pcbnew/class_board_design_settings.cpp | 72 +++--- pcbnew/class_board_item.cpp | 9 +- pcbnew/class_dimension.cpp | 8 +- pcbnew/class_dimension.h | 5 +- pcbnew/class_drawsegment.cpp | 20 +- pcbnew/class_drawsegment.h | 15 +- pcbnew/class_drc_item.cpp | 2 + pcbnew/class_edge_mod.cpp | 22 +- pcbnew/class_edge_mod.h | 7 +- pcbnew/class_footprint_library.cpp | 2 + pcbnew/class_marker_pcb.cpp | 24 +- pcbnew/class_marker_pcb.h | 11 +- pcbnew/class_mire.cpp | 14 +- pcbnew/class_mire.h | 32 ++- pcbnew/class_module.cpp | 24 +- pcbnew/class_module.h | 13 +- pcbnew/class_module_transform_functions.cpp | 15 +- pcbnew/class_netclass.cpp | 7 +- pcbnew/class_netclass.h | 4 + pcbnew/class_netinfo.h | 74 +++--- pcbnew/class_netinfo_item.cpp | 9 +- pcbnew/class_netinfolist.cpp | 38 +-- pcbnew/class_pad.cpp | 27 +- pcbnew/class_pad.h | 11 +- pcbnew/class_pad_draw_functions.cpp | 18 +- pcbnew/class_pcb_layer_widget.cpp | 11 +- pcbnew/class_pcb_text.cpp | 23 +- pcbnew/class_pcb_text.h | 32 +-- pcbnew/class_text_mod.cpp | 19 +- pcbnew/class_text_mod.h | 58 +++-- pcbnew/class_track.cpp | 20 +- pcbnew/class_track.h | 6 +- pcbnew/class_zone.cpp | 28 +- pcbnew/class_zone.h | 3 +- pcbnew/class_zone_setting.cpp | 2 +- pcbnew/class_zone_setting.h | 61 +++-- pcbnew/classpcb.cpp | 16 +- pcbnew/clean.cpp | 8 +- pcbnew/collectors.cpp | 5 +- pcbnew/collectors.h | 9 +- pcbnew/connect.cpp | 17 +- pcbnew/controle.cpp | 18 +- pcbnew/cross-probing.cpp | 22 +- pcbnew/deltrack.cpp | 9 +- pcbnew/dialogs/dialog_SVG_print.cpp | 11 +- pcbnew/dialogs/dialog_copper_zones.cpp | 5 +- pcbnew/dialogs/dialog_design_rules.cpp | 4 + pcbnew/dialogs/dialog_design_rules.h | 7 + pcbnew/dialogs/dialog_display_options.cpp | 2 + pcbnew/dialogs/dialog_drc.h | 14 +- .../dialog_edit_module_for_BoardEditor.cpp | 5 + .../dialog_edit_module_for_Modedit.cpp | 3 + pcbnew/dialogs/dialog_edit_module_text.cpp | 7 + pcbnew/dialogs/dialog_freeroute_exchange.cpp | 2 + pcbnew/dialogs/dialog_gendrill.cpp | 4 + pcbnew/dialogs/dialog_general_options.cpp | 5 +- pcbnew/dialogs/dialog_global_deletion.cpp | 6 + .../dialog_global_edit_tracks_and_vias.cpp | 4 +- .../dialog_graphic_item_properties.cpp | 5 + .../dialogs/dialog_graphic_items_options.cpp | 3 +- pcbnew/dialogs/dialog_layers_setup.cpp | 4 +- pcbnew/dialogs/dialog_mask_clearance.cpp | 3 +- pcbnew/dialogs/dialog_netlist.cpp | 4 + pcbnew/dialogs/dialog_orient_footprints.cpp | 3 + pcbnew/dialogs/dialog_pad_properties.cpp | 12 +- pcbnew/dialogs/dialog_pcb_text_properties.cpp | 7 +- .../dialog_pcbnew_config_libs_and_paths.cpp | 3 +- pcbnew/dialogs/dialog_print_using_printer.cpp | 12 +- pcbnew/dimension.cpp | 10 +- pcbnew/dist.cpp | 194 +++++++------- pcbnew/drag.h | 19 +- pcbnew/dragsegm.cpp | 8 +- pcbnew/drc.cpp | 15 +- pcbnew/drc_clearance_test_functions.cpp | 13 +- pcbnew/drc_marker_functions.cpp | 5 + pcbnew/drc_stuff.h | 74 +++--- pcbnew/edgemod.cpp | 9 +- pcbnew/edit.cpp | 16 +- pcbnew/edit_pcb_text.cpp | 6 +- pcbnew/edit_track_width.cpp | 7 +- pcbnew/editedge.cpp | 9 +- pcbnew/editmod.cpp | 4 + pcbnew/editrack-part2.cpp | 11 +- pcbnew/editrack.cpp | 12 +- pcbnew/edtxtmod.cpp | 18 +- pcbnew/event_handlers_tracks_vias_sizes.cpp | 19 +- pcbnew/export_gencad.cpp | 19 +- pcbnew/export_vrml.cpp | 11 +- pcbnew/files.cpp | 19 +- pcbnew/find.cpp | 8 +- pcbnew/gen_drill_report_files.cpp | 9 +- .../gen_holes_and_tools_lists_for_drill.cpp | 22 +- pcbnew/gen_modules_placefile.cpp | 17 +- pcbnew/gendrill.cpp | 9 +- pcbnew/gendrill.h | 17 +- pcbnew/globaleditpad.cpp | 13 +- pcbnew/gpcb_exchange.cpp | 20 +- pcbnew/graphpcb.cpp | 8 +- pcbnew/hotkeys_board_editor.cpp | 16 +- pcbnew/initpcb.cpp | 15 +- pcbnew/ioascii.cpp | 34 ++- pcbnew/librairi.cpp | 11 +- pcbnew/loadcmp.cpp | 21 +- pcbnew/magnetic_tracks_functions.cpp | 13 +- pcbnew/mirepcb.cpp | 17 +- pcbnew/modedit.cpp | 26 +- pcbnew/modedit_onclick.cpp | 19 +- pcbnew/modedit_undo_redo.cpp | 8 +- pcbnew/moduleframe.cpp | 21 +- pcbnew/modules.cpp | 16 +- pcbnew/move-drag_pads.cpp | 16 +- pcbnew/move_or_drag_track.cpp | 19 +- pcbnew/muonde.cpp | 21 +- pcbnew/netlist.cpp | 7 +- pcbnew/onleftclick.cpp | 22 +- pcbnew/onrightclick.cpp | 17 +- pcbnew/pcbframe.cpp | 2 +- pcbnew/pcbnew.cpp | 25 +- pcbnew/pcbnew.h | 47 ++-- pcbnew/pcbnew_config.cpp | 20 +- pcbnew/pcbnew_config.h | 10 + pcbnew/pcbplot.cpp | 15 +- pcbnew/pcbplot.h | 16 +- pcbnew/plot_rtn.cpp | 18 +- pcbnew/plotdxf.cpp | 13 +- pcbnew/plotgerb.cpp | 24 +- pcbnew/plothpgl.cpp | 14 +- pcbnew/plotps.cpp | 15 +- pcbnew/print_board_functions.cpp | 23 +- pcbnew/printout_controler.cpp | 6 +- pcbnew/protos.h | 32 ++- pcbnew/ratsnest.cpp | 17 +- pcbnew/sel_layer.cpp | 15 +- pcbnew/set_grid.cpp | 11 +- pcbnew/solve.cpp | 9 +- pcbnew/specctra.cpp | 7 +- pcbnew/specctra.h | 6 + pcbnew/specctra_export.cpp | 18 +- pcbnew/specctra_import.cpp | 9 +- pcbnew/surbrill.cpp | 20 +- pcbnew/swap_layers.cpp | 17 +- pcbnew/tool_pcb.cpp | 5 +- pcbnew/toolbars_update_user_interface.cpp | 20 +- pcbnew/tr_modif.cpp | 15 +- pcbnew/tracepcb.cpp | 22 +- pcbnew/trpiste.cpp | 20 +- pcbnew/xchgmod.cpp | 11 +- pcbnew/zone_filling_algorithm.cpp | 34 ++- pcbnew/zones_by_polygon.cpp | 23 +- pcbnew/zones_by_polygon_fill_functions.cpp | 16 +- ...nvert_brd_items_to_polygons_with_Boost.cpp | 20 +- ...ones_convert_to_polygons_aux_functions.cpp | 27 +- pcbnew/zones_functions_for_undo_redo.cpp | 48 +++- pcbnew/zones_non_copper_type_functions.cpp | 12 +- ...ones_polygons_insulated_copper_islands.cpp | 110 ++++---- pcbnew/zones_polygons_test_connections.cpp | 104 ++++---- pcbnew/zones_test_and_combine_areas.cpp | 244 ++++++++++++------ 212 files changed, 2394 insertions(+), 1424 deletions(-) diff --git a/3d-viewer/3d_aux.cpp b/3d-viewer/3d_aux.cpp index b3b667f92a..98cf72c76d 100644 --- a/3d-viewer/3d_aux.cpp +++ b/3d-viewer/3d_aux.cpp @@ -10,6 +10,14 @@ #include "common.h" #include "trigo.h" +#include "wxBasePcbFrame.h" + +#include "class_board_design_settings.h" +#include "class_zone.h" +#include "class_text_mod.h" +#include "class_module.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" #include "3d_viewer.h" #include "trackball.h" diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 87c07cb7a8..e0a2c29c9c 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -9,7 +9,17 @@ #include "macros.h" #include "drawtxt.h" #include "confirm.h" +#include "layers_id_colors_and_visibility.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_edge_mod.h" +#include "class_zone.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" #include "class_board_design_settings.h" +#include "class_marker_pcb.h" #include "colors_selection.h" #include "3d_viewer.h" diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index d841fa0a30..b19934b212 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -1,10 +1,11 @@ -/*****************/ -/* 3d_struct.h */ -/*****************/ +/** + * @file 3d_struct.h + */ #ifndef STRUCT_3D_H #define STRUCT_3D_H +#include "common.h" #include "base_struct.h" diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index 14a3a9b9c8..a431fea76f 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -4,6 +4,9 @@ #ifndef __3D_VIEWER_H__ #define __3D_VIEWER_H__ +#include "wxBasePcbFrame.h" // m_auimanager member. + + #if !wxUSE_GLCANVAS #error Please set wxUSE_GLCANVAS to 1 in setup.h. #endif @@ -20,11 +23,17 @@ # include #endif -#include "pcbstruct.h" #include "3d_struct.h" #include "id.h" +class BOARD_DESIGN_SETTINGS; +class TRACK; +class TEXTE_PCB; +class DRAWSEGMENT; +class ZONE_CONTAINER; + + #define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index fd82b19bf3..bfabbf7ff3 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -3,12 +3,13 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" #include "colors_selection.h" - +#include "layers_id_colors_and_visibility.h" #include "bitmaps.h" - #include "hotkeys.h" #include "help_common_strings.h" +#include "class_board.h" + #include #include #include diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 9323dda786..a1778815b7 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -13,12 +13,16 @@ #include "kicad_string.h" #include "macros.h" #include "appl_wxstruct.h" -#include "pcbstruct.h" + #include "pcbcommon.h" +#include "pcbstruct.h" #include "richio.h" #include "filter_reader.h" #include "footprint_info.h" +#include "class_pad.h" +#include "class_module.h" + /* Read the list of libraries (*.mod files) * for each module are stored diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index b1237d6054..fc9aed92cf 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -33,9 +33,15 @@ #include "fctsys.h" #include "pcbcommon.h" #include "plot_common.h" + +#include "class_pad.h" #include "class_zone_setting.h" #include "class_board_design_settings.h" + +class MODULE; + + /* Look up Table for conversion one layer number -> one bit layer mask: */ int g_TabOneLayerMask[LAYER_COUNT] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp index 02829ca0d8..8203f92a64 100644 --- a/cvpcb/autosel.cpp +++ b/cvpcb/autosel.cpp @@ -1,5 +1,5 @@ /**********************/ -/* CVPCB: autosel.cpp */ +/* CVPCB: autosel.cpp */ /**********************/ /* Routines for automatic selection of modules. */ @@ -10,6 +10,7 @@ #include "gestfich.h" #include "appl_wxstruct.h" #include "kicad_string.h" +#include "macros.h" #include "cvpcb.h" #include "cvpcb_mainframe.h" diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 5cd0188fc1..a65d2acbf5 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -8,9 +8,11 @@ #include "class_drawpanel.h" #include "confirm.h" #include "macros.h" +#include "bitmaps.h" + +#include "class_board.h" #include "cvpcb.h" -#include "bitmaps.h" #include "cvpcb_mainframe.h" #include "class_DisplayFootprintsFrame.h" #include "cvpcb_id.h" diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index 8ce17327d0..a92c552a20 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -1,10 +1,18 @@ -/* class_DisplayFootprintsFrame.h */ +/** + * @file class_DisplayFootprintsFrame.h + */ -/*******************************************************/ -/* class DISPLAY_FOOTPRINTS_FRAME: used to display footprints */ -/*******************************************************/ +#include "wxBasePcbFrame.h" + +class CVPCB_MAINFRAME; + + +/** + * Class DISPLAY_FOOTPRINTS_FRAME + * is used to display footprints. + */ class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME { public: diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp index 6b1d10e24b..8854321edc 100644 --- a/cvpcb/class_footprints_listbox.cpp +++ b/cvpcb/class_footprints_listbox.cpp @@ -5,6 +5,7 @@ #include "fctsys.h" #include "wxstruct.h" +#include "macros.h" #include "cvpcb.h" #include "cvpcb_mainframe.h" diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 435db2a6ea..d6f46ccc02 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -3,6 +3,7 @@ /*******************/ #include "fctsys.h" +#include "gr_basic.h" #include "appl_wxstruct.h" #include "wxstruct.h" #include "confirm.h" diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 6025de3eeb..5c02a7223d 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -5,13 +5,17 @@ #ifndef _CVPCB_MAINFRAME_H_ #define _CVPCB_MAINFRAME_H_ -#include "wx/listctrl.h" +#include #include + +#include "wxBasePcbFrame.h" #include "param_config.h" #include "cvpcb.h" #include "footprint_info.h" + /* Forward declarations of all top-level window classes. */ +class EDA_TOOLBAR; class FOOTPRINTS_LISTBOX; class COMPONENTS_LISTBOX; class DISPLAY_FOOTPRINTS_FRAME; diff --git a/cvpcb/dialogs/dialog_cvpcb_config.cpp b/cvpcb/dialogs/dialog_cvpcb_config.cpp index 7dd704db3b..576df736bd 100644 --- a/cvpcb/dialogs/dialog_cvpcb_config.cpp +++ b/cvpcb/dialogs/dialog_cvpcb_config.cpp @@ -11,6 +11,7 @@ #include "confirm.h" #include "gestfich.h" #include "id.h" +#include "macros.h" #include "cvpcb.h" #include "cvpcb_mainframe.h" diff --git a/cvpcb/init.cpp b/cvpcb/init.cpp index a47b345358..7d9b68f608 100644 --- a/cvpcb/init.cpp +++ b/cvpcb/init.cpp @@ -1,6 +1,6 @@ -/**************/ -/* init.cpp */ -/**************/ +/** + * @file init.cpp + */ #include "fctsys.h" #include "common.h" @@ -8,13 +8,13 @@ #include "gr_basic.h" #include "gestfich.h" #include "appl_wxstruct.h" +#include "macros.h" +#include "build_version.h" #include "cvpcb.h" #include "cvpcb_mainframe.h" #include "cvstruct.h" -#include "build_version.h" - void CVPCB_MAINFRAME::SetNewPkg( const wxString& package ) { diff --git a/cvpcb/listboxes.cpp b/cvpcb/listboxes.cpp index 0535b93808..96d0116cd9 100644 --- a/cvpcb/listboxes.cpp +++ b/cvpcb/listboxes.cpp @@ -1,9 +1,11 @@ -/*************************************************************************/ -/* listboxes.cpp: class for displaying footprint list and component list */ -/*************************************************************************/ +/** + * @file listboxes.cpp + * @brief Implementation of class for displaying footprint list and component lists. + */ #include "fctsys.h" #include "wxstruct.h" +#include "macros.h" #include "cvpcb.h" #include "cvpcb_mainframe.h" diff --git a/cvpcb/loadcmp.cpp b/cvpcb/loadcmp.cpp index b9a1dd2a80..3bfbda1abf 100644 --- a/cvpcb/loadcmp.cpp +++ b/cvpcb/loadcmp.cpp @@ -1,15 +1,19 @@ -/***************/ -/* loadcmp.cpp */ -/***************/ +/** + * @file cvpcb/loadcmp.cpp + */ #include "fctsys.h" #include "wxstruct.h" +#include "gr_basic.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" #include "macros.h" #include "appl_wxstruct.h" +#include "pcbstruct.h" +#include "class_module.h" + #include "cvpcb.h" #include "cvpcb_mainframe.h" #include "class_DisplayFootprintsFrame.h" @@ -80,6 +84,7 @@ found in the default search paths." ), } Found = 0; + while( !Found && reader.ReadLine() ) { Line = reader.Line(); @@ -91,10 +96,12 @@ found in the default search paths." ), while( reader.ReadLine() ) { Line = reader.Line(); + if( strnicmp( Line, "$EndINDEX", 9 ) == 0 ) break; StrPurge( Line ); + if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 ) { Found = 1; @@ -118,9 +125,11 @@ found in the default search paths." ), /* Read component name. */ sscanf( Line + 7, " %s", Name ); + if( stricmp( Name, TO_UTF8( CmpName ) ) == 0 ) { Module = new MODULE( GetBoard() ); + // Switch the locale to standard C (needed to print floating // point numbers like 1.3) SetLocaleTo_C_standard(); diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index d3e305b4fb..dc190985bd 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -1,12 +1,16 @@ -/*****************/ -/** setvisu.cpp **/ -/*****************/ +/** + * @file setvisu.cpp + */ #include "fctsys.h" #include "common.h" +#include "gr_basic.h" #include "class_drawpanel.h" - #include "bitmaps.h" + +#include "class_board.h" +#include "class_module.h" + #include "cvpcb.h" #include "cvpcb_mainframe.h" #include "cvstruct.h" diff --git a/gerbview/block.cpp b/gerbview/block.cpp index 49ee200860..7d5b735461 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -31,6 +31,7 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "gr_basic.h" #include "gerbview.h" #include "class_gerber_draw_item.h" diff --git a/gerbview/class_aperture_macro.cpp b/gerbview/class_aperture_macro.cpp index 9244e70423..bdd1551c1a 100644 --- a/gerbview/class_aperture_macro.cpp +++ b/gerbview/class_aperture_macro.cpp @@ -32,6 +32,8 @@ #include "common.h" #include "macros.h" #include "trigo.h" +#include "gr_basic.h" + #include "gerbview.h" #include "class_GERBER.h" diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index eb2d182aa9..db25ca1d4b 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -33,6 +33,7 @@ #include "trigo.h" #include "class_drawpanel.h" #include "drawtxt.h" +#include "macros.h" #include "gerbview.h" #include "class_board_design_settings.h" diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 0efc0faa30..75ef570b62 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -32,6 +32,9 @@ #include "common.h" #include "class_drawpanel.h" #include "pcbstruct.h" +#include "macros.h" +#include "class_layer_box_selector.h" + #include "gerbview.h" #include "class_GERBER.h" #include "layer_widget.h" @@ -46,7 +49,8 @@ */ -GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) : +GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, + int aPointSize ) : LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), myframe( aParent ) { @@ -257,8 +261,10 @@ bool GERBER_LAYER_WIDGET::useAlternateBitmap(int aRow) { bool inUse = false; GERBER_IMAGE* gerber = g_GERBER_List[aRow]; + if( gerber != NULL && gerber->m_InUse ) inUse = true; + return inUse; } diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 20c8d08fab..277a79a58a 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -8,6 +8,7 @@ #include "confirm.h" #include "macros.h" #include "trigo.h" +#include "gr_basic.h" #include "gerbview.h" #include "class_gerber_draw_item.h" diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 7d912792f5..320e545b35 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -1,6 +1,7 @@ -/**********************************************************/ -/* events_called_functions.cpp: Gerbview events functions */ -/**********************************************************/ +/** + * @file events_called_functions.cpp + * @brief Gerbview command event functions. + */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -15,97 +16,99 @@ #include "class_GERBER.h" #include "dialog_helpers.h" #include "class_DCodeSelectionbox.h" +#include "class_gerbview_layer_widget.h" + // Event table: BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME ) -EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow ) -EVT_SIZE( GERBVIEW_FRAME::OnSize ) + EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow ) + EVT_SIZE( GERBVIEW_FRAME::OnSize ) -EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) -EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) -EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) -EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, GERBVIEW_FRAME::Files_io ) -EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) -// Menu Files: -EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io ) -EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) -EVT_MENU( ID_GEN_PLOT, GERBVIEW_FRAME::ToPlotter ) -EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat ) + // Menu Files: + EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io ) + EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) + EVT_MENU( ID_GEN_PLOT, GERBVIEW_FRAME::ToPlotter ) + EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat ) -EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory ) -EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9, - GERBVIEW_FRAME::OnDrlFileHistory ) + EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory ) + EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9, + GERBVIEW_FRAME::OnDrlFileHistory ) -EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit ) + EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit ) -// menu Preferences -EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, - GERBVIEW_FRAME::Process_Config ) + // menu Preferences + EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, + GERBVIEW_FRAME::Process_Config ) -EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, - GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog ) + EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog ) -EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage ) + EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage ) -// menu Postprocess -EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::OnShowGerberSourceFile ) -EVT_MENU( ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, - EDA_BASE_FRAME::OnSelectPreferredEditor ) + // menu Postprocess + EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions ) + EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::OnShowGerberSourceFile ) + EVT_MENU( ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, + EDA_BASE_FRAME::OnSelectPreferredEditor ) -// menu Miscellaneous -EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, GERBVIEW_FRAME::Process_Special_Functions ) + // menu Miscellaneous + EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, GERBVIEW_FRAME::Process_Special_Functions ) -// Menu Help -EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) -EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) + // Menu Help + EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) + EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) -EVT_TOOL( wxID_CUT, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_TOOL( wxID_COPY, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_TOOL( wxID_PASTE, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter ) -EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, - GERBVIEW_FRAME::OnSelectActiveLayer ) + EVT_TOOL( wxID_CUT, GERBVIEW_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_COPY, GERBVIEW_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_PASTE, GERBVIEW_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter ) + EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, + GERBVIEW_FRAME::OnSelectActiveLayer ) -EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode ) + EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode ) -// Vertical toolbar: -EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) + // Vertical toolbar: + EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) -EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, - GERBVIEW_FRAME::Process_Special_Functions ) + EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, + GERBVIEW_FRAME::Process_Special_Functions ) -// Option toolbar -EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, - GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, - GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2, - GERBVIEW_FRAME::OnSelectDisplayMode ) + // Option toolbar + EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, + GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar ) + EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2, + GERBVIEW_FRAME::OnSelectDisplayMode ) -EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, - GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode ) -EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode ) -EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, - GERBVIEW_FRAME::OnUpdatePolygonsDrawMode ) -EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes ) -EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, - GERBVIEW_FRAME::OnUpdateShowLayerManager ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, + GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonsDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, + GERBVIEW_FRAME::OnUpdateShowLayerManager ) -EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnUpdateSelectDCode ) -EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox ) -EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2, - GERBVIEW_FRAME::OnUpdateDrawMode ) + EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnUpdateSelectDCode ) + EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, + GERBVIEW_FRAME::OnUpdateLayerSelectBox ) + EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2, + GERBVIEW_FRAME::OnUpdateDrawMode ) END_EVENT_TABLE() + /* Handles the selection of tools, menu, and popup menu commands. */ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 9f215f017f..b27d48da24 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -1,7 +1,6 @@ -/* export_to_pcbnew.cpp */ - -/* - * Export the layers to pcbnew +/** + * @file export_to_pcbnew.cpp + * @brief Export the layers to pcbnew. */ #include "fctsys.h" @@ -13,11 +12,15 @@ #include "gestfich.h" #include "trigo.h" +#include "../pcbnew/class_track.h" +#include "../pcbnew/class_drawsegment.h" + #include "gerbview.h" #include "class_board_design_settings.h" #include "class_gerber_draw_item.h" #include "select_layers_to_pcb.h" + /* A helper class to export a Gerber set of files to Pcbnew */ class GBR_TO_PCB_EXPORTER diff --git a/gerbview/files.cpp b/gerbview/files.cpp index be548a5679..12413cfe09 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -10,6 +10,7 @@ #include "gerbview.h" #include "gerbview_id.h" +#include "class_gerbview_layer_widget.h" /* Load a Gerber file selected from history list on current layer diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 98be784d14..05e5819a31 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -7,6 +7,7 @@ #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" +#include "gr_basic.h" #include "gerbview.h" #include "gerbview_id.h" @@ -90,10 +91,8 @@ bool EDA_APP::OnInit() frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() ); // Initialize some display options - DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning - // here - DisplayOpt.ShowTrackClearanceMode = 0; // tracks and vias clearance has no - // meaning here + DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here + DisplayOpt.ShowTrackClearanceMode = 0; // tracks and vias clearance has no meaning here SetTopWindow( frame ); // Set GerbView mainframe on top frame->Show( true ); // Show GerbView mainframe diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index faf909aded..3ef61bc0f0 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -1,19 +1,22 @@ -/************************************************/ -/** gerbview_config.cpp : Gerbview configuration*/ -/************************************************/ +/** + * @file gerbview_config.cpp + * @brief Gerbview configuration. +*/ #include "fctsys.h" +#include "id.h" #include "common.h" #include "class_drawpanel.h" #include "gestfich.h" #include "pcbcommon.h" + #include "gerbview.h" -//#include "pcbplot.h" #include "hotkeys.h" #include "class_board_design_settings.h" #include "gerbview_config.h" #include "dialog_hotkeys_editor.h" + void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event ) { int id = event.GetId(); @@ -71,10 +74,10 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void ) return m_configSettings; m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), - (int*) &g_UserUnit, 0, 0, 1 ) ); + (int*) &g_UserUnit, 0, 0, 1 ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), - &m_displayMode, 2, 0, 2 ) ); + &m_displayMode, 2, 0, 2 ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "DCodeColor" ), &g_ColorsSettings.m_ItemsColors[ @@ -110,6 +113,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void ) wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"), wxT("ColorLayer12"), wxT("ColorLaye13"), wxT("ColorLayer14"), wxT("ColorLayer15") }; + for( unsigned ii = 0; ii < 32; ii++ ) { int * prm = &g_ColorsSettings.m_LayersColors[1]; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index b9d9c11ffe..fce2957891 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -1,11 +1,14 @@ -/*******************/ -/* gerberframe.cpp */ -/*******************/ +/** + * @file gerbview_frame.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" #include "wxstruct.h" #include "class_drawpanel.h" +#include "build_version.h" +#include "macros.h" +#include "class_layer_box_selector.h" #include "gerbview.h" #include "class_gerber_draw_item.h" @@ -15,14 +18,15 @@ #include "class_GERBER.h" #include "dialog_helpers.h" #include "class_DCodeSelectionbox.h" +#include "class_gerbview_layer_widget.h" -#include "build_version.h" // Config keywords const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) ); + /****************************************/ /* class GERBVIEW_FRAME for GerbView*/ /****************************************/ diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 704202b0cf..8e63754356 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -1,25 +1,30 @@ -/***********************************************************/ -/* wxGerberFrame.h: */ -/***********************************************************/ +/** + * @file gerbview_frame.h + */ #ifndef WX_GERBER_STRUCT_H #define WX_GERBER_STRUCT_H -#include "id.h" + #include "param_config.h" -#include "class_gerbview_layer_widget.h" -#include "class_layer_box_selector.h" +#include "wxBasePcbFrame.h" + +#include "../pcbnew/class_board.h" + + +class DCODE_SELECTION_BOX; +class GERBER_LAYER_WIDGET; +class LAYER_BOX_SELECTOR; +class GERBER_DRAW_ITEM; #define NO_AVAILABLE_LAYERS -1 -class DCODE_SELECTION_BOX; - - -/****************************************************************** - * class GERBVIEW_FRAME: this is the main window used in gerbview - ******************************************************************/ +/** + * Class GERBVIEW_FRAME + * is the main window used in gerbview. + */ class GERBVIEW_FRAME : public PCB_BASE_FRAME { @@ -27,7 +32,9 @@ class GERBVIEW_FRAME : public PCB_BASE_FRAME protected: GERBER_LAYER_WIDGET* m_LayersManager; - wxFileHistory m_drillFileHistory; // Auxiliary file history used to store drill files history + + // Auxiliary file history used to store drill files history. + wxFileHistory m_drillFileHistory; public: LAYER_BOX_SELECTOR* m_SelLayerBox; @@ -37,7 +44,9 @@ public: wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999) private: - PARAM_CFG_ARRAY m_configSettings; // list of PARAM_CFG_xxx to read/write parameters saved in config + // list of PARAM_CFG_xxx to read/write parameters saved in config + PARAM_CFG_ARRAY m_configSettings; + int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: // - in fast mode (write mode) but if there are negative // items only the last image is correctly drawn (no @@ -47,13 +56,15 @@ private: // - in "exact" mode (also slower) in OR mode // (transparency mode) // m_displayMode = 0, 1 or 2 + bool m_show_layer_manager_tools; - wxArrayString m_Messages; // An array sting to store warning messages when reaging - // a gerber file + + // An array sting to store warning messages when reaging a gerber file. + wxArrayString m_Messages; public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~GERBVIEW_FRAME(); diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 52d3728efe..5b7e952102 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -1,26 +1,29 @@ -/***************/ -/* hotkeys.cpp */ -/***************/ +/** + * @file gerbview/hotkeys.cpp + */ #include "fctsys.h" #include "common.h" #include "kicad_device_context.h" +#include "id.h" #include "gerbview.h" #include "class_drawpanel.h" #include "hotkeys.h" + /* How to add a new hotkey: * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. * add a new Ki_HotkeyInfo entry like: * static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); - * "Command Label" is the name used in hotkey list display, and the identifier in the hotkey list file - * MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in OnHotKey() function. - * default key value is the default hotkey for this command. Can be overrided by the user hotkey list file - * add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) - * Add the new code in the switch in OnHotKey() function. - * when the variable PopupOn is true, an item is currently edited. - * This can be usefull if the new function cannot be executed while an item is currently being edited + * "Command Label" is the name used in hotkey list display, and the identifier in the + * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch + * in OnHotKey() function. default key value is the default hotkey for this command. + * Can be overrided by the user hotkey list file add the HkMyNewEntry pointer in the + * s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) Add the + * new code in the switch in OnHotKey() function. when the variable PopupOn is true, + * an item is currently edited. This can be usefull if the new function cannot be + * executed while an item is currently being edited * ( For example, one cannot start a new wire when a component is moving.) * * Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX) @@ -30,7 +33,8 @@ /* local variables */ /* Hotkey list: */ -static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); +static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), + HK_RESET_LOCAL_COORD, ' ' ); static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); @@ -38,15 +42,12 @@ static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); -static Ki_HotkeyInfo HkTrackDisplayMode( wxT( - "Track Display Mode" ), +static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); -static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( - "Switch to Next Layer" ), +static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), HK_SWITCH_LAYER_TO_NEXT, '+' ); -static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( - "Switch to Previous Layer" ), +static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); // List of common hotkey descriptors @@ -69,22 +70,19 @@ struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = }; -/***********************************************************/ -void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) -/***********************************************************/ - /* Hot keys. Some commands are relatives to the item under the mouse cursor * Commands are case insensitive * @param DC = current device context * @param hotkey = hotkey code (ascii or wxWidget code for special keys) * @param DrawStruct = NULL or pointer on a EDA_ITEM under the mouse cursor */ - +void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) { wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); - /* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */ + /* Convert lower to upper case (the usual toupper function has problem with non ascii + * codes like function keys */ if( (hotkey >= 'a') && (hotkey <= 'z') ) hotkey += 'A' - 'a'; diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 54c6c4bbab..76b64bc375 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -1,6 +1,6 @@ -/****************************************/ -/******* initpcb.cpp ********************/ -/****************************************/ +/** + * @file gerbview/initpcb.cpp + */ #include "fctsys.h" #include "common.h" @@ -10,6 +10,7 @@ #include "gerbview.h" #include "class_gerber_draw_item.h" #include "class_GERBER.h" +#include "class_gerbview_layer_widget.h" bool GERBVIEW_FRAME::Clear_Pcb( bool query ) diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index d8e63658fb..04270037c9 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -5,6 +5,7 @@ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" +#include "id.h" #include "gerbview.h" @@ -16,8 +17,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); wxString msg; - bool BlockActive = - (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); + bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); // Do not initiate a start block validation on menu. DrawPanel->m_CanStartBlock = -1; diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 2d6342838d..7d51996103 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -1,9 +1,10 @@ -/**************/ -/* rs274x.cpp */ -/**************/ +/** + * @file rs274x.cpp + */ #include "fctsys.h" #include "common.h" +#include "macros.h" #include "gerbview.h" #include "class_GERBER.h" @@ -22,8 +23,9 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true ); // But we can have A = Y, B = X and/or offset, mirror, scale; // Also: // Image is what you must plot (the entire data of the file). -// Layer is just a set of data blocks with their parameters. An image can have more than one layer -// So a gerber layer is not like a board layer or the graphic layers used in Gerbview to show a file. +// Layer is just a set of data blocks with their parameters. An image can have more than one +// layer so a gerber layer is not like a board layer or the graphic layers used in Gerbview +// to show a file. enum RS274X_PARAMETERS { // Directive parameters: single usage recommended // Must be at the beginning of the file @@ -919,6 +921,7 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ], AM_PRIMITIVE prim( m_GerbMetric ); prim.primitive_id = (AM_PRIMITIVE_ID) primitive_type; int i; + for( i = 0; i < paramCount && *text && *text != '*'; ++i ) { prim.params.push_back( AM_PARAM() ); @@ -926,8 +929,10 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ], AM_PARAM& param = prim.params.back(); text = GetNextLine( buff, text, gerber_file ); + if( text == NULL) // End of File return false; + param.ReadParam( text ); } @@ -958,8 +963,10 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ], AM_PARAM& param = prim.params.back(); text = GetNextLine( buff, text, gerber_file ); + if( text == NULL ) // End of File return false; + param.ReadParam( text ); } } diff --git a/include/build_version.h b/include/build_version.h index f9de4cd3c1..e3c0abbaaf 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -3,6 +3,9 @@ #ifndef KICAD_BUILD_VERSION_H #define KICAD_BUILD_VERSION_H +class wxString; + + /** * Function GetBuildVersion * Return the build date and version diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index bb1ca3705c..20801aedc2 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -11,31 +11,34 @@ class BOARD_DESIGN_SETTINGS { protected: - int m_CopperLayerCount; // Number of copper layers for this design + int m_CopperLayerCount; // Number of copper layers for this design public: - bool m_MicroViasAllowed; // true to allow micro vias - int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) - bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width - int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) - int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) - int m_PcbTextWidth; // current Pcb (not module) Text width - wxSize m_PcbTextSize; // current Pcb (not module) Text size - int m_TrackMinWidth; // track min value for width ((min copper size value - int m_ViasMinSize; // vias (not micro vias) min diameter - int m_ViasMinDrill; // vias (not micro vias) min drill diameter - int m_MicroViasMinSize; // micro vias (not vias) min diameter - int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter + bool m_MicroViasAllowed; // true to allow micro vias + int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) + + // if true, when creating a new track starting on an existing track, use this track width + bool m_UseConnectedTrackWidth; + int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) + int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) + int m_PcbTextWidth; // current Pcb (not module) Text width + wxSize m_PcbTextSize; // current Pcb (not module) Text size + int m_TrackMinWidth; // track min value for width ((min copper size value + int m_ViasMinSize; // vias (not micro vias) min diameter + int m_ViasMinDrill; // vias (not micro vias) min drill diameter + int m_MicroViasMinSize; // micro vias (not vias) min diameter + int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter + // Global mask margins: - int m_SolderMaskMargin; // Solder mask margin - int m_SolderPasteMargin; // Solder paste margin absolute value - double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size - // The final margin is the sum of these 2 values - int m_BoardThickness; // Board Thickness for 3D viewer + int m_SolderMaskMargin; // Solder mask margin + int m_SolderPasteMargin; // Solder paste margin absolute value + double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size + // The final margin is the sum of these 2 values + int m_BoardThickness; // Board Thickness for 3D viewer protected: - int m_EnabledLayers; // Bit-mask for layer enabling - int m_VisibleLayers; // Bit-mask for layer visibility - int m_VisibleElements; // Bit-mask for element category visibility + int m_EnabledLayers; // Bit-mask for layer enabling + int m_VisibleLayers; // Bit-mask for layer visibility + int m_VisibleElements; // Bit-mask for element category visibility public: BOARD_DESIGN_SETTINGS(); @@ -68,7 +71,8 @@ public: */ bool IsLayerVisible( int aLayerIndex ) const { - if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers + // @@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers + if( aLayerIndex < 0 || aLayerIndex >= 32 ) return false; // If a layer is disabled, it is automatically invisible diff --git a/include/dlist.h b/include/dlist.h index c85167000f..10e593389d 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -27,6 +27,9 @@ #define DLIST_H_ +#include // NULL definition. + + class EDA_ITEM; diff --git a/include/pcbcommon.h b/include/pcbcommon.h index 890ede0adf..500dd872a5 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -2,20 +2,27 @@ #ifndef __PCBCOMMON_H__ #define __PCBCOMMON_H__ -#include "pcbstruct.h" + #include "dlist.h" +#include "layers_id_colors_and_visibility.h" // LAYER_COUNT and NB_COPPER_LAYERS definitions. + +#include // wxString class. +#include // wxArrayString class. + #define L_MIN_DESSIN 1 /* Min width segments to allow draws with thickness */ -class DPAD; -class BOARD_ITEM; + class PCB_SCREEN; +class D_PAD; +class TRACK; +class BOARD; class DISPLAY_OPTIONS; + /* Look up Table for conversion one layer number -> one bit layer mask: */ extern int g_TabOneLayerMask[LAYER_COUNT]; -/* Look up Table for conversion copper layer count -> general copper layer - * mask: */ +/* Look up Table for conversion copper layer count -> general copper layer mask: */ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; diff --git a/include/pcbstruct.h b/include/pcbstruct.h index e5539afb3e..8a7e8bf7e1 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -1,30 +1,16 @@ -/**************************************************************/ -/* pcbstruct.h : some classes and definitions used in pcbnew */ -/**************************************************************/ +/** + * @file pcbstruct.h + * @brief Classes and definitions used in pcbnew. + */ #ifndef PCBSTRUCT_H #define PCBSTRUCT_H -#include "base_struct.h" -#include "class_base_screen.h" -#include "class_board_item.h" -#include "layers_id_colors_and_visibility.h" // Definitions relatives aux libraries #define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" #define L_ENTETE_LIB 18 -class NETINFO_ITEM; -class MARKER_PCB; -class RATSNEST_ITEM; - - -/* main window classes : */ -#include "wxBasePcbFrame.h" - -/* Class to handle a board */ -#include "class_board.h" - // Values for m_DisplayViaMode member: enum DisplayViaMode { @@ -34,47 +20,25 @@ enum DisplayViaMode { OPT_VIA_HOLE_END }; -/* Handle info to display a board */ -#include "class_pcb_screen.h" - -/**********************************/ -/* Module (Footprint) description */ -/**********************************/ - -#include "class_pad.h" // class for pads -#include "class_edge_mod.h" // Class for footprint graphic elements -#include "class_text_mod.h" // Class for footprint fields -#include "class_module.h" // Class for the footprint -#include "class_netinfo.h" // Class for nets - -#include "class_drawsegment.h" -#include "class_pcb_text.h" -#include "class_dimension.h" -#include "class_mire.h" -#include "class_track.h" -#include "class_marker_pcb.h" -#include "class_zone.h" /* Values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option - * This parameter controls how to show tracks and vias clearance area + * This parameter controls how to show tracks and vias clearance area */ enum ShowTrackClearanceModeList { DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas - SHOW_CLEARANCE_NEW_TRACKS, /* Show clearance areas only - * for new track during track - * creation */ - SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, /* Show clearance areas only - * for new track during track - * creation, and shows a via - * clearance area at end of - * current new segment (guide - * to place a new via + SHOW_CLEARANCE_NEW_TRACKS, /* Show clearance areas only for new track + * during track creation. */ + SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, /* Show clearance areas only for new track + * during track creation, and shows a via + * clearance area at end of current new + * segment (guide to place a new via */ SHOW_CLEARANCE_ALWAYS /* Show Always clearance areas * for track and vias */ }; + class DISPLAY_OPTIONS { public: diff --git a/pcbnew/ar_protos.h b/pcbnew/ar_protos.h index a4e7dea783..8e72ba3036 100644 --- a/pcbnew/ar_protos.h +++ b/pcbnew/ar_protos.h @@ -14,6 +14,7 @@ class PCB_EDIT_FRAME; class BOARD; class D_PAD; class RATSNEST_ITEM; +class TRACK; int Propagation( PCB_EDIT_FRAME* frame ); diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 6da53e3c87..f87b2d6825 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -4,11 +4,15 @@ #include "fctsys.h" #include "class_drawpanel.h" +#include "gr_basic.h" +#include "wxPcbStruct.h" #include "pcbnew.h" -#include "wxPcbStruct.h" #include "protos.h" +#include "class_track.h" +#include "class_board.h" + /* Attribute change for 1 track segment. * Attributes are diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index f231a4bec7..942b70e63b 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -10,11 +10,14 @@ #include "kicad_string.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "kicad_device_context.h" + #include "autorout.h" #include "cell.h" #include "pcbnew_id.h" +#include "class_board.h" +#include "class_module.h" -#include "kicad_device_context.h" typedef enum { FIXE_MODULE, diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index de11a9b639..3b4dac581b 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -8,14 +8,21 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "gr_basic.h" +#include "macros.h" +#include "pcbcommon.h" #include "protos.h" #include "ar_protos.h" #include "autorout.h" #include "cell.h" -#include "class_board_design_settings.h" #include "colors_selection.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_drawsegment.h" + #define GAIN 16 #define KEEP_OUT_MARGIN 500 diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index 4b95741a2e..fbcf7ea4b5 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -6,14 +6,18 @@ #include "fctsys.h" #include "class_drawpanel.h" #include "wxPcbStruct.h" +#include "gr_basic.h" #include "pcbnew.h" #include "autorout.h" #include "cell.h" #include "zones.h" -#include "class_board_design_settings.h" #include "ar_protos.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" + int E_scale; /* Scaling factor of distance tables. */ int Nb_Sides; /* Number of layer for autorouting (0 or 1) */ diff --git a/pcbnew/autorout.h b/pcbnew/autorout.h index 4095ccc60b..87932242c9 100644 --- a/pcbnew/autorout.h +++ b/pcbnew/autorout.h @@ -6,6 +6,9 @@ #define AUTOROUT_H +#include "base_struct.h" + + class BOARD; diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index f3f62d184d..ff275cf6ce 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -8,14 +8,16 @@ #include "fctsys.h" #include "wxstruct.h" +#include "pcbcommon.h" #include "confirm.h" #include "appl_wxstruct.h" #include "dialog_helpers.h" #include "kicad_device_context.h" +#include "wxBasePcbFrame.h" #include "pcbnew.h" #include "pcbnew_id.h" -#include "class_board_design_settings.h" +#include "class_board.h" #include "collectors.h" #include "class_drawpanel.h" diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 68db54fda7..4f00bcf031 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -1,20 +1,28 @@ -/*************/ -/* block.cpp */ -/*************/ +/** + * @file pcbnew/block.cpp + */ #include "fctsys.h" -#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" #include "block_commande.h" - -#include "pcbnew.h" +#include "pcbcommon.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "class_board.h" +#include "class_track.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" +#include "class_mire.h" +#include "class_module.h" +#include "class_dimension.h" +#include "class_zone.h" + #include "dialog_block_options_base.h" +#include "pcbnew.h" #include "protos.h" #define BLOCK_OUTLINE_COLOR YELLOW @@ -412,7 +420,8 @@ void PCB_EDIT_FRAME::Block_SelectItems() { if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) ) { - if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) ) + if( blockIncludeItemsOnInvisibleLayers + || m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) ) { picker.m_PickedItem = pt_segm; picker.m_PickedItemType = pt_segm->Type(); @@ -444,6 +453,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) ) break; + select_me = true; // This item is in bloc: select it break; @@ -453,6 +463,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) ) break; + select_me = true; // This item is in bloc: select it break; @@ -497,7 +508,8 @@ void PCB_EDIT_FRAME::Block_SelectItems() if( area->HitTest( GetScreen()->m_BlockLocate ) ) { - if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( area->GetLayer() ) ) + if( blockIncludeItemsOnInvisibleLayers + || m_Pcb->IsLayerVisible( area->GetLayer() ) ) { BOARD_ITEM* zone_c = (BOARD_ITEM*) area; picker.m_PickedItem = zone_c; @@ -563,6 +575,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); + if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } @@ -574,11 +587,11 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a screen->m_BlockLocate.m_BlockLastCursorPosition; } - if( screen->m_BlockLocate.m_MoveVector.x - || screen->m_BlockLocate.m_MoveVector.y ) + if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); + if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 6e18cace3b..bd8717f352 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -9,15 +9,25 @@ #include "class_drawpanel.h" #include "confirm.h" #include "block_commande.h" +#include "macros.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "module_editor_frame.h" #include "pcbplot.h" #include "trigo.h" +#include "pcbnew.h" #include "protos.h" +#include "class_board.h" +#include "class_track.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" +#include "class_mire.h" +#include "class_module.h" +#include "class_dimension.h" +#include "class_edge_mod.h" + #define BLOCK_COLOR BROWN #define IS_SELECTED 1 diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index ff0720ac11..7d8d8cee95 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -5,11 +5,19 @@ #include "fctsys.h" #include "common.h" +#include "pcbcommon.h" #include "pcbnew.h" #include "cell.h" #include "ar_protos.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_drawsegment.h" +#include "class_edge_mod.h" +#include "class_pcb_text.h" + /* * Calculates nrows and ncols, dimensions of the matrix representation of BOARD diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 9da9797922..19335b1bd8 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -11,6 +11,13 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "macros.h" + +#include "class_pad.h" +#include "class_track.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" + /* Exported functions */ diff --git a/pcbnew/board_undo_redo.cpp b/pcbnew/board_undo_redo.cpp index 995ae73135..dc07082014 100644 --- a/pcbnew/board_undo_redo.cpp +++ b/pcbnew/board_undo_redo.cpp @@ -4,10 +4,21 @@ #include "fctsys.h" #include "class_drawpanel.h" +#include "macros.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_track.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" +#include "class_mire.h" +#include "class_module.h" +#include "class_dimension.h" +#include "class_zone.h" + + /* Functions to undo and redo edit commands. * commmands to undo are stored in CurrentScreen->m_UndoList * commmands to redo are stored in CurrentScreen->m_RedoList diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index f5210f78b9..55617410f5 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -7,6 +7,10 @@ #include "gestfich.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" #include diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 76e63f8b5b..b88d30d853 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1,13 +1,24 @@ -/*******************************************/ -/* class_board.cpp - BOARD class functions */ -/*******************************************/ +/** + * @file class_board.cpp + * @brief BOARD class functions. + */ + #include + #include "fctsys.h" #include "common.h" +#include "pcbcommon.h" +#include "wxBasePcbFrame.h" #include "pcbnew.h" #include "colors_selection.h" + #include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_marker_pcb.h" + /* This is an odd place for this, but cvpcb won't link if it is * in class_board_item.cpp like I first tried it. @@ -25,8 +36,8 @@ BOARD_DESIGN_SETTINGS boardDesignSettings; */ static int sortPadsByXCoord( const void* pt_ref, const void* pt_comp ) { - D_PAD* ref = *(LISTE_PAD*) pt_ref; - D_PAD* comp = *(LISTE_PAD*) pt_comp; + D_PAD* ref = *(D_PAD**) pt_ref; + D_PAD* comp = *(D_PAD**) pt_comp; return ref->m_Pos.x - comp->m_Pos.x; } @@ -1676,14 +1687,14 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask ) } -D_PAD* BOARD::GetPad( LISTE_PAD* aPad, const wxPoint& aPosition, int aLayerMask ) +D_PAD* BOARD::GetPad( D_PAD** aPad, const wxPoint& aPosition, int aLayerMask ) { - D_PAD* pad; - int ii; + D_PAD* pad; + int ii; - int nb_pad = GetPadsCount(); - LISTE_PAD* ptr_pad = aPad; - LISTE_PAD* lim = aPad + nb_pad - 1; + int nb_pad = GetPadsCount(); + D_PAD** ptr_pad = aPad; + D_PAD** lim = aPad + nb_pad - 1; ptr_pad = aPad; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 94bf44ec90..5ae4c2d763 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -1,22 +1,30 @@ -/*************************************************/ -/* class_board.h - Class BOARD to handle a board */ -/*************************************************/ +/** + * @file class_board.h + * @brief Class BOARD to handle a board. + */ #ifndef CLASS_BOARD_H #define CLASS_BOARD_H + #include "dlist.h" + +#include "layers_id_colors_and_visibility.h" #include "class_netinfo.h" #include "class_pad.h" #include "class_colors_design_settings.h" #include "class_board_design_settings.h" +class PCB_BASE_FRAME; +class PCB_EDIT_FRAME; +class PICKED_ITEMS_LIST; class BOARD; class ZONE_CONTAINER; class SEGZONE; class TRACK; -class PCB_EDIT_FRAME; +class D_PAD; +class MARKER_PCB; // buffer of item candidates when search for items on the same track. @@ -1159,7 +1167,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A D_PAD object pointer to the connected pad. */ - D_PAD* GetPad( LISTE_PAD* aPad, const wxPoint& aPosition, int aLayerMask ); + D_PAD* GetPad( D_PAD** aPad, const wxPoint& aPosition, int aLayerMask ); /** * Function GetSortedPadListByXCoord diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index d50efac6b3..bb9a8b7189 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -1,10 +1,14 @@ -/*************************************************************************/ -/* class_board_connected_item.cpp : BOARD_CONNECTED_ITEM class functions */ -/*************************************************************************/ +/** + * @file class_board_connected_item.cpp + * @brief BOARD_CONNECTED_ITEM class functions. + */ #include "fctsys.h" #include "pcbnew.h" +#include "class_board.h" +#include "class_board_item.h" + BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ) diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index a396ac5b71..059134ac4f 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -1,46 +1,52 @@ -/***************************************************************************/ -/* class_board_design_settings.cpp - BOARD_DESIGN_SETTINGS class functions */ -/***************************************************************************/ +/** + * @file class_board_design_settings.cpp + * BOARD_DESIGN_SETTINGS class functions. + */ + #include "fctsys.h" #include "common.h" +#include "layers_id_colors_and_visibility.h" #include "pcbnew.h" #include "class_board_design_settings.h" +#include "class_track.h" + -/*****************************************************/ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() -/*****************************************************/ - -// Default values for designing boards { - m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. - // SetCopperLayerCount() will adjust this. - SetVisibleAlls( ); // All layers and all elements visible at first. + m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. + // SetCopperLayerCount() will adjust this. + SetVisibleAlls( ); // All layers and all elements visible at first. - SetCopperLayerCount( 2 ); // Default design is a double sided board + SetCopperLayerCount( 2 ); // Default design is a double sided board - m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) - m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width - m_MicroViasAllowed = false; // true to allow micro vias - m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) - m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) - m_PcbTextWidth = 100; // current Pcb (not module) Text width - m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size - m_TrackMinWidth = 80; // track min value for width ((min copper size value - m_ViasMinSize = 350; // vias (not micro vias) min diameter - m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter - m_MicroViasMinSize = 200; // micro vias (not vias) min diameter - m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter + // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA). + m_CurrentViaType = VIA_THROUGH; + + // if true, when creating a new track starting on an existing track, use this track width + m_UseConnectedTrackWidth = false; + + m_MicroViasAllowed = false; // true to allow micro vias + m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) + m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) + m_PcbTextWidth = 100; // current Pcb (not module) Text width + m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size + m_TrackMinWidth = 80; // track min value for width ((min copper size value + m_ViasMinSize = 350; // vias (not micro vias) min diameter + m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter + m_MicroViasMinSize = 200; // micro vias (not vias) min diameter + m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter // Global mask margins: - m_SolderMaskMargin = 150; // Solder mask margin - m_SolderPasteMargin = 0; // Solder paste margin absolute value - m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size - // The final margin is the sum of these 2 values - // Usually < 0 because the mask is smaller than pad + m_SolderMaskMargin = 150; // Solder mask margin + m_SolderPasteMargin = 0; // Solder paste margin absolute value + m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size + // The final margin is the sum of these 2 values + // Usually < 0 because the mask is smaller than pad - m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4); // Epoxy thickness for 3D view (and microwave calculations) // Layer Thickness for 3D viewer + // Layer thickness for 3D viewer + m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4); } @@ -57,12 +63,13 @@ int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const * Set the bit-mask of all visible elements categories, * including enabled layers */ -void BOARD_DESIGN_SETTINGS::SetVisibleAlls( ) +void BOARD_DESIGN_SETTINGS::SetVisibleAlls() { SetVisibleLayers( FULL_LAYERS ); m_VisibleElements = 0xFFFFFFFF; } + void BOARD_DESIGN_SETTINGS::SetVisibleLayers( int aMask ) { // Although Pcbnew uses only 29, Gerbview uses all 32 layers @@ -75,6 +82,7 @@ void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState // Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) return; + if( aNewState && IsLayerEnabled( aLayerIndex ) ) m_VisibleLayers |= 1 << aLayerIndex; else @@ -86,6 +94,7 @@ void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNe { if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST ) return; + if( aNewState ) m_VisibleElements |= 1 << aElementCategory; else @@ -110,6 +119,7 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) m_EnabledLayers |= 1 << ii; } + /** * Function SetEnabledLayers * changes the bit-mask of enabled layers @@ -127,10 +137,10 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask ) // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers m_CopperLayerCount = 0; + for( int ii = 0; aMask && ii < NB_COPPER_LAYERS; ii++, aMask >>= 1 ) { if( aMask & 1 ) m_CopperLayerCount++; } } - diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp index 2899fc97a6..00c2f0a7c4 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -1,11 +1,14 @@ -/******************************************/ -/* class BOARD_ITEM: some basic functions */ -/******************************************/ +/** + * @file class_board_item.cpp + * @brief Class BOARD_ITEM definition and some basic functions. + */ #include "fctsys.h" #include "common.h" #include "pcbnew.h" +#include "class_board.h" + wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) { diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 275e72eb3f..9b0be238e1 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -3,17 +3,21 @@ */ #include "fctsys.h" +#include "macros.h" #include "gr_basic.h" -#include "pcbnew.h" +#include "pcbcommon.h" #include "trigo.h" #include "wxstruct.h" -#include "class_board_design_settings.h" #include "class_drawpanel.h" #include "colors_selection.h" #include "kicad_string.h" #include "protos.h" #include "richio.h" +#include "class_board.h" +#include "class_pcb_text.h" +#include "class_dimension.h" + DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : BOARD_ITEM( aParent, TYPE_DIMENSION ) diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 7496d9c2ea..e2cc04e175 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -6,12 +6,13 @@ #ifndef DIMENSION_H #define DIMENSION_H + #include "class_board_item.h" -class EDA_RECT; -class READER; +class LINE_READER; class EDA_DRAW_PANEL; +class TEXTE_PCB; class DIMENSION : public BOARD_ITEM diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 661d9a675f..f6237968bf 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -1,21 +1,27 @@ -/***************************************************/ -/* class and functions to handle a graphic segment */ -/****************************************************/ +/** + * @file class_drawsegment.cpp + * @brief Class and functions to handle a graphic segments. + */ #include "fctsys.h" +#include "macros.h" #include "wxstruct.h" #include "gr_basic.h" #include "bezier_curves.h" #include "class_drawpanel.h" #include "kicad_string.h" #include "colors_selection.h" +#include "trigo.h" +#include "richio.h" +#include "pcbcommon.h" #include "pcbnew.h" -#include "class_board_design_settings.h" - -#include "trigo.h" #include "protos.h" -#include "richio.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_drawsegment.h" + DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ) diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index fd435773fa..da3cd40464 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -1,12 +1,19 @@ -/*************************************/ -/* class to handle a graphic segment */ -/**************************************/ +/** + * @file class_drawsegment.h + * @brief Class to handle a graphic segment. + */ #ifndef CLASS_DRAWSEGMENT_H #define CLASS_DRAWSEGMENT_H + +#include "class_board_item.h" #include "PolyLine.h" -#include "richio.h" + + +class LINE_READER; +class EDA_DRAW_FRAME; +class MODULE; class DRAWSEGMENT : public BOARD_ITEM diff --git a/pcbnew/class_drc_item.cpp b/pcbnew/class_drc_item.cpp index d6ce7921fc..0d990a1f49 100644 --- a/pcbnew/class_drc_item.cpp +++ b/pcbnew/class_drc_item.cpp @@ -31,6 +31,8 @@ #include "pcbnew.h" #include "drc_stuff.h" +#include "class_drc_item.h" + wxString DRC_ITEM::GetErrorText() const { diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 9da227c3d1..aeb25d57f6 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -1,6 +1,7 @@ -/****************************************************/ -/* class_module.cpp : EDGE_MODULE class definition. */ -/****************************************************/ +/** + * @file class_edge_mod.cpp + * @brief EDGE_MODULE class definition. + */ #include "fctsys.h" #include "gr_basic.h" @@ -10,13 +11,20 @@ #include "confirm.h" #include "kicad_string.h" #include "colors_selection.h" +#include "richio.h" +#include "macros.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" #include "pcbnew.h" -#include "class_board_design_settings.h" -#include "richio.h" -#define MAX_WIDTH 10000 /* Thickness (in 1 / 10000 ") of maximum reasonable - * features, text... */ +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" + + +#define MAX_WIDTH 10000 /* Thickness (in 1 / 10000 ") of maximum reasonable features, text... */ + /*********************/ /* class EDGE_MODULE */ diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index bd2d690109..c4ede10e59 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -6,10 +6,13 @@ #ifndef _CLASS_EDGE_MOD_H_ #define _CLASS_EDGE_MOD_H_ -#include "class_drawsegment.h" -#include "richio.h" +#include "class_drawsegment.h" + + +class LINE_READER; class EDA_3D_CANVAS; +class EDA_DRAW_FRAME; class EDGE_MODULE : public DRAWSEGMENT diff --git a/pcbnew/class_footprint_library.cpp b/pcbnew/class_footprint_library.cpp index b7a0b66a84..f0112913ed 100644 --- a/pcbnew/class_footprint_library.cpp +++ b/pcbnew/class_footprint_library.cpp @@ -9,6 +9,8 @@ #include "wxPcbStruct.h" #include "richio.h" #include "filter_reader.h" +#include "macros.h" +#include "pcbstruct.h" #include "class_footprint_library.h" diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index eff7c6e7d6..b0ad20a75d 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -6,18 +6,16 @@ #include "fctsys.h" #include "gr_basic.h" -#include "common.h" #include "class_drawpanel.h" +#include "wxstruct.h" #include "trigo.h" #include "pcbnew.h" #include "class_marker_pcb.h" + #define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape -/*******************/ -/* Classe MARKER_PCB */ -/*******************/ MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) : BOARD_ITEM( aParent, TYPE_MARKER_PCB ), @@ -29,10 +27,10 @@ MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) : MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos, - const wxString& aText, const wxPoint& aPos, - const wxString& bText, const wxPoint& bPos ) : + const wxString& aText, const wxPoint& aPos, + const wxString& bText, const wxPoint& bPos ) : BOARD_ITEM( NULL, TYPE_MARKER_PCB ), // parent set during BOARD::Add() - MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos ) + MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos ) { m_Color = WHITE; @@ -61,24 +59,27 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) const DRC_ITEM& rpt = m_drc; - frame->AppendMsgPanel( _( "Type" ), _("Marker"), DARKCYAN ); + frame->AppendMsgPanel( _( "Type" ), _( "Marker" ), DARKCYAN ); wxString errorTxt; - errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":"); + errorTxt << _( "ErrType" ) << wxT( "(" ) << rpt.GetErrorCode() << wxT( ")- " ) + << rpt.GetErrorText() << wxT( ":" ); frame->AppendMsgPanel( errorTxt, wxEmptyString, RED ); wxString txtA; - txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA(); + txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT( ": " ) << rpt.GetTextA(); wxString txtB; + if ( rpt.HasSecondItem() ) - txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB(); + txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT( ": " ) << rpt.GetTextB(); frame->AppendMsgPanel( txtA, txtB, DARKBROWN ); } + /** * Function Rotate * Rotate this object. @@ -90,6 +91,7 @@ void MARKER_PCB::Rotate(const wxPoint& aRotCentre, int aAngle) RotatePoint( &m_Pos, aRotCentre, aAngle ); } + /** * Function Flip * Flip this object, i.e. change the board side for this object diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index e43baaac79..2396061164 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -1,13 +1,16 @@ -/***************************************/ -/* Markers: used to show a drc problem */ -/***************************************/ +/** + * @file class_marker_pcb.h + * @brief Markers used to show a drc problem on boards. + */ #ifndef CLASS_MARKER_PCB_H #define CLASS_MARKER_PCB_H -#include "base_struct.h" + +#include "class_board_item.h" #include "class_marker_base.h" + class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE { diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 62ff5e38e6..4c64d92185 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -1,20 +1,22 @@ -/****************************************************/ -/* MIRE class definition (targets for photos) */ -/****************************************************/ +/** + * @file class_mire.cpp + * MIRE class definition (targets for photo plots) + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" #include "kicad_string.h" - -#include "pcbnew.h" -#include "class_board_design_settings.h" +#include "pcbcommon.h" #include "colors_selection.h" #include "trigo.h" #include "protos.h" #include "richio.h" +#include "class_board.h" +#include "class_mire.h" + PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) : BOARD_ITEM( aParent, PCB_TARGET_T ) diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index 390eb07399..8106a3874b 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -1,12 +1,18 @@ -/****************************************************/ -/* PCB_TARGET class definition. (targets for photos) */ -/****************************************************/ +/** + * @file class_mire.h + * @brief PCB_TARGET class definition. (targets for photo plots). + */ #ifndef MIRE_H #define MIRE_H -#include "base_struct.h" -#include "richio.h" + +#include "class_board_item.h" + + +class EDA_RECT; +class LINE_READER; +class EDA_DRAW_PANEL; class PCB_TARGET : public BOARD_ITEM @@ -21,8 +27,8 @@ public: PCB_TARGET( BOARD_ITEM* aParent ); ~PCB_TARGET(); - PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; } - PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; } + PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; } + PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; } wxPoint& GetPosition() { @@ -63,12 +69,12 @@ public: */ bool Save( FILE* aFile ) const; - bool ReadMirePcbDescr( LINE_READER* aReader ); + bool ReadMirePcbDescr( LINE_READER* aReader ); - void Copy( PCB_TARGET* source ); + void Copy( PCB_TARGET* source ); - void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, - const wxPoint& offset = ZeroOffset ); + void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, + const wxPoint& offset = ZeroOffset ); /** @@ -77,7 +83,7 @@ public: * @param refPos A wxPoint to test * @return bool - true if a hit, else false */ - bool HitTest( const wxPoint& refPos ); + bool HitTest( const wxPoint& refPos ); /** * Function HitTest (overlaid) @@ -86,7 +92,7 @@ public: * @param refArea : the given EDA_RECT * @return bool - true if a hit, else false */ - bool HitTest( EDA_RECT& refArea ); + bool HitTest( EDA_RECT& refArea ); EDA_RECT GetBoundingBox() const; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 1f081fab43..93bedf866f 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1,6 +1,7 @@ -/****************************************************/ -/* class_module.cpp : MODULE class implementation. */ -/****************************************************/ +/** + * @file class_module.cpp + * @brief MODULE class implementation. + */ #include "fctsys.h" #include "gr_basic.h" @@ -11,24 +12,23 @@ #include "confirm.h" #include "kicad_string.h" #include "pcbcommon.h" - #include "pcbnew.h" -#include "class_board_design_settings.h" #include "colors_selection.h" +#include "richio.h" +#include "filter_reader.h" +#include "macros.h" +#include "3d_struct.h" #include "drag.h" -#include "3d_struct.h" #include "protos.h" -#include "richio.h" -#include "filter_reader.h" +#include "class_board.h" +#include "class_edge_mod.h" +#include "class_module.h" -/*********************************************/ -/* Class MODULE : describes a pcb component. */ -/*********************************************/ MODULE::MODULE( BOARD* parent ) : - BOARD_ITEM( parent, TYPE_MODULE ) + BOARD_ITEM( (BOARD_ITEM*) parent, TYPE_MODULE ) { m_Attributs = MOD_DEFAULT; m_Layer = LAYER_N_FRONT; diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index f415c87975..881b9d1f3e 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -8,11 +8,19 @@ #define _MODULE_H_ -#include "richio.h" +#include "dlist.h" +#include "layers_id_colors_and_visibility.h" // ALL_LAYERS definition. +#include "class_board_item.h" + +#include "class_text_mod.h" +class LINE_READER; class EDA_3D_CANVAS; class S3D_MASTER; +class EDA_DRAW_PANEL; +class D_PAD; +class BOARD; enum Mod_Attribut /* Attributes used for modules */ @@ -30,6 +38,7 @@ enum Mod_Attribut /* Attributes used for modules */ #define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ #define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ + class MODULE : public BOARD_ITEM { public: @@ -60,7 +69,7 @@ public: int m_CntRot180; /* Automatic placement : cost ( 0..10 ) * for 180 degrees rotation (UP <->Down) */ wxSize m_Ext; /* Automatic placement margin around the module */ - double m_Surface; // Bounding box area + double m_Surface; // Bounding box area unsigned long m_Link; /* Temporary variable ( used in editions, ...) */ long m_LastEdit_Time; diff --git a/pcbnew/class_module_transform_functions.cpp b/pcbnew/class_module_transform_functions.cpp index b9a30e21f8..3266ce66f1 100644 --- a/pcbnew/class_module_transform_functions.cpp +++ b/pcbnew/class_module_transform_functions.cpp @@ -1,16 +1,19 @@ -/**************************************************** - * class_module_transform_functions.cpp : - * functions of class MODULE to handle some geometric changes: - * move, rot ... -****************************************************/ +/** + * @file class_module_transform_functions.cpp + * @brief Functions of class MODULE to handle some geometric changes such as move, rotate ... + */ #include "fctsys.h" #include "wxstruct.h" #include "trigo.h" #include "pcbcommon.h" - #include "pcbnew.h" +#include "macros.h" + #include "protos.h" +#include "class_pad.h" +#include "class_edge_mod.h" +#include "class_module.h" /* Calculate the layer number for changing cu / cmp layers for Cu / CMP diff --git a/pcbnew/class_netclass.cpp b/pcbnew/class_netclass.cpp index 2958b74f06..3eda529677 100644 --- a/pcbnew/class_netclass.cpp +++ b/pcbnew/class_netclass.cpp @@ -25,12 +25,15 @@ #include "fctsys.h" - #include "common.h" #include "kicad_string.h" #include "pcbnew.h" -#include "class_board_design_settings.h" #include "richio.h" +#include "macros.h" + +#include "class_board.h" +#include "class_netclass.h" + // Current design settings (used also to read configs): extern BOARD_DESIGN_SETTINGS boardDesignSettings; diff --git a/pcbnew/class_netclass.h b/pcbnew/class_netclass.h index dbd9146ec1..2ad71abf3c 100644 --- a/pcbnew/class_netclass.h +++ b/pcbnew/class_netclass.h @@ -32,6 +32,10 @@ #include #include "richio.h" + +class BOARD; + + /** * Class NETCLASS * handles a collection of nets and the parameters used to route or diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 8a14be2bb4..fee01f1e6a 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -1,6 +1,6 @@ -/************************/ -/* file class_netinfo.h */ -/************************/ +/** + * @file class_netinfo.h + */ /* * Classes to handle info on nets @@ -10,29 +10,32 @@ #define __CLASSES_NETINFO__ #include "class_netclass.h" -#include "richio.h" + +class LINE_READER; +class EDA_DRAW_PANEL; +class EDA_DRAW_FRAME; class NETINFO_ITEM; +class D_PAD; +class BOARD; +class BOARD_ITEM; -/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting - * 2 pads */ +/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting 2 pads */ /*****************************/ /* flags for a RATSNEST_ITEM */ /*****************************/ -#define CH_VISIBLE 1 /* Visible */ -#define CH_UNROUTABLE 2 /* Don't use autorouter. */ -#define CH_ROUTE_REQ 4 /* Must be routed by the autorouter. */ -#define CH_ACTIF 8 /* Not routed. */ -#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single - * module. */ +#define CH_VISIBLE 1 /* Visible */ +#define CH_UNROUTABLE 2 /* Don't use autorouter. */ +#define CH_ROUTE_REQ 4 /* Must be routed by the autorouter. */ +#define CH_ACTIF 8 /* Not routed. */ +#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single module. */ class RATSNEST_ITEM { private: - int m_NetCode; // netcode ( = 1.. n , 0 is the value used for not - // connected items) + int m_NetCode; // netcode ( = 1.. n , 0 is the value used for not connected items) public: int m_Status; // State: see previous defines (CH_ ...) @@ -64,21 +67,19 @@ public: void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const wxPoint& offset ); }; + /***************************************************************/ /******************* class NETINFO *****************************/ /***************************************************************/ - class NETINFO_LIST { private: BOARD* m_Parent; - std::vector m_NetBuffer; // nets buffer list (name, - // design constraints .. + std::vector m_NetBuffer; // nets buffer list (name, design constraints .. public: - std::vector m_PadsFullList; // Entry for a sorted pad - // list (used in ratsnest + std::vector m_PadsFullList; // Entry for a sorted pad list (used in ratsnest // calculations) public: NETINFO_LIST( BOARD* aParent ); @@ -88,7 +89,7 @@ public: NETINFO_LIST( BOARD* aParent ); * Function GetItem * @param aNetcode = netcode to identify a given NETINFO_ITEM * @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its - * netcode, or NULL if not found + * netcode, or NULL if not found */ NETINFO_ITEM* GetNetItem( int aNetcode ); @@ -122,7 +123,7 @@ public: NETINFO_LIST( BOARD* aParent ); * Function GetPadsCount * @return the number of pads in board */ - unsigned GetPadsCount() + unsigned GetPadsCount() { return m_PadsFullList.size(); } @@ -180,19 +181,18 @@ private: public: - int m_NbNodes; // Pads count for this net - int m_NbLink; // Ratsnets count for this net - int m_NbNoconn; // Ratsnets remaining to route count - int m_Flag; // used in some calculations. Had no - // special meaning + int m_NbNodes; // Pads count for this net + int m_NbLink; // Ratsnets count for this net + int m_NbNoconn; // Ratsnets remaining to route count + int m_Flag; // used in some calculations. Had no + // special meaning - std::vector m_ListPad; // List of pads connected to this net + std::vector m_ListPad; // List of pads connected to this net - unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of - * this - * net (included) in a general buffer of - * ratsnest (a vector - * buffer) */ + unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of this + * net (included) in a general buffer of + * ratsnest (a vector + * buffer) */ unsigned m_RatsnestEndIdx; // Ending point of ratsnests of this net // (excluded) in this buffer @@ -207,6 +207,7 @@ public: void SetClass( const NETCLASS* aNetClass ) { m_NetClass = (NETCLASS*) aNetClass; + if( aNetClass ) m_NetClassName = aNetClass->GetName(); else @@ -340,6 +341,7 @@ public: * @return int - the netcode */ int GetNet() const { return m_NetCode; } + void SetNet( int aNetCode ) { m_NetCode = aNetCode; } int GetNodesCount() const { return m_ListPad.size(); } @@ -385,10 +387,10 @@ public: /* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */ enum StatusPcbFlags { - LISTE_PAD_OK = 1, /* Pad list is Ok */ - LISTE_RATSNEST_ITEM_OK = 2, /* General Ratsnest is Ok */ - RATSNEST_ITEM_LOCAL_OK = 4, /* current MODULE ratsnest is Ok */ - CONNEXION_OK = 8, /* List of connections exists. */ + LISTE_PAD_OK = 1, /* Pad list is Ok */ + LISTE_RATSNEST_ITEM_OK = 2, /* General Ratsnest is Ok */ + RATSNEST_ITEM_LOCAL_OK = 4, /* current MODULE ratsnest is Ok */ + CONNEXION_OK = 8, /* List of connections exists. */ NET_CODES_OK = 0x10, /* Bit indicating that Netcode is OK, * do not change net name. */ DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index f579526b32..d8f3a4b884 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -3,13 +3,20 @@ /*************************************************************************/ #include "fctsys.h" +#include "gr_basic.h" #include "class_drawpanel.h" +#include "wxBasePcbFrame.h" #include "common.h" #include "kicad_string.h" #include "pcbnew.h" -#include "class_board_design_settings.h" #include "colors_selection.h" #include "richio.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" + /*********************************************************/ /* class NETINFO_ITEM: handle data relative to a given net */ diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index 23c6725cce..ff8d580172 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -1,13 +1,18 @@ -/***********************/ -/**** class_netinfolist.cpp ****/ -/***********************/ +/** + * @file class_netinfolist.cpp + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" + #include "pcbnew.h" +#include "class_board.h" +#include "class_module.h" +#include "class_netinfo.h" + // Constructor and destructor NETINFO_LIST::NETINFO_LIST( BOARD* aParent ) @@ -31,6 +36,7 @@ NETINFO_ITEM* NETINFO_LIST::GetNetItem( int aNetcode ) { if( aNetcode < 0 || ( aNetcode > (int) ( GetCount() - 1 ) ) ) return NULL; + return m_NetBuffer[aNetcode]; } @@ -72,10 +78,6 @@ static bool PadlistSortByNetnames( const D_PAD* a, const D_PAD* b ) } -/*****************************************************/ -void NETINFO_LIST::BuildListOfNets() -/*****************************************************/ - /** * Compute and update the net_codes for PADS et and equipots (.m_NetCode member) * net_codes are >= 1 (net_code = 0 means not connected) @@ -88,8 +90,9 @@ void NETINFO_LIST::BuildListOfNets() * and expects to have a nets list sorted by an alphabetic case sensitive sort * So do not change Build_Pads_Full_List() taht build a sorted list of pads */ +void NETINFO_LIST::BuildListOfNets() { - D_PAD* pad; + D_PAD* pad; int nodes_count = 0; NETINFO_ITEM* net_item; @@ -97,7 +100,7 @@ void NETINFO_LIST::BuildListOfNets() // Create and add the "unconnected net", always existing, // used to handle pads and tracks that are not member of a "real" net - net_item = new NETINFO_ITEM( m_Parent ); + net_item = new NETINFO_ITEM( (BOARD_ITEM*) m_Parent ); AppendNet( net_item ); /* Build the PAD list, sorted by net */ @@ -106,9 +109,11 @@ void NETINFO_LIST::BuildListOfNets() /* Build netnames list, and create a netcode for each netname */ D_PAD* last_pad = NULL; int netcode = 0; + for( unsigned ii = 0; ii < m_PadsFullList.size(); ii++ ) { pad = m_PadsFullList[ii]; + if( pad->GetNetname().IsEmpty() ) // pad not connected { pad->SetNet( 0 ); @@ -118,10 +123,10 @@ void NETINFO_LIST::BuildListOfNets() /* if the current netname was already found: add pad to the current net_item , * else create a new net_code and a new net_item */ - if( last_pad == NULL || ( pad->GetNetname() != last_pad->GetNetname() ) ) // create a new net_code + if( last_pad == NULL || ( pad->GetNetname() != last_pad->GetNetname() ) ) { netcode++; - net_item = new NETINFO_ITEM( m_Parent ); + net_item = new NETINFO_ITEM( (BOARD_ITEM*)m_Parent ); net_item->SetNet( netcode ); net_item->SetNetname( pad->GetNetname() ); AppendNet( net_item ); @@ -145,18 +150,14 @@ void NETINFO_LIST::BuildListOfNets() #if 0 for( unsigned icnt = 0; icnt < GetCount(); icnt++) { - wxLogWarning(wxT("icnt %d, netcode %d, netname <%s>\n"), - icnt, m_NetBuffer[icnt]->GetNet(), - GetChars( m_NetBuffer[icnt]->GetNetname() ) ); + wxLogWarning( wxT( "icnt %d, netcode %d, netname <%s>\n" ), + icnt, m_NetBuffer[icnt]->GetNet(), + GetChars( m_NetBuffer[icnt]->GetNetname() ) ); } #endif } -/*****************************************/ -void NETINFO_LIST::Build_Pads_Full_List() -/*****************************************/ - /** * Function Build_Pads_Full_List * Create the pad list, sorted by net names (sorted by an alphabetic case sensitive sort) @@ -170,6 +171,7 @@ void NETINFO_LIST::Build_Pads_Full_List() * and expects to have a nets list sorted by an alphabetic case sensitive sort * So do not change the sort function used here */ +void NETINFO_LIST::Build_Pads_Full_List() { if( m_Parent->m_Status_Pcb & LISTE_PAD_OK ) return; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index b5e28c3082..d465f9603c 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -1,18 +1,24 @@ -/***********************************************/ -/* class_pad.cpp : D_PAD class implementation. */ -/***********************************************/ +/** + * @file class_pad.cpp + * D_PAD class implementation. + */ #include "fctsys.h" #include "PolyLine.h" #include "common.h" #include "confirm.h" #include "kicad_string.h" +#include "trigo.h" +#include "richio.h" +#include "wxstruct.h" +#include "macros.h" #include "pcbnew.h" -#include "trigo.h" #include "pcbnew_id.h" // ID_TRACK_BUTT -#include "class_board_design_settings.h" -#include "richio.h" + +#include "class_board.h" +#include "class_module.h" + // Due to a bug in previous versions ( m_LengthDie not initialized in D_PAD ctor) // m_LengthDie is no more read from .brd files @@ -35,11 +41,9 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD ) m_Pos = ( (MODULE*) m_Parent )->GetPosition(); } - m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, - // PAD_RECT PAD_OVAL + m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL // PAD_TRAPEZOID - m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, - // PAD_CONN + m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN m_DrillShape = PAD_CIRCLE; // Drill shape = circle m_LocalClearance = 0; m_LocalSolderMaskMargin = 0; @@ -48,8 +52,7 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD ) m_layerMask = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to // default for a standard pad - SetSubRatsnest( 0 ); // used in ratsnest - // calculations + SetSubRatsnest( 0 ); // used in ratsnest calculations ComputeShapeMaxRadius(); } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 023c52c5fa..84caa0abdc 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -7,12 +7,15 @@ #define _PAD_H_ +#include "class_board_item.h" #include "pad_shapes.h" #include "PolyLine.h" -#include "richio.h" +class LINE_READER; class EDA_3D_CANVAS; +class EDA_DRAW_PANEL; +class MODULE; /* Default layers used for pads, according to the pad type. @@ -406,11 +409,5 @@ public: #endif }; -typedef class D_PAD* LISTE_PAD; - - -/* LocalWords: eeschema vout - */ - #endif // _PAD_H_ diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 88ed7541de..d3c844a15a 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -1,20 +1,26 @@ -/*******************************/ -/* class_pad_draw_function.cpp */ -/*******************************/ +/** + * @file class_pad_draw_functions.cpp + */ #include "fctsys.h" - #include "gr_basic.h" #include "common.h" #include "trigo.h" -#include "pcbnew_id.h" // ID_TRACK_BUTT +#include "class_pcb_screen.h" #include "class_drawpanel.h" #include "drawtxt.h" +#include "layers_id_colors_and_visibility.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" +#include "macros.h" +#include "pcbnew_id.h" // ID_TRACK_BUTT #include "pcbnew.h" -#include "class_board_design_settings.h" #include "colors_selection.h" +#include "class_board.h" + + /* uncomment this line to show this pad with its specfic size and color * when it is not on copper layers, and only one solder mask layer or solder paste layer * is displayed for this pad diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index bab4595b4a..c714620c43 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -32,13 +32,18 @@ #include "appl_wxstruct.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "pcbstruct.h" // enum PCB_VISIBLE +#include "layer_widget.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_pcb_layer_widget.h" + +#include "pcbnew.h" #include "collectors.h" #include "pcbnew_id.h" -#include "layer_widget.h" -#include "class_pcb_layer_widget.h" /** diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index d658ecf160..cd348450b1 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -1,6 +1,7 @@ -/*********************************************************/ -/* class TEXTE_PCB : texts on copper or technical layers */ -/*********************************************************/ +/** + * @file class_pcb_text.cpp + * @brief Class TEXTE_PCB texts on copper or technical layers implementation + */ #include "fctsys.h" #include "wxstruct.h" @@ -8,18 +9,18 @@ #include "base_struct.h" #include "drawtxt.h" #include "kicad_string.h" - -#include "pcbnew.h" -#include "class_board_design_settings.h" -#include "colors_selection.h" #include "trigo.h" -#include "protos.h" +#include "pcbcommon.h" +#include "colors_selection.h" #include "richio.h" #include "class_drawpanel.h" +#include "macros.h" + +#include "class_board.h" +#include "class_pcb_text.h" + +#include "protos.h" -/*******************/ -/* class TEXTE_PCB */ -/*******************/ TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) : BOARD_ITEM( parent, TYPE_TEXTE ), diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index a4357733ab..21cd41b90e 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -1,13 +1,17 @@ -/********************************/ -/* TEXTE_PCB class definition. */ -/********************************/ +/** + * @file class_pcb_text.h + * @brief TEXTE_PCB class definition. + */ #ifndef CLASS_PCB_TEXT_H #define CLASS_PCB_TEXT_H -#include "base_struct.h" +#include "class_board_item.h" #include "PolyLine.h" -#include "richio.h" + + +class LINE_READER; +class EDA_DRAW_PANEL; class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT @@ -20,8 +24,7 @@ public: /** * Function GetPosition * returns the position of this object. - * @return wxPoint& - The position of this object, non-const so it - * can be changed + * @return wxPoint& - The position of this object, non-const so it can be changed */ wxPoint& GetPosition() { @@ -56,7 +59,7 @@ public: /* duplicate structure */ void Copy( TEXTE_PCB* source ); - void Draw( EDA_DRAW_PANEL * panel, wxDC* DC, int aDrawMode, + void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset ); // File Operations: @@ -64,8 +67,7 @@ public: /** * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. + * writes the data structures for this object out to a FILE in "*.brd" format. * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ @@ -78,7 +80,7 @@ public: * Is virtual from EDA_ITEM. * @param frame A EDA_DRAW_FRAME in which to print status information. */ - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void DisplayInfo( EDA_DRAW_FRAME* frame ); /** @@ -87,19 +89,19 @@ public: * @param refPos A wxPoint to test * @return bool - true if a hit, else false */ - bool HitTest( const wxPoint& refPos ) + bool HitTest( const wxPoint& refPos ) { return TextHitTest( refPos ); } /** - * Function HitTest (overlaid) + * Function HitTest (overloaded) * tests if the given EDA_RECT intersect this object. * @param refArea the given EDA_RECT to test * @return bool - true if a hit, else false */ - bool HitTest( EDA_RECT& refArea ) + bool HitTest( EDA_RECT& refArea ) { return TextHitTest( refArea ); } @@ -142,7 +144,7 @@ public: * Function Show * is used to output the object tree, currently for debugging only. * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. + * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ virtual void Show( int nestLevel, std::ostream& os ); diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index e6da8b0584..3ac1c6c27f 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -1,23 +1,26 @@ -/********************************************************/ -/* class_module.cpp : TEXT_MODULE class implementation. */ -/********************************************************/ +/** + * @file class_module.cpp + * @brief TEXT_MODULE class implementation. + */ #include "fctsys.h" #include "gr_basic.h" #include "wxstruct.h" -#include "pcbnew.h" #include "trigo.h" #include "class_drawpanel.h" #include "drawtxt.h" #include "kicad_string.h" #include "pcbcommon.h" -#include "class_board_design_settings.h" #include "colors_selection.h" #include "richio.h" +#include "macros.h" +#include "wxBasePcbFrame.h" + +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" -/*******************************************************************/ -/* Class TEXTE_MODULE base class type of text elements in a module */ -/*******************************************************************/ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : BOARD_ITEM( parent, TYPE_TEXTE_MODULE ), EDA_TEXT() diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index c94f05565f..d1a28b1def 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -1,12 +1,22 @@ -/***************************************************/ -/* class_text_module.h : texts module description */ -/***************************************************/ +/** + * @file class_text_mod.h + * @brief Footprint text class description. + */ #ifndef TEXT_MODULE_H #define TEXT_MODULE_H -#include "richio.h" + +#include "class_board_item.h" + + +class LINE_READER; +class EDA_RECT; +class EDA_DRAW_PANEL; +class EDA_DRAW_FRAME; +class MODULE; + #define TEXT_is_REFERENCE 0 #define TEXT_is_VALUE 1 @@ -21,16 +31,18 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT * Physical orient is m_Orient + m_Parent->m_Orient */ public: - wxPoint m_Pos0; // text coordinates relatives to the footprint - // anchor, orient 0 + wxPoint m_Pos0; // text coordinates relatives to the footprint anchor, orient 0 // Text coordinate ref point is the text centre char m_Type; // 0: ref,1: val, others = 2..255 bool m_NoShow; // true = invisible -public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); +public: + TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); + ~TEXTE_MODULE(); TEXTE_MODULE* Next() const { return (TEXTE_MODULE*) Pnext; } + TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; } /** @@ -45,11 +57,11 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); } - void Copy( TEXTE_MODULE* source ); // copy structure + void Copy( TEXTE_MODULE* source ); // copy structure - int GetLength() const; /* text length */ + int GetLength() const; /* text length */ - int GetDrawRotation() const; // Return text rotation for drawings and plotting + int GetDrawRotation() const; // Return text rotation for drawings and plotting /** * Function GetTextRect @@ -65,9 +77,9 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); */ EDA_RECT GetBoundingBox() const; - void SetDrawCoord(); // Set absolute coordinates. + void SetDrawCoord(); // Set absolute coordinates. - void SetLocalCoord(); // Set relative coordinates. + void SetLocalCoord(); // Set relative coordinates. /** * Function Save @@ -76,7 +88,7 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ - bool Save( FILE* aFile ) const; + bool Save( FILE* aFile ) const; /** * Function ReadDescr @@ -84,13 +96,13 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); * @param aReader is a pointer to a LINE_READER to read from. * @return int - > 0 if success reading else 0. */ - int ReadDescr( LINE_READER* aReader ); + int ReadDescr( LINE_READER* aReader ); /* drawing functions */ - void Draw( EDA_DRAW_PANEL* panel, - wxDC* DC, - int aDrawMode, - const wxPoint& offset = ZeroOffset ); + void Draw( EDA_DRAW_PANEL* panel, + wxDC* DC, + int aDrawMode, + const wxPoint& offset = ZeroOffset ); /** * Function DrawUmbilical @@ -101,10 +113,10 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); * @param aDrawMode = drawing mode, typically GR_XOR * @param aOffset = offset for TEXTE_MODULE */ - void DrawUmbilical( EDA_DRAW_PANEL* aPanel, - wxDC* aDC, - int aDrawMode, - const wxPoint& aOffset = ZeroOffset ); + void DrawUmbilical( EDA_DRAW_PANEL* aPanel, + wxDC* aDC, + int aDrawMode, + const wxPoint& aOffset = ZeroOffset ); /** * Function DisplayInfo @@ -168,7 +180,7 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); * Function Show * is used to output the object tree, currently for debugging only. * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. + * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ virtual void Show( int nestLevel, std::ostream& os ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index cab5dd2d3a..41396ccb62 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1,21 +1,27 @@ -/***********************************************************************/ -/* Functions relatives to tracks, vias and segments used to fill zones */ -/* (see class_track.h ) */ -/***********************************************************************/ +/** + * @file class_track.h + * @brief Functions relatives to tracks, vias and segments used to fill zones. + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "trigo.h" #include "class_drawpanel.h" +#include "class_pcb_screen.h" #include "drawtxt.h" +#include "pcbcommon.h" +#include "colors_selection.h" +#include "wxstruct.h" +#include "macros.h" +#include "wxBasePcbFrame.h" + +#include "class_board.h" +#include "class_track.h" #include "pcbnew.h" -#include "class_board_design_settings.h" -#include "colors_selection.h" #include "protos.h" - /** * Function ShowClearance * tests to see if the clearance border is drawn on the given track. diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 366b66a5d1..ae5dc3abdc 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -6,10 +6,14 @@ #ifndef CLASS_TRACK_H #define CLASS_TRACK_H -#include "base_struct.h" + +#include "class_board_item.h" #include "PolyLine.h" +class TRACK; + + // Via attributes (m_Shape parameter) #define VIA_THROUGH 3 /* Always a through hole via */ #define VIA_BLIND_BURIED 2 /* this via can be on internal layers */ diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index f58dd38b7b..495468896f 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -1,27 +1,27 @@ -/**********************************/ -/* classes to handle copper zones */ -/**********************************/ +/** + * @file class_zone.cpp + * @brief Implementation of class to handle copper zones. + */ #include "fctsys.h" #include "wxstruct.h" -#include "gr_basic.h" #include "trigo.h" +#include "class_pcb_screen.h" #include "class_drawpanel.h" #include "kicad_string.h" - -#include "PolyLine.h" -#include "pcbnew.h" -#include "zones.h" -#include "class_board_design_settings.h" +#include "pcbcommon.h" #include "colors_selection.h" +#include "richio.h" +#include "macros.h" +#include "wxBasePcbFrame.h" #include "protos.h" -#include "richio.h" -#include "class_zone_setting.h" +#include "class_board.h" +#include "class_zone.h" + +#include "pcbnew.h" +#include "zones.h" -/************************/ -/* class ZONE_CONTAINER */ -/************************/ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_ZONE_CONTAINER ) diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index e7003cd33a..675111bc2b 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -9,6 +9,8 @@ #include #include "gr_basic.h" +#include "class_board_item.h" +#include "layers_id_colors_and_visibility.h" #include "PolyLine.h" #include "class_zone_setting.h" @@ -19,7 +21,6 @@ class EDA_DRAW_FRAME; class EDA_DRAW_PANEL; class PCB_EDIT_FRAME; class BOARD; -class BOARD_CONNECTED_ITEM; class ZONE_CONTAINER; diff --git a/pcbnew/class_zone_setting.cpp b/pcbnew/class_zone_setting.cpp index c7b99001d9..672f6bdd88 100644 --- a/pcbnew/class_zone_setting.cpp +++ b/pcbnew/class_zone_setting.cpp @@ -15,11 +15,11 @@ #endif #include "fctsys.h" -#include "PolyLine.h" #include "common.h" #include "pcbnew.h" #include "zones.h" + #include "class_zone.h" ZONE_SETTING::ZONE_SETTING( void ) diff --git a/pcbnew/class_zone_setting.h b/pcbnew/class_zone_setting.h index 788e329a06..2db900a7ec 100644 --- a/pcbnew/class_zone_setting.h +++ b/pcbnew/class_zone_setting.h @@ -1,15 +1,22 @@ -/****************************************************************/ -/* class ZONE_SETTING used to handle zones parameters in dialogs */ -/****************************************************************/ +/** + * @file class_zone_setting.h + * @brief Class ZONE_SETTING used to handle zones parameters in dialogs. + */ #ifndef ZONE_SETTING_H #define ZONE_SETTING_H + +class ZONE_CONTAINER; + + #define MAX_ZONE_CORNER_RADIUS 4000 -/*************************************************/ -/* Class ZONE_SETTING to handle zones parameters */ -/*************************************************/ + +/** + * Class ZONE_SETTING + * handles zones parameters. + */ class ZONE_SETTING { public: @@ -19,20 +26,29 @@ public: SMOOTHING_FILLET, SMOOTHING_LAST }; - int m_FillMode; // Mode for filling zone : 1 use segments, 0 use polygons - int m_ZoneClearance; // Clearance value - int m_ZoneMinThickness; // Min thickness value in filled areas - int m_NetcodeSelection; // Net code selection for the current zone - int m_CurrentZone_Layer; // Layer used to create the current zone - int m_Zone_HatchingStyle; // Option to show the zone area (outlines only, short hatches or full hatches - int m_ArcToSegmentsCount; /* Option to select number of segments to approximate a circle - * 16 or 32 segments */ - long m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs - long m_ThermalReliefCopperBridgeValue; // tickness of the copper bridge in thermal reliefs - int m_Zone_Pad_Options; // How pads are covered by copper in zone + + // Mode for filling zone : 1 use segments, 0 use polygons + int m_FillMode; + + int m_ZoneClearance; // Clearance value + int m_ZoneMinThickness; // Min thickness value in filled areas + int m_NetcodeSelection; // Net code selection for the current zone + int m_CurrentZone_Layer; // Layer used to create the current zone + + // Option to show the zone area (outlines only, short hatches or full hatches + int m_Zone_HatchingStyle; + + // Option to select number of segments to approximate a circle 16 or 32 segments. + int m_ArcToSegmentsCount; + + long m_ThermalReliefGapValue; // thickness of the gap in thermal reliefs + long m_ThermalReliefCopperBridgeValue; // thickness of the copper bridge in thermal reliefs + int m_Zone_Pad_Options; // How pads are covered by copper in zone + private: - int cornerSmoothingType; // Corner smoothing type - unsigned int cornerRadius; // Corner chamfer distance / fillet radius + int cornerSmoothingType; // Corner smoothing type + unsigned int cornerRadius; // Corner chamfer distance / fillet radius + public: ZONE_SETTING( void ); @@ -55,7 +71,9 @@ public: void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true); void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; }; - int GetCornerSmoothingType() const { return cornerSmoothingType; }; + + int GetCornerSmoothingType() const { return cornerSmoothingType; }; + void SetCornerRadius( int aRadius ) { if( aRadius > MAX_ZONE_CORNER_RADIUS ) @@ -65,7 +83,8 @@ public: else cornerRadius = aRadius; }; - unsigned int GetCornerRadius() const { return cornerRadius; }; + + unsigned int GetCornerRadius() const { return cornerRadius; }; }; diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index aa5fd9be50..b0ca565dfa 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -4,12 +4,13 @@ /****************************************************************/ #include "fctsys.h" - #include "common.h" +#include "trigo.h" +#include "class_pcb_screen.h" #include "pcbnew.h" #include "class_board_design_settings.h" +#include "layers_id_colors_and_visibility.h" -#include "trigo.h" #include "pcbnew_id.h" @@ -20,7 +21,8 @@ * The last 2 values is handy when somebody uses a library import of a module * (or foreign data) which has a bad coordinate * Also useful in Gerbview for this reason. - * Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions ) + * Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic + * functions ) */ static const double PcbZoomList[] = { @@ -84,23 +86,19 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( TYPE_SCREEN ) } -/***************************/ PCB_SCREEN::~PCB_SCREEN() -/***************************/ { ClearUndoRedoList(); } -/*************************/ void PCB_SCREEN::Init() -/*************************/ { InitDatas(); m_Active_Layer = LAYER_N_BACK; /* default active layer = bottom layer */ - m_Route_Layer_TOP = LAYER_N_FRONT; /* default layers pair for vias (bottom to top) */ + m_Route_Layer_TOP = LAYER_N_FRONT; /* default layers pair for vias (bottom to top) */ m_Route_Layer_BOTTOM = LAYER_N_BACK; - m_Zoom = 150; /* a default value for zoom */ + m_Zoom = 150; /* a default value for zoom */ } diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 74d5b0cbb1..bc4f8bb40d 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -6,11 +6,17 @@ #include "fctsys.h" #include "class_drawpanel.h" +#include "gr_basic.h" +#include "pcbcommon.h" +#include "wxPcbStruct.h" #include "pcbnew.h" -#include "wxPcbStruct.h" #include "protos.h" +#include "class_board.h" +#include "class_track.h" + + /* local functions : */ static void clean_segments( PCB_EDIT_FRAME* frame ); static void clean_vias( BOARD* aPcb ); diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index f46b244e7a..2cfa116771 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -23,7 +23,10 @@ */ #include "collectors.h" -#include "pcbnew.h" // class BOARD +#include "class_board_item.h" // class BOARD_ITEM + +#include "class_module.h" +#include "class_pad.h" /* This module contains out of line member functions for classes given in diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index bef59dab3c..11b227d9c5 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -22,6 +22,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +/** + * @file collectors.h + */ + #ifndef COLLECTORS_H #define COLLECTORS_H @@ -32,7 +36,10 @@ #include "class_collector.h" -#include "pcbstruct.h" // LAYER_COUNT, layer defs +#include "layers_id_colors_and_visibility.h" // LAYER_COUNT, layer defs + + +class BOARD_ITEM; /** diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index e9b0c488c5..c636169c96 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -1,15 +1,22 @@ -/***************************************************************************************/ -/* Ratsnest calculations: Function to handle existing tracks in ratsnest calculations */ -/***************************************************************************************/ +/** + * @file connect.cpp + * @brief Functions to handle existing tracks in ratsnest calculations. + */ #include "fctsys.h" #include "gr_basic.h" - #include "common.h" -#include "pcbnew.h" +#include "pcbcommon.h" +#include "macros.h" +#include "wxBasePcbFrame.h" +#include "class_track.h" +#include "class_board.h" + +#include "pcbnew.h" #include "protos.h" + extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ); extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index b9089dea1a..9074524cab 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -1,14 +1,20 @@ -/****************/ -/* controle.cpp */ -/****************/ +/** + * @file pcbnew/controle.cpp + */ #include "fctsys.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "protos.h" +#include "pcbcommon.h" +#include "macros.h" + #include "pcbnew_id.h" +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" +#include "protos.h" #include "collectors.h" //external functions used here: @@ -333,7 +339,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH // If there's no intrusion and DRC is active, we pass the cursor // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. if( !Drc_On || !g_CurrentTrackSegment - || g_CurrentTrackSegment != this->GetCurItem() + || (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() || !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) ) { diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 8759cdc1c0..fa17307e47 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -13,18 +13,19 @@ #include "fctsys.h" #include "appl_wxstruct.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "eda_dde.h" +#include "macros.h" + #include "pcbnew_id.h" +#include "class_board.h" +#include "class_module.h" + #include "collectors.h" +#include "pcbnew.h" #include "protos.h" -/*******************************************/ -void RemoteCommand( const char* cmdline ) -/*******************************************/ - /** Read a remote command send by eeschema via a socket, * port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) * @param cmdline = received command from eeschema @@ -32,6 +33,7 @@ void RemoteCommand( const char* cmdline ) * $PART: "reference" put cursor on component * $PIN: "pin name" $PART: "reference" put cursor on the footprint pin */ +void RemoteCommand( const char* cmdline ) { char line[1024]; wxString msg; @@ -131,11 +133,6 @@ void RemoteCommand( const char* cmdline ) } -// see wxstruct.h -/**************************************************************************/ -void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) -/**************************************************************************/ - /** Send a remote command to eeschema via a socket, * @param objectToSync = item to be located on schematic (module, pin or text) * Commands are @@ -144,6 +141,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) * $PART: "reference" $REF: "reference" put cursor on the component ref * $PART: "reference" $VAL: "value" put cursor on the component value */ +void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) { char cmd[1024]; const char* text_key; @@ -159,8 +157,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) { case TYPE_MODULE: module = (MODULE*) objectToSync; - sprintf( cmd, "$PART: \"%s\"", - TO_UTF8( module->m_Reference->m_Text ) ); + sprintf( cmd, "$PART: \"%s\"", TO_UTF8( module->m_Reference->m_Text ) ); break; case TYPE_PAD: @@ -177,6 +174,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) #define VALUE 1 module = (MODULE*) objectToSync->GetParent(); text_mod = (TEXTE_MODULE*) objectToSync; + if( text_mod->m_Type == REFERENCE ) text_key = "$REF:"; else if( text_mod->m_Type == VALUE ) diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 905440804d..553f3460d9 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -2,13 +2,18 @@ /* Edit Track: Erase Routines */ /* Delete segments, tracks, and net areas */ /******************************************/ -#include "fctsys.h" +#include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "macros.h" +#include "pcbcommon.h" +#include "class_board.h" +#include "class_track.h" + +#include "pcbnew.h" #include "protos.h" diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index ba31bfeed3..e7bdd9cbff 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -11,13 +11,22 @@ #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" - #include "dcsvg.h" +#include "wxBasePcbFrame.h" +#include "class_pcb_screen.h" +#include "macros.h" #include "pcbnew.h" #include "pcbplot.h" #include "printout_controler.h" +#include "class_board.h" +#include "class_edge_mod.h" +#include "class_mire.h" +#include "class_pcb_text.h" +#include "class_dimension.h" +#include "class_zone.h" + #include "dialog_SVG_print.h" diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 736c5af076..f5ae98c7bd 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -1,9 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: dialog_copper_zones.cpp // Author: jean-pierre Charras // Created: 09/oct/2008 -/// Licence: GNU License +// Licence: GNU License ///////////////////////////////////////////////////////////////////////////// #include @@ -19,6 +18,8 @@ #include "dialog_copper_zones.h" #include "class_zone_setting.h" +#include "class_board.h" + #define LAYER_BITMAP_SIZE_X 20 #define LAYER_BITMAP_SIZE_Y 10 diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index 214a555a52..778dbc48aa 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -32,6 +32,7 @@ */ #include "fctsys.h" #include "class_drawpanel.h" +#include "macros.h" #include "confirm.h" #include "pcbnew.h" @@ -39,10 +40,13 @@ #include "class_board_design_settings.h" #include "pcbnew_id.h" +#include "class_track.h" + #include "dialog_design_rules.h" #include "wx/generic/gridctrl.h" #include "dialog_design_rules_aux_helper_class.h" + // Column labels for net lists #define NET_TITLE _( "Net" ) #define CLASS_TITLE _( "Class" ) diff --git a/pcbnew/dialogs/dialog_design_rules.h b/pcbnew/dialogs/dialog_design_rules.h index 950d394cec..e5bdcd190b 100644 --- a/pcbnew/dialogs/dialog_design_rules.h +++ b/pcbnew/dialogs/dialog_design_rules.h @@ -5,8 +5,15 @@ #ifndef __dialog_design_rules_h_ #define __dialog_design_rules_h_ +#include "../class_board.h" + #include "dialog_design_rules_base.h" + +class PCB_EDIT_FRAME; +class BOARD_DESIGN_SETTINGS; + + // helper struct to handle a net and its netclass in dialog design rule editor struct NETCUP { diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp index 70a3379ca4..d2c610a13f 100644 --- a/pcbnew/dialogs/dialog_display_options.cpp +++ b/pcbnew/dialogs/dialog_display_options.cpp @@ -10,6 +10,8 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "pcbstruct.h" +#include "pcbcommon.h" #include "pcbnew_id.h" diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index d2bdf74fcd..80e73594ed 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -9,18 +9,24 @@ #include -// forward declarations -class DRCLISTBOX; -//end forward declarations - #include "fctsys.h" #include "pcbnew.h" #include "class_drawpanel.h" #include "wxstruct.h" #include "drc_stuff.h" +#include "class_marker_pcb.h" +#include "class_board.h" #include "dialog_drc_base.h" + +// forward declarations +class DRCLISTBOX; +class BOARD_DESIGN_SETTINGS; + + +//end forward declarations + // outside @end control identifiers since wxFormBuilder knows not DRCLISTBOX #define ID_DRCLISTCTRL 14000 #define ID_POPUP_UNCONNECTED_A 14001 diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 143b2947f9..7c9aa7d2e5 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -3,6 +3,7 @@ ******************************************************************************/ #include "fctsys.h" +#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" #include "pcbnew.h" @@ -11,6 +12,10 @@ #include "3d_struct.h" #include "3d_viewer.h" #include "wxPcbStruct.h" + +#include "class_module.h" +#include "class_text_mod.h" + #include "dialog_edit_module_for_BoardEditor.h" diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 9fb38669db..5fb114d205 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -11,6 +11,9 @@ #include "3d_struct.h" #include "3d_viewer.h" #include "wxPcbStruct.h" + +#include "class_module.h" +#include "class_text_mod.h" #include "module_editor_frame.h" #include "dialog_edit_module_for_Modedit.h" diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index cc25de1bda..7c80f4471f 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -7,16 +7,23 @@ #include "fctsys.h" #include "macros.h" +#include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" #include "pcbnew.h" #include "drawtxt.h" #include "confirm.h" +#include "wxBasePcbFrame.h" + +#include "class_module.h" +#include "class_text_mod.h" #include "dialog_edit_module_text_base.h" + extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp + /*************** **************/ /* class DialogEditModuleText */ /*************** **************/ diff --git a/pcbnew/dialogs/dialog_freeroute_exchange.cpp b/pcbnew/dialogs/dialog_freeroute_exchange.cpp index f0b2463974..2a6abd0499 100644 --- a/pcbnew/dialogs/dialog_freeroute_exchange.cpp +++ b/pcbnew/dialogs/dialog_freeroute_exchange.cpp @@ -8,6 +8,8 @@ #include "gestfich.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "macros.h" + #include "../common/dialogs/dialog_display_info_HTML_base.h" #include "dialog_freeroute_exchange.h" diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 7dd631199d..0ca32f45c6 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -33,6 +33,10 @@ #include "pcbplot.h" #include "gendrill.h" +#include "class_board.h" +#include "class_track.h" +#include "class_module.h" + #include "dialog_gendrill.h" diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 3ede8c6b7d..c1c061ed08 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -13,9 +13,12 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" -#include "dialog_general_options.h" +#include "pcbcommon.h" #include "pcbnew_id.h" +#include "class_board.h" + +#include "dialog_general_options.h" Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) : diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 14613e83cd..8dc2c98b50 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -8,6 +8,12 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" #include "dialog_global_deletion.h" diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index 6e93e027b3..aad1fd3e49 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: dialog_global_edit_tracks_and_vias.cpp // Author: jean-pierre Charras // Created: 30 oct 2009 @@ -12,8 +11,11 @@ #include "wxPcbStruct.h" #include "class_drawpanel.h" +#include "class_board.h" + #include "dialog_global_edit_tracks_and_vias.h" + /** * DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS, derived from DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_BASE * @see dialog_global_edit_tracks_and_vias_base.h and dialog_global_edit_tracks_and_vias_base.cpp, diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 4117eb6e1f..5f0f4a7c28 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -12,14 +12,19 @@ */ #include "fctsys.h" #include "macros.h" +#include "gr_basic.h" #include "confirm.h" #include "class_drawpanel.h" #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "class_board.h" +#include "class_drawsegment.h" + #include "dialog_graphic_item_properties_base.h" + /////////////////////////////////////////////////////////////////////////// class DialogGraphicItemProperties: public DialogGraphicItemProperties_base diff --git a/pcbnew/dialogs/dialog_graphic_items_options.cpp b/pcbnew/dialogs/dialog_graphic_items_options.cpp index 537c76858d..0c072aab5c 100644 --- a/pcbnew/dialogs/dialog_graphic_items_options.cpp +++ b/pcbnew/dialogs/dialog_graphic_items_options.cpp @@ -7,9 +7,10 @@ #include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" #include "pcbnew_id.h" +#include "module_editor_frame.h" +#include "class_board.h" #include "dialog_graphic_items_options.h" diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index 829973014e..c16ecaeb64 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -26,14 +26,16 @@ #include "fctsys.h" #include "class_drawpanel.h" +#include "macros.h" #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "class_board.h" + #include "dialog_layers_setup_base.h" -#include "class_board_design_settings.h" // some define to choose how copper layers widgets are shown diff --git a/pcbnew/dialogs/dialog_mask_clearance.cpp b/pcbnew/dialogs/dialog_mask_clearance.cpp index beb4294850..a3582bfc81 100644 --- a/pcbnew/dialogs/dialog_mask_clearance.cpp +++ b/pcbnew/dialogs/dialog_mask_clearance.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: dialog_mask_clearance.cpp // Author: jean-pierre Charras // Modified by: @@ -13,6 +12,8 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "class_board.h" + #include "dialog_mask_clearance.h" /** diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 9c20c7cd7e..5bfe04d249 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -9,7 +9,11 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "macros.h" +#include "pcbcommon.h" + #include "pcbnew_config.h" +#include "class_board_design_settings.h" #include "dialog_netlist.h" diff --git a/pcbnew/dialogs/dialog_orient_footprints.cpp b/pcbnew/dialogs/dialog_orient_footprints.cpp index fc9be7b2c4..606e321a6a 100644 --- a/pcbnew/dialogs/dialog_orient_footprints.cpp +++ b/pcbnew/dialogs/dialog_orient_footprints.cpp @@ -34,6 +34,9 @@ #include "wxPcbStruct.h" #include "macros.h" +#include "class_board.h" +#include "class_module.h" + #include "dialog_orient_footprints_base.h" diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 81b8011c8e..04e38d2f89 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -10,8 +10,18 @@ #include "confirm.h" #include "pcbnew.h" #include "trigo.h" +#include "macros.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" + #include +#include "class_board.h" +#include "class_module.h" + +#include "dialog_pad_properties_base.h" + + #define NBSHAPES 4 int CodeShape[NBSHAPES] = // list of pad shapes. { @@ -42,8 +52,6 @@ static long Std_Pad_Layers[NBTYPES] = }; -#include "dialog_pad_properties_base.h" - extern int ChangeSideMaskLayer( int masque ); diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index 9af78bce1d..9c5df36ebe 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -26,7 +26,6 @@ /* Dialog editor for text on copper and technical layers (TEXTE_PCB class) */ /***************************************************************************/ -#include "dialog_pcb_text_properties.h" #include "fctsys.h" #include "gr_basic.h" #include "class_drawpanel.h" @@ -36,6 +35,12 @@ #include "confirm.h" #include "dialog_helpers.h" +#include "class_board.h" +#include "class_pcb_text.h" + +#include "dialog_pcb_text_properties.h" + + /** * DIALOG_PCB_TEXT_PROPERTIES, derived from DIALOG_PCB_TEXT_PROPERTIES_BASE * @see dialog_dialog_pcb_text_properties_base.h and diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp index b910a7cf88..28216450c3 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp @@ -14,8 +14,9 @@ #include "confirm.h" #include "gestfich.h" #include "pcbnew.h" - +#include "macros.h" #include "wxPcbStruct.h" +#include "pcbcommon.h" #include "dialog_pcbnew_config_libs_and_paths.h" diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 5c1425da98..53400e9bdc 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -9,14 +9,16 @@ #include "appl_wxstruct.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxPcbStruct.h" + +#include "printout_controler.h" +#include "pcbnew.h" +#include "pcbplot.h" + +#include "class_board.h" #include "dialog_print_using_printer_base.h" -#include "printout_controler.h" -#include "pcbnew.h" -#include "wxPcbStruct.h" -#include "pcbplot.h" -#include "class_board_design_settings.h" #define WIDTH_MAX_VALUE 1000 #define WIDTH_MIN_VALUE 1 diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index 18d73e6642..ce6b83e05f 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -5,13 +5,19 @@ #include "fctsys.h" #include "confirm.h" +#include "gr_basic.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "drawtxt.h" #include "dialog_helpers.h" +#include "class_board.h" +#include "class_pcb_text.h" +#include "class_dimension.h" + +#include "pcbnew.h" + + /* Local functions */ static void MoveDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); diff --git a/pcbnew/dist.cpp b/pcbnew/dist.cpp index 073303fd2f..9ecf8fb545 100644 --- a/pcbnew/dist.cpp +++ b/pcbnew/dist.cpp @@ -1,14 +1,15 @@ - /***************************************************************/ - /* EDITEUR de PCB: AUTOROUTAGE: routine de calcul de distances */ - /***************************************************************/ +/***************************************************************/ +/* EDITEUR de PCB: AUTOROUTAGE: routine de calcul de distances */ +/***************************************************************/ #include "fctsys.h" - +#include "macros.h" #include "common.h" #include "pcbnew.h" #include "autorout.h" #include "cell.h" + /* Les tables de distances et penalites sont etablies sur la base du pas de routage de 50 unites(le pas entre les cellules est 50 unites) La distance vraie est calculee par un facteur d'echelle @@ -16,96 +17,100 @@ La distance vraie est calculee par un facteur d'echelle /* calculate approximate distance */ -int GetApxDist(int r1,int c1,int r2,int c2 ) +int GetApxDist( int r1, int c1, int r2, int c2 ) { -int d1, d2; /* row and column deltas */ + int d1, d2; /* row and column deltas */ - if ((d1 = r1-r2) < 0) /* get absolute row delta */ - d1 = -d1; - if ((d2 = c1-c2) < 0) /* get absolute column delta */ - d2 = -d2; + if( ( d1 = r1 - r2 ) < 0 ) /* get absolute row delta */ + d1 = -d1; - return( (d1+d2) * 50 * E_scale); + if( ( d2 = c1 - c2 ) < 0 ) /* get absolute column delta */ + d2 = -d2; - if (!d1) /* in same row? */ - return( (d2*50*E_scale) ); /* 50 mils per cell */ + return ( d1+d2 ) * 50 * E_scale; - if (!d2) /* in same column? */ - return( (d1*50*E_scale) ); /* 50 mils per cell */ + if( !d1 ) /* in same row? */ + return d2 * 50 * E_scale; /* 50 mils per cell */ + + if( !d2 ) /* in same column? */ + return d1 *50 * E_scale; /* 50 mils per cell */ + + if( d1 > d2 ) /* get smaller into d1 */ + { + EXCHG(d1,d2); + } + + d2 -= d1; /* get non-diagonal part of approximate "route" */ + + return ( ( ( d1 * 71 ) + ( d2 * 50 ) ) * E_scale ); /* 71 mils diagonally per cell */ +} - if (d1 > d2) /* get smaller into d1 */ - { - EXCHG(d1,d2); - } - d2 -= d1; /* get non-diagonal part of approximate "route" */ - return( ((d1*71)+(d2*50))*E_scale ); /* 71 mils diagonally per cell */ - } /* distance to go thru a cell (en mils) */ static int dist[10][10] = { /* OT=Otherside, OR=Origin (source) cell */ -/*..........N, NE, E, SE, S, SW, W, NW, OT, OR */ -/* N */ { 50, 60, 35, 60, 99, 60, 35, 60, 12, 12 }, -/* NE */ { 60, 71, 60, 71, 60, 99, 60, 71, 23, 23 }, -/* E */ { 35, 60, 50, 60, 35, 60, 99, 60, 12, 12 }, -/* SE */ { 60, 71, 60, 71, 60, 71, 60, 99, 23, 23 }, -/* S */ { 99, 60, 35, 60, 50, 60, 35, 60, 12, 12 }, -/* SW */ { 60, 99, 60, 71, 60, 71, 60, 71, 23, 23 }, -/* W */ { 35, 60, 99, 60, 35, 60, 50, 60, 12, 12 }, -/* NW */ { 60, 71, 60, 99, 60, 71, 60, 71, 23, 23 }, +/*..........N, NE, E, SE, S, SW, W, NW, OT, OR */ +/* N */ { 50, 60, 35, 60, 99, 60, 35, 60, 12, 12 }, +/* NE */ { 60, 71, 60, 71, 60, 99, 60, 71, 23, 23 }, +/* E */ { 35, 60, 50, 60, 35, 60, 99, 60, 12, 12 }, +/* SE */ { 60, 71, 60, 71, 60, 71, 60, 99, 23, 23 }, +/* S */ { 99, 60, 35, 60, 50, 60, 35, 60, 12, 12 }, +/* SW */ { 60, 99, 60, 71, 60, 71, 60, 71, 23, 23 }, +/* W */ { 35, 60, 99, 60, 35, 60, 50, 60, 12, 12 }, +/* NW */ { 60, 71, 60, 99, 60, 71, 60, 71, 23, 23 }, -/* OT */ { 12, 23, 12, 23, 12, 23, 12, 23, 99, 99 }, -/* OR */ { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 } - }; +/* OT */ { 12, 23, 12, 23, 12, 23, 12, 23, 99, 99 }, +/* OR */ { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 } + }; /* penalty for extraneous holes and corners, scaled by sharpness of turn */ static int penalty[10][10] = { /* OT=Otherside, OR=Origin (source) cell */ -/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ -/* N */ { 0, 5, 10, 15, 20, 15, 10, 5, 50, 0 }, -/* NE */ { 5, 0, 5, 10, 15, 20, 15, 10, 50, 0 }, -/* E */ { 10, 5, 0, 5, 10, 15, 20, 15, 50, 0 }, -/* SE */ { 15, 10, 5, 0, 5, 10, 15, 20, 50, 0 }, -/* S */ { 20, 15, 10, 5, 0, 5, 10, 15, 50, 0 }, -/* SW */ { 15, 20, 15, 10, 5, 0, 5, 10, 50, 0 }, -/* W */ { 10, 15, 20, 15, 10, 5, 0, 5, 50, 0 }, -/* NW */ { 5, 10, 15, 20, 15, 10, 5, 0, 50, 0 }, +/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ +/* N */ { 0, 5, 10, 15, 20, 15, 10, 5, 50, 0 }, +/* NE */ { 5, 0, 5, 10, 15, 20, 15, 10, 50, 0 }, +/* E */ { 10, 5, 0, 5, 10, 15, 20, 15, 50, 0 }, +/* SE */ { 15, 10, 5, 0, 5, 10, 15, 20, 50, 0 }, +/* S */ { 20, 15, 10, 5, 0, 5, 10, 15, 50, 0 }, +/* SW */ { 15, 20, 15, 10, 5, 0, 5, 10, 50, 0 }, +/* W */ { 10, 15, 20, 15, 10, 5, 0, 5, 50, 0 }, +/* NW */ { 5, 10, 15, 20, 15, 10, 5, 0, 50, 0 }, /* OT */ { 50, 50, 50, 50, 50, 50, 50, 50, 100, 0 }, -/* OR */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - }; +/* OR */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }; /* penalty pour directions preferencielles */ #define PN 20 static int dir_penalty_TOP[10][10] = { /* OT=Otherside, OR=Origin (source) cell */ -/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ -/* N */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* NE */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* E */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* SE */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* S */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* SW */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* W */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* NW */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ +/* N */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* NE */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* E */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* SE */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* S */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* SW */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* W */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* NW */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* OT */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, -/* OR */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 } - }; +/* OT */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }, +/* OR */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 } + }; static int dir_penalty_BOTTOM[10][10] = { /* OT=Otherside, OR=Origin (source) cell */ -/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ -/* N */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* NE */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* E */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* SE */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* S */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* SW */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* W */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* NW */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */ +/* N */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* NE */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* E */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* SE */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* S */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* SW */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* W */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* NW */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* OT */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, -/* OR */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 } - }; +/* OT */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }, +/* OR */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 } + }; /* ** x is the direction to enter the cell of interest. @@ -116,31 +121,44 @@ static int dir_penalty_BOTTOM[10][10] = { ** the calculation is driven by the tables above. */ - /************************************/ - /* int CalcDist(int x,int y,int z ) */ - /************************************/ +/************************************/ +/* int CalcDist(int x,int y,int z ) */ +/************************************/ /* calculate distance of a trace through a cell */ int CalcDist(int x,int y,int z ,int side ) { -int adjust, ldist; + int adjust, ldist; - adjust = 0; /* set if hole is encountered */ - if (x == EMPTY) x = 10; - if (y == EMPTY) y = 10; - else if (y == FROM_OTHERSIDE) - { - if (z == EMPTY) z = 10; - adjust = penalty[x-1][z-1]; - } - ldist = dist[x-1][y-1] + penalty[x-1][y-1] + adjust ; + adjust = 0; /* set if hole is encountered */ - if(Nb_Sides) - { - if(side == BOTTOM) ldist += dir_penalty_TOP[x-1][y-1]; - if(side == TOP) ldist += dir_penalty_BOTTOM[x-1][y-1]; - } - return(ldist * 10); + if( x == EMPTY ) + x = 10; + + if( y == EMPTY ) + { + y = 10; + } + else if( y == FROM_OTHERSIDE ) + { + if( z == EMPTY ) + z = 10; + + adjust = penalty[x-1][z-1]; + } + + ldist = dist[x-1][y-1] + penalty[x-1][y-1] + adjust; + + if( Nb_Sides ) + { + if( side == BOTTOM ) + ldist += dir_penalty_TOP[x-1][y-1]; + + if( side == TOP ) + ldist += dir_penalty_BOTTOM[x-1][y-1]; + } + + return ldist * 10; } diff --git a/pcbnew/drag.h b/pcbnew/drag.h index 1f8d72784a..b241d91498 100644 --- a/pcbnew/drag.h +++ b/pcbnew/drag.h @@ -1,6 +1,19 @@ -/**************************************************/ -/* Useful class and functions used to drag tracks */ -/**************************************************/ +/** + * @file drag.h + * @brief Useful class and functions used to drag tracks + */ + + +#include +#include +#include "class_track.h" + + +class wxDC; +class EDA_DRAW_PANEL; +class MODULE; +class D_PAD; + /** Helper class to handle a list of track segments to drag * and has info to undo/abort the move command diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 6acc2376ac..0b7af6da6b 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -6,10 +6,16 @@ #include "fctsys.h" #include "common.h" +#include "gr_basic.h" #include "class_drawpanel.h" -#include "pcbnew.h" +#include "wxBasePcbFrame.h" #include "drag.h" +#include "pcbnew.h" + +#include "class_module.h" +#include "class_board.h" + /* a list of DRAG_SEGM items used to move or drag tracks */ std::vector g_DragSegmentList; diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 298b60d2f1..f9b065b55b 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -29,14 +29,19 @@ /****************************/ #include "fctsys.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" #include "class_board_design_settings.h" -#include "protos.h" +#include "class_module.h" +#include "class_track.h" +#include "class_pad.h" +#include "class_zone.h" +#include "pcbnew.h" +#include "protos.h" #include "drc_stuff.h" + #include "dialog_drc.h" @@ -544,7 +549,7 @@ void DRC::testZones( bool adoTestFillSegments ) } -bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd, int x_limit ) +bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ) { int layerMask = aRefPad->m_layerMask & ALL_CU_LAYERS; @@ -563,7 +568,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd, in * (a value = 0 means use netclass value) */ - for( LISTE_PAD* pad_list = aStart; pad_listm_layerMask & layerMask ) == 0 ) + if( ( pad->m_layerMask & layerMask ) == 0 ) { // if holes are in the same location and have the same size and shape, // this can be accepted diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index aabb6cad7a..448855c7a6 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -32,14 +32,20 @@ /****************************/ #include "fctsys.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "pcbnew.h" #include "protos.h" - #include "drc_stuff.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_marker_pcb.h" + + /* compare 2 trapezoids (can be rectangle) and return true if distance > aDist * i.e if for each edge of the first polygon distance from each edge of the other polygon * is >= aDist @@ -404,7 +410,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) if( checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) ) continue; - m_currentMarker = fillMarker( aRefSeg, track, DRCE_TRACK_NEAR_VIA, m_currentMarker ); + m_currentMarker = fillMarker( aRefSeg, track, + DRCE_TRACK_NEAR_VIA, m_currentMarker ); return false; } diff --git a/pcbnew/drc_marker_functions.cpp b/pcbnew/drc_marker_functions.cpp index 0006691135..4d3e1609dc 100644 --- a/pcbnew/drc_marker_functions.cpp +++ b/pcbnew/drc_marker_functions.cpp @@ -37,6 +37,11 @@ #include "class_board_design_settings.h" #include "drc_stuff.h" +#include "class_pad.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_marker_pcb.h" + MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe ) { diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h index 19c4c26a19..010bca81c9 100644 --- a/pcbnew/drc_stuff.h +++ b/pcbnew/drc_stuff.h @@ -1,3 +1,7 @@ +/** + * @file drc_stuff.h + */ + /* * This program source code file is part of KICAD, a free EDA CAD application. * @@ -26,8 +30,7 @@ #define _DRC_STUFF_H -#include "fctsys.h" -#include "class_marker_pcb.h" +#include #define OK_DRC 0 @@ -73,8 +76,16 @@ class EDA_DRAW_PANEL; -class MARKER_PCB; +class PCB_EDIT_FRAME; class DIALOG_DRC_CONTROL; +class BOARD_ITEM; +class BOARD; +class D_PAD; +class ZONE_CONTAINER; +class TRACK; +class MARKER_PCB; +class DRC_ITEM; +class NETCLASS; /** @@ -92,7 +103,7 @@ public: * Function DeleteAllItems * removes and deletes all the items in the list. */ - virtual void DeleteAllItems() = 0; + virtual void DeleteAllItems() = 0; /** * Function GetItem @@ -109,13 +120,13 @@ public: * @param aIndex The 0 based index into the list of the desired item which * is to be deleted. */ - virtual void DeleteItem( int aIndex ) = 0; + virtual void DeleteItem( int aIndex ) = 0; /** * Function GetCount * returns the number of items in the list. */ - virtual int GetCount() = 0; + virtual int GetCount() = 0; virtual ~DRC_ITEM_LIST() { } }; @@ -159,16 +170,16 @@ private: * to the position of the segment under test (segm to segm DRC, segm to pad DRC * Next variables store coordinates relative to the start point of this segment */ - wxPoint m_padToTestPos; // Position of the pad to compare in drc test segm to pad or pad to pad - wxPoint m_segmEnd; // End point of the reference segment (start point = (0,0) ) + wxPoint m_padToTestPos; // Position of the pad to compare in drc test segm to pad or pad to pad + wxPoint m_segmEnd; // End point of the reference segment (start point = (0,0) ) /* Some functions are comparing the ref segm to pads or others segments using * coordinates relative to the ref segment considered as the X axis * so we store the ref segment length (the end point relative to these axis) * and the segment orientation (used to rotate other coordinates) */ - int m_segmAngle; // Ref segm orientation in 0,1 degre - int m_segmLength; // length of the reference segment + int m_segmAngle; // Ref segm orientation in 0,1 degre + int m_segmLength; // length of the reference segment /* variables used in checkLine to test DRC segm to segm: * define the area relative to the ref segment that does not contains anu other segment @@ -190,7 +201,7 @@ private: * is a private helper function used to update needed pointers from the * one pointer which is known not to change, m_mainWindow. */ - void updatePointers(); + void updatePointers(); /** @@ -250,20 +261,20 @@ private: * @return bool - true if succes, else false but only after * reporting _all_ NETCLASS violations. */ - bool testNetClasses(); + bool testNetClasses(); - void testTracks(); + void testTracks(); - void testPad2Pad(); + void testPad2Pad(); - void testUnconnected(); + void testUnconnected(); - void testZones( bool adoTestFillSegments ); + void testZones( bool adoTestFillSegments ); //---------------------------------------------- - bool doNetClass( NETCLASS* aNetClass, wxString& msg ); + bool doNetClass( NETCLASS* aNetClass, wxString& msg ); /** * Function doPadToPadsDrc @@ -274,8 +285,7 @@ private: * @param aEnd Marks the end of the list and is not included * @param x_limit is used to stop the test (when the any pad's X coord exceeds this) */ - bool doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, - LISTE_PAD* aEnd, int x_limit ); + bool doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ); /** * Function DoTrackDrc @@ -286,7 +296,7 @@ private: * @return bool - true if no poblems, else false and m_currentMarker is * filled in with the problem information. */ - bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true ); + bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true ); /** @@ -298,7 +308,7 @@ private: * @param aCornerIndex The first corner of the segment to test. * @return bool - false if DRC error or true if OK */ - bool doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ); + bool doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ); //--------------------------------------------------- @@ -308,7 +318,7 @@ private: * @param aPad Another pad to check against * @return bool - true if clearance between aRefPad and aPad is >= dist_min, else false */ - bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ); + bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ); /** @@ -326,7 +336,7 @@ private: * @return true distance >= dist_min, * false if distance < dist_min */ - bool checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMinDist ); + bool checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMinDist ); /** @@ -336,7 +346,8 @@ private: * (used to test DRC between a segment and a round pad, via or round end of a track * @param aCentre The coordinate of the circle's center * @param aRadius A "keep out" radius centered over the circle - * @param aLength The length of the segment (i.e. coordinate of end, becuase it is on the X axis) + * @param aLength The length of the segment (i.e. coordinate of end, becuase it is on + * the X axis) * @return bool - true if distance >= radius, else * false when distance < aRadius */ @@ -345,7 +356,8 @@ private: /** * Function checkLine - * (helper function used in drc calculations to see if one track is in contact with another track). + * (helper function used in drc calculations to see if one track is in contact with + * another track). * Test if a line intersects a bounding box (a rectangle) * The rectangle is defined by m_xcliplo, m_ycliplo and m_xcliphi, m_ycliphi * return true if the line from aSegStart to aSegEnd is outside the bounding box @@ -371,15 +383,15 @@ public: /** * Function Drc - * tests the outline segment starting at CornerIndex and returns the result and displays the error - * in the status panel only if one exists. + * tests the outline segment starting at CornerIndex and returns the result and displays + * the error in the status panel only if one exists. * Test Edge inside other areas * Test Edge too close other areas * @param aArea The areaparent which contains the corner. * @param aCornerIndex The starting point of the segment to test. * @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK */ - int Drc( ZONE_CONTAINER* aArea, int aCornerIndex ); + int Drc( ZONE_CONTAINER* aArea, int aCornerIndex ); /** * Function DrcBlind @@ -428,9 +440,9 @@ public: { m_doPad2PadTest = aPad2PadTest; m_doUnconnectedTest = aUnconnectedTest; - m_doZonesTest = aZonesTest; - m_rptFilename = aReportName; - m_doCreateRptFile = aSaveReport; + m_doZonesTest = aZonesTest; + m_rptFilename = aReportName; + m_doCreateRptFile = aSaveReport; } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index c6e8fc87e5..cc4e4e2d4f 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -10,12 +10,17 @@ #include "fctsys.h" #include "trigo.h" +#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxPcbStruct.h" + +#include "module_editor_frame.h" +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "module_editor_frame.h" static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 851c7537cd..5ebd6437c2 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -9,17 +9,21 @@ #include "confirm.h" #include "eda_doc.h" #include "gestfich.h" -#include "pcbnew_id.h" - -#include "pcbnew.h" +#include "kicad_device_context.h" #include "wxPcbStruct.h" +#include "pcbcommon.h" + +#include "pcbnew_id.h" +#include "pcbnew.h" #include "module_editor_frame.h" -#include "class_board_design_settings.h" #include "protos.h" -#include "dialog_drc.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" -#include "kicad_device_context.h" +#include "dialog_drc.h" #include "dialog_global_edit_tracks_and_vias.h" diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 281705ec45..c75e65f2dc 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -5,10 +5,12 @@ #include "fctsys.h" #include "gr_basic.h" #include "class_drawpanel.h" - #include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" +#include "macros.h" + +#include "class_board.h" +#include "class_pcb_text.h" #include "protos.h" diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 0a4b286bb8..854fe99299 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -4,12 +4,15 @@ */ #include "fctsys.h" +#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxPcbStruct.h" + +#include "class_board.h" +#include "class_track.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "drc_stuff.h" #include "protos.h" diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 8478c3fb08..eaef364ff7 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -5,13 +5,16 @@ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxPcbStruct.h" +#include "gr_basic.h" +#include "pcbcommon.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "class_board_design_settings.h" - #include "protos.h" +#include "class_board.h" +#include "class_drawsegment.h" + static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index 5142b9a276..b6513e62e0 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -12,6 +12,10 @@ #include "trigo.h" #include "3d_viewer.h" +#include "class_module.h" +#include "class_pad.h" +#include "class_edge_mod.h" + #include "dialog_edit_module_for_BoardEditor.h" diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index bd3ca7ae69..170d7cdccd 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -3,14 +3,19 @@ /************************/ #include "fctsys.h" +#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxPcbStruct.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_marker_pcb.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "drc_stuff.h" - #include "protos.h" diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 3bc9394e3d..e9ec960b34 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -4,17 +4,19 @@ #include "fctsys.h" #include "class_drawpanel.h" - -#include "pcbnew.h" +#include "trigo.h" +#include "pcbcommon.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "colors_selection.h" +#include "pcbnew.h" #include "drc_stuff.h" -#include "trigo.h" - #include "protos.h" +#include "class_board.h" +#include "class_track.h" +#include "class_zone.h" + static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC ); void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 1c4af156f9..183a43e856 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -1,17 +1,25 @@ -/********************/ -/* Edi module text. */ -/********************/ +/** + * @file edtxtmod.cpp + * @brief Edit module text. + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" - -#include "pcbnew.h" #include "drawtxt.h" #include "trigo.h" +#include "wxBasePcbFrame.h" +#include "macros.h" + +#include "pcbnew.h" #include "protos.h" +#include "class_board.h" +#include "class_module.h" +#include "class_text_mod.h" +#include "class_pcb_text.h" + static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index 5db5df31cd..f4d6f9f671 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -1,21 +1,22 @@ -/* event_handlers_tracks_vias_sizes.cpp - * - * Handlers for popup and toolbars events relative - * to the tracks and vias sizes +/** + * @file event_handlers_tracks_vias_sizes.cpp + * @brief Handlers for popup and toolbars events relative to the tracks and vias sizes. */ #include "fctsys.h" - #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew_id.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "dialog_helpers.h" +#include "pcbnew_id.h" +#include "pcbnew.h" + +#include "class_board.h" +#include "class_module.h" + + /** * Function Tracks_and_Vias_Size_Event * Event handler for tracks and vias size selection (and some options) diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index db2b9b276d..858eb74ff4 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -1,18 +1,25 @@ -/************************************************/ -/* export_gencad.cpp - export GenCAD 1.4 format */ -/************************************************/ +/** + * @file export_gencad.cpp + * @brief Export GenCAD 1.4 format. + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" #include "appl_wxstruct.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" - #include "build_version.h" +#include "macros.h" + +#include "pcbnew.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_edge_mod.h" + bool CreateHeaderInfoData( FILE* file, PCB_EDIT_FRAME* frame ); static void CreateTracksInfoData( FILE* file, BOARD* pcb ); diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 8ed490377b..1d1d95c574 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -2,16 +2,25 @@ #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "drawtxt.h" #include "trigo.h" #include "appl_wxstruct.h" #include "3d_struct.h" +#include "macros.h" + +#include "pcbnew.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_edge_mod.h" +#include "class_pcb_text.h" #include #include + /* helper function: * some characters cannot be used in names, * this function change them to "_" diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index ab785718c2..faf5cbbb07 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -1,20 +1,27 @@ -/***************************************/ -/* files.cpp: read / write board files */ -/***************************************/ +/** + * @file pcbnew/files.cpp + * @brief Read and write board files. + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "protos.h" -#include "pcbnew_id.h" +#include "macros.h" +#include "pcbcommon.h" #include "3d_viewer.h" #include "richio.h" #include "filter_reader.h" +#include "pcbnew.h" +#include "protos.h" +#include "pcbnew_id.h" + +#include "class_board.h" + + #define BACKUP_FILE_EXT wxT( "000" ) diff --git a/pcbnew/find.cpp b/pcbnew/find.cpp index cc7ced1a55..ae3ab53683 100644 --- a/pcbnew/find.cpp +++ b/pcbnew/find.cpp @@ -8,13 +8,15 @@ #include "class_drawpanel.h" #include "confirm.h" #include "kicad_string.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_module.h" +#include "class_marker_pcb.h" + +#include "pcbnew.h" #include "pcbnew_id.h" - #include "protos.h" - #include "find.h" diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp index 4a7dab80aa..827e97a713 100644 --- a/pcbnew/gen_drill_report_files.cpp +++ b/pcbnew/gen_drill_report_files.cpp @@ -3,9 +3,6 @@ /************************************************************************/ #include "fctsys.h" - -#include - #include "common.h" #include "plot_common.h" #include "base_struct.h" @@ -13,10 +10,12 @@ #include "drawtxt.h" #include "confirm.h" #include "kicad_string.h" +#include "macros.h" + +#include "class_board.h" + #include "pcbnew.h" #include "pcbplot.h" -#include "macros.h" -#include "class_board_design_settings.h" #include "gendrill.h" diff --git a/pcbnew/gen_holes_and_tools_lists_for_drill.cpp b/pcbnew/gen_holes_and_tools_lists_for_drill.cpp index 350eae708c..a7f38d8252 100644 --- a/pcbnew/gen_holes_and_tools_lists_for_drill.cpp +++ b/pcbnew/gen_holes_and_tools_lists_for_drill.cpp @@ -2,16 +2,19 @@ /* Functions to create drill data used to create files and report files */ /*************************************************************************/ -#include "fctsys.h" - #include // sort -#include +#include "fctsys.h" #include "common.h" #include "plot_common.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" + #include "pcbnew.h" #include "pcbplot.h" -#include "macros.h" #include "gendrill.h" @@ -24,8 +27,10 @@ static bool CmpHoleDiameterValue( const HOLE_INFO& a, const HOLE_INFO& b ) { if( a.m_Hole_Diameter != b.m_Hole_Diameter ) return a.m_Hole_Diameter < b.m_Hole_Diameter; + if( a.m_Hole_Pos.x != b.m_Hole_Pos.x ) return a.m_Hole_Pos.x < b.m_Hole_Pos.x; + return a.m_Hole_Pos.y < b.m_Hole_Pos.y; } @@ -38,7 +43,7 @@ static bool CmpHoleDiameterValue( const HOLE_INFO& a, const HOLE_INFO& b ) * param aPcb : the given board * param aHoleListBuffer : the std::vector to fill with pcb holes info * param aToolListBuffer : the std::vector to fill with tools to use - * param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored (used to creates report file) + * param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored (used to creates report file) * param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored * param aExcludeThroughHoles : if true, exclude through holes ( pads and vias through ) * param aGenerateNPTH_list : @@ -135,10 +140,11 @@ void Build_Holes_List( BOARD* aPcb, sort( aHoleListBuffer.begin(), aHoleListBuffer.end(), CmpHoleDiameterValue ); // build the tool list - int LastHole = -1; /* Set to not initialised - * (this is a value not used for aHoleListBuffer[ii].m_Hole_Diameter) */ + int LastHole = -1; /* Set to not initialised (this is a value not used + * for aHoleListBuffer[ii].m_Hole_Diameter) */ DRILL_TOOL new_tool( 0 ); unsigned jj; + for( unsigned ii = 0; ii < aHoleListBuffer.size(); ii++ ) { if( aHoleListBuffer[ii].m_Hole_Diameter != LastHole ) @@ -149,12 +155,14 @@ void Build_Holes_List( BOARD* aPcb, } jj = aToolListBuffer.size(); + if( jj == 0 ) continue; // Should not occurs aHoleListBuffer[ii].m_Tool_Reference = jj; // Tool value Initialized (value >= 1) aToolListBuffer.back().m_TotalCount++; + if( aHoleListBuffer[ii].m_Hole_Shape ) aToolListBuffer.back().m_OvalCount++; } diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 1cdbdde36a..bdc692a8df 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -1,21 +1,28 @@ -/*****************************/ -/* gen_modules_placefile.cpp */ -/*****************************/ +/** + * @file gen_modules_placefile.cpp + */ /* * 1 - create ascii files for automatic placement of smd components * 2 - create a module report (pos and module descr) (ascii file) */ + #include "fctsys.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" #include "appl_wxstruct.h" - #include "build_version.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_drawsegment.h" + +#include "pcbnew.h" + class LIST_MOD /* Can list the elements of useful modules. */ { diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp index 2b6af674f9..19801fb6ea 100644 --- a/pcbnew/gendrill.cpp +++ b/pcbnew/gendrill.cpp @@ -44,18 +44,19 @@ #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "pcbplot.h" #include "macros.h" #include "appl_wxstruct.h" -#include "class_board_design_settings.h" +#include "build_version.h" +#include "class_board.h" + +#include "pcbplot.h" +#include "pcbnew.h" #include "gendrill.h" #include "dialog_gendrill.h" // Dialog box for drill file generation -#include "build_version.h" const wxString DrillFileExtension( wxT( "drl" ) ); const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl" ) ); diff --git a/pcbnew/gendrill.h b/pcbnew/gendrill.h index 41d36363f1..c22d6915d8 100644 --- a/pcbnew/gendrill.h +++ b/pcbnew/gendrill.h @@ -1,6 +1,8 @@ -/******************************************************************************/ -/* classes and functions declaration used in drill file and report generation */ -/******************************************************************************/ +/** + * @file gendrill.h + * @brief Classes and functions declaration used in drill file and report generation. + */ + /* * This program source code file is part of KICAD, a free EDA CAD application. * @@ -28,6 +30,13 @@ #ifndef _GENDRILL_H_ #define _GENDRILL_H_ +#include + + +class BOARD; +class PLOTTER; + + /* the DRILL_TOOL class handles tools used in the excellon drill file */ class DRILL_TOOL { @@ -228,4 +237,4 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilenam std::vector& aToolListBuffer ); -#endif // #ifndef _GENDRILL_H_ +#endif // #ifndef _GENDRILL_H_ diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index f11305b46d..51c77339dc 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -1,12 +1,17 @@ -/*************/ -/* Edit pads */ -/*************/ +/** + * @file globaleditpad.cpp + */ #include "fctsys.h" - #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" + #include "pcbnew.h" #include "dialog_global_pads_edition_base.h" diff --git a/pcbnew/gpcb_exchange.cpp b/pcbnew/gpcb_exchange.cpp index 17b3bb23fd..5d4640fc49 100644 --- a/pcbnew/gpcb_exchange.cpp +++ b/pcbnew/gpcb_exchange.cpp @@ -1,14 +1,22 @@ -/**********************************************************************/ -/* Import functions to import footprints from a gpcb (Newlib) library */ -/**********************************************************************/ +/** + * @file gpcb_exchange.cpp + * @brief Import functions to import footprints from a gpcb (Newlib) library. + */ #include "fctsys.h" #include "wxstruct.h" #include "kicad_string.h" -#include "pcbnew.h" #include "trigo.h" #include "richio.h" #include "filter_reader.h" +#include "macros.h" + +#include "class_pad.h" +#include "class_module.h" +#include "class_edge_mod.h" + +#include "pcbnew.h" + /* read parameters from a line, and return all params in a wxArrayString * each param is in one wxString, and double quotes removed if exists @@ -323,7 +331,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) } if( params[0].CmpNoCase( wxT( "Pad" ) ) == 0 ) // Pad with no hole (smd pad) - { // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags] + { // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags] Pad = new D_PAD( this ); Pad->m_PadShape = PAD_RECT; Pad->m_layerMask = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT; @@ -444,7 +452,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) /* Read a text line and extract params and tokens. * special chars are: - * [ ] ( ) Begin and end of parameter list and units indicator + * [ ] ( ) Begin and end of parameter list and units indicator * " is a string delimiter * space is the param separator * The first word is the keyword diff --git a/pcbnew/graphpcb.cpp b/pcbnew/graphpcb.cpp index c8db99f294..497db901a7 100644 --- a/pcbnew/graphpcb.cpp +++ b/pcbnew/graphpcb.cpp @@ -5,12 +5,18 @@ #include "fctsys.h" #include "common.h" +#include "macros.h" +#include "trigo.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_track.h" #include "pcbnew.h" -#include "trigo.h" #include "cell.h" #include "ar_protos.h" + int ToMatrixCoordinate( int aPhysicalCoordinate ); void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color ); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 199d702134..60e6cee66b 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -1,15 +1,19 @@ -/****************************/ -/* hotkeys_board_editor.cpp */ -/****************************/ +/** + * @file hotkeys_board_editor.cpp + */ #include "fctsys.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "pcbnew_id.h" #include "class_drawpanel.h" #include "confirm.h" -#include "class_board_design_settings.h" +#include "pcbcommon.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" + +#include "pcbnew.h" +#include "pcbnew_id.h" #include "hotkeys.h" #include "protos.h" diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 143d5f4b8b..e3b6bca0a2 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -1,17 +1,16 @@ -/*********************************************/ -/******* file initpcb.cpp ********************/ -/*********************************************/ - +/** + * @file pcbnew/initpcb.cpp + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" -#include "class_board_design_settings.h" -//#include "protos.h" +#include "class_board.h" + +#include "pcbnew.h" +#include "module_editor_frame.h" /** diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index be508a6d6d..c1fb958d38 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -1,17 +1,21 @@ -/****************************************************/ -/* Routines for reading and saving of structures in */ -/* ASCII file common to Pcbnew and CVPCB. */ -/****************************************************/ + /** + * @file ioascii.cpp + * @brief Routines for reading and saving of structures in ASCII file common to Pcbnew and CVPCB. + */ #include "fctsys.h" #include "confirm.h" #include "kicad_string.h" - -#include "pcbnew.h" +#include "build_version.h" #include "wxPcbStruct.h" -#include "autorout.h" -#include "class_board_design_settings.h" +#include "richio.h" +#include "macros.h" +#include "pcbcommon.h" +/** + * @todo Fix having to recompile the same file with a different defintion. This is + * what C++ derivation was designed to solve. + */ #ifdef PCBNEW #include "zones.h" #endif @@ -20,13 +24,21 @@ #include "cvpcb.h" #endif -#include "build_version.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_pcb_text.h" +#include "class_zone.h" +#include "class_dimension.h" +#include "class_drawsegment.h" +#include "class_mire.h" +#include "pcbnew.h" #include "pcbnew_id.h" -#include "richio.h" - +#include "autorout.h" #include "pcb_plot_params.h" + /* ASCII format of structures: * * Structure PAD: diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 03b748cbfb..1fd7464c1a 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -8,13 +8,20 @@ #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" #include "dialog_helpers.h" #include "richio.h" #include "filter_reader.h" +#include "pcbcommon.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" #include "class_footprint_library.h" +#include "module_editor_frame.h" + /* * Module library header format: diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 7f3868459c..031eaae761 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -1,22 +1,29 @@ -/**********************************************/ -/* Footprints selection and loading functions */ -/**********************************************/ +/** + * @file pcbnew/loadcmp.cpp + * @brief Footprints selection and loading functions. + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" #include "eda_doc.h" #include "kicad_string.h" -#include "dialog_get_component.h" #include "appl_wxstruct.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" #include "dialog_helpers.h" #include "filter_reader.h" +#include "gr_basic.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" +#include "module_editor_frame.h" #include "footprint_info.h" #include "class_footprint_library.h" +#include "dialog_get_component.h" static void DisplayCmpDoc( wxString& Name ); diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index 3c02505559..4ecd91ef56 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -1,6 +1,6 @@ -/*********************************/ -/* magnetic_tracks_functions.cpp */ -/*********************************/ +/** + * @file magnetic_tracks_functions.cpp + */ /* functions used to control the cursor position, when creating a track * and when the "magnetic tracks" option is on @@ -11,7 +11,12 @@ #include "fctsys.h" #include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_track.h" + #include "protos.h" #include "pcbnew_id.h" diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index 03ecc0ff2c..cdc4c367e3 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -1,15 +1,18 @@ -/********************************************/ -/* Functions to edit targets (class MIRE) */ -/********************************************/ +/** + * @file mirepcb.cpp + * @brief Functions to edit targets (class MIRE). + */ #include "fctsys.h" #include "class_drawpanel.h" +#include "wxPcbStruct.h" +#include "dialog_helpers.h" +#include "gr_basic.h" + +#include "class_board.h" +#include "class_mire.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "class_board_design_settings.h" -#include "dialog_helpers.h" - #include "protos.h" diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 403853ea81..c99e7f1596 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -1,6 +1,6 @@ -/****************/ -/* modedit.cpp */ -/****************/ +/** + * @file modedit.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -8,21 +8,25 @@ #include "confirm.h" #include "gestfich.h" #include "appl_wxstruct.h" -#include "pcbnew_id.h" #include "trigo.h" - #include "3d_viewer.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" -#include "protos.h" - #include "kicad_device_context.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" + +#include "pcbnew.h" +#include "protos.h" +#include "pcbnew_id.h" +#include "module_editor_frame.h" +#include "collectors.h" #include "dialog_edit_module_for_Modedit.h" -#include "collectors.h" - BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode ) { diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 8b1479f03c..87b1e2a2d8 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -1,21 +1,24 @@ -/************************/ -/* modedit_onclick.cpp */ -/************************/ +/** + * @file modedit_onclick.cpp + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" - #include "3d_viewer.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" -#include "dialog_edit_module_for_Modedit.h" +#include "gr_basic.h" +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" + +#include "pcbnew.h" #include "protos.h" #include "pcbnew_id.h" - #include "hotkeys.h" +#include "module_editor_frame.h" +#include "dialog_edit_module_for_Modedit.h" void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) diff --git a/pcbnew/modedit_undo_redo.cpp b/pcbnew/modedit_undo_redo.cpp index b4bf6ffc70..58f8d0c93f 100644 --- a/pcbnew/modedit_undo_redo.cpp +++ b/pcbnew/modedit_undo_redo.cpp @@ -4,12 +4,14 @@ #include "fctsys.h" #include "class_drawpanel.h" +#include "wxPcbStruct.h" + +#include "class_board.h" +#include "class_module.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "module_editor_frame.h" - #include "protos.h" +#include "module_editor_frame.h" void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem, diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 9b39f695f8..1e8fef344e 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -1,20 +1,25 @@ -/************************************************************/ -/* moduleframe.cpp - Footprint (module) editor main window. */ -/************************************************************/ +/** + * @file moduleframe.cpp + * @brief Footprint (module) editor main window. + */ #include "fctsys.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" +#include "dialog_helpers.h" +#include "3d_viewer.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" #include "protos.h" #include "pcbnew_id.h" #include "hotkeys.h" -#include "dialog_helpers.h" - -#include "3d_viewer.h" +#include "module_editor_frame.h" static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index aa51add2c5..2b55475998 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -1,18 +1,21 @@ -/***************/ -/* modules.cpp */ -/***************/ +/* + * @file modules.cpp + */ #include "fctsys.h" #include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "macros.h" +#include "pcbcommon.h" +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" #include "protos.h" - #include "drag.h" @@ -517,6 +520,7 @@ void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module ) if( module == NULL ) return; + module->DrawEdgesOnly( panel, DC, g_Offset_Module, GR_XOR ); if( g_Show_Pads_Module_in_Move ) diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 3930fc2c10..a00d3c0c76 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -1,18 +1,24 @@ -/************************/ -/* Edit footprint pads. */ -/************************/ +/** + * @file move-drag_pads.cpp + * @brief Edit footprint pads. + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "trigo.h" #include "block_commande.h" +#include "wxBasePcbFrame.h" +#include "macros.h" +#include "pcbcommon.h" +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" #include "drag.h" - #include "protos.h" diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 4a328695a4..654324b4af 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -1,20 +1,23 @@ -/****************************************************/ -/* Track editing */ -/* routines to move and drag track segments or node */ -/****************************************************/ +/** + * @file move_or_drag_track.cpp + * @brief Track editing routines to move and drag track segments or node. + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" -#include "drc_stuff.h" +#include "macros.h" +#include "gr_basic.h" +#include "pcbcommon.h" +#include "class_board.h" + +#include "pcbnew.h" +#include "drc_stuff.h" #include "drag.h" #include "pcbnew_id.h" - #include "protos.h" diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index f3690cfc7f..91cf52a436 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -1,6 +1,7 @@ -/*******************************************/ -/* mounde.cpp - Microwave pcb layout code. */ -/*******************************************/ +/** + * @file muonde.cpp + * @brief Microwave pcb layout code. + */ #include "fctsys.h" #include "class_drawpanel.h" @@ -8,13 +9,21 @@ #include "trigo.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" -#include "protos.h" #include "dialog_helpers.h" #include "richio.h" #include "filter_reader.h" +#include "gr_basic.h" +#include "pcbcommon.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" + +#include "protos.h" +#include "pcbnew.h" + #define COEFF_COUNT 6 static double* PolyEdges; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 52a7e69801..88bf45b578 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -26,7 +26,6 @@ * (that reinit the new references) */ -#include "vector" #include "algorithm" #include "fctsys.h" @@ -34,11 +33,15 @@ #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "richio.h" #include "dialog_helpers.h" +#include "macros.h" +#include "class_board.h" +#include "class_module.h" + +#include "pcbnew.h" #include "dialog_netlist.h" diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 828e3234ab..2d595213db 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -6,9 +6,13 @@ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_zone.h" +#include "class_pcb_text.h" + +#include "pcbnew.h" #include "pcbnew_id.h" @@ -170,7 +174,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_PCB_MIRE_BUTT: if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { - SetCurItem( CreateTarget( aDC ) ); + SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) ); DrawPanel->MoveCursorToCrossHair(); } else if( DrawStruct->Type() == PCB_TARGET_T ) @@ -204,7 +208,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { - DrawStruct = Begin_DrawSegment( NULL, shape, aDC ); + DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC ); SetCurItem( DrawStruct ); DrawPanel->m_AutoPAN_Request = true; } @@ -212,7 +216,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) && (DrawStruct->Type() == TYPE_DRAWSEGMENT) && DrawStruct->IsNew() ) { - DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC ); + DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC ); SetCurItem( DrawStruct ); DrawPanel->m_AutoPAN_Request = true; } @@ -228,7 +232,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { - DrawStruct = Begin_Route( NULL, aDC ); + DrawStruct = (BOARD_ITEM*) Begin_Route( NULL, aDC ); SetCurItem( DrawStruct ); if( DrawStruct ) @@ -241,7 +245,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) // SetCurItem() must not write to the msg panel // because a track info is displayed while moving the mouse cursor if( track ) // A new segment was created - SetCurItem( DrawStruct = track, false ); + SetCurItem( DrawStruct = (BOARD_ITEM*) track, false ); DrawPanel->m_AutoPAN_Request = true; } @@ -321,7 +325,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { DrawPanel->MoveCursorToCrossHair(); - DrawStruct = Load_Module_From_Library( wxEmptyString, aDC ); + DrawStruct = (BOARD_ITEM*) Load_Module_From_Library( wxEmptyString, aDC ); SetCurItem( DrawStruct ); if( DrawStruct ) @@ -348,13 +352,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { - DrawStruct = EditDimension( NULL, aDC ); + DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC ); SetCurItem( DrawStruct ); DrawPanel->m_AutoPAN_Request = true; } else if( DrawStruct && (DrawStruct->Type() == TYPE_DIMENSION) && DrawStruct->IsNew() ) { - DrawStruct = EditDimension( (DIMENSION*) DrawStruct, aDC ); + DrawStruct = (BOARD_ITEM*) EditDimension( (DIMENSION*) DrawStruct, aDC ); SetCurItem( DrawStruct ); DrawPanel->m_AutoPAN_Request = true; } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 6e30a51fa1..4c8c5d519b 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -1,16 +1,21 @@ -/**************************************************/ -/* onrightclick.cpp: Right mouse button functions */ -/**************************************************/ +/** + * @file pcbnew/onrightclick.cpp + * @brief Right mouse button functions. + */ #include "fctsys.h" -#include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_pcb_text.h" +#include "class_zone.h" #include "pcbnew.h" #include "wxPcbStruct.h" -#include "class_board_design_settings.h" - #include "pcbnew_id.h" #include "hotkeys.h" #include "collectors.h" diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 3980cdf1a7..4656c07ba2 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -34,7 +34,7 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" -#include "pcbstruct.h" // enum PCB_VISIBLE +#include "pcbcommon.h" // enum PCB_VISIBLE #include "collectors.h" #include "build_version.h" #include "protos.h" diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index c7ee016622..91d456aed4 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -5,30 +5,21 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "confirm.h" +#include "macros.h" +#include "class_drawpanel.h" +#include "wxPcbStruct.h" +#include "eda_dde.h" +#include "pcbcommon.h" +#include "colors_selection.h" +#include "gr_basic.h" #include #include #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "plot_common.h" -#include "gestfich.h" -#include "pcbplot.h" -#include "autorout.h" -#include "cell.h" -#include "worksheet.h" -#include "zones.h" -#include "drag.h" -#include "eda_dde.h" -#include "colors_selection.h" -#include "class_drawpanel.h" - -#include "id.h" +#include "protos.h" #include "hotkeys.h" -#include "build_version.h" - -#include "protos.h" // Colors for layers and items COLORS_DESIGN_SETTINGS g_ColorsSettings; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index e1834db907..e28d219d38 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -1,38 +1,41 @@ -/**************************************/ -/* PCBNEW.H : headers */ -/**************************************/ +/** + * @file pcbnew.h + */ + #ifndef PCBNEW_H #define PCBNEW_H -#include "pcbstruct.h" -#include "pcbcommon.h" -#include "class_board_design_settings.h" + +#include "fctsys.h" // PCB_INTERNAL_UNIT and EESCHEMA_INTERNAL_UNIT definitions. +#include "base_struct.h" // IS_DRAGGED and IN_EDIT definitions. + #define U_PCB (PCB_INTERNAL_UNIT / EESCHEMA_INTERNAL_UNIT) -// Arcs are appromed by segments: define the number of segments per 360 deg (kicad use 0.1 deg approx: -#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF 16 // be aware 3600/ARC_APPROX_SEGMENTS_COUNT_LOW_DEF is an integer +// Arcs are approximated by segments: define the number of segments per 360 deg (kicad use 0.1 +// deg approximation). Be aware 3600 / ARC_APPROX_SEGMENTS_COUNT_LOW_DEF is an integer. +#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF 16 #define ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF 32 -/* Flag used in locate functions - * the locate ref point is the on grid cursor or the off grid mouse cursor */ +/* Flag used in locate functions. The locate ref point is the on grid cursor or the off + * grid mouse cursor. */ #define CURSEUR_ON_GRILLE (0 << 0) #define CURSEUR_OFF_GRILLE (1 << 0) -#define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation -#define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select -#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select +#define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation +#define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select +#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select -#define START 0 /* Flag used in locale routines */ +#define START 0 /* Flag used in locate routines */ #define END 1 -#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint centre) */ -#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text centre) */ +#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint center) */ +#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text center) */ -#define TEXTS_MIN_SIZE 50 // Min size in pcbnew units value (50 * 0.0001 mils) -#define TEXTS_MAX_SIZE 10000 // Min size in pcbnew units value (1 inch) ) -#define TEXTS_MAX_WIDTH 5000 // Max width in pcbnew units value (0.5 inches) +#define TEXTS_MIN_SIZE 50 // Minimum text size in pcbnew units value (50 * 0.0001 mils) +#define TEXTS_MAX_SIZE 10000 // Maximum text size in pcbnew units value (1 inch) ) +#define TEXTS_MAX_WIDTH 5000 // Maximum text width in pcbnew units value (0.5 inches) /* Flag to force the SKETCH mode to display items (.m_Flags member) */ #define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT ) @@ -55,7 +58,7 @@ extern wxString g_Shapes3DExtBuffer; extern wxString g_DocModulesFileName; /* Variables used in footprint handling */ -extern wxSize g_ModuleTextSize; /* Default footprint texts size */ +extern wxSize g_ModuleTextSize; /* Default footprint texts size */ extern int g_ModuleTextWidth; extern int g_ModuleSegmentWidth; @@ -63,13 +66,13 @@ extern int g_ModuleSegmentWidth; extern int Route_Layer_TOP; extern int Route_Layer_BOTTOM; -extern int g_MaxLinksShowed; // Max count links showed in routing +extern int g_MaxLinksShowed; // Max count links showed in routing extern bool g_TwoSegmentTrackBuild; extern int g_MagneticPadOption; extern int g_MagneticTrackOption; -extern wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ +extern wxPoint g_Offset_Module; /* Offset trace when moving footprint. */ enum MagneticPadOptionValues { diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 70ffc1f324..edace62726 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -1,6 +1,6 @@ -/****************************************/ -/** pcbnew_config.cpp : configuration **/ -/****************************************/ +/** + * @file pcbnew_config.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -8,22 +8,26 @@ #include "confirm.h" #include "gestfich.h" #include "xnode.h" - -#include "pcbnew.h" +#include "macros.h" +#include "pcbcommon.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" -#include "pcbplot.h" #include "plot_common.h" #include "worksheet.h" +#include "dialog_hotkeys_editor.h" + +#include "class_pad.h" + +#include "pcbplot.h" +#include "pcbnew.h" #include "pcbnew_id.h" #include "hotkeys.h" #include "protos.h" +#include "pcbnew_config.h" #include "dialog_mask_clearance.h" #include "dialog_general_options.h" -#include "pcbnew_config.h" -#include "dialog_hotkeys_editor.h" #define HOTKEY_FILENAME wxT( "pcbnew" ) diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h index e11e1acd77..91e7926448 100644 --- a/pcbnew/pcbnew_config.h +++ b/pcbnew/pcbnew_config.h @@ -2,9 +2,16 @@ /** pcbnew_config.h : configuration parameters for PCBNew **/ /************************************************************/ +#ifndef _PCBNEW_CONFIG_H_ +#define _PCBNEW_CONFIG_H_ + #include "param_config.h" #include "colors_selection.h" + +class BOARD_DESIGN_SETTINGS; + + #define GROUP wxT( "/pcbnew" ) #define GROUPLIB wxT( "/pcbnew/libraries" ) #define GROUPCOMMON wxT( "/common" ) @@ -15,3 +22,6 @@ /* Configuration parameters. */ extern BOARD_DESIGN_SETTINGS boardDesignSettings; + + +#endif // _PCBNEW_CONFIG_H_ diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 298ff56dc7..3c4b6d74dd 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -1,20 +1,23 @@ -/***************/ -/* pcbplot.cpp */ -/***************/ +/** + * @file pcbnew/pcbplot.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" #include "plot_common.h" #include "confirm.h" #include "gestfich.h" -#include "pcbnew.h" #include "wxPcbStruct.h" #include "pcbplot.h" #include "worksheet.h" +#include "pcbstruct.h" +#include "macros.h" + +#include "class_board.h" + +#include "pcbnew.h" #include "pcbnew_id.h" #include "protos.h" -#include "pcbstruct.h" -#include "class_board_design_settings.h" #include "dialog_plot_base.h" #include "pcb_plot_params.h" diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 68b2fa3d07..66f475d587 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -1,12 +1,22 @@ -/************/ -/* pcbplot.h*/ -/************/ +/** + * @file pcbnew/pcbplot.h + */ #ifndef PCBPLOT_H #define PCBPLOT_H #include "pcb_plot_params.h" + +class PLOTTER; +class TEXTE_PCB; +class DRAWSEGMENT; +class DIMENSION; +class EDGE_MODULE; +class PCB_TARGET; +class ZONE_CONTAINER; + + /* Shared Config keys for plot and print */ #define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" ) #define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" ) diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index a59bfe025f..5d5530e637 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -9,11 +9,23 @@ #include "base_struct.h" #include "drawtxt.h" #include "confirm.h" +#include "trigo.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" +#include "macros.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_edge_mod.h" +#include "class_pcb_text.h" +#include "class_zone.h" +#include "class_drawsegment.h" +#include "class_mire.h" +#include "class_dimension.h" + #include "pcbnew.h" #include "pcbplot.h" -#include "trigo.h" -#include "class_board_design_settings.h" - static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask, GRTraceMode trace_mode ); diff --git a/pcbnew/plotdxf.cpp b/pcbnew/plotdxf.cpp index e5531d8985..8430b31639 100644 --- a/pcbnew/plotdxf.cpp +++ b/pcbnew/plotdxf.cpp @@ -1,16 +1,19 @@ -/******************/ -/**** Plot DXF ****/ -/******************/ +/** + * @file plotdxf.cpp + * @brief Plot DXF. + */ #include "fctsys.h" #include "common.h" #include "plot_common.h" #include "confirm.h" -#include "pcbnew.h" -#include "pcbplot.h" #include "trigo.h" +#include "wxBasePcbFrame.h" +#include "pcbnew.h" #include "protos.h" +#include "pcbplot.h" + bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) { diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index acb2365615..ce33c34c91 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -1,7 +1,7 @@ - -/*********************************************************/ -/****Function to plot a board in GERBER RS274X format ****/ -/*********************************************************/ +/** + * @file plotgerb.cpp + * @brief Functions to plot a board in GERBER RS274X format. + */ /* Creates the output files, one per board layer: * filenames are like xxxc.PHO and use the RS274X format @@ -14,16 +14,14 @@ #include "common.h" #include "plot_common.h" #include "confirm.h" -#include "pcbnew.h" #include "pcbplot.h" #include "trigo.h" +#include "wxBasePcbFrame.h" +#include "layers_id_colors_and_visibility.h" +#include "pcbnew.h" #include "protos.h" -/********************************************************************************/ -bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, - bool PlotOriginIsAuxAxis, GRTraceMode trace_mode ) -/********************************************************************************/ /* Creates the output files, one per board layer: * filenames are like xxxc.PHO and use the RS274X format @@ -31,8 +29,11 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, * format 3.4, Leading zero omitted, Abs format * format 3.4 uses the native pcbnew units (1/10000 inch). */ +bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, + bool PlotOriginIsAuxAxis, GRTraceMode trace_mode ) { FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); + if( output_file == NULL ) { return false; @@ -44,7 +45,9 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, double scale = g_PcbPlotOptions.m_PlotScale; if( PlotOriginIsAuxAxis ) + { offset = m_Auxiliary_Axis_Position; + } else { offset.x = 0; @@ -65,6 +68,7 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, // ( only if hole size == pad size ): if( (Layer >= LAYER_N_BACK) && (Layer <= LAYER_N_FRONT) ) g_PcbPlotOptions.m_SkipNPTH_Pads = true; + // Sheet refs on gerber CAN be useful... and they're always 1:1 if( g_PcbPlotOptions.m_PlotFrameRef ) PlotWorkSheet( plotter, GetScreen() ); @@ -74,11 +78,11 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, g_PcbPlotOptions.m_SkipNPTH_Pads = false; } - else // error in start_plot( ): failed opening a temporary file { wxMessageBox( _("Error when creating %s file: unable to create a temporary file")); } + delete plotter; SetLocaleTo_Default(); diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index 73851b32ed..cb23911828 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -1,16 +1,20 @@ -/*******************/ -/**** Plot HPGL ****/ -/*******************/ +/** + * @file plothpgl.cpp + */ #include "fctsys.h" #include "common.h" #include "plot_common.h" #include "confirm.h" -#include "pcbnew.h" -#include "pcbplot.h" #include "trigo.h" +#include "wxBasePcbFrame.h" +#include "macros.h" +#include "class_board.h" + +#include "pcbnew.h" #include "protos.h" +#include "pcbplot.h" bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index c35d0e4db1..4e0919fc29 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -1,16 +1,21 @@ -/*************************/ -/**** Plot Postscript ****/ -/*************************/ +/** + * @file plotps.cpp + * @brief Plot Postscript. + */ #include "fctsys.h" #include "common.h" #include "plot_common.h" #include "confirm.h" -#include "pcbnew.h" -#include "pcbplot.h" #include "trigo.h" +#include "wxBasePcbFrame.h" +#include "macros.h" +#include "class_board.h" + +#include "pcbnew.h" #include "protos.h" +#include "pcbplot.h" /* Generate a PostScript file (*. ps) of the circuit layer. diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 2a49d83f29..2e5a258b17 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -1,18 +1,25 @@ -/************************************************************/ -/* print_board_functions.cpp: some functions to plot boards */ -/************************************************************/ +/** + * @file print_board_functions.cpp + * @brief Functions to print boards. + */ #include "fctsys.h" -#include "gr_basic.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "module_editor_frame.h" -#include "class_board_design_settings.h" -#include "pcbplot.h" #include "printout_controler.h" #include "colors_selection.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" +#include "class_track.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "protos.h" +#include "pcbplot.h" +#include "module_editor_frame.h" static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index a1b6c34847..b6fb838553 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -7,9 +7,13 @@ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" +#include "gr_basic.h" +#include "wxBasePcbFrame.h" #include "class_drawpanel.h" #include "confirm.h" + +#include "class_board.h" + #include "pcbnew.h" #include "protos.h" diff --git a/pcbnew/protos.h b/pcbnew/protos.h index ba074b3199..80a34a8c1f 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -1,6 +1,6 @@ -/***********/ -/* protos.h */ -/***********/ +/** + * @file pcbnew/protos.h + */ #ifndef PROTO_H #define PROTO_H @@ -9,6 +9,15 @@ #include +class wxDC; +class wxPoint; +class EDA_DRAW_PANEL; +class BOARD_ITEM; +class D_PAD; +class TRACK; +class MODULE; + + /** * Function SwapData * Used in undo / redo command: @@ -20,12 +29,6 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ); -/*******************/ -/* PAD_CONNECT.CPP */ -/*******************/ - -class D_PAD; - /***************/ /* TRPISTE.CPP */ @@ -35,10 +38,13 @@ class D_PAD; * Function DrawTraces * Draws n consecutive track segments in list. * Useful to show a track when it is a chain of segments - * (fir instance when creating a new track) - * @param aTrackList = First segment - * @param nbsegment = number of segments in list - * @param Mode_color = mode (GRXOR, GROR ..) + * (for instance when creating a new track) + * + * @param panel A EDA_DRAW_ITEM pointer to the canvas. + * @param DC A wxDC pointer of the device context used for drawing. + * @param aStartTrace First segment + * @param nbsegment Number of segments in list + * @param mode_color Drawing mode (GRXOR, GROR ..) */ void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 69732a4772..4306a4767e 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -1,17 +1,22 @@ -/***********************/ -/**** ratsnest.cpp ****/ -/* Ratsnets functions */ -/***********************/ +/** + * @file ratsnest.cpp + * @brief Ratsnets functions. + */ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" -#include "class_board_design_settings.h" #include "colors_selection.h" +#include "wxBasePcbFrame.h" +#include "macros.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" + +#include "pcbnew.h" #include "protos.h" diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index fa46774f0c..588f1c238c 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -1,12 +1,16 @@ -/* Set up the basic primitives for Layer control */ +/** + * @file sel_layer.cpp + * @brief Set up the basic primitives for Layer control. + */ #include "fctsys.h" #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxBasePcbFrame.h" +#include "pcbcommon.h" -#include "pcbnew.h" -#include "class_board_design_settings.h" +#include "class_board.h" enum layer_sel_id { @@ -21,13 +25,12 @@ class SELECT_LAYER_DIALOG : public wxDialog private: PCB_BASE_FRAME* m_Parent; wxRadioBox* m_LayerList; - int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" - // radiobutton + int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton public: // Constructor and destructor SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, int default_layer, - int min_layer, int max_layer, bool null_layer ); + int min_layer, int max_layer, bool null_layer ); ~SELECT_LAYER_DIALOG() { }; private: diff --git a/pcbnew/set_grid.cpp b/pcbnew/set_grid.cpp index 1e18ef31e0..55d18d9424 100644 --- a/pcbnew/set_grid.cpp +++ b/pcbnew/set_grid.cpp @@ -1,15 +1,14 @@ -/************************************/ -/* set_grid.cpp - manage user grid. */ -/************************************/ +/** + * @file set_grid.cpp + * @brief Manage user grid. + */ #include "fctsys.h" #include "common.h" #include "class_drawpanel.h" +#include "wxBasePcbFrame.h" #include "pcbnew.h" - -//#include "protos.h" - #include "pcbnew_id.h" #include "dialog_set_grid_base.h" diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 1a9c1d3b84..62500f30ee 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -5,13 +5,18 @@ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" -#include "autorout.h" #include "wxPcbStruct.h" +#include "gr_basic.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_track.h" #include "pcbnew.h" -#include "class_board_design_settings.h" #include "protos.h" #include "ar_protos.h" +#include "autorout.h" #include "cell.h" diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index f0f51c9269..46eba9c4b8 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -50,11 +50,14 @@ #include #include +#include "build_version.h" + +#include "class_board.h" +#include "class_track.h" + #include "specctra.h" #include // wxFFileOutputStream -#include "build_version.h" - namespace DSN { diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 03b1409042..da494fe412 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -33,6 +33,7 @@ #include #include "fctsys.h" +#include "macros.h" // MAX definition. #include "specctra_lexer.h" @@ -40,6 +41,11 @@ class TYPE_COLLECTOR; // outside the DSN namespace +class BOARD; +class TRACK; +class SEGVIA; +class NETCLASS; + typedef DSN::T DSN_T; using namespace DSN; diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 54f2a0a80f..d397db238a 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -31,21 +31,29 @@ Also see the comments at the top of the specctra.cpp file itself. */ - -#include "specctra.h" -#include "collectors.h" #include "wxPcbStruct.h" #include "pcbstruct.h" // HISTORY_NUMBER #include "confirm.h" // DisplayError() #include "gestfich.h" // EDA_FileSelector() -#include "class_board_design_settings.h" - #include "trigo.h" // RotatePoint() + #include // std::set #include // std::map #include // boost::addressof() +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_drawsegment.h" + +#include "collectors.h" + +#include "specctra.h" + + using namespace DSN; diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index ebe7380d51..ab5eed2781 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -32,12 +32,19 @@ */ -#include "specctra.h" #include "class_drawpanel.h" // DrawPanel #include "confirm.h" // DisplayError() #include "gestfich.h" // EDA_FileSelector() #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_module.h" +#include "class_edge_mod.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_drawsegment.h" + +#include "specctra.h" using namespace DSN; diff --git a/pcbnew/surbrill.cpp b/pcbnew/surbrill.cpp index c365b9bdb1..99fa56e39a 100644 --- a/pcbnew/surbrill.cpp +++ b/pcbnew/surbrill.cpp @@ -1,19 +1,24 @@ -/*******************/ -/* Highlight nets. */ -/*******************/ +/** + * @file surbrill.cpp + * @brief Highlight nets. + */ #include "fctsys.h" #include "class_drawpanel.h" #include "kicad_string.h" +#include "wxPcbStruct.h" +#include "kicad_device_context.h" +#include "macros.h" + +#include "class_board.h" +#include "class_track.h" +#include "class_zone.h" #include "pcbnew.h" -#include "wxPcbStruct.h" #include "collectors.h" -#include "kicad_device_context.h" - -#define Pad_fill (Pad_Fill_Item.State == RUN) +#define Pad_fill ( Pad_Fill_Item.State == RUN ) /** @@ -138,6 +143,7 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) // this should not happen. } } + if( netcode >= 0 ) { GetBoard()->SetHighLightNet( netcode ); diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 36b8643ff4..6d146c8057 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -1,18 +1,19 @@ -/*******************************/ -/* Dialog frame to swap layers */ -/*******************************/ - -/* - * swap_layers.cpp +/** + * @file swap_layers.cpp + * @brief Dialog to swap layers. */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" -#include "protos.h" +#include "class_board.h" +#include "class_track.h" +#include "class_drawsegment.h" + +#include "pcbnew.h" +#include "protos.h" #include "wx/statline.h" diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 5054d98381..a4e3dc350d 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -8,10 +8,11 @@ #include "dialog_helpers.h" #include "class_layer_box_selector.h" #include "colors_selection.h" +#include "wxPcbStruct.h" + +#include "class_board.h" #include "pcbnew.h" -#include "wxPcbStruct.h" -#include "class_board_design_settings.h" #include "pcbnew_id.h" #include "hotkeys.h" diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 6b0ddd79d4..ec6bd6884b 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -1,21 +1,21 @@ -/**************************************************************** - * toolbars_update_user_interface.cpp - ****************************************************************/ - -/* - * function to update toolbars UI after changing parameters +/** + * @file toolbars_update_user_interface.cpp + * @brief Function to update toolbars UI after changing parameters. */ #include "fctsys.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "3d_viewer.h" +#include "dialog_helpers.h" +#include "pcbcommon.h" + +#include "class_board.h" + +#include "pcbnew.h" #include "pcbnew_id.h" #include "drc_stuff.h" -#include "3d_viewer.h" -#include "class_board_design_settings.h" -#include "dialog_helpers.h" void PCB_EDIT_FRAME::OnUpdateLayerPair( wxUpdateUIEvent& aEvent ) diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 165a4367ce..2bf3d26019 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -1,14 +1,19 @@ -/******************/ -/* Trace editing. */ -/******************/ +/** + * @file tr_modif.cpp + * @brief Trace editing. + */ #include "fctsys.h" - -#include "pcbnew.h" +#include "gr_basic.h" #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_track.h" + +#include "pcbnew.h" #include "protos.h" + static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ); diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 739df60dd2..f5c06df743 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -1,24 +1,26 @@ -/****************/ -/* tracepcb.cpp */ -/****************/ - -/* - * Functions to redraw the current board ... +/** + * @file tracepcb.cpp + * @brief Functions to redraw the current board. */ -#include - #include "fctsys.h" -#include "gr_basic.h" #include "class_drawpanel.h" +#include "wxPcbStruct.h" + +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" +#include "class_marker_pcb.h" #include "pcbnew.h" -#include "wxPcbStruct.h" #include "module_editor_frame.h" #include "pcbplot.h" #include "protos.h" + #include + extern int g_DrawDefaultLineThickness; // Default line thickness, used to draw Frame references diff --git a/pcbnew/trpiste.cpp b/pcbnew/trpiste.cpp index c9d0c1d5b3..e538baae28 100644 --- a/pcbnew/trpiste.cpp +++ b/pcbnew/trpiste.cpp @@ -1,25 +1,19 @@ -/********************************/ -/* Routines for plotting traces */ -/********************************/ +/** + * @file trpiste.cpp + * @brief Routine for plotting traces. + */ #include "fctsys.h" #include "gr_basic.h" - #include "common.h" -#include "pcbnew.h" #include "trigo.h" +#include "class_track.h" + +#include "pcbnew.h" #include "protos.h" -/* - * Draws n consecutive track segments in list. - * Useful to show a track when it is a chain of segments - * (fir instance when creating a new track) - * param aTrackList = First segment - * param nbsegment = number of segments in list - * param Mode_color = mode (GRXOR, GROR ..) - */ void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment, int draw_mode ) { // preserve the start of the list for debugging. diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index c1e3d12139..3784331dc6 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -1,12 +1,17 @@ -/*******************************/ -/* Pcbnew: exchange modules */ -/*******************************/ +/** + * @file xchgmod.cpp + */ #include "fctsys.h" #include "class_drawpanel.h" #include "confirm.h" #include "kicad_string.h" #include "wxPcbStruct.h" +#include "macros.h" +#include "pcbcommon.h" + +#include "class_board.h" +#include "class_module.h" #include "pcbnew.h" #include "dialog_exchange_modules_base.h" diff --git a/pcbnew/zone_filling_algorithm.cpp b/pcbnew/zone_filling_algorithm.cpp index b534f6d2fa..280fe6a653 100644 --- a/pcbnew/zone_filling_algorithm.cpp +++ b/pcbnew/zone_filling_algorithm.cpp @@ -1,16 +1,19 @@ -/* filling_zone_algorithm: - * Algos used to fill a zone defined by a polygon and a filling starting point +/** + * @file zone_filling_algorithm.cpp: + * Algorithms used to fill a zone defined by a polygon and a filling starting point. */ #include // sort #include "fctsys.h" +#include "trigo.h" +#include "wxPcbStruct.h" + +#include "class_zone.h" #include "pcbnew.h" -#include "wxPcbStruct.h" #include "zones.h" -#include "trigo.h" #include "protos.h" /* Local functions */ @@ -18,10 +21,6 @@ /* Local variables */ -/***********************************************************/ -int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb ) -/***********************************************************/ - /** * Function BuildFilledPolysListData * Build m_FilledPolysList data from real outlines (m_Poly) @@ -32,11 +31,13 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb ) * This function does not add holes for pads and tracks but calls * AddClearanceAreasPolygonsToPolysList() to do that for copper layers */ +int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb ) { m_FilledPolysList.clear(); /* convert outlines + holes to outlines without holes (adding extra segments if necessary) - * m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building this zone + * m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building + * this zone */ if( GetNumCorners() <= 2 ) // malformed zone. Kbool does not like it ... @@ -103,6 +104,7 @@ static bool SortByXValues( const int& a, const int &b) return a < b; } + /** * Function Fill_Zone_Areas_With_Segments * Fill sub areas in a zone with segments with m_ZoneMinThickness width @@ -202,8 +204,11 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments() error = true; } - if ( error ) break; + if ( error ) + break; + int iimax = x_coordinates.size()-1; + for (int ii = 0; ii < iimax; ii +=2 ) { wxPoint seg_start, seg_end; @@ -216,10 +221,15 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments() m_FillSegmList.push_back( segment ); } } //End examine segments in one area - if ( error ) break; + + if ( error ) + break; + istart = iend + 1; // istart points the first corner of the next area } // End find one end of outline - if ( error ) break; + + if ( error ) + break; } // End examine all areas return count; diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 0e861577b0..35bf1a3a0e 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -1,14 +1,17 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: zones_by_polygon.cpp -// Licence: GPL License -///////////////////////////////////////////////////////////////////////////// +/** + * @file zones_by_polygon.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" + +#include "class_board.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" #include "pcbnew_id.h" #include "protos.h" @@ -31,12 +34,12 @@ static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel /* Local variables */ static wxPoint s_CornerInitialPosition; // Used to abort a move corner command -static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted) -static bool s_AddCutoutToCurrentZone; // if true, the next outline will be addes to s_CurrentZone -static ZONE_CONTAINER* s_CurrentZone; // if != NULL, these ZONE_CONTAINER params will be used for the next zone -static wxPoint s_CursorLastPosition; // in move zone outline, last cursor position. Used to calculate the move vector +static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted) +static bool s_AddCutoutToCurrentZone; // if true, the next outline will be addes to s_CurrentZone +static ZONE_CONTAINER* s_CurrentZone; // if != NULL, these ZONE_CONTAINER params will be used for the next zone +static wxPoint s_CursorLastPosition; // in move zone outline, last cursor position. Used to calculate the move vector static PICKED_ITEMS_LIST s_PickedList; // a picked list to save zones for undo/redo command -static PICKED_ITEMS_LIST _AuxiliaryList; // a picked list to store zones that are deleted or added when combined +static PICKED_ITEMS_LIST _AuxiliaryList; // a picked list to store zones that are deleted or added when combined #include "dialog_copper_zones.h" diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 3527bac653..2814450bf2 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -1,6 +1,7 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: zones_by_polygon_fill_functions.cpp -///////////////////////////////////////////////////////////////////////////// +/* + * @file zones_by_polygon_fill_functions.cpp + */ + /* * This program source code file is part of KICAD, a free EDA CAD application. * @@ -26,11 +27,18 @@ */ #include + #include "fctsys.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "macros.h" + +#include "class_board.h" +#include "class_track.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" 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 f639aeda3f..71716c46be 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -1,6 +1,6 @@ -/*******************************************/ -/* zones_convert_brd_items_to_polygons.cpp */ -/*******************************************/ +/** + * @file zones_convert_brd_items_to_polygons_with_Boost.cpp + */ /* Functions to convert some board items to polygons * (pads, tracks ..) @@ -22,18 +22,22 @@ */ #include -#include - #include "fctsys.h" #include "polygons_defs.h" - -#include "pcbnew.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_edge_mod.h" +#include "class_drawsegment.h" +#include "class_pcb_text.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" -#include "PolyLine.h" extern void BuildUnconnectedThermalStubsPolygonList( std::vector& aCornerBuffer, diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index a8ebc00d3d..f896d042ff 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -1,20 +1,19 @@ -/***********************************************/ -/* zones_convert_to_polygons_aux_functions.cpp */ -/***********************************************/ -/* auxiliary functions used to calculare filled copper zones areas -*/ - -#include +/** + * @file zones_convert_to_polygons_aux_functions.cpp + */ #include "fctsys.h" #include "polygons_defs.h" - -#include "pcbnew.h" +#include "PolyLine.h" #include "wxPcbStruct.h" #include "trigo.h" +#include "class_board.h" +#include "class_module.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" -#include "PolyLine.h" /** @@ -29,10 +28,10 @@ */ void BuildUnconnectedThermalStubsPolygonList( std::vector& aCornerBuffer, - BOARD* aPcb, - ZONE_CONTAINER* aZone, - double aArcCorrection, - int aRoundPadThermalRotation) + BOARD* aPcb, + ZONE_CONTAINER* aZone, + double aArcCorrection, + int aRoundPadThermalRotation ) { std::vector corners_buffer; // a local polygon buffer to store one stub corners_buffer.reserve( 4 ); diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp index e331c2fe0f..a3c3a0046e 100644 --- a/pcbnew/zones_functions_for_undo_redo.cpp +++ b/pcbnew/zones_functions_for_undo_redo.cpp @@ -1,7 +1,6 @@ -///////////////////////////////////////////////////////////////////////////// - -// Name: zones_functions_for_undo_redo.cpp -///////////////////////////////////////////////////////////////////////////// +/** + * @file zones_functions_for_undo_redo.cpp + */ /* * This program source code file is part of KICAD, a free EDA CAD application. @@ -46,8 +45,12 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" -#include "pcbnew.h" #include "wxPcbStruct.h" + +#include "class_board.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" #include "zones_functions_for_undo_redo.h" @@ -63,29 +66,37 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) // compare basic parameters: if( GetLayer() != aZoneToCompare.GetLayer() ) return false; + if( m_Netname != aZoneToCompare.m_Netname ) return false; // Compare zone specfic parameters if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance ) return false; + if( m_ZoneMinThickness != aZoneToCompare.m_ZoneMinThickness ) return false; + if( m_FillMode != aZoneToCompare.m_FillMode ) return false; + if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount ) return false; + if( m_PadOption != aZoneToCompare.m_PadOption ) return false; + if( m_ThermalReliefGapValue != aZoneToCompare.m_ThermalReliefGapValue ) return false; + if( m_ThermalReliefCopperBridgeValue != aZoneToCompare.m_ThermalReliefCopperBridgeValue ) return false; // Compare outlines - wxASSERT( m_Poly ); // m_Poly == NULL Should never happen + wxASSERT( m_Poly ); // m_Poly == NULL Should never happen wxASSERT( aZoneToCompare.m_Poly ); - if( m_Poly->corner != aZoneToCompare.m_Poly->corner ) // Compare vector + + if( m_Poly->corner != aZoneToCompare.m_Poly->corner ) // Compare vector return false; return true; @@ -111,12 +122,16 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, in for( unsigned ii = 0; ; ii++ ) { ZONE_CONTAINER* zone = aPcb->GetArea( ii ); + if( zone == NULL ) // End of list break; + if( aNetCode >= 0 && aNetCode != zone->GetNet() ) continue; + if( aLayer >= 0 && aLayer != zone->GetLayer() ) continue; + ZONE_CONTAINER* zoneDup = new ZONE_CONTAINER( aPcb ); zoneDup->Copy( zone ); ITEM_PICKER picker( zone, UR_CHANGED ); @@ -167,9 +182,11 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, UNDO_REDO_T status = aPickList.GetPickedItemStatus( kk ); ZONE_CONTAINER* ref = (ZONE_CONTAINER*) aPickList.GetPickedItem( kk ); + for( unsigned ii = 0; ; ii++ ) // analyse the main picked list { ZONE_CONTAINER* zone = aPcb->GetArea( ii ); + if( zone == NULL ) { /* End of list: the stored item is not found: @@ -188,16 +205,19 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, { ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); aPickList.SetPickedItemStatus( UR_DELETED, kk ); + if( zcopy ) ref->Copy( zcopy ); else wxMessageBox( wxT( "UpdateCopyOfZonesList() error: link = NULL" ) ); + aPickList.SetPickedItemLink( NULL, kk ); // the copy was deleted; the link does not exists now delete zcopy; } // Remove this item from aAuxiliaryList, mainly for tests purpose bool notfound = true; + for( unsigned nn = 0; nn < aAuxiliaryList.GetCount(); nn++ ) { if( aAuxiliaryList.GetPickedItem( nn ) == ref ) @@ -209,8 +229,8 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, } if( notfound ) - wxMessageBox( wxT( - "UpdateCopyOfZonesList() error: item not found in aAuxiliaryList" ) ); + wxMessageBox( wxT( "UpdateCopyOfZonesList() error: item not found in aAuxiliaryList" ) ); + break; } if( zone == ref ) // picked zone found @@ -218,6 +238,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, if( aPickList.GetPickedItemStatus( kk ) != UR_NEW ) { ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); + if( zone->IsSame( *zcopy ) ) // Remove picked, because no changes { delete zcopy; // Delete copy @@ -225,6 +246,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, kk--; } } + break; } } @@ -247,11 +269,11 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, if( aAuxiliaryList.GetCount()> 0 ) { wxString msg; - msg.Printf( wxT( - "UpdateCopyOfZonesList() error: aAuxiliaryList not void: %d item left (status %d)" ), - aAuxiliaryList.GetCount(), aAuxiliaryList.GetPickedItemStatus( 0 ) ); + msg.Printf( wxT( "UpdateCopyOfZonesList() error: aAuxiliaryList not void: %d item left (status %d)" ), + aAuxiliaryList.GetCount(), aAuxiliaryList.GetPickedItemStatus( 0 ) ); wxMessageBox( msg ); - while( aAuxiliaryList.GetCount()> 0 ) + + while( aAuxiliaryList.GetCount() > 0 ) { delete aAuxiliaryList.GetPickedItemLink( 0 ); aAuxiliaryList.RemovePicker( 0 ); diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index b247cf29d8..4d2c284f9d 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -1,18 +1,20 @@ +/** + * @file zones_non_copper_type_functions.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" -#include "gr_basic.h" #include "confirm.h" -#include "pcbnew.h" #include "wxPcbStruct.h" +#include "class_board.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" #include "dialog_non_copper_zones_properties_base.h" -/* Local functions */ - -/* Local variables */ /* Class DialogNonCopperZonesEditor * Dialog editor for non copper zones properties diff --git a/pcbnew/zones_polygons_insulated_copper_islands.cpp b/pcbnew/zones_polygons_insulated_copper_islands.cpp index becac384ce..2285017bac 100644 --- a/pcbnew/zones_polygons_insulated_copper_islands.cpp +++ b/pcbnew/zones_polygons_insulated_copper_islands.cpp @@ -1,54 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// - -// Name: zones_polygons_insulated_copper_islands.cpp -// Licence: GPL License -///////////////////////////////////////////////////////////////////////////// - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif +/** + * @file zones_polygons_insulated_copper_islands.cpp + */ using namespace std; #include "fctsys.h" - #include "common.h" -#include "pcbnew.h" -#include "PolyLine.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" -/***************************************************************************************/ -void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD * aPcb ) -/***************************************************************************************/ - /** * Function Test_For_Copper_Island_And_Remove__Insulated_Islands * Remove insulated copper islands found in m_FilledPolysList. * @param aPcb = the board to analyse */ +void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD * aPcb ) { if( m_FilledPolysList.size() == 0 ) return; // Build a list of points connected to the net: - std::vector ListPointsCandidates; // list of coordinates of pads and vias on this layer and on this net. - for( MODULE* module = aPcb->m_Modules; - module; - module = module->Next() ) + // list of coordinates of pads and vias on this layer and on this net. + std::vector ListPointsCandidates; + + for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->m_Pads; - pad != NULL; - pad = pad->Next() ) + for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() ) { if( !pad->IsOnLayer( GetLayer() ) ) continue; @@ -60,15 +44,16 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD } } - for( TRACK* track = aPcb->m_Track; - track; - track = track->Next() ) + for( TRACK* track = aPcb->m_Track; track; track = track->Next() ) { if( !track->IsOnLayer( GetLayer() ) ) continue; + if( track->GetNet() != GetNet() ) continue; + ListPointsCandidates.push_back( track->m_Start ); + if( track->Type() != TYPE_VIA ) ListPointsCandidates.push_back( track->m_End ); } @@ -76,78 +61,77 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD // test if a point is inside unsigned indexstart = 0, indexend; bool connected = false; - for( indexend = 0; - indexend < m_FilledPolysList.size(); - indexend++ ) + + for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ ) { - if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found + if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found { - EDA_RECT bbox = - CalculateSubAreaBoundaryBox( indexstart, - indexend ); - for( unsigned ic = 0; - ic < ListPointsCandidates.size(); - ic++ ) - { // test if this area is connected to a board item: + EDA_RECT bbox = CalculateSubAreaBoundaryBox( indexstart, indexend ); + + for( unsigned ic = 0; ic < ListPointsCandidates.size(); ic++ ) + { + // test if this area is connected to a board item: wxPoint pos = ListPointsCandidates[ic]; + if( !bbox.Contains( pos ) ) continue; - if( TestPointInsidePolygon( - m_FilledPolysList, indexstart, - indexend, pos.x, - pos.y ) ) + + if( TestPointInsidePolygon( m_FilledPolysList, indexstart, indexend, + pos.x, pos.y ) ) { connected = true; break; } } - if( connected ) // this polygon is connected: analyse next polygon + if( connected ) // this polygon is connected: analyse next polygon { - indexstart = indexend + 1; // indexstart points the first point of the next polygon + indexstart = indexend + 1; // indexstart points the first point of the next polygon connected = false; } - else // Not connected: remove this polygon + else // Not connected: remove this polygon { - m_FilledPolysList.erase( - m_FilledPolysList.begin() + indexstart, - m_FilledPolysList.begin() + indexend + - 1 ); - indexend = indexstart; /* indexstart points the first point of the next polygon - * because the current poly is removed */ + m_FilledPolysList.erase( m_FilledPolysList.begin() + indexstart, + m_FilledPolysList.begin() + indexend + 1 ); + + indexend = indexstart; /* indexstart points the first point of the next polygon + * because the current poly is removed */ } } } } -/**************************************************************************************/ -EDA_RECT ZONE_CONTAINER::CalculateSubAreaBoundaryBox( int aIndexStart, int aIndexEnd ) -/**************************************************************************************/ - /** * Function CalculateSubAreaBoundaryBox * Calculates the bounding box of a a filled area ( list of CPolyPt ) - * use m_FilledPolysList as list of CPolyPt (that are the corners of one or more polygons or filled areas ) + * use m_FilledPolysList as list of CPolyPt (that are the corners of one or more polygons or + * filled areas ) * @return an EDA_RECT as bounding box * @param aIndexStart = index of the first corner of a polygon (filled area) in m_FilledPolysList * @param aIndexEnd = index of the last corner of a polygon in m_FilledPolysList */ +EDA_RECT ZONE_CONTAINER::CalculateSubAreaBoundaryBox( int aIndexStart, int aIndexEnd ) { CPolyPt start_point, end_point; EDA_RECT bbox; start_point = m_FilledPolysList[aIndexStart]; end_point = start_point; + for( int ii = aIndexStart; ii <= aIndexEnd; ii++ ) { CPolyPt ptst = m_FilledPolysList[ii]; + if( start_point.x > ptst.x ) start_point.x = ptst.x; + if( start_point.y > ptst.y ) start_point.y = ptst.y; + if( end_point.x < ptst.x ) end_point.x = ptst.x; + if( end_point.y < ptst.y ) end_point.y = ptst.y; } diff --git a/pcbnew/zones_polygons_test_connections.cpp b/pcbnew/zones_polygons_test_connections.cpp index 2db393e965..2eb3a17012 100644 --- a/pcbnew/zones_polygons_test_connections.cpp +++ b/pcbnew/zones_polygons_test_connections.cpp @@ -1,49 +1,37 @@ -///////////////////////////////////////////////////////////////////////////// - -// Name: zones_polygons_test_connections.cpp -// Licence: GPL License -///////////////////////////////////////////////////////////////////////////// - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif +/** + * @file zones_polygons_test_connections.cpp + */ using namespace std; + #include // sort -#include #include "fctsys.h" - #include "common.h" -#include "pcbnew.h" -#include "PolyLine.h" +#include "macros.h" +#include "class_board.h" +#include "class_module.h" +#include "class_track.h" +#include "class_zone.h" + +#include "pcbnew.h" #include "zones.h" static bool CmpZoneSubnetValue( const BOARD_CONNECTED_ITEM* a, const BOARD_CONNECTED_ITEM* b ); void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); -/***********************************************************/ -void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) -/***********************************************************/ - /** * Function Test_Connection_To_Copper_Areas * init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found * @param aNetcode = netcode to analyse. if -1, analyse all nets */ +void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) { - std::vector Candidates; // list of pads and tracks candidates on this layer and on this net. + // list of pads and tracks candidates on this layer and on this net. + std::vector Candidates; int subnet = 0; int netcode; ZONE_CONTAINER* curr_zone; @@ -81,7 +69,8 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // Build a list of candidates connected to the net: Candidates.clear(); - // At this point, layers are not considered, because areas on different layers can be connected by a via or a pad. + // At this point, layers are not considered, because areas on different layers can + // be connected by a via or a pad. for( MODULE* module = m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() ) @@ -102,18 +91,24 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // test if a candidate is inside a filled area of this zone unsigned indexstart = 0, indexend; + for( indexend = 0; indexend < curr_zone->m_FilledPolysList.size(); indexend++ ) { - if( curr_zone->m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found + // end of a filled sub-area found + if( curr_zone->m_FilledPolysList[indexend].end_contour ) { subnet++; EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend ); + for( unsigned ic = 0; ic < Candidates.size(); ic++ ) { // test if this area is connected to a board item: item = Candidates[ic]; + if( !item->IsOnLayer( curr_zone->GetLayer() ) ) continue; + wxPoint pos1, pos2; + if( item->Type() == TYPE_PAD ) { pos1 = pos2 = ( (D_PAD*) item )->m_Pos; @@ -128,8 +123,12 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) pos2 = ( (TRACK*) item )->m_End; } else + { continue; + } + bool connected = false; + if( bbox.Contains( pos1 ) ) { if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, indexstart, @@ -146,12 +145,14 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) if( connected ) { // Set ZoneSubnet to the current subnet value. - // If the previous subnet is not 0, merge all items with old subnet to the new one + // If the previous subnet is not 0, merge all items with old subnet + // to the new one int old_subnet = 0; old_subnet = item->GetZoneSubNet(); item->SetZoneSubNet( subnet ); - if( (old_subnet > 0) && (old_subnet != subnet) ) // Merge previous subnet with the current + // Merge previous subnet with the current + if( (old_subnet > 0) && (old_subnet != subnet) ) { for( unsigned jj = 0; jj < Candidates.size(); jj++ ) { @@ -165,43 +166,38 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) } // End test candidates for the current filled area - indexstart = indexend + 1; // prepare test next area, starting at indexend+1 (if exists) - } // End read one area in curr_zone->m_FilledPolysList - } - - // End read full curr_zone->m_FilledPolysList - } - - // End read all zones in board + indexstart = indexend + 1; // prepare test next area, starting at indexend+1 + // (if exists). End read one area in + // curr_zone->m_FilledPolysList + } + } // End read all segments in zone. + } // End read all zones in board } -/**************************************************************************************************/ -void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ) -/**************************************************************************************************/ - /** * Function Merge_SubNets_Connected_By_CopperAreas(BOARD* aPcb) - * Calls Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for each netcode found in zone list + * Calls Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for each + * netcode found in zone list * @param aPcb = the current board */ +void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ) { for( int index = 0; index < aPcb->GetAreaCount(); index++ ) { ZONE_CONTAINER* curr_zone = aPcb->GetArea( index ); + if ( ! curr_zone->IsOnCopperLayer() ) continue; + if ( curr_zone->GetNet() <= 0 ) continue; + Merge_SubNets_Connected_By_CopperAreas( aPcb, curr_zone->GetNet() ); } } -/**************************************************************************************************/ -void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) -/**************************************************************************************************/ - /** * Function Merge_SubNets_Connected_By_CopperAreas(BOARD* aPcb, int aNetcode) * Used after connections by tracks calculations @@ -214,6 +210,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) * @param aPcb = the current board * @param aNetcode = netcode to consider */ +void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) { BOARD_CONNECTED_ITEM* item; int old_subnet, subnet, next_subnet_free_number; @@ -225,6 +222,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for( int index = 0; index < aPcb->GetAreaCount(); index++ ) { ZONE_CONTAINER* curr_zone = aPcb->GetArea( index ); + if( aNetcode == curr_zone->GetNet() ) { found = true; @@ -236,8 +234,10 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) return; std::vector Candidates; // list of pads and tracks candidates to test. + // Build a list of candidates connected to the net: next_subnet_free_number = 0; + for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() ) @@ -262,7 +262,8 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) if( Candidates.size() == 0 ) return; - next_subnet_free_number++; // This is a subnet we can use with not connected items by tracks, but connected by zone. + next_subnet_free_number++; // This is a subnet we can use with not connected items + // by tracks, but connected by zone. // Sort by zone_subnet: sort( Candidates.begin(), Candidates.end(), CmpZoneSubnetValue ); @@ -273,13 +274,13 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for( unsigned jj = 0; jj < Candidates.size(); jj++ ) { item = Candidates[jj]; + if ( item->GetSubNet() == 0 && (item->GetZoneSubNet() > 0) ) { item->SetSubNet( next_subnet_free_number + item->GetZoneSubNet() ); } } - // Now, for each zone subnet, we search for 2 items with different subnets. // if found, the 2 subnet are merged in the whole candidate list. old_subnet = 0; @@ -304,7 +305,8 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) zone_subnet = old_zone_subnet; - if( subnet == old_subnet ) // 2 successive items already from the same cluster: nothing to do + // 2 successive items already from the same cluster: nothing to do + if( subnet == old_subnet ) continue; // Here we have 2 items connected by the same area have 2 differents subnets: merge subnets @@ -314,13 +316,13 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for( unsigned jj = 0; jj < Candidates.size(); jj++ ) { BOARD_CONNECTED_ITEM * item_to_merge = Candidates[jj]; + if( item_to_merge->GetSubNet() == old_subnet ) item_to_merge->SetSubNet( subnet ); } old_subnet = subnet; } - } diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index 76fc9fff03..e3f4432a6e 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -1,18 +1,22 @@ -/****************************************************************************/ -/* Name: zones_test_and_combine_areas.cpp */ -/* Licence: GPL License */ -/* functions to test, merge and cut polygons used as copper areas outlines */ -/* some pieces of code come from FreePCB */ -/****************************************************************************/ - -#include +/** + * @file zones_test_and_combine_areas.cpp + * @brief Functions to test, merge and cut polygons used as copper areas outlines + * some pieces of code come from FreePCB. + */ #include "fctsys.h" #include "common.h" #include "confirm.h" +#include "class_undoredo_container.h" + +#include "class_board.h" +#include "class_zone.h" +#include "class_marker_pcb.h" + #include "pcbnew.h" #include "drc_stuff.h" + static bool bDontShowSelfIntersectionArcsWarning; static bool bDontShowSelfIntersectionWarning; static bool bDontShowIntersectionArcsWarning; @@ -21,8 +25,8 @@ static bool bDontShowIntersectionArcsWarning; /** * Function AddArea * Add an empty copper area to board areas list - * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands) - * can be NULL + * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful + * in undo commands) can be NULL * @param aNetcode = the necode of the copper area (0 = no net) * @param aLayer = the layer of area * @param aStartPointPosition = position of the first point of the polygon outline of this area @@ -30,11 +34,12 @@ static bool bDontShowIntersectionArcsWarning; * @return pointer to the new area */ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, - int aLayer, wxPoint aStartPointPosition, int aHatch ) + int aLayer, wxPoint aStartPointPosition, int aHatch ) { ZONE_CONTAINER* new_area = InsertArea( aNetcode, - m_ZoneDescriptorList.size( ) - 1, - aLayer, aStartPointPosition.x, aStartPointPosition.y, aHatch ); + m_ZoneDescriptorList.size( ) - 1, + aLayer, aStartPointPosition.x, + aStartPointPosition.y, aHatch ); if( aNewZonesList ) { @@ -49,14 +54,15 @@ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, /** * Function RemoveArea * remove copper area from net, and put it in a deleted list (if exists) - * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands) - * can be NULL + * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo + * commands) can be NULL * @param area_to_remove = area to delete or put in deleted list */ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to_remove ) { if( area_to_remove == NULL ) return; + if( aDeletedList ) { ITEM_PICKER picker( area_to_remove, UR_DELETED ); @@ -65,7 +71,9 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to Remove( area_to_remove ); // remove from zone list, but does not delete it } else + { Delete( area_to_remove ); + } } @@ -81,6 +89,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int new_area->SetNet( netcode ); new_area->SetLayer( layer ); new_area->m_TimeStamp = GetTimeStamp(); + if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) ) m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area ); else @@ -107,7 +116,9 @@ int BOARD::CompleteArea( ZONE_CONTAINER* area_to_complete, int style ) return 1; } else + { Delete( area_to_complete ); + } return 0; } @@ -136,6 +147,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) // make bounding rect for each contour std::vector cr; cr.reserve( n_cont ); + for( int icont = 0; icontGetCornerBounds( icont ) ); @@ -143,14 +155,19 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) { int is_start = p->GetContourStart( icont ); int is_end = p->GetContourEnd( icont ); + for( int is = is_start; is<=is_end; is++ ) { int is_prev = is - 1; + if( is_prev < is_start ) is_prev = is_end; + int is_next = is + 1; + if( is_next > is_end ) is_next = is_start; + int style = p->GetSideStyle( is ); int x1i = p->GetX( is ); int y1i = p->GetY( is ); @@ -171,14 +188,19 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) { int is2_start = p->GetContourStart( icont2 ); int is2_end = p->GetContourEnd( icont2 ); + for( int is2 = is2_start; is2<=is2_end; is2++ ) { int is2_prev = is2 - 1; + if( is2_prev < is2_start ) is2_prev = is2_end; + int is2_next = is2 + 1; + if( is2_next > is2_end ) is2_next = is2_start; + if( icont != icont2 || (is2 != is && is2 != is_prev && is2 != is_next && is != is2_prev && is != @@ -195,6 +217,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) { // intersection between non-adjacent sides bInt = true; + if( style != CPolyLine::STRAIGHT || style2 != CPolyLine::STRAIGHT ) { bArcInt = true; @@ -204,6 +227,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) } } } + if( bArcInt ) break; } @@ -222,6 +246,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) CurrArea->utility2 = 1; else CurrArea->utility2 = 0; + return CurrArea->utility2; } @@ -230,16 +255,16 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea ) * Function ClipAreaPolygon * Process an area that has been modified, by clipping its polygon against itself. * This may change the number and order of copper areas in the net. - * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands) - * can be NULL + * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in + * undo commands) can be NULL * @param aCurrArea = the zone to process * @param bMessageBoxInt == true, shows message when clipping occurs. * @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs. * @param bRetainArcs = true to handle arcs (not really used in kicad) * @return: - * -1 if arcs intersect other sides, so polygon can't be clipped - * 0 if no intersecting sides - * 1 if intersecting sides + * -1 if arcs intersect other sides, so polygon can't be clipped + * 0 if no intersecting sides + * 1 if intersecting sides * Also sets areas->utility1 flags if areas are modified */ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, @@ -251,6 +276,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, if( test == -1 && !bRetainArcs ) test = 1; + if( test == -1 ) { // arc intersections, don't clip unless bRetainArcs == false @@ -258,12 +284,13 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, { wxString str; str.Printf( wxT( "Area %8.8X of net \"%s\" has arcs intersecting other sides.\n" ), - aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); + aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); str += wxT( "This may cause problems with other editing operations,\n" ); str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" ); str += wxT( "Manual correction is recommended." ); wxMessageBox( str ); } + return -1; // arcs intersect with other sides, error } @@ -279,32 +306,34 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, if( bMessageBoxInt && bDontShowSelfIntersectionWarning == false ) { wxString str; - str.Printf( wxT( - "Area %8.8X of net \"%s\" is self-intersecting and will be clipped.\n" ), - aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); + str.Printf( wxT( "Area %8.8X of net \"%s\" is self-intersecting and will be clipped.\n" ), + aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); str += wxT( "This may result in splitting the area.\n" ); str += wxT( "If the area is complex, this may take a few seconds." ); wxMessageBox( str ); -// bDontShowSelfIntersectionWarning = dlg.bDontShowBoxState; +// bDontShowSelfIntersectionWarning = dlg.bDontShowBoxState; } } //** TODO test for cutouts outside of area -//** if( test == 1 ) +//** if( test == 1 ) { std::vector* pa = new std::vector; curr_polygon->Undraw(); int n_poly = aCurrArea->m_Poly->NormalizeAreaOutlines( pa, bRetainArcs ); - if( n_poly > 1 ) // i.e if clipping has created some polygons, we must add these new copper areas + + // i.e if clipping has created some polygons, we must add these new copper areas. + if( n_poly > 1 ) { ZONE_CONTAINER* NewArea; + for( int ip = 1; ip < n_poly; ip++ ) { // create new copper area and copy poly into it CPolyLine* new_p = (*pa)[ip - 1]; NewArea = AddArea( aNewZonesList, aCurrArea->GetNet(), aCurrArea->GetLayer(), - wxPoint(0, 0), CPolyLine::NO_HATCH ); + wxPoint(0, 0), CPolyLine::NO_HATCH ); // remove the poly that was automatically created for the new area // and replace it with a poly from NormalizeWithKbool @@ -314,9 +343,11 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, NewArea->utility = 1; } } + curr_polygon->Draw(); delete pa; } + return test; } @@ -325,8 +356,8 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, * Process an area that has been modified, by clipping its polygon against * itself and the polygons for any other areas on the same net. * This may change the number and order of copper areas in the net. - * @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas (useful in undo commands - * can be NULL + * @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas + * (useful in undo commands can be NULL * @param modified_area = area to test * @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs. * @param bMessageBoxInt == true, shows message when clipping occurs. @@ -349,10 +380,12 @@ int BOARD::AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, // now see if we need to clip against other areas int layer = modified_area->GetLayer(); bool bCheckAllAreas = false; + if( test == 1 ) bCheckAllAreas = true; else bCheckAllAreas = TestAreaIntersections( modified_area ); + if( bCheckAllAreas ) CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNet(), bMessageBoxInt, true ); @@ -371,11 +404,10 @@ int BOARD::AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, for( unsigned ia1 = 0; ia1 < m_ZoneDescriptorList.size() - 1; ) { ZONE_CONTAINER* zone = m_ZoneDescriptorList[ia1]; + if( zone->GetNumCorners() >= 3 ) ia1++; - - // Remove zone because it is incorrect: - else + else // Remove zone because it is incorrect: RemoveArea( aModifiedZonesList, zone ); } @@ -386,15 +418,16 @@ int BOARD::AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, /** * Function CombineAllAreasInNet * Checks all copper areas in net for intersections, combining them if found - * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands - * can be NULL + * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in + * undo commands can be NULL * @param aNetCode = net to consider * @param bMessageBox : if true display warning message box * @param bUseUtility : if true, don't check areas if both utility flags are 0 * Sets utility flag = 1 for any areas modified * If an area has self-intersecting arcs, doesn't try to combine it */ -int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, bool bMessageBox, bool bUseUtility ) +int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, + bool bMessageBox, bool bUseUtility ) { if( m_ZoneDescriptorList.size() <= 1 ) return 0; @@ -414,11 +447,14 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, // legal polygon CRect b1 = curr_area->m_Poly->GetCornerBounds(); bool mod_ia1 = false; + for( unsigned ia2 = m_ZoneDescriptorList.size() - 1; ia2 > ia1; ia2-- ) { ZONE_CONTAINER* area2 = m_ZoneDescriptorList[ia2]; + if( area2->GetNet() != aNetCode ) continue; + if( curr_area->GetLayer() == area2->GetLayer() && curr_area->utility2 != -1 && area2->utility2 != -1 ) { @@ -427,12 +463,13 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, || b1.bottom > b2.top || b1.top < b2.bottom ) ) { // check area2 against curr_area - if( curr_area->utility || area2->utility || bUseUtility == - false ) + if( curr_area->utility || area2->utility || bUseUtility == false ) { int ret = TestAreaIntersection( curr_area, area2 ); + if( ret == 1 ) ret = CombineAreas( aDeletedList, curr_area, area2 ); + if( ret == 1 ) { mod_ia1 = true; @@ -442,12 +479,10 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, if( bMessageBox && bDontShowIntersectionArcsWarning == false ) { wxString str; - str.Printf( - wxT( - "Areas %d and %d of net \"%s\" intersect, but some of the intersecting sides are arcs.\n" ), - ia1 + 1, - ia2 + 1, - GetChars( curr_area->m_Netname ) ); + str.Printf( wxT( "Areas %d and %d of net \"%s\" intersect, but some of the intersecting sides are arcs.\n" ), + ia1 + 1, + ia2 + 1, + GetChars( curr_area->m_Netname ) ); str += wxT( "Therefore, these areas can't be combined." ); wxMessageBox( str ); } @@ -477,8 +512,10 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) for( unsigned ia2 = 0; ia2 < m_ZoneDescriptorList.size(); ia2++ ) { ZONE_CONTAINER* area2 = m_ZoneDescriptorList[ia2]; + if( area_to_test->GetNet() != area2->GetNet() ) continue; + if( area_to_test == area2 ) continue; @@ -491,10 +528,11 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) // test bounding rects CRect b1 = poly1->GetCornerBounds(); CRect b2 = poly2->GetCornerBounds(); - if( b1.bottom > b2.top - || b1.top < b2.bottom - || b1.left > b2.right - || b1.right < b2.left ) + + if( b1.bottom > b2.top + || b1.top < b2.bottom + || b1.left > b2.right + || b1.right < b2.left ) continue; // test for intersecting segments @@ -502,11 +540,13 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) { int is1 = poly1->GetContourStart( icont1 ); int ie1 = poly1->GetContourEnd( icont1 ); + for( int ic1 = is1; ic1<=ie1; ic1++ ) { int xi1 = poly1->GetX( ic1 ); int yi1 = poly1->GetY( ic1 ); int xf1, yf1, style1; + if( ic1 < ie1 ) { xf1 = poly1->GetX( ic1 + 1 ); @@ -517,16 +557,20 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) xf1 = poly1->GetX( is1 ); yf1 = poly1->GetY( is1 ); } + style1 = poly1->GetSideStyle( ic1 ); + for( int icont2 = 0; icont2 < poly2->GetNumContours(); icont2++ ) { int is2 = poly2->GetContourStart( icont2 ); int ie2 = poly2->GetContourEnd( icont2 ); + for( int ic2 = is2; ic2<=ie2; ic2++ ) { int xi2 = poly2->GetX( ic2 ); int yi2 = poly2->GetY( ic2 ); int xf2, yf2, style2; + if( ic2 < ie2 ) { xf2 = poly2->GetX( ic2 + 1 ); @@ -537,6 +581,7 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) xf2 = poly2->GetX( is2 ); yf2 = poly2->GetY( is2 ); } + style2 = poly2->GetSideStyle( ic2 ); int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, style1, xi2, yi2, xf2, yf2, style2 ); @@ -547,12 +592,13 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) } } - // If a contour is inside an other contour, no segments intersects, but the zones can be combined - // test a corner inside an outline (only one corner is enought) + // If a contour is inside an other contour, no segments intersects, but the zones can + // be combined test a corner inside an outline (only one corner is enought) for( int ic2 = 0; ic2 < poly2->GetNumCorners(); ic2++ ) { int x = poly2->GetX( ic2 ); int y = poly2->GetY( ic2 ); + if( poly1->TestPointInside( x, y ) ) { return true; @@ -563,6 +609,7 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) { int x = poly1->GetX( ic1 ); int y = poly1->GetY( ic1 ); + if( poly2->TestPointInside( x, y ) ) { return true; @@ -596,24 +643,28 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ // test bounding rects CRect b1 = poly1->GetCornerBounds(); CRect b2 = poly2->GetCornerBounds(); - if( b1.bottom > b2.top - || b1.top < b2.bottom - || b1.left > b2.right - || b1.right < b2.left ) + + if( b1.bottom > b2.top + || b1.top < b2.bottom + || b1.left > b2.right + || b1.right < b2.left ) return 0; // now test for intersecting segments bool bInt = false; bool bArcInt = false; + for( int icont1 = 0; icont1GetNumContours(); icont1++ ) { int is1 = poly1->GetContourStart( icont1 ); int ie1 = poly1->GetContourEnd( icont1 ); + for( int ic1 = is1; ic1<=ie1; ic1++ ) { int xi1 = poly1->GetX( ic1 ); int yi1 = poly1->GetY( ic1 ); int xf1, yf1, style1; + if( ic1 < ie1 ) { xf1 = poly1->GetX( ic1 + 1 ); @@ -624,16 +675,20 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ xf1 = poly1->GetX( is1 ); yf1 = poly1->GetY( is1 ); } + style1 = poly1->GetSideStyle( ic1 ); + for( int icont2 = 0; icont2GetNumContours(); icont2++ ) { int is2 = poly2->GetContourStart( icont2 ); int ie2 = poly2->GetContourEnd( icont2 ); + for( int ic2 = is2; ic2<=ie2; ic2++ ) { int xi2 = poly2->GetX( ic2 ); int yi2 = poly2->GetY( ic2 ); int xf2, yf2, style2; + if( ic2 < ie2 ) { xf2 = poly2->GetX( ic2 + 1 ); @@ -644,14 +699,17 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ xf2 = poly2->GetX( is2 ); yf2 = poly2->GetY( is2 ); } + style2 = poly2->GetSideStyle( ic2 ); int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, style1, xi2, yi2, xf2, yf2, style2 ); if( n_int ) { bInt = true; + if( style1 != CPolyLine::STRAIGHT || style2 != CPolyLine::STRAIGHT ) bArcInt = true; + break; } } @@ -673,12 +731,13 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ if( bArcInt ) return 0; - // If a contour is inside an other contour, no segments intersects, but the zones can be combined - // test a corner inside an outline (only one corner is enought) + // If a contour is inside an other contour, no segments intersects, but the zones + // can be combined test a corner inside an outline (only one corner is enought) for( int ic2 = 0; ic2 < poly2->GetNumCorners(); ic2++ ) { int x = poly2->GetX( ic2 ); int y = poly2->GetY( ic2 ); + if( poly1->TestPointInside( x, y ) ) { return 1; @@ -689,6 +748,7 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ { int x = poly1->GetX( ic1 ); int y = poly1->GetY( ic1 ); + if( poly2->TestPointInside( x, y ) ) { return 1; @@ -697,8 +757,10 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ return 0; } + if( bArcInt ) return 2; + return 1; } @@ -706,8 +768,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ /** * Function CombineAreas * If possible, combine 2 copper areas - * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands - * can be NULL + * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo + * commands can be NULL * @param area_ref = tje main area (zone) * @param area_to_combine = the zone that can be merged with area_ref * area_ref must be BEFORE area_to_combine @@ -716,7 +778,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ * 1 if intersection * 2 if arcs intersect */ -int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine ) +int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ref, + ZONE_CONTAINER* area_to_combine ) { if( area_ref == area_to_combine ) { @@ -747,10 +810,12 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r // foreach point in the polygon bool first = true; + while( booleng->PolygonHasMorePoints() ) { int x = (int) booleng->GetPolygonXPoint(); int y = (int) booleng->GetPolygonYPoint(); + if( first ) { first = false; @@ -758,7 +823,9 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r ), x, y, area_ref->m_Poly->GetHatchStyle() ); } else + { area_ref->m_Poly->AppendCorner( x, y ); + } } booleng->EndPolygonGet(); @@ -782,14 +849,17 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r { int x = booleng->GetPolygonXPoint(); int y = booleng->GetPolygonYPoint(); + if( first ) { first = false; - area_to_combine->m_Poly->Start( area_ref->GetLayer( - ), x, y, area_ref->m_Poly->GetHatchStyle() ); + area_to_combine->m_Poly->Start( area_ref->GetLayer(), x, y, + area_ref->m_Poly->GetHatchStyle() ); } else + { area_to_combine->m_Poly->AppendCorner( x, y ); + } } booleng->EndPolygonGet(); @@ -800,16 +870,20 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r // add holes bool show_error = true; + while( booleng->StartPolygonGet() ) { - if( booleng->GetPolygonPointEdgeType() != KB_INSIDE_EDGE ) // we expect all vertex are holes inside the main outline + // we expect all vertex are holes inside the main outline + if( booleng->GetPolygonPointEdgeType() != KB_INSIDE_EDGE ) { if( show_error ) // show this error only once, if happens DisplayError( NULL, - wxT( "BOARD::CombineAreas() error: unexpected outside contour descriptor" ) ); + wxT( "BOARD::CombineAreas() error: unexpected outside contour descriptor" ) ); + show_error = false; continue; } + while( booleng->PolygonHasMorePoints() ) { int x = (int) booleng->GetPolygonXPoint(); @@ -894,6 +968,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E msg2, wxPoint( x, y ) ); Add( marker ); } + nerrors++; } } @@ -903,6 +978,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E { int x = testSmoothedPoly->GetX( ic2 ); int y = testSmoothedPoly->GetY( ic2 ); + if( refSmoothedPoly->TestPointInside( x, y ) ) { // COPPERAREA_COPPERAREA error: copper area corner inside copper area ref @@ -916,6 +992,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E msg2, wxPoint( x, y ) ); Add( marker ); } + nerrors++; } } @@ -925,11 +1002,13 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E { int ic_start = refSmoothedPoly->GetContourStart( icont ); int ic_end = refSmoothedPoly->GetContourEnd( icont ); + for( int ic = ic_start; ic<=ic_end; ic++ ) { int ax1 = refSmoothedPoly->GetX( ic ); int ay1 = refSmoothedPoly->GetY( ic ); int ax2, ay2; + if( ic == ic_end ) { ax2 = refSmoothedPoly->GetX( ic_start ); @@ -940,16 +1019,20 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ax2 = refSmoothedPoly->GetX( ic + 1 ); ay2 = refSmoothedPoly->GetY( ic + 1 ); } + int astyle = refSmoothedPoly->GetSideStyle( ic ); + for( int icont2 = 0; icont2 < testSmoothedPoly->GetNumContours(); icont2++ ) { int ic_start2 = testSmoothedPoly->GetContourStart( icont2 ); int ic_end2 = testSmoothedPoly->GetContourEnd( icont2 ); + for( int ic2 = ic_start2; ic2<=ic_end2; ic2++ ) { int bx1 = testSmoothedPoly->GetX( ic2 ); int by1 = testSmoothedPoly->GetY( ic2 ); int bx2, by2; + if( ic2 == ic_end2 ) { bx2 = testSmoothedPoly->GetX( ic_start2 ); @@ -960,17 +1043,17 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E bx2 = testSmoothedPoly->GetX( ic2 + 1 ); by2 = testSmoothedPoly->GetY( ic2 + 1 ); } + int bstyle = testSmoothedPoly->GetSideStyle( ic2 ); int x, y; - int d = GetClearanceBetweenSegments( - bx1, by1, bx2, by2, bstyle, - 0, - ax1, ay1, ax2, - ay2, astyle, - 0, - zone2zoneClearance, - &x, &y ); + int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, bstyle, + 0, + ax1, ay1, ax2, + ay2, astyle, + 0, + zone2zoneClearance, + &x, &y ); if( d < zone2zoneClearance ) { @@ -985,6 +1068,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E msg2, wxPoint( x, y ) ); Add( marker ); } + nerrors++; } } @@ -1029,10 +1113,12 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) { int ii = aCornerIndex - 1; end = aArea->GetCornerPosition( ii ); + while( ii >= 0 ) { if( aArea->m_Poly->corner[ii].end_contour ) break; + end = aArea->GetCornerPosition( ii ); ii--; } @@ -1056,6 +1142,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) // test for ending line inside Area_To_Test int x = end.x; int y = end.y; + if( Area_To_Test->m_Poly->TestPointInside( x, y ) ) { // COPPERAREA_COPPERAREA error: corner inside copper area @@ -1071,15 +1158,18 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) int ay1 = start.y; int ax2 = end.x; int ay2 = end.y; + for( int icont2 = 0; icont2 < Area_To_Test->m_Poly->GetNumContours(); icont2++ ) { int ic_start2 = Area_To_Test->m_Poly->GetContourStart( icont2 ); int ic_end2 = Area_To_Test->m_Poly->GetContourEnd( icont2 ); + for( int ic2 = ic_start2; ic2<=ic_end2; ic2++ ) { int bx1 = Area_To_Test->m_Poly->GetX( ic2 ); int by1 = Area_To_Test->m_Poly->GetY( ic2 ); int bx2, by2; + if( ic2 == ic_end2 ) { bx2 = Area_To_Test->m_Poly->GetX( ic_start2 ); @@ -1090,14 +1180,16 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) bx2 = Area_To_Test->m_Poly->GetX( ic2 + 1 ); by2 = Area_To_Test->m_Poly->GetY( ic2 + 1 ); } + int bstyle = Area_To_Test->m_Poly->GetSideStyle( ic2 ); int x, y; int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, bstyle, - 0, - ax1, ay1, ax2, ay2, astyle, - 0, - zone_clearance, - &x, &y ); + 0, + ax1, ay1, ax2, ay2, astyle, + 0, + zone_clearance, + &x, &y ); + if( d < zone_clearance ) { // COPPERAREA_COPPERAREA error : edge intersect or too close