Blob Blame History Raw
diff -ru kicad-2010.04.06/eeschema/class_drawsheet.cpp kicad-2010.04.06-new/eeschema/class_drawsheet.cpp
--- kicad-2010.04.06/eeschema/class_drawsheet.cpp	2010-03-24 19:26:04.000000000 +0100
+++ kicad-2010.04.06-new/eeschema/class_drawsheet.cpp	2010-05-01 15:16:14.000000000 +0200
@@ -239,9 +239,11 @@
  * @param aFrame = the schematic frame
  */
 void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
-                              bool                   aRedraw )
+                              bool                   aRedraw,
+                              bool                   aSaveForUndoRedo)
 {
     SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
+    bool isSaved = false;
 
     if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
         return;
@@ -268,6 +270,11 @@
         NextPinsheet = Pinsheet->Next();
         if( HLabel == NULL )   // Hlabel not found: delete pinsheet
         {
+            if( aSaveForUndoRedo && !isSaved )
+            {
+                isSaved = true;
+                aFrame->SaveCopyInUndoList( this, UR_CHANGED);
+            }
             aFrame->OnModify( );
             aFrame->DeleteSheetLabel( false, Pinsheet );
         }
diff -ru kicad-2010.04.06/eeschema/class_drawsheet.h kicad-2010.04.06-new/eeschema/class_drawsheet.h
--- kicad-2010.04.06/eeschema/class_drawsheet.h	2010-03-16 19:22:59.000000000 +0100
+++ kicad-2010.04.06-new/eeschema/class_drawsheet.h	2010-05-01 15:17:22.000000000 +0200
@@ -178,10 +178,12 @@
 
     /** Function CleanupSheet
      * Delete pinsheets which are not corresponding to a hierarchical label
-     * @param aRedraw = true to redraw Sheet
      * @param aFrame = the schematic frame
+     * @param aRedraw = true to redraw Sheet
+     * @param aSaveForUndoRedo = true to put this sheet in UndoRedo list,
+     *          if it is modified.
      */
-    void         CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
+    void         CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw, bool aSaveForUndoRedo );
 
     /** Function GetPenSize
      * @return the size of the "pen" that be used to draw or plot this item
diff -ru kicad-2010.04.06/eeschema/schedit.cpp kicad-2010.04.06-new/eeschema/schedit.cpp
--- kicad-2010.04.06/eeschema/schedit.cpp	2010-03-24 19:26:04.000000000 +0100
+++ kicad-2010.04.06-new/eeschema/schedit.cpp	2010-05-01 15:18:31.000000000 +0200
@@ -383,7 +383,7 @@
     case ID_POPUP_SCH_CLEANUP_SHEET:
         if ( screen->GetCurItem()
              && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
-            ( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true );
+            ( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true, true );
         break;
 
     case ID_POPUP_SCH_EDIT_PINSHEET: