fpini.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Write/Read Options to INI File
  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 FPIni;
  13. interface
  14. uses
  15. FPUtils;
  16. const
  17. ININame = 'fp.ini';
  18. ConfigDir : string{$ifdef GABOR}[50]{$endif} = '.'+DirSep;
  19. INIFileName: string{$ifdef GABOR}[50]{$endif} = ININame;
  20. procedure InitINIFile;
  21. function ReadINIFile: boolean;
  22. function WriteINIFile: boolean;
  23. implementation
  24. uses
  25. Dos,Objects,Drivers,App,
  26. WINI,{$ifndef EDITORS}WEditor{$else}Editors{$endif},
  27. {$ifndef NODEBUG}FPDebug,{$endif}FPConst,FPVars,FPViews,
  28. FPIntf,FPTools,FPSwitch;
  29. const
  30. { INI file sections }
  31. secFiles = 'Files';
  32. secRun = 'Run';
  33. secCompile = 'Compile';
  34. secColors = 'Colors';
  35. secHelp = 'Help';
  36. secEditor = 'Editor';
  37. secBreakpoint = 'Breakpoints';
  38. secWatches = 'Watches';
  39. secHighlight = 'Highlight';
  40. secMouse = 'Mouse';
  41. secSearch = 'Search';
  42. secTools = 'Tools';
  43. secSourcePath = 'SourcePath';
  44. secPreferences = 'Preferences';
  45. { INI file tags }
  46. ieRecentFile = 'RecentFile';
  47. (* ieOpenFile = 'OpenFile';
  48. ieOpenFileCount = 'OpenFileCount'; *)
  49. ieRunParameters = 'Parameters';
  50. iePrimaryFile = 'PrimaryFile';
  51. ieCompileMode = 'CompileMode';
  52. iePalette = 'Palette';
  53. ieHelpFiles = 'Files';
  54. ieDefaultTabSize = 'DefaultTabSize';
  55. ieDefaultEditorFlags='DefaultFlags';
  56. ieDefaultSaveExt = 'DefaultSaveExt';
  57. ieOpenExts = 'OpenExts';
  58. ieHighlightExts = 'Exts';
  59. ieTabsPattern = 'NeedsTabs';
  60. ieDoubleClickDelay = 'DoubleDelay';
  61. ieReverseButtons = 'ReverseButtons';
  62. ieAltClickAction = 'AltClickAction';
  63. ieCtrlClickAction = 'CtrlClickAction';
  64. ieFindFlags = 'FindFlags';
  65. ieToolName = 'Title';
  66. ieToolProgram = 'Program';
  67. ieToolParams = 'Params';
  68. ieToolHotKey = 'HotKey';
  69. ieBreakpointTyp = 'Type';
  70. ieBreakpointCount = 'Count';
  71. ieBreakpointState = 'State';
  72. ieBreakpointName = 'Name';
  73. ieBreakpointFile = 'FileName';
  74. ieBreakpointLine = 'LineNumber';
  75. ieBreakpointCond = 'Condition';
  76. ieWatchCount = 'Count';
  77. ieWatchName = 'Watch';
  78. ieSourceList = 'SourceList';
  79. ieVideoMode = 'VideoMode';
  80. ieAutoSave = 'AutoSaveFlags';
  81. ieMiscOptions = 'MiscOptions';
  82. ieDesktopLocation = 'DesktopLocation';
  83. ieDesktopFlags = 'DesktopFileFlags';
  84. ieCenterDebuggerRow= 'CenterCurrentLineWhileDebugging';
  85. procedure InitINIFile;
  86. var S: string;
  87. begin
  88. S:=LocateFile(ININame);
  89. if S<>'' then
  90. INIPath:=S;
  91. INIPath:=FExpand(INIPath);
  92. end;
  93. function PaletteToStr(S: string): string;
  94. var C: string;
  95. I: integer;
  96. begin
  97. C:='';
  98. for I:=1 to length(S) do
  99. begin
  100. C:=C+'#$'+IntToHexL(ord(S[I]),2);
  101. end;
  102. PaletteToStr:=C;
  103. end;
  104. function StrToPalette(S: string): string;
  105. var I,P,X: integer;
  106. C: string;
  107. Hex: boolean;
  108. OK: boolean;
  109. begin
  110. C:=''; I:=1;
  111. OK:=S<>'';
  112. while OK and (I<=length(S)) and (S[I]='#') do
  113. begin
  114. Inc(I); Hex:=false;
  115. if S[I]='$' then begin Inc(I); Hex:=true; end;
  116. P:=Pos('#',copy(S,I,255)); if P>0 then P:=I+P-1 else P:=length(S)+1;
  117. if Hex=false then
  118. begin
  119. X:=StrToInt(copy(S,I,P-I));
  120. OK:=(LastStrToIntResult=0) and (0<=X) and (X<=255);
  121. end
  122. else
  123. begin
  124. X:=HexToInt(copy(S,I,P-I));
  125. OK:=(LastHexToIntResult=0) and (0<=X) and (X<=255);
  126. end;
  127. if OK then C:=C+chr(X);
  128. Inc(I,P-I);
  129. end;
  130. StrToPalette:=C;
  131. end;
  132. {$ifndef NODEBUG}
  133. procedure WriteOneWatchEntry(I : Longint;INIFile : PINIFile);
  134. var
  135. PW : PWatch;
  136. S : String;
  137. begin
  138. Str(I,S);
  139. PW:=WatchesCollection^.At(I);
  140. With PW^ do
  141. begin
  142. INIFile^.SetEntry(secWatches,ieWatchName+S,GetStr(expr));
  143. end;
  144. end;
  145. procedure WriteOneBreakPointEntry(I : longint;INIFile : PINIFile);
  146. var PB : PBreakpoint;
  147. S : String;
  148. begin
  149. Str(I,S);
  150. PB:=BreakpointsCollection^.At(I);
  151. If assigned(PB) then
  152. With PB^ do
  153. Begin
  154. INIFile^.SetEntry(secBreakpoint,ieBreakpointTyp+S,BreakpointTypeStr[typ]);
  155. INIFile^.SetEntry(secBreakpoint,ieBreakpointState+S,BreakpointStateStr[state]);
  156. if typ=bt_file_line then
  157. begin
  158. INIFile^.SetEntry(secBreakpoint,ieBreakpointFile+S,FileName^);
  159. INIFile^.SetIntEntry(secBreakpoint,ieBreakpointLine+S,Line);
  160. end
  161. else
  162. INIFile^.SetEntry(secBreakpoint,ieBreakpointName+S,Name^);
  163. if assigned(Conditions) then
  164. INIFile^.SetEntry(secBreakpoint,ieBreakpointCond+S,Conditions^);
  165. end;
  166. end;
  167. procedure ReadOneWatchEntry(I : Longint;INIFile : PINIFile);
  168. var
  169. PW : PWatch;
  170. S : String;
  171. begin
  172. Str(I,S);
  173. PW:=new(PWatch,Init(INIFile^.GetEntry(secWatches,ieWatchName+S,'')));
  174. WatchesCollection^.Insert(PW);
  175. end;
  176. procedure ReadOneBreakPointEntry(i : longint;INIFile : PINIFile);
  177. var PB : PBreakpoint;
  178. S,S2,SC : string;
  179. Line : longint;
  180. typ : BreakpointType;
  181. state : BreakpointState;
  182. begin
  183. Str(I,S2);
  184. typ:=bt_invalid;
  185. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointTyp+S2,BreakpointTypeStr[typ]);
  186. for typ:=low(BreakpointType) to high(BreakpointType) do
  187. If pos(BreakpointTypeStr[typ],S)>0 then break;
  188. state:=bs_deleted;
  189. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointState+S2,BreakpointStateStr[state]);
  190. for state:=low(BreakpointState) to high(BreakpointState) do
  191. If pos(BreakpointStateStr[state],S)>0 then break;
  192. case typ of
  193. bt_invalid :;
  194. bt_file_line :
  195. begin
  196. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointFile+S2,'');
  197. Line:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointLine+S2,0);
  198. end;
  199. else
  200. begin
  201. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointName+S2,'');
  202. end;
  203. end;
  204. SC:=INIFile^.GetEntry(secBreakpoint,ieBreakpointCond+S2,'');
  205. if (typ=bt_function) and (S<>'') then
  206. new(PB,init_function(S))
  207. else if (typ=bt_file_line) and (S<>'') then
  208. new(PB,init_file_line(S,Line))
  209. else
  210. new(PB,init_type(typ,S));
  211. If assigned(PB) then
  212. begin
  213. PB^.state:=state;
  214. If SC<>'' then
  215. PB^.conditions:=NewStr(SC);
  216. BreakpointsCollection^.Insert(PB);
  217. end;
  218. end;
  219. {$endif NODEBUG}
  220. function ReadINIFile: boolean;
  221. var INIFile: PINIFile;
  222. S,PS,S1,S2,S3: string;
  223. I,P: integer;
  224. X,Y : sw_integer;
  225. BreakPointCount,WatchesCount:longint;
  226. OK: boolean;
  227. ts : TSwitchMode;
  228. W: word;
  229. R : TRect;
  230. begin
  231. OK:=ExistsFile(INIPath);
  232. if OK then
  233. begin
  234. New(INIFile, Init(INIPath));
  235. { Files }
  236. OpenExts:=INIFile^.GetEntry(secFiles,ieOpenExts,OpenExts);
  237. RecentFileCount:=High(RecentFiles);
  238. for I:=Low(RecentFiles) to High(RecentFiles) do
  239. begin
  240. S:=INIFile^.GetEntry(secFiles,ieRecentFile+IntToStr(I),'');
  241. if (S='') and (RecentFileCount>I-1) then RecentFileCount:=I-1;
  242. with RecentFiles[I] do
  243. begin
  244. P:=Pos(',',S); if P=0 then P:=length(S)+1;
  245. FileName:=copy(S,1,P-1); Delete(S,1,P);
  246. P:=Pos(',',S); if P=0 then P:=length(S)+1;
  247. LastPos.X:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
  248. P:=Pos(',',S); if P=0 then P:=length(S)+1;
  249. LastPos.Y:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
  250. end;
  251. end;
  252. { Run }
  253. { First read the primary file, which can also set the parameters which can
  254. be overruled with the parameter loading }
  255. SetPrimaryFile(INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile));
  256. SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
  257. { Compile }
  258. S:=INIFile^.GetEntry(secCompile,ieCompileMode,'');
  259. for ts:=low(TSwitchMode) to high(TSwitchMode) do
  260. begin
  261. if SwitchesModeStr[ts]=S then
  262. SwitchesMode:=ts;
  263. end;
  264. { Help }
  265. S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
  266. repeat
  267. P:=Pos(';',S); if P=0 then P:=length(S)+1;
  268. PS:=copy(S,1,P-1);
  269. if PS<>'' then HelpFiles^.Insert(NewStr(PS));
  270. Delete(S,1,P);
  271. until S='';
  272. { Editor }
  273. {$ifndef EDITORS}
  274. DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
  275. DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
  276. DefaultSaveExt:=INIFile^.GetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
  277. {$endif}
  278. { Highlight }
  279. HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
  280. TabsPattern:=INIFile^.GetEntry(secHighlight,ieTabsPattern,TabsPattern);
  281. { SourcePath }
  282. SourceDirs:=INIFile^.GetEntry(secSourcePath,ieSourceList,SourceDirs);
  283. { Mouse }
  284. DoubleDelay:=INIFile^.GetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
  285. MouseReverse:=boolean(INIFile^.GetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse)));
  286. AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
  287. CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
  288. { Search }
  289. FindFlags:=INIFile^.GetIntEntry(secSearch,ieFindFlags,FindFlags);
  290. { Breakpoints }
  291. {$ifndef NODEBUG}
  292. BreakpointCount:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointCount,0);
  293. for i:=1 to BreakpointCount do
  294. ReadOneBreakPointEntry(i-1,INIFile);
  295. WatchesCount:=INIFile^.GetIntEntry(secWatches,ieWatchCount,0);
  296. for i:=1 to WatchesCount do
  297. ReadOneWatchEntry(i-1,INIFile);
  298. {$endif}
  299. { Tools }
  300. for I:=1 to MaxToolCount do
  301. begin
  302. S:=IntToStr(I);
  303. S1:=INIFile^.GetEntry(secTools,ieToolName+S,'');
  304. if S1='' then Break; { !!! }
  305. S2:=INIFile^.GetEntry(secTools,ieToolProgram+S,'');
  306. S3:=INIFile^.GetEntry(secTools,ieToolParams+S,'');
  307. W:=Max(0,Min(65535,INIFile^.GetIntEntry(secTools,ieToolHotKey+S,0)));
  308. AddTool(S1,S2,S3,W);
  309. end;
  310. { Colors }
  311. S:=AppPalette;
  312. PS:=StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_1_40',PaletteToStr(copy(S,1,40))));
  313. PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_41_80',PaletteToStr(copy(S,41,40))));
  314. PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_81_120',PaletteToStr(copy(S,81,40))));
  315. PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_121_160',PaletteToStr(copy(S,121,40))));
  316. PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_161_200',PaletteToStr(copy(S,161,40))));
  317. PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_201_240',PaletteToStr(copy(S,201,40))));
  318. if length(PS)<length(CIDEAppColor) then
  319. PS:=PS+copy(CIDEAppColor,length(PS)+1,255);
  320. AppPalette:=PS;
  321. (* { Open files }
  322. for I:=INIFile^.GetIntEntry(secFiles,ieOpenFileCount,0) downto 1 do
  323. begin
  324. S:=INIFile^.GetEntry(secFiles,ieOpenFile+IntToStr(I),'');
  325. if (S='') then
  326. break;
  327. P:=Pos(',',S); if P=0 then P:=length(S)+1;
  328. S1:=copy(S,1,P-1);
  329. Delete(S,1,P);
  330. P:=Pos(',',S);
  331. if P=0 then P:=length(S)+1;
  332. X:=Max(0,StrToInt(copy(S,1,P-1)));
  333. Delete(S,1,P);
  334. P:=Pos(',',S);
  335. if P=0 then P:=length(S)+1;
  336. Y:=Max(0,StrToInt(copy(S,1,P-1)));
  337. Delete(S,1,P);
  338. P:=Pos(',',S);
  339. if P=0 then P:=length(S)+1;
  340. R.A.X:=Max(0,StrToInt(copy(S,1,P-1)));
  341. Delete(S,1,P);
  342. P:=Pos(',',S);
  343. if P=0 then P:=length(S)+1;
  344. R.A.Y:=Max(0,StrToInt(copy(S,1,P-1)));
  345. Delete(S,1,P);
  346. P:=Pos(',',S);
  347. if P=0 then P:=length(S)+1;
  348. R.B.X:=Max(0,StrToInt(copy(S,1,P-1)));
  349. Delete(S,1,P);
  350. P:=Pos(',',S);
  351. if P=0 then P:=length(S)+1;
  352. R.B.Y:=Max(0,StrToInt(copy(S,1,P-1)));
  353. if (R.A.X<R.B.X) and (R.A.Y<R.B.Y) then
  354. TryToOpenFile(@R,S1,X,Y,false)
  355. else
  356. TryToOpenFile(nil,S1,X,Y,false);
  357. { remove it because otherwise we allways keep old files }
  358. INIFile^.DeleteEntry(secFiles,ieOpenFile+IntToStr(I));
  359. end;
  360. *)
  361. { Desktop }
  362. DesktopFileFlags:=INIFile^.GetIntEntry(secPreferences,ieDesktopFlags,DesktopFileFlags);
  363. { Debugger }
  364. IniCenterDebuggerRow:=INIFile^.GetIntEntry(secPreferences,ieCenterDebuggerRow,1)<>0;
  365. { Preferences }
  366. AutoSaveOptions:=INIFile^.GetIntEntry(secPreferences,ieAutoSave,AutoSaveOptions);
  367. MiscOptions:=INIFile^.GetIntEntry(secPreferences,ieMiscOptions,MiscOptions);
  368. DesktopLocation:=INIFile^.GetIntEntry(secPreferences,ieDesktopLocation,DesktopLocation);
  369. Dispose(INIFile, Done);
  370. end;
  371. ReadINIFile:=OK;
  372. end;
  373. function WriteINIFile: boolean;
  374. var INIFile: PINIFile;
  375. S: string;
  376. R : TRect;
  377. S1,S2,S3: string;
  378. W: word;
  379. BreakPointCount,WatchesCount:longint;
  380. I(*,OpenFileCount*): integer;
  381. OK: boolean;
  382. PW,PPW : PSourceWindow;
  383. procedure ConcatName(P: PString); {$ifndef FPC}far;{$endif}
  384. begin
  385. if (S<>'') then S:=S+';';
  386. S:=S+P^;
  387. end;
  388. begin
  389. New(INIFile, Init(INIPath));
  390. { Files }
  391. { avoid keeping old files }
  392. INIFile^.DeleteSection(secFiles);
  393. INIFile^.SetEntry(secFiles,ieOpenExts,'"'+OpenExts+'"');
  394. for I:=1 to High(RecentFiles) do
  395. begin
  396. if I<=RecentFileCount then
  397. with RecentFiles[I] do S:=FileName+','+IntToStr(LastPos.X)+','+IntToStr(LastPos.Y)
  398. else
  399. S:='';
  400. INIFile^.SetEntry(secFiles,ieRecentFile+IntToStr(I),S);
  401. end;
  402. (*
  403. PW:=FirstEditorWindow;
  404. PPW:=PW;
  405. I:=1;
  406. while assigned(PW) do
  407. begin
  408. If PW^.HelpCtx=hcSourceWindow then
  409. begin
  410. With PW^.editor^ do
  411. S:=FileName+','+IntToStr(CurPos.X)+','+IntToStr(CurPos.Y);
  412. PW^.GetBounds(R);
  413. S:=S+','+IntToStr(R.A.X)+','+IntToStr(R.A.Y)+','+
  414. IntToStr(R.B.X)+','+IntToStr(R.B.Y);
  415. INIFile^.SetEntry(secFiles,ieOpenFile+IntToStr(I),S);
  416. Inc(I);
  417. OpenFileCount:=I-1;
  418. end;
  419. PW:=PSourceWindow(PW^.next);
  420. While assigned(PW) and (PW<>PPW) and (PW^.HelpCtx<>hcSourceWindow) do
  421. PW:=PSourceWindow(PW^.next);
  422. If PW=PPW then
  423. break;
  424. end;
  425. INIFile^.SetIntEntry(secFiles,ieOpenFileCount,OpenFileCount);
  426. *)
  427. { Run }
  428. INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
  429. { Compile }
  430. INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
  431. INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
  432. { Help }
  433. S:='';
  434. HelpFiles^.ForEach(@ConcatName);
  435. INIFile^.SetEntry(secHelp,ieHelpFiles,'"'+S+'"');
  436. { Editor }
  437. {$ifndef EDITORS}
  438. INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
  439. INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
  440. INIFile^.SetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
  441. {$endif}
  442. { Highlight }
  443. INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
  444. INIFile^.SetEntry(secHighlight,ieTabsPattern,'"'+TabsPattern+'"');
  445. { SourcePath }
  446. INIFile^.SetEntry(secSourcePath,ieSourceList,'"'+SourceDirs+'"');
  447. { Mouse }
  448. INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
  449. INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
  450. INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
  451. INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
  452. { Search }
  453. INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
  454. { Breakpoints }
  455. {$ifndef NODEBUG}
  456. BreakPointCount:=BreakpointsCollection^.Count;
  457. INIFile^.SetIntEntry(secBreakpoint,ieBreakpointCount,BreakpointCount);
  458. for i:=1 to BreakpointCount do
  459. WriteOneBreakPointEntry(I-1,INIFile);
  460. WatchesCount:=WatchesCollection^.Count;
  461. INIFile^.SetIntEntry(secWatches,ieWatchCount,WatchesCount);
  462. for i:=1 to WatchesCount do
  463. WriteOneWatchEntry(I-1,INIFile);
  464. {$endif}
  465. { Tools }
  466. INIFile^.DeleteSection(secTools);
  467. for I:=1 to GetToolCount do
  468. begin
  469. S:=IntToStr(I);
  470. GetToolParams(I-1,S1,S2,S3,W);
  471. if S1<>'' then S1:='"'+S1+'"';
  472. if S2<>'' then S2:='"'+S2+'"';
  473. if S3<>'' then S3:='"'+S3+'"';
  474. INIFile^.SetEntry(secTools,ieToolName+S,S1);
  475. INIFile^.SetEntry(secTools,ieToolProgram+S,S2);
  476. INIFile^.SetEntry(secTools,ieToolParams+S,S3);
  477. INIFile^.SetIntEntry(secTools,ieToolHotKey+S,W);
  478. end;
  479. { Colors }
  480. if AppPalette<>CIDEAppColor then
  481. begin
  482. { this has a bug. if a different palette has been read on startup, and
  483. then changed back to match the default, this will not update it in the
  484. ini file, eg. the original (non-default) will be left unmodified... }
  485. S:=AppPalette;
  486. INIFile^.SetEntry(secColors,iePalette+'_1_40',PaletteToStr(copy(S,1,40)));
  487. INIFile^.SetEntry(secColors,iePalette+'_41_80',PaletteToStr(copy(S,41,40)));
  488. INIFile^.SetEntry(secColors,iePalette+'_81_120',PaletteToStr(copy(S,81,40)));
  489. INIFile^.SetEntry(secColors,iePalette+'_121_160',PaletteToStr(copy(S,121,40)));
  490. INIFile^.SetEntry(secColors,iePalette+'_161_200',PaletteToStr(copy(S,161,40)));
  491. INIFile^.SetEntry(secColors,iePalette+'_201_240',PaletteToStr(copy(S,201,40)));
  492. end;
  493. { Desktop }
  494. INIFile^.SetIntEntry(secPreferences,ieDesktopFlags,DesktopFileFlags);
  495. INIFile^.SetIntEntry(secPreferences,ieCenterDebuggerRow,byte(IniCenterDebuggerRow));
  496. { Preferences }
  497. INIFile^.SetIntEntry(secPreferences,ieAutoSave,AutoSaveOptions);
  498. INIFile^.SetIntEntry(secPreferences,ieMiscOptions,MiscOptions);
  499. INIFile^.SetIntEntry(secPreferences,ieDesktopLocation,DesktopLocation);
  500. OK:=INIFile^.Update;
  501. Dispose(INIFile, Done);
  502. WriteINIFile:=OK;
  503. end;
  504. end.
  505. {
  506. $Log$
  507. Revision 1.26 2000-02-04 00:08:35 pierre
  508. + IniCenterDebuggerRow
  509. Revision 1.25 1999/11/05 13:47:19 pierre
  510. * Breakpoint conditions were not reloaded correctly
  511. Revision 1.24 1999/09/16 14:34:59 pierre
  512. + TBreakpoint and TWatch registering
  513. + WatchesCollection and BreakpointsCollection stored in desk file
  514. * Syntax highlighting was broken
  515. Revision 1.23 1999/09/13 16:24:43 peter
  516. + clock
  517. * backspace unident like tp7
  518. Revision 1.22 1999/09/07 09:21:54 pierre
  519. + Watches saved
  520. Revision 1.21 1999/08/03 20:22:33 peter
  521. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  522. + Desktop saving should work now
  523. - History saved
  524. - Clipboard content saved
  525. - Desktop saved
  526. - Symbol info saved
  527. * syntax-highlight bug fixed, which compared special keywords case sensitive
  528. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  529. * with 'whole words only' set, the editor didn't found occourences of the
  530. searched text, if the text appeared previously in the same line, but didn't
  531. satisfied the 'whole-word' condition
  532. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  533. (ie. the beginning of the selection)
  534. * when started typing in a new line, but not at the start (X=0) of it,
  535. the editor inserted the text one character more to left as it should...
  536. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  537. * Shift shouldn't cause so much trouble in TCodeEditor now...
  538. * Syntax highlight had problems recognizing a special symbol if it was
  539. prefixed by another symbol character in the source text
  540. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  541. Revision 1.20 1999/06/28 12:36:51 pierre
  542. * avoid keeping old open file names
  543. Revision 1.19 1999/04/07 21:55:48 peter
  544. + object support for browser
  545. * html help fixes
  546. * more desktop saving things
  547. * NODEBUG directive to exclude debugger
  548. Revision 1.18 1999/03/23 15:11:31 peter
  549. * desktop saving things
  550. * vesa mode
  551. * preferences dialog
  552. Revision 1.17 1999/03/12 01:13:58 peter
  553. * flag if trytoopen should look for other extensions
  554. + browser tab in the tools-compiler
  555. Revision 1.16 1999/03/08 14:58:09 peter
  556. + prompt with dialogs for tools
  557. Revision 1.15 1999/03/05 17:53:02 pierre
  558. + saving and opening of open files on exit
  559. Revision 1.14 1999/03/01 15:41:55 peter
  560. + Added dummy entries for functions not yet implemented
  561. * MenuBar didn't update itself automatically on command-set changes
  562. * Fixed Debugging/Profiling options dialog
  563. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  564. set
  565. * efBackSpaceUnindents works correctly
  566. + 'Messages' window implemented
  567. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  568. + Added TP message-filter support (for ex. you can call GREP thru
  569. GREP2MSG and view the result in the messages window - just like in TP)
  570. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  571. so topic search didn't work...
  572. * In FPHELP.PAS there were still context-variables defined as word instead
  573. of THelpCtx
  574. * StdStatusKeys() was missing from the statusdef for help windows
  575. + Topic-title for index-table can be specified when adding a HTML-files
  576. Revision 1.13 1999/02/22 02:15:14 peter
  577. + default extension for save in the editor
  578. + Separate Text to Find for the grep dialog
  579. * fixed redir crash with tp7
  580. Revision 1.12 1999/02/19 18:43:46 peter
  581. + open dialog supports mask list
  582. Revision 1.11 1999/02/10 09:53:14 pierre
  583. * better storing of breakpoints
  584. Revision 1.10 1999/02/05 13:08:42 pierre
  585. + new breakpoint types added
  586. Revision 1.9 1999/02/05 12:11:55 pierre
  587. + SourceDir that stores directories for sources that the
  588. compiler should not know about
  589. Automatically asked for addition when a new file that
  590. needed filedialog to be found is in an unknown directory
  591. Stored and retrieved from INIFile
  592. + Breakpoints conditions added to INIFile
  593. * Breakpoints insterted and removed at debin and end of debug session
  594. Revision 1.8 1999/02/04 17:52:38 pierre
  595. * bs_invalid renamed bs_deleted
  596. Revision 1.7 1999/02/04 17:19:24 peter
  597. * linux fixes
  598. Revision 1.6 1999/02/04 13:32:04 pierre
  599. * Several things added (I cannot commit them independently !)
  600. + added TBreakpoint and TBreakpointCollection
  601. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  602. + Breakpoint list in INIFile
  603. * Select items now also depend of SwitchMode
  604. * Reading of option '-g' was not possible !
  605. + added search for -Fu args pathes in TryToOpen
  606. + added code for automatic opening of FileDialog
  607. if source not found
  608. Revision 1.5 1999/01/21 11:54:15 peter
  609. + tools menu
  610. + speedsearch in symbolbrowser
  611. * working run command
  612. Revision 1.4 1999/01/04 11:49:45 peter
  613. * 'Use tab characters' now works correctly
  614. + Syntax highlight now acts on File|Save As...
  615. + Added a new class to syntax highlight: 'hex numbers'.
  616. * There was something very wrong with the palette managment. Now fixed.
  617. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  618. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  619. process revised
  620. Revision 1.1 1998/12/28 15:47:45 peter
  621. + Added user screen support, display & window
  622. + Implemented Editor,Mouse Options dialog
  623. + Added location of .INI and .CFG file
  624. + Option (INI) file managment implemented (see bottom of Options Menu)
  625. + Switches updated
  626. + Run program
  627. }