fpini.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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,
  22. WINI,{$ifndef EDITORS}WEditor,WCEdit{$else}Editors{$endif},
  23. {$ifndef NODEBUG}FPDebug,{$endif}FPConst,FPVars,
  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. secMisc = 'Misc';
  42. { INI file tags }
  43. ieRecentFile = 'RecentFile';
  44. (* ieOpenFile = 'OpenFile';
  45. ieOpenFileCount = 'OpenFileCount'; *)
  46. ieRunParameters = 'Parameters';
  47. iePrimaryFile = 'PrimaryFile';
  48. ieCompileMode = 'CompileMode';
  49. iePalette = 'Palette';
  50. ieHelpFiles = 'Files';
  51. ieDefaultTabSize = 'DefaultTabSize';
  52. ieDefaultEditorFlags='DefaultFlags';
  53. ieDefaultSaveExt = 'DefaultSaveExt';
  54. ieOpenExts = 'OpenExts';
  55. ieHighlightExts = 'Exts';
  56. ieTabsPattern = 'NeedsTabs';
  57. ieDoubleClickDelay = 'DoubleDelay';
  58. ieReverseButtons = 'ReverseButtons';
  59. ieAltClickAction = 'AltClickAction';
  60. ieCtrlClickAction = 'CtrlClickAction';
  61. ieFindFlags = 'FindFlags';
  62. ieToolName = 'Title';
  63. ieToolProgram = 'Program';
  64. ieToolParams = 'Params';
  65. ieToolHotKey = 'HotKey';
  66. ieBreakpointTyp = 'Type';
  67. ieBreakpointCount = 'Count';
  68. ieBreakpointState = 'State';
  69. ieBreakpointName = 'Name';
  70. ieBreakpointFile = 'FileName';
  71. ieBreakpointLine = 'LineNumber';
  72. ieBreakpointCond = 'Condition';
  73. ieWatchCount = 'Count';
  74. ieWatchName = 'Watch';
  75. ieSourceList = 'SourceList';
  76. { ieVideoMode = 'VideoMode';}
  77. ieAutoSave = 'AutoSaveFlags';
  78. ieMiscOptions = 'MiscOptions';
  79. ieDesktopLocation = 'DesktopLocation';
  80. ieDesktopFlags = 'DesktopFileFlags';
  81. ieCenterDebuggerRow= 'CenterCurrentLineWhileDebugging';
  82. ieShowReadme = 'ShowReadme';
  83. procedure InitINIFile;
  84. var S: string;
  85. begin
  86. S:=LocateFile(INIFileName);
  87. if S<>'' then
  88. IniFileName:=S;
  89. IniFileName:=FExpand(IniFileName);
  90. end;
  91. function PaletteToStr(S: string): string;
  92. var C: string;
  93. I: integer;
  94. begin
  95. C:='';
  96. for I:=1 to length(S) do
  97. begin
  98. C:=C+'#$'+IntToHexL(ord(S[I]),2);
  99. end;
  100. PaletteToStr:=C;
  101. end;
  102. function StrToPalette(S: string): string;
  103. var I,P,X: integer;
  104. C: string;
  105. Hex: boolean;
  106. OK: boolean;
  107. begin
  108. C:=''; I:=1;
  109. OK:=S<>'';
  110. while OK and (I<=length(S)) and (S[I]='#') do
  111. begin
  112. Inc(I); Hex:=false;
  113. if S[I]='$' then begin Inc(I); Hex:=true; end;
  114. P:=Pos('#',copy(S,I,High(S))); if P>0 then P:=I+P-1 else P:=length(S)+1;
  115. if Hex=false then
  116. begin
  117. X:=StrToInt(copy(S,I,P-I));
  118. OK:=(LastStrToIntResult=0) and (0<=X) and (X<=High(S));
  119. end
  120. else
  121. begin
  122. X:=HexToInt(copy(S,I,P-I));
  123. OK:=(LastHexToIntResult=0) and (0<=X) and (X<=255);
  124. end;
  125. if OK then C:=C+chr(X);
  126. Inc(I,P-I);
  127. end;
  128. StrToPalette:=C;
  129. end;
  130. {$ifndef NODEBUG}
  131. procedure WriteOneWatchEntry(I : Longint;INIFile : PINIFile);
  132. var
  133. PW : PWatch;
  134. S : String;
  135. begin
  136. Str(I,S);
  137. PW:=WatchesCollection^.At(I);
  138. With PW^ do
  139. begin
  140. INIFile^.SetEntry(secWatches,ieWatchName+S,GetStr(expr));
  141. end;
  142. end;
  143. procedure WriteOneBreakPointEntry(I : longint;INIFile : PINIFile);
  144. var PB : PBreakpoint;
  145. S : String;
  146. begin
  147. Str(I,S);
  148. PB:=BreakpointsCollection^.At(I);
  149. If assigned(PB) then
  150. With PB^ do
  151. Begin
  152. INIFile^.SetEntry(secBreakpoint,ieBreakpointTyp+S,BreakpointTypeStr[typ]);
  153. INIFile^.SetEntry(secBreakpoint,ieBreakpointState+S,BreakpointStateStr[state]);
  154. if typ=bt_file_line then
  155. begin
  156. INIFile^.SetEntry(secBreakpoint,ieBreakpointFile+S,FileName^);
  157. INIFile^.SetIntEntry(secBreakpoint,ieBreakpointLine+S,Line);
  158. end
  159. else
  160. INIFile^.SetEntry(secBreakpoint,ieBreakpointName+S,Name^);
  161. if assigned(Conditions) then
  162. INIFile^.SetEntry(secBreakpoint,ieBreakpointCond+S,Conditions^);
  163. end;
  164. end;
  165. procedure ReadOneWatchEntry(I : Longint;INIFile : PINIFile);
  166. var
  167. PW : PWatch;
  168. S : String;
  169. begin
  170. Str(I,S);
  171. PW:=new(PWatch,Init(INIFile^.GetEntry(secWatches,ieWatchName+S,'')));
  172. WatchesCollection^.Insert(PW);
  173. end;
  174. procedure ReadOneBreakPointEntry(i : longint;INIFile : PINIFile);
  175. var PB : PBreakpoint;
  176. S,S2,SC : string;
  177. Line : longint;
  178. typ : BreakpointType;
  179. state : BreakpointState;
  180. begin
  181. Str(I,S2);
  182. typ:=bt_invalid;
  183. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointTyp+S2,BreakpointTypeStr[typ]);
  184. for typ:=low(BreakpointType) to high(BreakpointType) do
  185. If pos(BreakpointTypeStr[typ],S)>0 then break;
  186. state:=bs_deleted;
  187. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointState+S2,BreakpointStateStr[state]);
  188. for state:=low(BreakpointState) to high(BreakpointState) do
  189. If pos(BreakpointStateStr[state],S)>0 then break;
  190. case typ of
  191. bt_invalid :;
  192. bt_file_line :
  193. begin
  194. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointFile+S2,'');
  195. Line:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointLine+S2,0);
  196. end;
  197. else
  198. begin
  199. S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointName+S2,'');
  200. end;
  201. end;
  202. SC:=INIFile^.GetEntry(secBreakpoint,ieBreakpointCond+S2,'');
  203. if (typ=bt_function) and (S<>'') then
  204. new(PB,init_function(S))
  205. else if (typ=bt_file_line) and (S<>'') then
  206. new(PB,init_file_line(S,Line))
  207. else
  208. new(PB,init_type(typ,S));
  209. If assigned(PB) then
  210. begin
  211. PB^.state:=state;
  212. If SC<>'' then
  213. PB^.conditions:=NewStr(SC);
  214. BreakpointsCollection^.Insert(PB);
  215. end;
  216. end;
  217. {$endif NODEBUG}
  218. function ReadINIFile: boolean;
  219. var INIFile: PINIFile;
  220. S,PS,S1,S2,S3: string;
  221. I,P: integer;
  222. BreakPointCount,WatchesCount:longint;
  223. OK: boolean;
  224. ts : TSwitchMode;
  225. W: word;
  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. { Misc }
  366. ShowReadme:=INIFile^.GetIntEntry(secMisc,ieShowReadme,{integer(ShowReadme)}1)<>0;
  367. Dispose(INIFile, Done);
  368. end;
  369. ReadINIFile:=OK;
  370. end;
  371. function WriteINIFile: boolean;
  372. var INIFile: PINIFile;
  373. S: string;
  374. S1,S2,S3: string;
  375. W: word;
  376. BreakPointCount,WatchesCount:longint;
  377. I(*,OpenFileCount*): integer;
  378. OK: boolean;
  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. { Misc }
  497. INIFile^.SetIntEntry(secMisc,ieShowReadme,integer(ShowReadme));
  498. OK:=INIFile^.Update;
  499. Dispose(INIFile, Done);
  500. WriteINIFile:=OK;
  501. end;
  502. end.
  503. {
  504. $Log$
  505. Revision 1.1 2000-07-13 09:48:34 michael
  506. + Initial import
  507. Revision 1.30 2000/06/22 09:07:12 pierre
  508. * Gabor changes: see fixes.txt
  509. Revision 1.29 2000/06/16 08:50:41 pierre
  510. + new bunch of Gabor's changes
  511. Revision 1.28 2000/03/21 23:30:22 pierre
  512. adapted to wcedit addition by Gabor
  513. Revision 1.27 2000/03/13 20:38:02 pierre
  514. IniPath removed and IniFileName moved to fpvars unit
  515. Revision 1.26 2000/02/04 00:08:35 pierre
  516. + IniCenterDebuggerRow
  517. Revision 1.25 1999/11/05 13:47:19 pierre
  518. * Breakpoint conditions were not reloaded correctly
  519. Revision 1.24 1999/09/16 14:34:59 pierre
  520. + TBreakpoint and TWatch registering
  521. + WatchesCollection and BreakpointsCollection stored in desk file
  522. * Syntax highlighting was broken
  523. Revision 1.23 1999/09/13 16:24:43 peter
  524. + clock
  525. * backspace unident like tp7
  526. Revision 1.22 1999/09/07 09:21:54 pierre
  527. + Watches saved
  528. Revision 1.21 1999/08/03 20:22:33 peter
  529. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  530. + Desktop saving should work now
  531. - History saved
  532. - Clipboard content saved
  533. - Desktop saved
  534. - Symbol info saved
  535. * syntax-highlight bug fixed, which compared special keywords case sensitive
  536. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  537. * with 'whole words only' set, the editor didn't found occourences of the
  538. searched text, if the text appeared previously in the same line, but didn't
  539. satisfied the 'whole-word' condition
  540. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  541. (ie. the beginning of the selection)
  542. * when started typing in a new line, but not at the start (X=0) of it,
  543. the editor inserted the text one character more to left as it should...
  544. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  545. * Shift shouldn't cause so much trouble in TCodeEditor now...
  546. * Syntax highlight had problems recognizing a special symbol if it was
  547. prefixed by another symbol character in the source text
  548. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  549. Revision 1.20 1999/06/28 12:36:51 pierre
  550. * avoid keeping old open file names
  551. Revision 1.19 1999/04/07 21:55:48 peter
  552. + object support for browser
  553. * html help fixes
  554. * more desktop saving things
  555. * NODEBUG directive to exclude debugger
  556. Revision 1.18 1999/03/23 15:11:31 peter
  557. * desktop saving things
  558. * vesa mode
  559. * preferences dialog
  560. Revision 1.17 1999/03/12 01:13:58 peter
  561. * flag if trytoopen should look for other extensions
  562. + browser tab in the tools-compiler
  563. Revision 1.16 1999/03/08 14:58:09 peter
  564. + prompt with dialogs for tools
  565. Revision 1.15 1999/03/05 17:53:02 pierre
  566. + saving and opening of open files on exit
  567. Revision 1.14 1999/03/01 15:41:55 peter
  568. + Added dummy entries for functions not yet implemented
  569. * MenuBar didn't update itself automatically on command-set changes
  570. * Fixed Debugging/Profiling options dialog
  571. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  572. set
  573. * efBackSpaceUnindents works correctly
  574. + 'Messages' window implemented
  575. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  576. + Added TP message-filter support (for ex. you can call GREP thru
  577. GREP2MSG and view the result in the messages window - just like in TP)
  578. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  579. so topic search didn't work...
  580. * In FPHELP.PAS there were still context-variables defined as word instead
  581. of THelpCtx
  582. * StdStatusKeys() was missing from the statusdef for help windows
  583. + Topic-title for index-table can be specified when adding a HTML-files
  584. Revision 1.13 1999/02/22 02:15:14 peter
  585. + default extension for save in the editor
  586. + Separate Text to Find for the grep dialog
  587. * fixed redir crash with tp7
  588. Revision 1.12 1999/02/19 18:43:46 peter
  589. + open dialog supports mask list
  590. Revision 1.11 1999/02/10 09:53:14 pierre
  591. * better storing of breakpoints
  592. Revision 1.10 1999/02/05 13:08:42 pierre
  593. + new breakpoint types added
  594. Revision 1.9 1999/02/05 12:11:55 pierre
  595. + SourceDir that stores directories for sources that the
  596. compiler should not know about
  597. Automatically asked for addition when a new file that
  598. needed filedialog to be found is in an unknown directory
  599. Stored and retrieved from INIFile
  600. + Breakpoints conditions added to INIFile
  601. * Breakpoints insterted and removed at debin and end of debug session
  602. Revision 1.8 1999/02/04 17:52:38 pierre
  603. * bs_invalid renamed bs_deleted
  604. Revision 1.7 1999/02/04 17:19:24 peter
  605. * linux fixes
  606. Revision 1.6 1999/02/04 13:32:04 pierre
  607. * Several things added (I cannot commit them independently !)
  608. + added TBreakpoint and TBreakpointCollection
  609. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  610. + Breakpoint list in INIFile
  611. * Select items now also depend of SwitchMode
  612. * Reading of option '-g' was not possible !
  613. + added search for -Fu args pathes in TryToOpen
  614. + added code for automatic opening of FileDialog
  615. if source not found
  616. Revision 1.5 1999/01/21 11:54:15 peter
  617. + tools menu
  618. + speedsearch in symbolbrowser
  619. * working run command
  620. Revision 1.4 1999/01/04 11:49:45 peter
  621. * 'Use tab characters' now works correctly
  622. + Syntax highlight now acts on File|Save As...
  623. + Added a new class to syntax highlight: 'hex numbers'.
  624. * There was something very wrong with the palette managment. Now fixed.
  625. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  626. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  627. process revised
  628. Revision 1.1 1998/12/28 15:47:45 peter
  629. + Added user screen support, display & window
  630. + Implemented Editor,Mouse Options dialog
  631. + Added location of .INI and .CFG file
  632. + Option (INI) file managment implemented (see bottom of Options Menu)
  633. + Switches updated
  634. + Run program
  635. }