fpdesk.pas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Desktop loading/saving routines
  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. unit FPDesk;
  13. interface
  14. const
  15. ResHistory = 'HISTORY';
  16. ResClipboard = 'CLIPBOARD';
  17. ResWatches = 'WATCHES';
  18. ResBreakpoints = 'BREAKPOINTS';
  19. ResDesktop = 'DESKTOP';
  20. ResSymbols = 'SYMBOLS';
  21. procedure InitDesktopFile;
  22. function LoadDesktop: boolean;
  23. function SaveDesktop: boolean;
  24. procedure DoneDesktopFile;
  25. implementation
  26. uses Dos,
  27. Objects,App,
  28. WResource,
  29. FPConst,FPVars,FPUtils;
  30. procedure InitDesktopFile;
  31. begin
  32. if DesktopLocation=dlCurrentDir then
  33. DesktopPath:=FExpand(DesktopName)
  34. else
  35. DesktopPath:=FExpand(DirOf(INIPath)+DesktopName);
  36. end;
  37. procedure DoneDesktopFile;
  38. begin
  39. end;
  40. function WriteHistory(F: PResourceFile): boolean;
  41. begin
  42. WriteHistory:=true;
  43. end;
  44. function WriteClipboard(F: PResourceFile): boolean;
  45. begin
  46. WriteClipboard:=true;
  47. end;
  48. function WriteWatches(F: PResourceFile): boolean;
  49. begin
  50. WriteWatches:=true;
  51. end;
  52. function WriteBreakpoints(F: PResourceFile): boolean;
  53. begin
  54. WriteBreakPoints:=true;
  55. end;
  56. function WriteOpenWindows(F: PResourceFile): boolean;
  57. var S: PMemoryStream;
  58. begin
  59. WriteOpenWindows:=true;
  60. {$ifndef DEV}Exit;{$endif}
  61. New(S, Init(1024*1024,4096));
  62. Desktop^.Store(S^);
  63. S^.Seek(0);
  64. F^.CreateResource(resDesktop,rcBinary,0);
  65. F^.AddResourceEntryFromStream(resDesktop,langDefault,0,S^,S^.GetSize);
  66. Dispose(S, Done);
  67. end;
  68. function WriteSymbols(F: PResourceFile): boolean;
  69. begin
  70. WriteSymbols:=true;
  71. end;
  72. function LoadDesktop: boolean;
  73. begin
  74. LoadDesktop:=true;
  75. end;
  76. function SaveDesktop: boolean;
  77. var OK: boolean;
  78. F: PResourceFile;
  79. begin
  80. New(F, CreateFile(DesktopPath));
  81. OK:=true;
  82. if OK and ((DesktopFileFlags and dfHistoryLists)<>0) then
  83. OK:=WriteHistory(F);
  84. if OK and ((DesktopFileFlags and dfClipboardContent)<>0) then
  85. OK:=WriteClipboard(F);
  86. if OK and ((DesktopFileFlags and dfWatches)<>0) then
  87. OK:=WriteWatches(F);
  88. if OK and ((DesktopFileFlags and dfBreakpoints)<>0) then
  89. OK:=WriteBreakpoints(F);
  90. if OK and ((DesktopFileFlags and dfOpenWindows)<>0) then
  91. OK:=WriteOpenWindows(F);
  92. if OK and ((DesktopFileFlags and dfSymbolInformation)<>0) then
  93. OK:=WriteSymbols(F);
  94. Dispose(F, Done);
  95. SaveDesktop:=OK;
  96. end;
  97. END.
  98. {
  99. $Log$
  100. Revision 1.4 1999-04-15 08:58:05 peter
  101. * syntax highlight fixes
  102. * browser updates
  103. Revision 1.3 1999/04/07 21:55:45 peter
  104. + object support for browser
  105. * html help fixes
  106. * more desktop saving things
  107. * NODEBUG directive to exclude debugger
  108. Revision 1.2 1999/03/23 16:16:39 peter
  109. * linux fixes
  110. Revision 1.1 1999/03/23 15:11:28 peter
  111. * desktop saving things
  112. * vesa mode
  113. * preferences dialog
  114. }