fpini.pas 23 KB

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