fpini.pas 26 KB

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