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.

87 lines
3.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 CERN
  5. * Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
  6. * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. #ifndef BOARD_COMMIT_H
  26. #define BOARD_COMMIT_H
  27. #include <commit.h>
  28. class BOARD_ITEM;
  29. class BOARD;
  30. class PICKED_ITEMS_LIST;
  31. class PCB_TOOL_BASE;
  32. class TOOL_MANAGER;
  33. class EDA_DRAW_FRAME;
  34. class TOOL_BASE;
  35. #define SKIP_UNDO 0x0001
  36. #define APPEND_UNDO 0x0002
  37. #define SKIP_SET_DIRTY 0x0004
  38. #define SKIP_CONNECTIVITY 0x0008
  39. #define ZONE_FILL_OP 0x0010
  40. class BOARD_COMMIT : public COMMIT
  41. {
  42. public:
  43. BOARD_COMMIT( TOOL_MANAGER* aToolMgr );
  44. BOARD_COMMIT( EDA_DRAW_FRAME* aFrame );
  45. BOARD_COMMIT( PCB_TOOL_BASE *aTool );
  46. virtual ~BOARD_COMMIT();
  47. BOARD* GetBoard() const;
  48. virtual void Push( const wxString& aMessage = wxT( "A commit" ),
  49. int aCommitFlags = 0 ) override;
  50. virtual void Revert() override;
  51. COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) override;
  52. COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ) override;
  53. COMMIT& Stage( const PICKED_ITEMS_LIST& aItems,
  54. UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED ) override;
  55. /**
  56. * Sets a flag that will cause Push() to resolve net conflicts on track/via clusters instead
  57. * of the default behavior which is to skip updating track/via clusters that have conflicts.
  58. * This is used in the netlist updater to update any clusters that were changed due to pad nets
  59. * changing, but should not be used for other changes as you typically don't want to change
  60. * track/via nets due to temporary conflicts created by board editing operations.
  61. * @param aResolve is true if this commit should resolve conflicting track/via net assignments
  62. */
  63. void SetResolveNetConflicts( bool aResolve = true ) { m_resolveNetConflicts = aResolve; }
  64. private:
  65. virtual EDA_ITEM* parentObject( EDA_ITEM* aItem ) const override;
  66. void dirtyIntersectingZones( BOARD_ITEM* item );
  67. private:
  68. TOOL_MANAGER* m_toolMgr;
  69. bool m_isFootprintEditor;
  70. bool m_isBoardEditor;
  71. bool m_resolveNetConflicts;
  72. };
  73. #endif