Browse Source

+ With DebugUndo added 3 menu items
"Dump Undo" "Undo All" and "Redo All"
for Undo checks

pierre 26 years ago
parent
commit
ca57b504b0
3 changed files with 80 additions and 4 deletions
  1. 10 1
      ide/text/fpconst.pas
  2. 14 2
      ide/text/fpide.pas
  3. 56 1
      ide/text/fpviews.pas

+ 10 - 1
ide/text/fpconst.pas

@@ -192,6 +192,10 @@ const
      cmDeleteBreakpoint  = 2402;
      cmToggleBreakpoint  = 2403;
 
+     cmDumpUndo          = 2500;
+     cmUndoAll           = 2501;
+     cmRedoAll           = 2502;
+
      { Help constants }
      hcSourceWindow      = 8000;
      hcHelpWindow        = 8001;
@@ -361,7 +365,12 @@ implementation
 END.
 {
   $Log$
-  Revision 1.28  1999-10-14 10:23:44  pierre
+  Revision 1.29  1999-10-27 12:10:42  pierre
+    + With DebugUndo added 3 menu items
+      "Dump Undo" "Undo All" and "Redo All"
+      for Undo checks
+
+  Revision 1.28  1999/10/14 10:23:44  pierre
    ClockView Black on Gray by default
 
   Revision 1.27  1999/09/13 16:24:43  peter

+ 14 - 2
ide/text/fpide.pas

@@ -237,6 +237,11 @@ begin
     NewSubMenu('~E~dit',hcEditMenu, NewMenu(
       NewItem('~U~ndo','Alt+BkSp', kbAltBack, cmUndo, hcUndo,
       NewItem('~R~edo','', kbNoKey, cmRedo, hcRedo,
+{$ifdef DebugUndo}
+      NewItem('~D~ump Undo','', kbNoKey, cmDumpUndo, hcUndo,
+      NewItem('U~n~do All','', kbNoKey, cmUndoAll, hcUndo,
+      NewItem('R~e~do All','', kbNoKey, cmRedoAll, hcRedo,
+{$endif DebugUndo}
       NewLine(
       NewItem('Cu~t~','Shift+Del', kbShiftDel, cmCut, hcCut,
       NewItem('~C~opy','Ctrl+Ins', kbCtrlIns, cmCopy, hcCut,
@@ -244,7 +249,9 @@ begin
       NewItem('C~l~ear','Ctrl+Del', kbCtrlDel, cmClear, hcClear,
       NewLine(
       NewItem('~S~how clipboard','', kbNoKey, cmShowClipboard, hcShowClipboard,
-      WinPMI)))))))))),
+      WinPMI))))))
+{$ifdef DebugUndo}))){$endif DebugUndo}
+      )))),
     NewSubMenu('~S~earch',hcSearchMenu, NewMenu(
       NewItem('~F~ind...','', kbNoKey, cmFind, hcFind,
       NewItem('~R~eplace...','', kbNoKey, cmReplace, hcReplace,
@@ -847,7 +854,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.41  1999-09-22 16:21:41  pierre
+  Revision 1.42  1999-10-27 12:10:42  pierre
+    + With DebugUndo added 3 menu items
+      "Dump Undo" "Undo All" and "Redo All"
+      for Undo checks
+
+  Revision 1.41  1999/09/22 16:21:41  pierre
    * Use ShrinkPas for RecentFiles
 
   Revision 1.40  1999/09/22 13:04:31  pierre

+ 56 - 1
ide/text/fpviews.pas

@@ -115,6 +115,11 @@ type
       function  GetSpecSymbol(SpecClass: TSpecSymbolClass; Index: integer): string; virtual;
 {$endif}
       procedure   HandleEvent(var Event: TEvent); virtual;
+{$ifdef DebugUndo}
+      procedure   DumpUndo;
+      procedure   UndoAll;
+      procedure   RedoAll;
+{$endif DebugUndo}
       function    GetLocalMenu: PMenu; virtual;
       function    GetCommandTarget: PView; virtual;
       function    CreateLocalMenuView(var Bounds: TRect; M: PMenu): PMenuPopup; virtual;
@@ -807,6 +812,46 @@ begin
   CreateLocalMenuView:=MV;
 end;
 
+{$ifdef DebugUndo}
+procedure TSourceEditor.DumpUndo;
+var
+  i : sw_integer;
+begin
+  ClearToolMessages;
+  AddToolCommand('UndoList Dump');
+  for i:=0 to UndoList^.count-1 do
+    with UndoList^.At(i)^ do
+      begin
+       AddToolMessage('',ActionString[action]+' '+IntToStr(StartPos.X)+':'+IntToStr(StartPos.Y)+
+         ' '+IntToStr(EndPos.X)+':'+IntToStr(EndPos.Y)+' "'+GetStr(Text)+'"',0,0);
+      end;
+  if RedoList^.count>0 then
+    AddToolCommand('RedoList Dump');
+  for i:=0 to RedoList^.count-1 do
+    with RedoList^.At(i)^ do
+      begin
+       AddToolMessage('',ActionString[action]+' '+IntToStr(StartPos.X)+':'+IntToStr(StartPos.Y)+
+         ' '+IntToStr(EndPos.X)+':'+IntToStr(EndPos.Y)+' "'+GetStr(Text)+'"',0,0);
+      end;
+  UpdateToolMessages;
+  if Assigned(MessagesWindow) then
+    MessagesWindow^.Focus;
+end;
+
+procedure TSourceEditor.UndoAll;
+begin
+  While UndoList^.count>0 do
+    Undo;
+end;
+
+procedure TSourceEditor.RedoAll;
+begin
+  While RedoList^.count>0 do
+    Redo;
+end;
+
+{$endif DebugUndo}
+
 procedure TSourceEditor.HandleEvent(var Event: TEvent);
 var DontClear: boolean;
     S: string;
@@ -817,6 +862,11 @@ begin
       begin
         DontClear:=false;
         case Event.Command of
+{$ifdef DebugUndo}
+          cmDumpUndo    : DumpUndo;
+          cmUndoAll     : UndoAll;
+          cmRedoAll     : RedoAll;
+{$endif DebugUndo}
           cmBrowseAtCursor:
             begin
               S:=LowerCaseStr(GetEditorCurWord(@Self));
@@ -2779,7 +2829,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.43  1999-10-25 16:55:13  pierre
+  Revision 1.44  1999-10-27 12:10:42  pierre
+    + With DebugUndo added 3 menu items
+      "Dump Undo" "Undo All" and "Redo All"
+      for Undo checks
+
+  Revision 1.43  1999/10/25 16:55:13  pierre
    * adapted to a small weditor change
 
   Revision 1.42  1999/09/16 14:34:59  pierre