From 73b39e836dccd4d70a81a3df808b8afdcb2925a0 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Mon, 6 Dec 2021 23:07:46 +0000
Subject: [PATCH] Set modify bit when editing page layout.

Fixes https://gitlab.com/kicad/code/kicad/issues/9891
---
 eeschema/tools/sch_editor_control.cpp         | 4 +++-
 pagelayout_editor/tools/pl_editor_control.cpp | 1 +
 pcbnew/tools/board_editor_control.cpp         | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index 5f621843b5..60a6ff4e62 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -132,7 +132,9 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
     DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) );
     dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
 
-    if( dlg.ShowModal() != wxID_OK )
+    if( dlg.ShowModal() )
+        m_frame->OnModify();
+    else
         m_frame->RollbackSchematicFromUndo();
 
     return 0;
diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp
index d30238331e..c1c5c86ac7 100644
--- a/pagelayout_editor/tools/pl_editor_control.cpp
+++ b/pagelayout_editor/tools/pl_editor_control.cpp
@@ -100,6 +100,7 @@ int PL_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
     }
     else
     {
+        m_frame->OnModify();
         m_frame->HardRedraw();
     }
     return 0;
diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp
index 93fb08d44d..d8b8eb715d 100644
--- a/pcbnew/tools/board_editor_control.cpp
+++ b/pcbnew/tools/board_editor_control.cpp
@@ -338,7 +338,9 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
                                                              MAX_PAGE_SIZE_PCBNEW_MILS ) );
     dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
 
-    if( dlg.ShowModal() != wxID_OK )
+    if( dlg.ShowModal() == wxID_OK )
+        m_frame->OnModify();
+    else
         m_frame->RollbackFromUndo();
 
     return 0;