You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1293 lines
42 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
16 years ago
16 years ago
16 years ago
16 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
18 years ago
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
16 years ago
16 years ago
14 years ago
16 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
16 years ago
16 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
16 years ago
16 years ago
16 years ago
16 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
16 years ago
16 years ago
17 years ago
16 years ago
16 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
  5. * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
  7. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. /**
  27. * @file export_gencad.cpp
  28. * @brief Export GenCAD 1.4 format.
  29. */
  30. #include <fctsys.h>
  31. #include <confirm.h>
  32. #include <gestfich.h>
  33. #include <pgm_base.h>
  34. #include <pcb_edit_frame.h>
  35. #include <trigo.h>
  36. #include <build_version.h>
  37. #include <macros.h>
  38. #include <pcbnew.h>
  39. #include <dialogs/dialog_gencad_export_options.h>
  40. #include <class_board.h>
  41. #include <class_module.h>
  42. #include <class_track.h>
  43. #include <class_edge_mod.h>
  44. #include <hash_eda.h>
  45. static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* frame );
  46. static void CreateArtworksSection( FILE* aFile );
  47. static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb );
  48. static void CreateBoardSection( FILE* aFile, BOARD* aPcb );
  49. static void CreateComponentsSection( FILE* aFile, BOARD* aPcb );
  50. static void CreateDevicesSection( FILE* aFile, BOARD* aPcb );
  51. static void CreateRoutesSection( FILE* aFile, BOARD* aPcb );
  52. static void CreateSignalsSection( FILE* aFile, BOARD* aPcb );
  53. static void CreateShapesSection( FILE* aFile, BOARD* aPcb );
  54. static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb );
  55. static void FootprintWriteShape( FILE* File, MODULE* module, const wxString& aShapeName );
  56. // layer names for Gencad export
  57. #if 0 // was:
  58. static const wxString GenCADLayerName[] =
  59. {
  60. wxT( "BOTTOM" ), wxT( "INNER1" ), wxT( "INNER2" ),
  61. wxT( "INNER3" ), wxT( "INNER4" ), wxT( "INNER5" ),
  62. wxT( "INNER6" ), wxT( "INNER7" ), wxT( "INNER8" ),
  63. wxT( "INNER9" ), wxT( "INNER10" ), wxT( "INNER11" ),
  64. wxT( "INNER12" ), wxT( "INNER13" ), wxT( "INNER14" ),
  65. wxT( "TOP" ), wxT( "LAYER17" ), wxT( "LAYER18" ),
  66. wxT( "SOLDERPASTE_BOTTOM" ), wxT( "SOLDERPASTE_TOP" ),
  67. wxT( "SILKSCREEN_BOTTOM" ), wxT( "SILKSCREEN_TOP" ),
  68. wxT( "SOLDERMASK_BOTTOM" ), wxT( "SOLDERMASK_TOP" ), wxT( "LAYER25" ),
  69. wxT( "LAYER26" ), wxT( "LAYER27" ), wxT( "LAYER28" ),
  70. wxT( "LAYER29" ), wxT( "LAYER30" ), wxT( "LAYER31" ),
  71. wxT( "LAYER32" )
  72. };
  73. // flipped layer name for Gencad export (to make CAM350 imports correct)
  74. static const wxString GenCADLayerNameFlipped[32] =
  75. {
  76. wxT( "TOP" ), wxT( "INNER14" ), wxT( "INNER13" ),
  77. wxT( "INNER12" ), wxT( "INNER11" ), wxT( "INNER10" ),
  78. wxT( "INNER9" ), wxT( "INNER8" ), wxT( "INNER7" ),
  79. wxT( "INNER6" ), wxT( "INNER5" ), wxT( "INNER4" ),
  80. wxT( "INNER3" ), wxT( "INNER2" ), wxT( "INNER1" ),
  81. wxT( "BOTTOM" ), wxT( "LAYER17" ), wxT( "LAYER18" ),
  82. wxT( "SOLDERPASTE_TOP" ), wxT( "SOLDERPASTE_BOTTOM" ),
  83. wxT( "SILKSCREEN_TOP" ), wxT( "SILKSCREEN_BOTTOM" ),
  84. wxT( "SOLDERMASK_TOP" ), wxT( "SOLDERMASK_BOTTOM" ), wxT( "LAYER25" ),
  85. wxT( "LAYER26" ), wxT( "LAYER27" ), wxT( "LAYER28" ),
  86. wxT( "LAYER29" ), wxT( "LAYER30" ), wxT( "LAYER31" ),
  87. wxT( "LAYER32" )
  88. };
  89. #else
  90. static std::string GenCADLayerName( int aCuCount, PCB_LAYER_ID aId )
  91. {
  92. if( IsCopperLayer( aId ) )
  93. {
  94. if( aId == F_Cu )
  95. return "TOP";
  96. else if( aId == B_Cu )
  97. return "BOTTOM";
  98. else if( aId <= 14 )
  99. {
  100. return StrPrintf( "INNER%d", aCuCount - aId - 1 );
  101. }
  102. else
  103. {
  104. return StrPrintf( "LAYER%d", aId );
  105. }
  106. }
  107. else
  108. {
  109. const char* txt;
  110. // using a switch to clearly show mapping & catch out of bounds index.
  111. switch( aId )
  112. {
  113. // Technicals
  114. case B_Adhes: txt = "B.Adhes"; break;
  115. case F_Adhes: txt = "F.Adhes"; break;
  116. case B_Paste: txt = "SOLDERPASTE_BOTTOM"; break;
  117. case F_Paste: txt = "SOLDERPASTE_TOP"; break;
  118. case B_SilkS: txt = "SILKSCREEN_BOTTOM"; break;
  119. case F_SilkS: txt = "SILKSCREEN_TOP"; break;
  120. case B_Mask: txt = "SOLDERMASK_BOTTOM"; break;
  121. case F_Mask: txt = "SOLDERMASK_TOP"; break;
  122. // Users
  123. case Dwgs_User: txt = "Dwgs.User"; break;
  124. case Cmts_User: txt = "Cmts.User"; break;
  125. case Eco1_User: txt = "Eco1.User"; break;
  126. case Eco2_User: txt = "Eco2.User"; break;
  127. case Edge_Cuts: txt = "Edge.Cuts"; break;
  128. case Margin: txt = "Margin"; break;
  129. // Footprint
  130. case F_CrtYd: txt = "F_CrtYd"; break;
  131. case B_CrtYd: txt = "B_CrtYd"; break;
  132. case F_Fab: txt = "F_Fab"; break;
  133. case B_Fab: txt = "B_Fab"; break;
  134. default:
  135. wxASSERT_MSG( 0, wxT( "aId UNEXPECTED" ) );
  136. txt = "BAD-INDEX!"; break;
  137. }
  138. return txt;
  139. }
  140. }
  141. static const PCB_LAYER_ID gc_seq[] = {
  142. B_Cu,
  143. In30_Cu,
  144. In29_Cu,
  145. In28_Cu,
  146. In27_Cu,
  147. In26_Cu,
  148. In25_Cu,
  149. In24_Cu,
  150. In23_Cu,
  151. In22_Cu,
  152. In21_Cu,
  153. In20_Cu,
  154. In19_Cu,
  155. In18_Cu,
  156. In17_Cu,
  157. In16_Cu,
  158. In15_Cu,
  159. In14_Cu,
  160. In13_Cu,
  161. In12_Cu,
  162. In11_Cu,
  163. In10_Cu,
  164. In9_Cu,
  165. In8_Cu,
  166. In7_Cu,
  167. In6_Cu,
  168. In5_Cu,
  169. In4_Cu,
  170. In3_Cu,
  171. In2_Cu,
  172. In1_Cu,
  173. F_Cu,
  174. };
  175. // flipped layer name for Gencad export (to make CAM350 imports correct)
  176. static std::string GenCADLayerNameFlipped( int aCuCount, PCB_LAYER_ID aId )
  177. {
  178. if( 1<= aId && aId <= 14 )
  179. {
  180. return StrPrintf( "INNER%d", 14 - aId );
  181. }
  182. return GenCADLayerName( aCuCount, aId );
  183. }
  184. static wxString escapeString( const wxString& aString )
  185. {
  186. wxString copy( aString );
  187. copy.Replace( "\"", "\\\"" );
  188. return copy;
  189. }
  190. #endif
  191. static std::string fmt_mask( LSET aSet )
  192. {
  193. #if 0
  194. return aSet.FmtHex();
  195. #else
  196. return StrPrintf( "%08x", (unsigned) ( aSet & LSET::AllCuMask() ).to_ulong() );
  197. #endif
  198. }
  199. // Export options
  200. static bool flipBottomPads;
  201. static bool uniquePins;
  202. static bool individualShapes;
  203. static bool storeOriginCoords;
  204. // These are the export origin (the auxiliary axis)
  205. static int GencadOffsetX, GencadOffsetY;
  206. // Association between shape names (using shapeName index) and components
  207. static std::map<MODULE*, int> componentShapes;
  208. static std::map<int, wxString> shapeNames;
  209. static const wxString getShapeName( MODULE* aModule )
  210. {
  211. static const wxString invalid( "invalid" );
  212. if( individualShapes )
  213. return aModule->GetReference();
  214. auto itShape = componentShapes.find( aModule );
  215. wxCHECK( itShape != componentShapes.end(), invalid );
  216. auto itName = shapeNames.find( itShape->second );
  217. wxCHECK( itName != shapeNames.end(), invalid );
  218. return itName->second;
  219. }
  220. // GerbTool chokes on units different than INCH so this is the conversion factor
  221. const static double SCALE_FACTOR = 1000.0 * IU_PER_MILS;
  222. /* Two helper functions to calculate coordinates of modules in gencad values
  223. * (GenCAD Y axis from bottom to top)
  224. */
  225. static double MapXTo( int aX )
  226. {
  227. return (aX - GencadOffsetX) / SCALE_FACTOR;
  228. }
  229. static double MapYTo( int aY )
  230. {
  231. return (GencadOffsetY - aY) / SCALE_FACTOR;
  232. }
  233. /* Driver function: processing starts here */
  234. void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
  235. {
  236. DIALOG_GENCAD_EXPORT_OPTIONS optionsDialog( this );
  237. if( optionsDialog.ShowModal() == wxID_CANCEL )
  238. return;
  239. FILE* file = wxFopen( optionsDialog.GetFileName(), "wt" );
  240. if( !file )
  241. {
  242. DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ),
  243. GetChars( optionsDialog.GetFileName() ) ) );
  244. return;
  245. }
  246. // Get options
  247. flipBottomPads = optionsDialog.GetOption( FLIP_BOTTOM_PADS );
  248. uniquePins = optionsDialog.GetOption( UNIQUE_PIN_NAMES );
  249. individualShapes = optionsDialog.GetOption( INDIVIDUAL_SHAPES );
  250. storeOriginCoords = optionsDialog.GetOption( STORE_ORIGIN_COORDS );
  251. // Switch the locale to standard C (needed to print floating point numbers)
  252. LOCALE_IO toggle;
  253. // Update some board data, to ensure a reliable gencad export
  254. GetBoard()->ComputeBoundingBox();
  255. // Save the auxiliary origin for the rest of the module
  256. GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().x : 0;
  257. GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0;
  258. // No idea on *why* this should be needed... maybe to fix net names?
  259. Compile_Ratsnest( true );
  260. /* Temporary modification of footprints that are flipped (i.e. on bottom
  261. * layer) to convert them to non flipped footprints.
  262. * This is necessary to easily export shapes to GenCAD,
  263. * that are given as normal orientation (non flipped, rotation = 0))
  264. * these changes will be undone later
  265. */
  266. BOARD* pcb = GetBoard();
  267. for( auto module : pcb->Modules() )
  268. {
  269. module->SetFlag( 0 );
  270. if( module->GetLayer() == B_Cu )
  271. {
  272. module->Flip( module->GetPosition() );
  273. module->SetFlag( 1 );
  274. }
  275. }
  276. /* Gencad has some mandatory and some optional sections: some importer
  277. * need the padstack section (which is optional) anyway. Also the
  278. * order of the section *is* important */
  279. CreateHeaderInfoData( file, this ); // Gencad header
  280. CreateBoardSection( file, pcb ); // Board perimeter
  281. CreatePadsShapesSection( file, pcb ); // Pads and padstacks
  282. CreateArtworksSection( file ); // Empty but mandatory
  283. /* Gencad splits a component info in shape, component and device.
  284. * We don't do any sharing (it would be difficult since each module is
  285. * customizable after placement) */
  286. CreateShapesSection( file, pcb );
  287. CreateComponentsSection( file, pcb );
  288. CreateDevicesSection( file, pcb );
  289. // In a similar way the netlist is split in net, track and route
  290. CreateSignalsSection( file, pcb );
  291. CreateTracksInfoData( file, pcb );
  292. CreateRoutesSection( file, pcb );
  293. fclose( file );
  294. // Undo the footprints modifications (flipped footprints)
  295. for( auto module : pcb->Modules() )
  296. {
  297. if( module->GetFlag() )
  298. {
  299. module->Flip( module->GetPosition() );
  300. module->SetFlag( 0 );
  301. }
  302. }
  303. componentShapes.clear();
  304. shapeNames.clear();
  305. }
  306. // Sort vias for uniqueness
  307. static bool ViaSort( const VIA* aPadref, const VIA* aPadcmp )
  308. {
  309. if( aPadref->GetWidth() != aPadcmp->GetWidth() )
  310. return aPadref->GetWidth() < aPadcmp->GetWidth();
  311. if( aPadref->GetDrillValue() != aPadcmp->GetDrillValue() )
  312. return aPadref->GetDrillValue() < aPadcmp->GetDrillValue();
  313. if( aPadref->GetLayerSet() != aPadcmp->GetLayerSet() )
  314. return aPadref->GetLayerSet().FmtBin().compare( aPadcmp->GetLayerSet().FmtBin() ) < 0;
  315. return false;
  316. }
  317. // The ARTWORKS section is empty but (officially) mandatory
  318. static void CreateArtworksSection( FILE* aFile )
  319. {
  320. /* The artworks section is empty */
  321. fputs( "$ARTWORKS\n", aFile );
  322. fputs( "$ENDARTWORKS\n\n", aFile );
  323. }
  324. // Emit PADS and PADSTACKS. They are sorted and emitted uniquely.
  325. // Via name is synthesized from their attributes, pads are numbered
  326. static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
  327. {
  328. std::vector<D_PAD*> padstacks;
  329. std::vector<VIA*> vias;
  330. std::vector<VIA*> viastacks;
  331. padstacks.resize( 1 ); // We count pads from 1
  332. // The master layermask (i.e. the enabled layers) for padstack generation
  333. LSET master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
  334. int cu_count = aPcb->GetCopperLayerCount();
  335. fputs( "$PADS\n", aFile );
  336. // Enumerate and sort the pads
  337. auto pads( aPcb->GetPads() );
  338. std::sort( pads.begin(), pads.end(),
  339. []( const D_PAD* a, const D_PAD* b ) { return D_PAD::Compare( a, b ) < 0; } );
  340. // The same for vias
  341. for( auto track : aPcb->Tracks() )
  342. {
  343. if( auto via = dyn_cast<VIA*>( track ) )
  344. vias.push_back( via );
  345. }
  346. std::sort( vias.begin(), vias.end(), ViaSort );
  347. vias.erase( std::unique( vias.begin(), vias.end(),
  348. []( const VIA* a, const VIA* b ) { return ViaSort( a, b ) == false; } ),
  349. vias.end() );
  350. // Emit vias pads
  351. for( auto item : vias )
  352. {
  353. VIA* via = static_cast<VIA*>( item );
  354. viastacks.push_back( via );
  355. fprintf( aFile, "PAD V%d.%d.%s ROUND %g\nCIRCLE 0 0 %g\n",
  356. via->GetWidth(), via->GetDrillValue(),
  357. fmt_mask( via->GetLayerSet() & master_layermask ).c_str(),
  358. via->GetDrillValue() / SCALE_FACTOR,
  359. via->GetWidth() / (SCALE_FACTOR * 2) );
  360. }
  361. // Emit component pads
  362. D_PAD* old_pad = 0;
  363. int pad_name_number = 0;
  364. for( unsigned i = 0; i<pads.size(); ++i )
  365. {
  366. D_PAD* pad = pads[i];
  367. const wxPoint& off = pad->GetOffset();
  368. pad->SetSubRatsnest( pad_name_number );
  369. if( old_pad && 0==D_PAD::Compare( old_pad, pad ) )
  370. continue; // already created
  371. old_pad = pad;
  372. pad_name_number++;
  373. pad->SetSubRatsnest( pad_name_number );
  374. fprintf( aFile, "PAD P%d", pad->GetSubRatsnest() );
  375. padstacks.push_back( pad ); // Will have its own padstack later
  376. int dx = pad->GetSize().x / 2;
  377. int dy = pad->GetSize().y / 2;
  378. switch( pad->GetShape() )
  379. {
  380. default:
  381. wxASSERT_MSG( false, "Pad type not implemented" );
  382. // fall-through
  383. case PAD_SHAPE_CIRCLE:
  384. fprintf( aFile, " ROUND %g\n",
  385. pad->GetDrillSize().x / SCALE_FACTOR );
  386. /* Circle is center, radius */
  387. fprintf( aFile, "CIRCLE %g %g %g\n",
  388. off.x / SCALE_FACTOR,
  389. -off.y / SCALE_FACTOR,
  390. pad->GetSize().x / (SCALE_FACTOR * 2) );
  391. break;
  392. case PAD_SHAPE_RECT:
  393. fprintf( aFile, " RECTANGULAR %g\n",
  394. pad->GetDrillSize().x / SCALE_FACTOR );
  395. // Rectangle is begin, size *not* begin, end!
  396. fprintf( aFile, "RECTANGLE %g %g %g %g\n",
  397. (-dx + off.x ) / SCALE_FACTOR,
  398. (-dy - off.y ) / SCALE_FACTOR,
  399. dx / (SCALE_FACTOR / 2), dy / (SCALE_FACTOR / 2) );
  400. break;
  401. case PAD_SHAPE_ROUNDRECT:
  402. case PAD_SHAPE_OVAL:
  403. {
  404. const wxSize& size = pad->GetSize();
  405. int radius;
  406. if( pad->GetShape() == PAD_SHAPE_ROUNDRECT )
  407. radius = pad->GetRoundRectCornerRadius();
  408. else
  409. radius = std::min( size.x, size.y ) / 2;
  410. int lineX = size.x / 2 - radius;
  411. int lineY = size.y / 2 - radius;
  412. fprintf( aFile, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );
  413. // bottom left arc
  414. fprintf( aFile, "ARC %g %g %g %g %g %g\n",
  415. ( off.x - lineX - radius ) / SCALE_FACTOR,
  416. ( -off.y - lineY ) / SCALE_FACTOR, ( off.x - lineX ) / SCALE_FACTOR,
  417. ( -off.y - lineY - radius ) / SCALE_FACTOR,
  418. ( off.x - lineX ) / SCALE_FACTOR, ( -off.y - lineY ) / SCALE_FACTOR );
  419. // bottom line
  420. if( lineX > 0 )
  421. {
  422. fprintf( aFile, "LINE %g %g %g %g\n",
  423. ( off.x - lineX ) / SCALE_FACTOR,
  424. ( -off.y - lineY - radius ) / SCALE_FACTOR,
  425. ( off.x + lineX ) / SCALE_FACTOR,
  426. ( -off.y - lineY - radius ) / SCALE_FACTOR );
  427. }
  428. // bottom right arc
  429. fprintf( aFile, "ARC %g %g %g %g %g %g\n",
  430. ( off.x + lineX ) / SCALE_FACTOR,
  431. ( -off.y - lineY - radius ) / SCALE_FACTOR,
  432. ( off.x + lineX + radius ) / SCALE_FACTOR,
  433. ( -off.y - lineY ) / SCALE_FACTOR, ( off.x + lineX ) / SCALE_FACTOR,
  434. ( -off.y - lineY ) / SCALE_FACTOR );
  435. // right line
  436. if( lineY > 0 )
  437. {
  438. fprintf( aFile, "LINE %g %g %g %g\n",
  439. ( off.x + lineX + radius ) / SCALE_FACTOR,
  440. ( -off.y + lineY ) / SCALE_FACTOR,
  441. ( off.x + lineX + radius ) / SCALE_FACTOR,
  442. ( -off.y - lineY ) / SCALE_FACTOR );
  443. }
  444. // top right arc
  445. fprintf( aFile, "ARC %g %g %g %g %g %g\n",
  446. ( off.x + lineX + radius ) / SCALE_FACTOR,
  447. ( -off.y + lineY ) / SCALE_FACTOR, ( off.x + lineX ) / SCALE_FACTOR,
  448. ( -off.y + lineY + radius ) / SCALE_FACTOR,
  449. ( off.x + lineX ) / SCALE_FACTOR, ( -off.y + lineY ) / SCALE_FACTOR );
  450. // top line
  451. if( lineX > 0 )
  452. {
  453. fprintf( aFile, "LINE %g %g %g %g\n"
  454. , ( off.x - lineX ) / SCALE_FACTOR,
  455. ( -off.y + lineY + radius ) / SCALE_FACTOR,
  456. ( off.x + lineX ) / SCALE_FACTOR,
  457. ( -off.y + lineY + radius ) / SCALE_FACTOR );
  458. }
  459. // top left arc
  460. fprintf( aFile, "ARC %g %g %g %g %g %g\n",
  461. ( off.x - lineX ) / SCALE_FACTOR,
  462. ( -off.y + lineY + radius ) / SCALE_FACTOR,
  463. ( off.x - lineX - radius ) / SCALE_FACTOR,
  464. ( -off.y + lineY ) / SCALE_FACTOR, ( off.x - lineX ) / SCALE_FACTOR,
  465. ( -off.y + lineY ) / SCALE_FACTOR );
  466. // left line
  467. if( lineY > 0 )
  468. {
  469. fprintf( aFile, "LINE %g %g %g %g\n",
  470. ( off.x - lineX - radius ) / SCALE_FACTOR,
  471. ( -off.y - lineY ) / SCALE_FACTOR,
  472. ( off.x - lineX - radius ) / SCALE_FACTOR,
  473. ( -off.y + lineY ) / SCALE_FACTOR );
  474. }
  475. }
  476. break;
  477. case PAD_SHAPE_TRAPEZOID:
  478. {
  479. fprintf( aFile, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );
  480. wxPoint poly[4];
  481. pad->BuildPadPolygon( poly, wxSize( 0, 0 ), 0 );
  482. for( int cur = 0; cur < 4; ++cur )
  483. {
  484. int next = ( cur + 1 ) % 4;
  485. fprintf( aFile, "LINE %g %g %g %g\n",
  486. ( off.x + poly[cur].x ) / SCALE_FACTOR,
  487. ( -off.y - poly[cur].y ) / SCALE_FACTOR,
  488. ( off.x + poly[next].x ) / SCALE_FACTOR,
  489. ( -off.y - poly[next].y ) / SCALE_FACTOR );
  490. }
  491. }
  492. break;
  493. case PAD_SHAPE_CUSTOM:
  494. {
  495. fprintf( aFile, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );
  496. const SHAPE_POLY_SET& outline = pad->GetCustomShapeAsPolygon();
  497. for( int jj = 0; jj < outline.OutlineCount(); ++jj )
  498. {
  499. const SHAPE_LINE_CHAIN& poly = outline.COutline( jj );
  500. int pointCount = poly.PointCount();
  501. for( int ii = 0; ii < pointCount; ii++ )
  502. {
  503. int next = ( ii + 1 ) % pointCount;
  504. fprintf( aFile, "LINE %g %g %g %g\n",
  505. ( off.x + poly.CPoint( ii ).x ) / SCALE_FACTOR,
  506. ( -off.y - poly.CPoint( ii ).y ) / SCALE_FACTOR,
  507. ( off.x + poly.CPoint( next ).x ) / SCALE_FACTOR,
  508. ( -off.y - poly.CPoint( next ).y ) / SCALE_FACTOR );
  509. }
  510. }
  511. }
  512. break;
  513. }
  514. }
  515. fputs( "\n$ENDPADS\n\n", aFile );
  516. // Now emit the padstacks definitions, using the combined layer masks
  517. fputs( "$PADSTACKS\n", aFile );
  518. // Via padstacks
  519. for( unsigned i = 0; i < viastacks.size(); i++ )
  520. {
  521. VIA* via = viastacks[i];
  522. LSET mask = via->GetLayerSet() & master_layermask;
  523. fprintf( aFile, "PADSTACK VIA%d.%d.%s %g\n",
  524. via->GetWidth(), via->GetDrillValue(),
  525. fmt_mask( mask ).c_str(),
  526. via->GetDrillValue() / SCALE_FACTOR );
  527. for( LSEQ seq = mask.Seq( gc_seq, arrayDim( gc_seq ) ); seq; ++seq )
  528. {
  529. PCB_LAYER_ID layer = *seq;
  530. fprintf( aFile, "PAD V%d.%d.%s %s 0 0\n",
  531. via->GetWidth(), via->GetDrillValue(),
  532. fmt_mask( mask ).c_str(),
  533. GenCADLayerName( cu_count, layer ).c_str()
  534. );
  535. }
  536. }
  537. /* Component padstacks
  538. * Older versions of CAM350 don't apply correctly the FLIP semantics for
  539. * padstacks, i.e. doesn't swap the top and bottom layers... so I need to
  540. * define the shape as MIRRORX and define a separate 'flipped' padstack...
  541. * until it appears yet another noncompliant importer */
  542. for( unsigned i = 1; i < padstacks.size(); i++ )
  543. {
  544. D_PAD* pad = padstacks[i];
  545. // Straight padstack
  546. fprintf( aFile, "PADSTACK PAD%u %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR );
  547. LSET pad_set = pad->GetLayerSet() & master_layermask;
  548. // the special gc_seq
  549. for( LSEQ seq = pad_set.Seq( gc_seq, arrayDim( gc_seq ) ); seq; ++seq )
  550. {
  551. PCB_LAYER_ID layer = *seq;
  552. fprintf( aFile, "PAD P%u %s 0 0\n", i, GenCADLayerName( cu_count, layer ).c_str() );
  553. }
  554. // Flipped padstack
  555. if( flipBottomPads )
  556. {
  557. fprintf( aFile, "PADSTACK PAD%uF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR );
  558. // the normal PCB_LAYER_ID sequence is inverted from gc_seq[]
  559. for( LSEQ seq = pad_set.Seq(); seq; ++seq )
  560. {
  561. PCB_LAYER_ID layer = *seq;
  562. fprintf( aFile, "PAD P%u %s 0 0\n", i, GenCADLayerNameFlipped( cu_count, layer ).c_str() );
  563. }
  564. }
  565. }
  566. fputs( "$ENDPADSTACKS\n\n", aFile );
  567. }
  568. /// Compute hashes for modules without taking into account their position, rotation or layer
  569. static size_t hashModule( const MODULE* aModule )
  570. {
  571. size_t ret = 0x11223344;
  572. constexpr int flags = HASH_FLAGS::POSITION | HASH_FLAGS::REL_COORD
  573. | HASH_FLAGS::ROTATION | HASH_FLAGS::LAYER;
  574. for( auto i : aModule->GraphicalItems() )
  575. ret ^= hash_eda( i, flags );
  576. for( auto i : aModule->Pads() )
  577. ret ^= hash_eda( i, flags );
  578. return ret;
  579. }
  580. /* Creates the footprint shape list.
  581. * Since module shape is customizable after the placement we cannot share them;
  582. * instead we opt for the one-module-one-shape-one-component-one-device approach
  583. */
  584. static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
  585. {
  586. const char* layer;
  587. wxString pinname;
  588. const char* mirror = "0";
  589. std::map<wxString, size_t> shapes;
  590. fputs( "$SHAPES\n", aFile );
  591. for( auto module : aPcb->Modules() )
  592. {
  593. if( !individualShapes )
  594. {
  595. // Check if such shape has been already generated, and if so - reuse it
  596. // It is necessary to compute hash (i.e. check all children objects) as
  597. // certain components instances might have been modified on the board.
  598. // In such case the shape will be different despite the same LIB_ID.
  599. wxString shapeName = module->GetFPID().Format();
  600. auto shapeIt = shapes.find( shapeName );
  601. size_t modHash = hashModule( module );
  602. if( shapeIt != shapes.end() )
  603. {
  604. if( modHash != shapeIt->second )
  605. {
  606. // there is an entry for this footprint, but it has a modified shape,
  607. // so we need to create a new entry
  608. wxString newShapeName;
  609. int suffix = 0;
  610. // find an unused name or matching entry
  611. do
  612. {
  613. newShapeName = wxString::Format( "%s_%d", shapeName, suffix );
  614. shapeIt = shapes.find( newShapeName );
  615. ++suffix;
  616. }
  617. while( shapeIt != shapes.end() && shapeIt->second != modHash );
  618. shapeName = newShapeName;
  619. }
  620. if( shapeIt != shapes.end() && modHash == shapeIt->second )
  621. {
  622. // shape found, so reuse it
  623. componentShapes[module] = modHash;
  624. continue;
  625. }
  626. }
  627. // new shape
  628. componentShapes[module] = modHash;
  629. shapeNames[modHash] = shapeName;
  630. shapes[shapeName] = modHash;
  631. FootprintWriteShape( aFile, module, shapeName );
  632. }
  633. else // individual shape for each component
  634. {
  635. FootprintWriteShape( aFile, module, module->GetReference() );
  636. }
  637. // set of already emitted pins to check for duplicates
  638. std::set<wxString> pins;
  639. for( auto pad : module->Pads() )
  640. {
  641. /* Padstacks are defined using the correct layers for the pads, therefore to
  642. * all pads need to be marked as TOP to use the padstack information correctly.
  643. */
  644. layer = "TOP";
  645. pinname = pad->GetName();
  646. if( pinname.IsEmpty() )
  647. pinname = wxT( "none" );
  648. if( uniquePins )
  649. {
  650. int suffix = 0;
  651. wxString origPinname( pinname );
  652. auto it = pins.find( pinname );
  653. while( it != pins.end() )
  654. {
  655. pinname = wxString::Format( "%s_%d", origPinname, suffix );
  656. ++suffix;
  657. it = pins.find( pinname );
  658. }
  659. pins.insert( pinname );
  660. }
  661. double orient = pad->GetOrientation() - module->GetOrientation();
  662. NORMALIZE_ANGLE_POS( orient );
  663. // Bottom side modules use the flipped padstack
  664. fprintf( aFile, ( flipBottomPads && module->GetFlag() ) ?
  665. "PIN \"%s\" PAD%dF %g %g %s %g %s\n" :
  666. "PIN \"%s\" PAD%d %g %g %s %g %s\n",
  667. TO_UTF8( escapeString( pinname ) ), pad->GetSubRatsnest(),
  668. pad->GetPos0().x / SCALE_FACTOR,
  669. -pad->GetPos0().y / SCALE_FACTOR,
  670. layer, orient / 10.0, mirror );
  671. }
  672. }
  673. fputs( "$ENDSHAPES\n\n", aFile );
  674. }
  675. /* Creates the section $COMPONENTS (Footprints placement)
  676. * Bottom side components are difficult to handle: shapes must be mirrored or
  677. * flipped, silk layers need to be handled correctly and so on. Also it seems
  678. * that *noone* follows the specs...
  679. */
  680. static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
  681. {
  682. fputs( "$COMPONENTS\n", aFile );
  683. int cu_count = aPcb->GetCopperLayerCount();
  684. for( auto module : aPcb->Modules() )
  685. {
  686. const char* mirror;
  687. const char* flip;
  688. double fp_orient = module->GetOrientation();
  689. if( module->GetFlag() )
  690. {
  691. mirror = "MIRRORX";
  692. flip = "FLIP";
  693. NEGATE_AND_NORMALIZE_ANGLE_POS( fp_orient );
  694. }
  695. else
  696. {
  697. mirror = "0";
  698. flip = "0";
  699. }
  700. fprintf( aFile, "\nCOMPONENT \"%s\"\n",
  701. TO_UTF8( escapeString( module->GetReference() ) ) );
  702. fprintf( aFile, "DEVICE \"DEV_%s\"\n",
  703. TO_UTF8( escapeString( getShapeName( module ) ) ) );
  704. fprintf( aFile, "PLACE %g %g\n",
  705. MapXTo( module->GetPosition().x ),
  706. MapYTo( module->GetPosition().y ) );
  707. fprintf( aFile, "LAYER %s\n",
  708. module->GetFlag() ? "BOTTOM" : "TOP" );
  709. fprintf( aFile, "ROTATION %g\n",
  710. fp_orient / 10.0 );
  711. fprintf( aFile, "SHAPE \"%s\" %s %s\n",
  712. TO_UTF8( escapeString( getShapeName( module ) ) ),
  713. mirror, flip );
  714. // Text on silk layer: RefDes and value (are they actually useful?)
  715. TEXTE_MODULE *textmod = &module->Reference();
  716. for( int ii = 0; ii < 2; ii++ )
  717. {
  718. double txt_orient = textmod->GetTextAngle();
  719. std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS );
  720. fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
  721. textmod->GetPos0().x / SCALE_FACTOR,
  722. -textmod->GetPos0().y / SCALE_FACTOR,
  723. textmod->GetTextWidth() / SCALE_FACTOR,
  724. txt_orient / 10.0,
  725. mirror,
  726. layer.c_str(),
  727. TO_UTF8( escapeString( textmod->GetText() ) ) );
  728. // Please note, the width is approx
  729. fprintf( aFile, " 0 0 %g %g\n",
  730. ( textmod->GetTextWidth() * textmod->GetLength() ) / SCALE_FACTOR,
  731. textmod->GetTextHeight() / SCALE_FACTOR );
  732. textmod = &module->Value(); // Dirty trick for the second iteration
  733. }
  734. // The SHEET is a 'generic description' for referencing the component
  735. fprintf( aFile, "SHEET \"RefDes: %s, Value: %s\"\n",
  736. TO_UTF8( module->GetReference() ),
  737. TO_UTF8( module->GetValue() ) );
  738. }
  739. fputs( "$ENDCOMPONENTS\n\n", aFile );
  740. }
  741. /* Emit the netlist (which is actually the thing for which GenCAD is used these
  742. * days!); tracks are handled later */
  743. static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
  744. {
  745. wxString msg;
  746. NETINFO_ITEM* net;
  747. int NbNoConn = 1;
  748. fputs( "$SIGNALS\n", aFile );
  749. for( unsigned ii = 0; ii < aPcb->GetNetCount(); ii++ )
  750. {
  751. net = aPcb->FindNet( ii );
  752. if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
  753. {
  754. msg.Printf( "NoConnection%d", NbNoConn++ );
  755. }
  756. if( net->GetNet() <= 0 ) // dummy netlist (no connection)
  757. continue;
  758. msg = wxT( "SIGNAL \"" ) + escapeString( net->GetNetname() ) + "\"";
  759. fputs( TO_UTF8( msg ), aFile );
  760. fputs( "\n", aFile );
  761. for( auto module : aPcb->Modules() )
  762. {
  763. for( auto pad : module->Pads() )
  764. {
  765. if( pad->GetNetCode() != net->GetNet() )
  766. continue;
  767. msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
  768. GetChars( escapeString( module->GetReference() ) ),
  769. GetChars( escapeString( pad->GetName() ) ) );
  770. fputs( TO_UTF8( msg ), aFile );
  771. fputs( "\n", aFile );
  772. }
  773. }
  774. }
  775. fputs( "$ENDSIGNALS\n\n", aFile );
  776. }
  777. // Creates the header section
  778. static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
  779. {
  780. wxString msg;
  781. BOARD *board = aFrame->GetBoard();
  782. fputs( "$HEADER\n", aFile );
  783. fputs( "GENCAD 1.4\n", aFile );
  784. // Please note: GenCAD syntax requires quoted strings if they can contain spaces
  785. msg.Printf( wxT( "USER \"%s %s\"\n" ),
  786. GetChars( Pgm().App().GetAppName() ),
  787. GetChars( GetBuildVersion() ) );
  788. fputs( TO_UTF8( msg ), aFile );
  789. msg = wxT( "DRAWING \"" ) + board->GetFileName() + wxT( "\"\n" );
  790. fputs( TO_UTF8( msg ), aFile );
  791. const TITLE_BLOCK& tb = aFrame->GetTitleBlock();
  792. msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" );
  793. fputs( TO_UTF8( msg ), aFile );
  794. fputs( "UNITS INCH\n", aFile );
  795. // giving 0 as the argument to Map{X,Y}To returns the scaled origin point
  796. msg.Printf( wxT( "ORIGIN %g %g\n" ),
  797. storeOriginCoords ? MapXTo( 0 ) : 0,
  798. storeOriginCoords ? MapYTo( 0 ) : 0 );
  799. fputs( TO_UTF8( msg ), aFile );
  800. fputs( "INTERTRACK 0\n", aFile );
  801. fputs( "$ENDHEADER\n\n", aFile );
  802. return true;
  803. }
  804. /* Creates the section ROUTES
  805. * that handles tracks, vias
  806. * TODO: add zones
  807. * section:
  808. * $ROUTE
  809. * ...
  810. * $ENROUTE
  811. * Track segments must be sorted by nets
  812. */
  813. static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
  814. {
  815. int vianum = 1;
  816. int old_netcode, old_width, old_layer;
  817. LSET master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
  818. int cu_count = aPcb->GetCopperLayerCount();
  819. TRACKS tracks( aPcb->Tracks() );
  820. std::sort( tracks.begin(), tracks.end(), []( const TRACK* a, const TRACK* b ) {
  821. if( a->GetNetCode() == b->GetNetCode() )
  822. {
  823. if( a->GetWidth() == b->GetWidth() )
  824. return ( a->GetLayer() < b->GetLayer() );
  825. return ( a->GetWidth() < b->GetWidth() );
  826. }
  827. return ( a->GetNetCode() < b->GetNetCode() );
  828. } );
  829. fputs( "$ROUTES\n", aFile );
  830. old_netcode = -1; old_width = -1; old_layer = -1;
  831. for( auto track : tracks )
  832. {
  833. if( old_netcode != track->GetNetCode() )
  834. {
  835. old_netcode = track->GetNetCode();
  836. NETINFO_ITEM* net = track->GetNet();
  837. wxString netname;
  838. if( net && (net->GetNetname() != wxEmptyString) )
  839. netname = net->GetNetname();
  840. else
  841. netname = wxT( "_noname_" );
  842. fprintf( aFile, "ROUTE \"%s\"\n", TO_UTF8( escapeString( netname ) ) );
  843. }
  844. if( old_width != track->GetWidth() )
  845. {
  846. old_width = track->GetWidth();
  847. fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() );
  848. }
  849. if( track->Type() == PCB_TRACE_T )
  850. {
  851. if( old_layer != track->GetLayer() )
  852. {
  853. old_layer = track->GetLayer();
  854. fprintf( aFile, "LAYER %s\n",
  855. GenCADLayerName( cu_count, track->GetLayer() ).c_str() );
  856. }
  857. fprintf( aFile, "LINE %g %g %g %g\n",
  858. MapXTo( track->GetStart().x ), MapYTo( track->GetStart().y ),
  859. MapXTo( track->GetEnd().x ), MapYTo( track->GetEnd().y ) );
  860. }
  861. if( track->Type() == PCB_VIA_T )
  862. {
  863. const VIA* via = static_cast<const VIA*>(track);
  864. LSET vset = via->GetLayerSet() & master_layermask;
  865. fprintf( aFile, "VIA VIA%d.%d.%s %g %g ALL %g via%d\n",
  866. via->GetWidth(), via->GetDrillValue(),
  867. fmt_mask( vset ).c_str(),
  868. MapXTo( via->GetStart().x ), MapYTo( via->GetStart().y ),
  869. via->GetDrillValue() / SCALE_FACTOR, vianum++ );
  870. }
  871. }
  872. fputs( "$ENDROUTES\n\n", aFile );
  873. }
  874. /* Creates the section $DEVICES
  875. * This is a list of footprints properties
  876. * ( Shapes are in section $SHAPE )
  877. */
  878. static void CreateDevicesSection( FILE* aFile, BOARD* aPcb )
  879. {
  880. std::set<wxString> emitted;
  881. fputs( "$DEVICES\n", aFile );
  882. for( const auto& componentShape : componentShapes )
  883. {
  884. const wxString& shapeName = shapeNames[componentShape.second];
  885. bool newDevice;
  886. std::tie( std::ignore, newDevice ) = emitted.insert( shapeName );
  887. if( !newDevice ) // do not repeat device definitions
  888. continue;
  889. const MODULE* module = componentShape.first;
  890. fprintf( aFile, "\nDEVICE \"DEV_%s\"\n", TO_UTF8( escapeString( shapeName ) ) );
  891. fprintf( aFile, "PART \"%s\"\n", TO_UTF8( escapeString( module->GetValue() ) ) );
  892. fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( escapeString( module->GetFPID().Format() ) ) );
  893. // The TYPE attribute is almost freeform
  894. const char* ty = "TH";
  895. if( module->GetAttributes() & MOD_CMS )
  896. ty = "SMD";
  897. if( module->GetAttributes() & MOD_VIRTUAL )
  898. ty = "VIRTUAL";
  899. fprintf( aFile, "TYPE %s\n", ty );
  900. }
  901. fputs( "$ENDDEVICES\n\n", aFile );
  902. }
  903. /* Creates the section $BOARD.
  904. * We output here only the board perimeter
  905. */
  906. static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
  907. {
  908. fputs( "$BOARD\n", aFile );
  909. // Extract the board edges
  910. for( auto drawing : aPcb->Drawings() )
  911. {
  912. if( drawing->Type() == PCB_LINE_T )
  913. {
  914. DRAWSEGMENT* drawseg = static_cast<DRAWSEGMENT*>( drawing );
  915. if( drawseg->GetLayer() == Edge_Cuts )
  916. {
  917. // XXX GenCAD supports arc boundaries but I've seen nothing that reads them
  918. fprintf( aFile, "LINE %g %g %g %g\n",
  919. MapXTo( drawseg->GetStart().x ), MapYTo( drawseg->GetStart().y ),
  920. MapXTo( drawseg->GetEnd().x ), MapYTo( drawseg->GetEnd().y ) );
  921. }
  922. }
  923. }
  924. fputs( "$ENDBOARD\n\n", aFile );
  925. }
  926. /* Creates the section "$TRACKS"
  927. * This sections give the list of widths (tools) used in tracks and vias
  928. * format:
  929. * $TRACK
  930. * TRACK <name> <width>
  931. * $ENDTRACK
  932. *
  933. * Each tool name is build like this: "TRACK" + track width.
  934. * For instance for a width = 120 : name = "TRACK120".
  935. */
  936. static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
  937. {
  938. // Find thickness used for traces
  939. std::set<int> trackinfo;
  940. for( auto track : aPcb->Tracks() )
  941. trackinfo.insert( track->GetWidth() );
  942. // Write data
  943. fputs( "$TRACKS\n", aFile );
  944. for( auto size : trackinfo )
  945. fprintf( aFile, "TRACK TRACK%d %g\n", size, size / SCALE_FACTOR );
  946. fputs( "$ENDTRACKS\n\n", aFile );
  947. }
  948. /* Creates the shape of a footprint (section SHAPE)
  949. * The shape is always given "normal" (Orient 0, not mirrored)
  950. * It's almost guaranteed that the silk layer will be imported wrong but
  951. * the shape also contains the pads!
  952. */
  953. static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aShapeName )
  954. {
  955. EDGE_MODULE* PtEdge;
  956. /* creates header: */
  957. fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
  958. if( module->GetAttributes() & MOD_VIRTUAL )
  959. {
  960. fprintf( aFile, "INSERT SMD\n" );
  961. }
  962. else
  963. {
  964. if( module->GetAttributes() & MOD_CMS )
  965. {
  966. fprintf( aFile, "INSERT SMD\n" );
  967. }
  968. else
  969. {
  970. fprintf( aFile, "INSERT TH\n" );
  971. }
  972. }
  973. #if 0 /* ATTRIBUTE name and value is unspecified and the original exporter
  974. * got the syntax wrong, so CAM350 rejected the whole shape! */
  975. if( module->m_Attributs != MOD_DEFAULT )
  976. {
  977. fprintf( aFile, "ATTRIBUTE" );
  978. if( module->m_Attributs & MOD_CMS )
  979. fprintf( aFile, " PAD_SMD" );
  980. if( module->m_Attributs & MOD_VIRTUAL )
  981. fprintf( aFile, " VIRTUAL" );
  982. fprintf( aFile, "\n" );
  983. }
  984. #endif
  985. // Silk outline; wildly interpreted by various importers:
  986. // CAM350 read it right but only closed shapes
  987. // ProntoPlace double-flip it (at least the pads are correct)
  988. // GerberTool usually get it right...
  989. for( auto PtStruct : module->GraphicalItems() )
  990. {
  991. switch( PtStruct->Type() )
  992. {
  993. case PCB_MODULE_TEXT_T:
  994. // If we wanted to export text, this is not the correct section
  995. break;
  996. case PCB_MODULE_EDGE_T:
  997. PtEdge = (EDGE_MODULE*) PtStruct;
  998. if( PtEdge->GetLayer() == F_SilkS
  999. || PtEdge->GetLayer() == B_SilkS )
  1000. {
  1001. switch( PtEdge->GetShape() )
  1002. {
  1003. case S_SEGMENT:
  1004. fprintf( aFile, "LINE %g %g %g %g\n",
  1005. PtEdge->m_Start0.x / SCALE_FACTOR,
  1006. -PtEdge->m_Start0.y / SCALE_FACTOR,
  1007. PtEdge->m_End0.x / SCALE_FACTOR,
  1008. -PtEdge->m_End0.y / SCALE_FACTOR );
  1009. break;
  1010. case S_CIRCLE:
  1011. {
  1012. int radius = KiROUND( GetLineLength( PtEdge->m_End0,
  1013. PtEdge->m_Start0 ) );
  1014. fprintf( aFile, "CIRCLE %g %g %g\n",
  1015. PtEdge->m_Start0.x / SCALE_FACTOR,
  1016. -PtEdge->m_Start0.y / SCALE_FACTOR,
  1017. radius / SCALE_FACTOR );
  1018. break;
  1019. }
  1020. case S_ARC:
  1021. {
  1022. int arcendx, arcendy;
  1023. arcendx = PtEdge->m_End0.x - PtEdge->m_Start0.x;
  1024. arcendy = PtEdge->m_End0.y - PtEdge->m_Start0.y;
  1025. RotatePoint( &arcendx, &arcendy, -PtEdge->GetAngle() );
  1026. arcendx += PtEdge->GetStart0().x;
  1027. arcendy += PtEdge->GetStart0().y;
  1028. fprintf( aFile, "ARC %g %g %g %g %g %g\n",
  1029. PtEdge->m_End0.x / SCALE_FACTOR,
  1030. -PtEdge->GetEnd0().y / SCALE_FACTOR,
  1031. arcendx / SCALE_FACTOR,
  1032. -arcendy / SCALE_FACTOR,
  1033. PtEdge->GetStart0().x / SCALE_FACTOR,
  1034. -PtEdge->GetStart0().y / SCALE_FACTOR );
  1035. break;
  1036. }
  1037. case S_POLYGON:
  1038. // Not exported (TODO)
  1039. break;
  1040. default:
  1041. DisplayError( NULL, wxString::Format( "Type Edge Module %d invalid.", PtStruct->Type() ) );
  1042. break;
  1043. }
  1044. }
  1045. break;
  1046. default:
  1047. break;
  1048. }
  1049. }
  1050. }