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.

134 lines
3.8 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
14 years ago
14 years ago
  1. /*
  2. * @file zones_by_polygon_fill_functions.cpp
  3. */
  4. /*
  5. * This program source code file is part of KiCad, a free EDA CAD application.
  6. *
  7. * Copyright (C) 2009 Jean-Pierre Charras jp.charras at wanadoo.fr
  8. * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, you may find one here:
  22. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  23. * or you may search the http://www.gnu.org website for the version 2 license,
  24. * or you may write to the Free Software Foundation, Inc.,
  25. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  26. */
  27. #include <wx/progdlg.h>
  28. #include <fctsys.h>
  29. #include <pgm_base.h>
  30. #include <class_drawpanel.h>
  31. #include <class_draw_panel_gal.h>
  32. #include <ratsnest_data.h>
  33. #include <pcb_edit_frame.h>
  34. #include <macros.h>
  35. #include <tool/tool_manager.h>
  36. #include <tools/pcb_actions.h>
  37. #include <class_board.h>
  38. #include <class_track.h>
  39. #include <class_zone.h>
  40. #include <pcbnew.h>
  41. #include <zones.h>
  42. #include <connectivity_data.h>
  43. #include <board_commit.h>
  44. #include <widgets/progress_reporter.h>
  45. #include <zone_filler.h>
  46. /**
  47. * Function Delete_OldZone_Fill (obsolete)
  48. * Used for compatibility with old boards
  49. * Remove the zone filling which include the segment aZone, or the zone which have the
  50. * given time stamp.
  51. * A zone is a group of segments which have the same TimeStamp
  52. * @param aZone = zone segment within the zone to delete. Can be NULL
  53. * @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
  54. */
  55. void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, timestamp_t aTimestamp )
  56. {
  57. bool modify = false;
  58. timestamp_t TimeStamp;
  59. if( aZone == NULL )
  60. TimeStamp = aTimestamp;
  61. else
  62. TimeStamp = aZone->GetTimeStamp(); // Save reference time stamp (aZone will be deleted)
  63. // SEGZONE is a deprecated item, only used for compatibility with very old boards
  64. SEGZONE* next;
  65. for( SEGZONE* zone = GetBoard()->m_SegZoneDeprecated; zone != NULL; zone = next )
  66. {
  67. next = zone->Next();
  68. if( zone->GetTimeStamp() == TimeStamp )
  69. {
  70. modify = true;
  71. // remove item from linked list and free memory
  72. zone->DeleteStructure();
  73. }
  74. }
  75. if( modify )
  76. {
  77. OnModify();
  78. m_canvas->Refresh();
  79. }
  80. }
  81. int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow* aActiveWindow )
  82. {
  83. auto toolMgr = GetToolManager();
  84. wxCHECK( toolMgr, 1 );
  85. toolMgr->RunAction( PCB_ACTIONS::zoneFillAll, true );
  86. return 0;
  87. }
  88. void PCB_EDIT_FRAME::Check_All_Zones( wxWindow* aActiveWindow )
  89. {
  90. if( !m_ZoneFillsDirty )
  91. return;
  92. std::vector<ZONE_CONTAINER*> toFill;
  93. for( auto zone : GetBoard()->Zones() )
  94. toFill.push_back(zone);
  95. BOARD_COMMIT commit( this );
  96. std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
  97. new WX_PROGRESS_REPORTER( aActiveWindow, _( "Checking Zones" ), 3 ) );
  98. ZONE_FILLER filler( GetBoard(), &commit );
  99. filler.SetProgressReporter( progressReporter.get() );
  100. if( filler.Fill( toFill, true ) )
  101. {
  102. m_ZoneFillsDirty = false;
  103. if( IsGalCanvasActive() && GetGalCanvas() )
  104. GetGalCanvas()->ForceRefresh();
  105. GetCanvas()->Refresh();
  106. }
  107. }