fpmdebug.inc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Debug menu entries
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. procedure TIDEApp.DoUserScreenWindow;
  13. begin
  14. if UserScreenWindow=nil then
  15. begin
  16. New(UserScreenWindow, Init(UserScreen, SearchFreeWindowNo));
  17. Desktop^.Insert(UserScreenWindow);
  18. end;
  19. UserScreenWindow^.MakeFirst;
  20. end;
  21. procedure TIDEApp.DoCloseUserScreenWindow;
  22. begin
  23. if Assigned(UserScreenWindow) then
  24. Message(UserScreenWindow,evCommand,cmClose,nil);
  25. end;
  26. procedure TIDEApp.DoUserScreen;
  27. var Event : TEvent;
  28. Clear : Boolean;
  29. begin
  30. if UserScreen=nil then
  31. begin
  32. ErrorBox(msg_userscreennotavailable,nil);
  33. Exit;
  34. end;
  35. ShowUserScreen;
  36. InitKeyBoard;
  37. repeat
  38. repeat
  39. Drivers.GetKeyEvent(Event);
  40. if Event.What=evNothing then
  41. GiveUpTimeSlice;
  42. until Event.What=evKeyboard;
  43. Clear:=true;
  44. if not UserScreen^.CanScroll then
  45. Clear:=false
  46. else
  47. case Event.keycode of
  48. kbPgUp : UserScreen^.Scroll(-20);
  49. kbPgDn : UserScreen^.Scroll(20);
  50. kbUp : UserScreen^.Scroll(-1);
  51. kbDown : UserScreen^.Scroll(1);
  52. kbHome : UserScreen^.Scroll(-1024);
  53. kbEnd : UserScreen^.Scroll(+1024);
  54. else
  55. Clear:=false;
  56. end;
  57. if Clear then
  58. ClearEvent(Event);
  59. until Event.what=evKeyboard;
  60. while (Keyboard.PollKeyEvent<>0) do
  61. Keyboard.GetKeyEvent;
  62. DoneKeyboard;
  63. ShowIDEScreen;
  64. end;
  65. procedure TIDEApp.DoShowCallStack;
  66. begin
  67. {$ifdef NODEBUG}
  68. NoDebugger;
  69. {$else}
  70. If not assigned(StackWindow) then
  71. InitStackWindow
  72. else
  73. StackWindow^.MakeFirst;
  74. {$endif NODEBUG}
  75. end;
  76. procedure TIDEApp.DoShowRegisters;
  77. begin
  78. {$ifdef NODEBUG}
  79. NoDebugger;
  80. {$else}
  81. If not assigned(RegistersWindow) then
  82. InitRegistersWindow
  83. else
  84. RegistersWindow^.MakeFirst;
  85. {$endif NODEBUG}
  86. end;
  87. procedure TIDEApp.DoShowFPU;
  88. begin
  89. {$ifdef NODEBUG}
  90. NoDebugger;
  91. {$else}
  92. If not assigned(FPUWindow) then
  93. InitFPUWindow
  94. else
  95. FPUWindow^.MakeFirst;
  96. {$endif NODEBUG}
  97. end;
  98. procedure TIDEApp.DoShowBreakpointList;
  99. begin
  100. {$ifdef NODEBUG}
  101. NoDebugger;
  102. {$else}
  103. If assigned(BreakpointsWindow) then
  104. begin
  105. BreakpointsWindow^.Update;
  106. BreakpointsWindow^.Show;
  107. BreakpointsWindow^.MakeFirst;
  108. end
  109. else
  110. begin
  111. New(BreakpointsWindow,Init);
  112. Desktop^.Insert(BreakpointsWindow);
  113. end;
  114. {$endif NODEBUG}
  115. end;
  116. procedure TIDEApp.DoShowWatches;
  117. begin
  118. {$ifdef NODEBUG}
  119. NoDebugger;
  120. {$else}
  121. If assigned(WatchesWindow) then
  122. begin
  123. WatchesWindow^.Update;
  124. WatchesWindow^.MakeFirst;
  125. end
  126. else
  127. begin
  128. New(WatchesWindow,Init);
  129. Desktop^.Insert(WatchesWindow);
  130. end;
  131. {$endif NODEBUG}
  132. end;
  133. procedure TIDEApp.DoAddWatch;
  134. {$ifdef NODEBUG}
  135. begin
  136. NoDebugger;
  137. end;
  138. {$else}
  139. var
  140. P: PWatch;
  141. EditorWindow : PSourceWindow;
  142. EditorWasFirst : boolean;
  143. S : string;
  144. begin
  145. EditorWindow:=FirstEditorWindow;
  146. { Leave the editor first, but only if there was already an WatchesWindow }
  147. EditorWasFirst:=(PWindow(Desktop^.First)=PWindow(EditorWindow)) and
  148. assigned(WatchesWindow);
  149. If assigned(EditorWindow) then
  150. S:={LowerCaseStr(}EditorWindow^.Editor^.GetCurrentWord
  151. else
  152. S:='';
  153. P:=New(PWatch,Init(S));
  154. if ExecuteDialog(New(PWatchItemDialog,Init(P)),nil)<>cmCancel then
  155. begin
  156. WatchesCollection^.Insert(P);
  157. WatchesCollection^.Update;
  158. DoShowWatches;
  159. if EditorWasFirst then
  160. EditorWindow^.MakeFirst;
  161. end
  162. else
  163. dispose(P,Done);
  164. end;
  165. {$endif NODEBUG}
  166. {
  167. $Log$
  168. Revision 1.5 2002-10-30 22:07:11 pierre
  169. * only handle direction keys specially if buffer is bigger than window
  170. Revision 1.4 2002/09/07 15:40:43 peter
  171. * old logs removed and tabs fixed
  172. Revision 1.3 2002/09/03 13:59:09 pierre
  173. * don't use LowerCaseStr for AddWatch as it confuses line completion
  174. Revision 1.2 2002/09/02 09:27:35 pierre
  175. * avoid 100 CPU usage when AltF5 is used
  176. }