fpini.pas 22 KB

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