From 84151990cdede3bfdefe80c261e708a425c5cd35 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 9 Apr 2018 20:56:27 +0100 Subject: [PATCH] Don't set dirty bit when adding MARKERs. They're not saved in the file, so they shouldn't dirty it. Fixes: lp:1762497 * https://bugs.launchpad.net/kicad/+bug/1762497 --- include/commit.h | 3 ++- pcbnew/board_commit.cpp | 6 ++++-- pcbnew/board_commit.h | 4 +++- pcbnew/drc.cpp | 4 ++-- pcbnew/drc_clearance_test_functions.cpp | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/commit.h b/include/commit.h index f5c3de31ed..9498a51753 100644 --- a/include/commit.h +++ b/include/commit.h @@ -130,7 +130,8 @@ public: COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag = UR_UNSPECIFIED ); ///> Executes the changes. - virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) = 0; + virtual void Push( const wxString& aMessage = wxT( "A commit" ), + bool aCreateUndoEntry = true, bool aSetDirtyBit = true ) = 0; ///> Revertes the commit by restoring the modifed items state. virtual void Revert() = 0; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 57e0e6800f..81fbdb7c8e 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -56,7 +56,7 @@ BOARD_COMMIT::~BOARD_COMMIT() } -void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) +void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool aSetDirtyBit ) { // Objects potentially interested in changes: PICKED_ITEMS_LIST undoList; @@ -283,7 +283,9 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) panel->RedrawRatsnest(); } - frame->OnModify(); + if( aSetDirtyBit ) + frame->OnModify(); + frame->UpdateMsgPanel(); clear(); diff --git a/pcbnew/board_commit.h b/pcbnew/board_commit.h index fea964d298..ab33fe212b 100644 --- a/pcbnew/board_commit.h +++ b/pcbnew/board_commit.h @@ -42,7 +42,9 @@ public: virtual ~BOARD_COMMIT(); - virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) override; + virtual void Push( const wxString& aMessage = wxT( "A commit" ), + bool aCreateUndoEntry = true, bool aSetDirtyBit = true ) override; + virtual void Revert() override; private: diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 34fcc39d4a..a20cb39d11 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -99,7 +99,7 @@ void DRC::addMarkerToPcb( MARKER_PCB* aMarker ) { BOARD_COMMIT commit( m_pcbEditorFrame ); commit.Add( aMarker ); - commit.Push( wxEmptyString, false ); + commit.Push( wxEmptyString, false, false ); } @@ -339,7 +339,7 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers ) } if( aCreateMarkers ) - commit.Push( wxEmptyString, false ); + commit.Push( wxEmptyString, false, false ); return nerrors; } diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index 73e9d814aa..b49c34a88e 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -152,7 +152,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) for( auto marker : markers ) commit.Add( marker ); - commit.Push( wxEmptyString, false ); + commit.Push( wxEmptyString, false, false ); }; // Returns false if we should return false from call site, or true to continue