fpmopts.inc 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Options menu entries
  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. procedure TIDEApp.SetSwitchesMode;
  13. var R,R2: TRect;
  14. D: PCenterDialog;
  15. RB: PRadioButtons;
  16. i : TSwitchMode;
  17. SwitchesCount : integer;
  18. LastItem: PSItem;
  19. L: longint;
  20. begin
  21. SwitchesCount:=ord(high(TSwitchMode))-ord(low(TSwitchMode))+1;
  22. R.Assign(0,0,36,4+SwitchesCount);
  23. New(D, Init(R, 'SwitchesMode'));
  24. with D^ do
  25. begin
  26. GetExtent(R);
  27. R.Grow(-3,-1);
  28. Inc(R.A.Y);
  29. R2.Copy(R);
  30. Inc(R2.A.Y);
  31. R2.B.Y:=R2.A.Y+SwitchesCount;
  32. LastItem:=nil;
  33. for I:=high(TSwitchMode) downto low(TSwitchMode) do
  34. LastItem:=NewSItem(SwitchesModeName[I], LastItem);
  35. New(RB, Init(R2, LastItem));
  36. L:=ord(SwitchesMode);
  37. { ^^^ this is necessary, since TRadioButtons.GetData() reads a full
  38. longint and by just specifying the SwitchesMode var (only 1 bytes),
  39. the three bytes located next to it in the memory will determine the
  40. three most significant bytes of the longint. And if they aren't all
  41. zero, then we will select some items outside the actual ones... }
  42. RB^.SetData(L);
  43. Insert(RB);
  44. R2.Copy(R);
  45. R2.B.Y:=R2.A.Y+1;
  46. Insert(New(PLabel, Init(R2, 'Switches Mode', RB)));
  47. end;
  48. InsertButtons(D);
  49. RB^.Select;
  50. if Desktop^.ExecView(D)=cmOK then
  51. SwitchesMode:=TSwitchMode(RB^.Value);
  52. Dispose(D, Done);
  53. end;
  54. procedure TIDEApp.DoCompilerSwitch;
  55. var R,R2,TabR,TabIR: TRect;
  56. D: PCenterDialog;
  57. CB1,CB2,CB3,CB4: PCheckBoxes;
  58. RB1,RB2,RB3: PRadioButtons;
  59. Items: PSItem;
  60. IL: PInputLine;
  61. Count : integer;
  62. I,L: longint;
  63. Tab: PTab;
  64. Label11,Label21,Label22,Label23,Label24,Label31: PLabel;
  65. begin
  66. R.Assign(0,0,72,18);
  67. New(D, Init(R, 'Compiler Switches'));
  68. with D^ do
  69. begin
  70. GetExtent(R);
  71. R.Grow(-2,-1);
  72. Dec(R.B.Y,2);
  73. TabR.Copy(R);
  74. TabIR.Copy(R);
  75. Inc(TabIR.A.Y,2);
  76. TabIR.Grow(0,-1);
  77. { --- Sheet 1 --- }
  78. Count:=SyntaxSwitches^.ItemCount;
  79. R.Copy(TabIR);
  80. R2.Copy(R);
  81. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  82. R2.B.Y:=R2.A.Y+Count;
  83. Items:=nil;
  84. for I:=Count-1 downto 0 do
  85. Items:=NewSItem(SyntaxSwitches^.ItemName(I), Items);
  86. New(CB1, Init(R2, Items));
  87. for I:=0 to Count-1 do
  88. if SyntaxSwitches^.GetBooleanItem(I) then
  89. CB1^.Press(I);
  90. Dec(R2.A.Y);
  91. R2.B.Y:=R2.A.Y+1;
  92. New(Label11, Init(R2, 'Syntax Switches', CB1));
  93. { --- Sheet 2 --- }
  94. Count:=CodegenSwitches^.ItemCount;
  95. R2.Copy(TabIR);
  96. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2-2;
  97. R2.B.Y:=R2.A.Y+Count;
  98. Items:=nil;
  99. for I:=Count-1 downto 0 do
  100. Items:=NewSItem(CodegenSwitches^.ItemName(I), Items);
  101. New(CB3, Init(R2, Items));
  102. for I:=0 to Count-1 do
  103. if CodegenSwitches^.GetBooleanItem(I) then
  104. CB3^.Press(I);
  105. Dec(R2.A.Y);
  106. R2.B.Y:=R2.A.Y+1;
  107. New(Label21, Init(R2, 'Run-time checks', CB3));
  108. Count:=OptimizingGoalSwitches^.ItemCount;
  109. R2.Copy(TabIR);
  110. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  111. Dec(R2.B.X,4);
  112. R2.B.Y:=R2.A.Y+Count;
  113. Items:=nil;
  114. for I:=Count-1 downto 0 do
  115. Items:=NewSItem(OptimizingGoalSwitches^.ItemName(I), Items);
  116. New(RB3, Init(R2, Items));
  117. for I:=0 to Count-1 do
  118. if OptimizingGoalSwitches^.GetBooleanItem(I) then
  119. RB3^.Press(I);
  120. Dec(R2.A.Y);
  121. R2.B.Y:=R2.A.Y+1;
  122. New(Label22, Init(R2, 'Optimizations', RB3));
  123. Count:=OptimizationSwitches^.ItemCount;
  124. R2.Copy(TabIR);
  125. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  126. Dec(R2.B.X,4);
  127. Inc(R2.A.Y, OptimizingGoalSwitches^.ItemCount);
  128. R2.B.Y:=R2.A.Y+Count;
  129. Items:=nil;
  130. for I:=Count-1 downto 0 do
  131. Items:=NewSItem(OptimizationSwitches^.ItemName(I), Items);
  132. New(CB2, Init(R2, Items));
  133. for I:=0 to Count-1 do
  134. if OptimizationSwitches^.GetBooleanItem(I) then
  135. CB2^.Press(I);
  136. Dec(R2.A.Y);
  137. R2.B.Y:=R2.A.Y+1;
  138. Count:=ProcessorSwitches^.ItemCount;
  139. R2.Copy(TabIR);
  140. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2-2;
  141. Inc(R2.A.Y,1+CodegenSwitches^.ItemCount);
  142. R2.B.Y:=R2.A.Y+Count;
  143. Items:=nil;
  144. for I:=Count-1 downto 0 do
  145. Items:=NewSItem(ProcessorSwitches^.ItemName(I), Items);
  146. New(RB1, Init(R2, Items));
  147. L:=ProcessorSwitches^.GetCurrSel;
  148. RB1^.SetData(L);
  149. Dec(R2.A.Y);
  150. R2.B.Y:=R2.A.Y+1;
  151. New(Label23, Init(R2, 'Target processor', RB1));
  152. Count:=AsmReaderSwitches^.ItemCount;
  153. R2.Copy(TabIR);
  154. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  155. Dec(R2.B.X,4);
  156. Inc(R2.A.Y, OptimizationSwitches^.ItemCount+OptimizingGoalSwitches^.ItemCount);
  157. R2.B.Y:=R2.A.Y+Count;
  158. Items:=nil;
  159. for I:=Count-1 downto 0 do
  160. Items:=NewSItem(AsmReaderSwitches^.ItemName(I), Items);
  161. New(RB2, Init(R2, Items));
  162. L:=AsmReaderSwitches^.GetCurrSel;
  163. RB2^.SetData(L);
  164. Dec(R2.A.Y);
  165. R2.B.Y:=R2.A.Y+1;
  166. New(Label24, Init(R2, 'Assembler format', RB2));
  167. { --- Sheet 3 --- }
  168. Count:=VerboseSwitches^.ItemCount;
  169. R.Copy(TabIR);
  170. R2.Copy(R);
  171. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  172. R2.B.Y:=R2.A.Y+Count;
  173. Items:=nil;
  174. for I:=Count-1 downto 0 do
  175. Items:=NewSItem(VerboseSwitches^.ItemName(I), Items);
  176. New(CB4, Init(R2, Items));
  177. for I:=0 to Count-1 do
  178. if VerboseSwitches^.GetBooleanItem(I) then
  179. CB4^.Press(I);
  180. Dec(R2.A.Y);
  181. R2.B.Y:=R2.A.Y+1;
  182. New(Label31, Init(R2, 'Verbose Switches', CB4));
  183. { create tabs }
  184. New(Tab, Init(TabR,
  185. NewTabDef('S~y~ntax',CB1,
  186. NewTabItem(Label11,
  187. NewTabItem(CB1,
  188. nil)),
  189. NewTabDef('Code ~g~eneration',CB3,
  190. NewTabItem(Label21,
  191. NewTabItem(CB3,
  192. NewTabItem(Label22,
  193. NewTabItem(CB2,
  194. NewTabItem(Label23,
  195. NewTabItem(RB3,
  196. NewTabItem(RB1,
  197. NewTabItem(Label24,
  198. NewTabItem(RB2,
  199. nil))))))))),
  200. NewTabDef('~V~erbose',CB4,
  201. NewTabItem(Label31,
  202. NewTabItem(CB4,
  203. nil)),
  204. nil)))));
  205. Tab^.GrowMode:=0;
  206. Insert(Tab);
  207. { conditionnals }
  208. R2.Copy(TabR); R2.A.Y:=R2.B.Y+1; R2.B.Y:=R2.A.Y+1;
  209. New(IL, Init(R2, 128));
  210. IL^.Data^:=ConditionalSwitches^.GetStringItem(0);
  211. Insert(IL);
  212. R2.Move(0,-1);
  213. Insert(New(PLabel, Init(R2,ConditionalSwitches^.ItemName(0), IL)));
  214. end;
  215. InsertButtons(D);
  216. if Desktop^.ExecView(D)=cmOK then
  217. begin
  218. for I:=0 to SyntaxSwitches^.ItemCount-1 do
  219. SyntaxSwitches^.SetBooleanItem(I,CB1^.Mark(I));
  220. for I:=0 to CodeGenSwitches^.ItemCount-1 do
  221. CodegenSwitches^.SetBooleanItem(I,CB3^.Mark(I));
  222. for I:=0 to OptimizationSwitches^.ItemCount-1 do
  223. OptimizationSwitches^.SetBooleanItem(I,CB2^.Mark(I));
  224. for I:=0 to VerboseSwitches^.ItemCount-1 do
  225. VerboseSwitches^.SetBooleanItem(I,CB4^.Mark(I));
  226. OptimizingGoalSwitches^.SetCurrSel(RB3^.Value);
  227. ProcessorSwitches^.SetCurrSel(RB1^.Value);
  228. AsmReaderSwitches^.SetCurrSel(RB2^.Value);
  229. ConditionalSwitches^.SetStringItem(0,IL^.Data^);
  230. end;
  231. Dispose(D, Done);
  232. end;
  233. procedure TIDEApp.MemorySizes;
  234. var R,R2,R3: TRect;
  235. D: PCenterDialog;
  236. ILs: array[0..10] of PIntegerLine;
  237. I: integer;
  238. begin
  239. R.Assign(0,0,40,2+MemorySwitches^.ItemCount*2);
  240. New(D, Init(R, 'Memory sizes'));
  241. with D^ do
  242. begin
  243. GetExtent(R); R.Grow(-3,-1);
  244. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  245. for I:=0 to MemorySwitches^.ItemCount-1 do
  246. begin
  247. R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  248. New(ILs[I], Init(R3, MinMemSize, MaxMemSize));
  249. ILs[I]^.Data^:=IntToStr(MemorySwitches^.GetLongintItem(I));
  250. Insert(ILs[I]);
  251. R3.Copy(R2); R3.B.X:=21;
  252. Insert(New(PLabel, Init(R3, MemorySwitches^.ItemName(I), ILs[I])));
  253. R2.Move(0,2);
  254. end;
  255. { R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  256. New(IL2, Init(R3, MinHeapSize, MaxHeapSize));
  257. IL2^.Data^:=IntToStr(GetHeapSize);
  258. Insert(IL2);
  259. R3.Copy(R2); R3.B.X:=21;
  260. Insert(New(PLabel, Init(R3, 'Local ~h~eap size', IL2)));}
  261. end;
  262. InsertButtons(D);
  263. ILs[0]^.Select;
  264. if Desktop^.ExecView(D)=cmOK then
  265. begin
  266. for I:=0 to MemorySwitches^.ItemCount-1 do
  267. begin
  268. MemorySwitches^.SetLongintItem(I,StrToInt(ILs[I]^.Data^));
  269. end;
  270. { SetStackSize(StrToInt(IL1^.Data^));
  271. SetHeapSize(StrToInt(IL2^.Data^));}
  272. end;
  273. Dispose(D, Done);
  274. end;
  275. procedure TIDEApp.DoLinkerSwitch;
  276. var R,R2: TRect;
  277. D: PCenterDialog;
  278. RB2: PRadioButtons;
  279. I: longint;
  280. Items: PSItem;
  281. L: longint;
  282. begin
  283. R.Assign(0,0,56,8);
  284. New(D, Init(R, 'Linker'));
  285. with D^ do
  286. begin
  287. GetExtent(R); R.Grow(-3,-1);
  288. { R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+GetEXEFormatCount; R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  289. Items:=nil;
  290. for I:=GetEXEFormatCount downto 1 do
  291. Items:=NewSItem(GetEXEFormatName(TEXEFormat(I)),Items);
  292. New(RB1, Init(R2, Items));
  293. Mask:=0; V:=1;
  294. for I:=1 to GetEXEFormatCount do
  295. begin
  296. if IsEXEFormatAvailable(TEXEFormat(I)) then
  297. Mask:=Mask or V;
  298. V:=V shl 1;
  299. end;
  300. RB1^.SetButtonState($ffff,false);
  301. RB1^.SetButtonState(Mask,true);
  302. L:=ord(GetEXEFormat)-1;
  303. RB1^.SetData(L);
  304. Insert(RB1);
  305. R2.Copy(R); R2.B.Y:=R2.A.Y+1;
  306. Insert(New(PLabel, Init(R2, 'Output format', RB1)));}
  307. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+LibLinkerSwitches^.ItemCount; R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2+1;
  308. Items:=nil;
  309. for I:=LibLinkerSwitches^.ItemCount-1 downto 0 do
  310. Items:=NewSItem(LibLinkerSwitches^.ItemName(I), Items);
  311. New(RB2, Init(R2, Items));
  312. L:=LibLinkerSwitches^.GetCurrSel;
  313. RB2^.SetData(L);
  314. Insert(RB2);
  315. R2.Copy(R); R2.B.Y:=R2.A.Y+1; R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2+1;
  316. Insert(New(PLabel, Init(R2, 'Preferred library type', RB2)));
  317. end;
  318. InsertButtons(D);
  319. if Desktop^.ExecView(D)=cmOK then
  320. begin
  321. { SetEXEFormat(TEXEFormat(RB1^.Value+1));}
  322. LibLinkerSwitches^.SetCurrSel(RB2^.Value);
  323. end;
  324. Dispose(D, Done);
  325. end;
  326. procedure TIDEApp.DoDebuggerSwitch;
  327. var R,R2: TRect;
  328. D: PCenterDialog;
  329. RB : PRadioButtons;
  330. CB: PCheckBoxes;
  331. IL2: PInputLine;
  332. L,I: longint;
  333. Items: PSItem;
  334. begin
  335. R.Assign(0,0,60,2+DebugInfoSwitches^.ItemCount+2
  336. +ProfileInfoSwitches^.ItemCount+4);
  337. New(D, Init(R, 'Debugging/Profiling'));
  338. with D^ do
  339. begin
  340. GetExtent(R); R.Grow(-3,-1);
  341. R2.Copy(R); Inc(R2.A.Y,2); R2.B.Y:=R2.A.Y+DebugInfoSwitches^.ItemCount;
  342. Items:=nil;
  343. for I:=DebugInfoSwitches^.ItemCount-1 downto 0 do
  344. Items:=NewSItem(DebugInfoSwitches^.ItemName(I), Items);
  345. New(RB, Init(R2, Items));
  346. L:=DebugInfoSwitches^.GetCurrSel;
  347. RB^.SetData(L);
  348. Insert(RB);
  349. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  350. Insert(New(PLabel, Init(R2, 'Debugging information', RB)));
  351. R2.Copy(R); Inc(R2.A.Y,2+DebugInfoSwitches^.ItemCount+2); R2.B.Y:=R2.A.Y+ProfileInfoSwitches^.ItemCount;
  352. Items:=nil;
  353. for I:=ProfileInfoSwitches^.ItemCount-1 downto 0 do
  354. Items:=NewSItem(ProfileInfoSwitches^.ItemName(I), Items);
  355. New(CB, Init(R2, Items));
  356. L:=ProfileInfoSwitches^.GetCurrSel;
  357. If L = 1 then L:=3;
  358. CB^.SetData(L);
  359. Insert(CB);
  360. R2.Copy(R); Inc(R2.A.Y,6); R2.B.Y:=R2.A.Y+1;
  361. Insert(New(PLabel, Init(R2, 'Profiling Switches', CB)));
  362. {custom }
  363. R2.A.Y:=R2.B.Y+2;
  364. R2.B.Y:=R2.A.Y+1;
  365. New(IL2, Init(R2, 255));
  366. IL2^.Data^:=CustomArg[SwitchesMode];
  367. Insert(IL2);
  368. R2.Move(0,-1);
  369. Insert(New(PLabel, Init(R2,'~A~dditional compiler args', IL2)));
  370. end;
  371. InsertButtons(D);
  372. RB^.Select;
  373. if Desktop^.ExecView(D)=cmOK then
  374. begin
  375. DebugInfoSwitches^.SetCurrSel(RB^.Value);
  376. {Writeln(':',CB^.Value,':');
  377. readln;}
  378. if CB^.Value = 3 then
  379. I := 1
  380. else
  381. I := 0;
  382. ProfileInfoSwitches^.SetCurrSel(I);
  383. CustomArg[SwitchesMode]:=IL2^.Data^;
  384. end;
  385. Dispose(D, Done);
  386. end;
  387. procedure TIDEApp.Directories;
  388. var R,R2: TRect;
  389. D: PCenterDialog;
  390. IL : array[0..11] of PInputLine;
  391. Count,I : integer;
  392. const
  393. LW = 25;
  394. begin
  395. Count:=DirectorySwitches^.ItemCount;
  396. R.Assign(0,0,64,2+Count*2);
  397. New(D, Init(R, 'Directories'));
  398. with D^ do
  399. begin
  400. GetExtent(R);
  401. R.Grow(-2,-2);
  402. Dec(R.B.X);
  403. R.B.Y:=R.A.Y+1;
  404. for i:=Count-1 downto 0 do
  405. begin
  406. R2.Copy(R);
  407. R2.A.X:=LW;
  408. New(IL[i], Init(R2, 255));
  409. IL[i]^.Data^:=DirectorySwitches^.GetStringItem(i);
  410. Insert(IL[i]);
  411. R2.Copy(R);
  412. R2.B.X:=LW;
  413. Insert(New(PLabel, Init(R2, DirectorySwitches^.ItemName(i), IL[i])));
  414. R.Move(0,2);
  415. end;
  416. end;
  417. InsertButtons(D);
  418. IL[Count-1]^.Select;
  419. if Desktop^.ExecView(D)=cmOK then
  420. begin
  421. for i:=Count-1 downto 0 do
  422. DirectorySwitches^.SetStringItem(i,IL[i]^.Data^);
  423. end;
  424. Dispose(D, Done);
  425. end;
  426. procedure TIDEApp.Tools;
  427. begin
  428. ExecuteDialog(New(PToolsDialog, Init),nil);
  429. end;
  430. procedure TIDEApp.EditorOptions(Editor: PEditor);
  431. var D: PCenterDialog;
  432. R,R2,R3: TRect;
  433. CB: PCheckBoxes;
  434. IL: PIntegerLine;
  435. ExtIL,TabExtIL: PInputLine;
  436. TabSize: Integer;
  437. EFlags: Longint;
  438. begin
  439. if Editor=nil
  440. then begin TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags; end
  441. else begin TabSize:=Editor^.TabSize; EFlags:=Editor^.Flags; end;
  442. R.Assign(0,0,56,18);
  443. New(D, Init(R, 'Editor Options'));
  444. with D^ do
  445. begin
  446. GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+7;
  447. R2.Copy(R); Inc(R2.A.Y);
  448. New(CB, Init(R2,
  449. NewSItem('Create backup ~f~iles',
  450. NewSItem('~I~nsert mode',
  451. NewSItem('~A~uto indent mode',
  452. NewSItem('~U~se tab characters',
  453. NewSItem('~B~ackspace unindents',
  454. NewSItem('~P~ersistent blocks',
  455. NewSItem('~S~yntax highlight',
  456. NewSItem('~B~lock insert cursor',
  457. NewSItem('~V~ertical blocks',
  458. NewSItem('Highlight ~c~olumn',
  459. NewSItem('Highlight ~r~ow',
  460. NewSItem('Aut~o~-closing brackets',
  461. nil))))))))))))));
  462. CB^.Value:=EFlags;
  463. Insert(CB);
  464. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  465. Insert(New(PLabel, Init(R2, 'Editor options', CB)));
  466. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+1;
  467. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y;
  468. R3.Copy(R); Inc(R3.A.X,10); R3.B.X:=R3.A.X+5;
  469. New(IL, Init(R3, 0,100));
  470. IL^.Data^:=IntToStr(TabSize);
  471. Insert(IL);
  472. R3.Copy(R); R3.B.X:=R3.A.X+10;
  473. Insert(New(PLabel, Init(R3, '~T~ab size', IL)));
  474. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  475. R2.Copy(R); Inc(R2.A.Y);
  476. New(ExtIL, Init(R2, 128));
  477. ExtIL^.SetData(HighlightExts);
  478. Insert(ExtIL);
  479. R2.Move(0,-1);
  480. Insert(New(PLabel, Init(R2, '~H~ighlight extensions', ExtIL)));
  481. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  482. R2.Copy(R); Inc(R2.A.Y);
  483. New(TabExtIL, Init(R2, 128));
  484. TabExtIL^.SetData(TabsPattern);
  485. Insert(TabExtIL);
  486. R2.Move(0,-1);
  487. Insert(New(PLabel, Init(R2, 'File ~p~atterns needing tabs', TabExtIL)));
  488. end;
  489. InsertButtons(D);
  490. CB^.Select;
  491. if Desktop^.ExecView(D)=cmOK then
  492. begin
  493. TabSize:=StrToInt(IL^.Data^); EFlags:=CB^.Value;
  494. if Editor=nil then
  495. begin
  496. DefaultTabSize:=TabSize;
  497. DefaultCodeEditorFlags:=EFlags;
  498. end
  499. else
  500. begin
  501. Editor^.TabSize:=TabSize;
  502. Editor^.SetFlags(EFlags);
  503. end;
  504. ExtIL^.GetData(HighlightExts);
  505. TabExtIL^.GetData(TabsPattern);
  506. end;
  507. Dispose(D, Done);
  508. end;
  509. procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
  510. var D: PCenterDialog;
  511. R,R2,R3 : TRect;
  512. PreS: string[15];
  513. CB1,CB2: PCheckBoxes;
  514. RB1,RB2: PRadioButtons;
  515. begin
  516. if Browser=nil then
  517. begin
  518. PreS:='';
  519. end
  520. else
  521. begin
  522. PreS:='Local ';
  523. end;
  524. R.Assign(0,0,56,15);
  525. New(D, Init(R, PreS+'Browser Options'));
  526. with D^ do
  527. begin
  528. GetExtent(R); R.Grow(-2,-2);
  529. R.B.Y:=R.A.Y+1+3; R2.Copy(R); Inc(R2.A.Y);
  530. New(CB1, Init(R2,
  531. NewSItem(RExpand('~L~abels',21+2),
  532. NewSItem('~C~onstants',
  533. NewSItem('~T~ypes',
  534. NewSItem('~V~ariables',
  535. NewSItem('~P~rocedures',
  536. NewSItem('~I~nherited',
  537. nil)))))))
  538. );
  539. Insert(CB1);
  540. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  541. Insert(New(PLabel, Init(R2, 'Symbols', CB1)));
  542. R.Move(0,R.B.Y-R.A.Y+1);
  543. R.B.Y:=R.A.Y+1+2; R2.Copy(R);
  544. R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
  545. New(RB1, Init(R3,
  546. NewSItem('~N~ew browser',
  547. NewSItem('~R~eplace current',
  548. nil)))
  549. );
  550. Insert(RB1);
  551. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  552. Insert(New(PLabel, Init(R3, 'Sub-browsing', RB1)));
  553. R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
  554. New(RB2, Init(R3,
  555. NewSItem('~S~cope',
  556. NewSItem('R~e~ference',
  557. nil)))
  558. );
  559. Insert(RB2);
  560. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  561. Insert(New(PLabel, Init(R3, 'Preferred pane', RB2)));
  562. R.Move(0,R.B.Y-R.A.Y+1);
  563. R.B.Y:=R.A.Y+1+1; R2.Copy(R); Inc(R2.A.Y);
  564. New(CB2, Init(R2,
  565. NewSItem(RExpand('~Q~ualified symbols',21+2),
  566. NewSItem('S~o~rt always',
  567. nil)))
  568. );
  569. Insert(CB2);
  570. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  571. Insert(New(PLabel, Init(R2, 'Display', CB2)));
  572. end;
  573. InsertButtons(D);
  574. CB1^.Select;
  575. if Desktop^.ExecView(D)=cmOK then
  576. begin
  577. end;
  578. Dispose(D, Done);
  579. end;
  580. procedure TIDEApp.Mouse;
  581. var R,R2: TRect;
  582. D: PCenterDialog;
  583. SB: PScrollBar;
  584. CB: PCheckBoxes;
  585. RB1,RB2: PRadioButtons;
  586. begin
  587. R.Assign(0,0,62,15);
  588. New(D, Init(R, 'Mouse Options'));
  589. with D^ do
  590. begin
  591. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+3;
  592. R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  593. New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
  594. SB^.SetParams(DoubleDelay,1,20,1,1);
  595. Insert(SB);
  596. R2.Move(0,-1);
  597. Insert(New(PStaticText, Init(R2, 'Fast Medium Slow')));
  598. R2.Move(-1,-1);
  599. Insert(New(PLabel, Init(R2, '~M~ouse double click', SB)));
  600. R2.Copy(R); Inc(R2.A.Y,2); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  601. New(CB, Init(R2, NewSItem('~R~everse mouse buttons', nil) ));
  602. if MouseReverse then CB^.Press(0);
  603. Insert(CB);
  604. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+8;
  605. R2.Copy(R); Inc(R2.A.Y); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  606. New(RB1, Init(R2,
  607. NewSItem('~N~othing',
  608. NewSItem('~T~opic search',
  609. NewSItem('~G~o to cursor',
  610. NewSItem('~B~reakpoint',
  611. NewSItem('~E~valuate',
  612. NewSItem('~A~dd watch',
  613. NewSItem('Browse ~s~ymbol',
  614. nil)))))))));
  615. RB1^.Press(CtrlMouseAction);
  616. Insert(RB1);
  617. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  618. Insert(New(PLabel, Init(R2, 'Ctrl+Right mouse button', RB1)));
  619. R2.Copy(R); Inc(R2.A.Y); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  620. New(RB2, Init(R2,
  621. NewSItem('N~o~thing',
  622. NewSItem('To~p~ic search',
  623. NewSItem('Go to ~c~ursor',
  624. NewSItem('Brea~k~point',
  625. NewSItem('E~v~aluate',
  626. NewSItem('Add ~w~atch',
  627. NewSItem('Browse s~y~mbol',
  628. nil)))))))));
  629. RB2^.Press(AltMouseAction);
  630. Insert(RB2);
  631. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  632. Insert(New(PLabel, Init(R2, 'Alt+Right mouse button', RB2)));
  633. end;
  634. InsertButtons(D);
  635. RB1^.Select;
  636. if Desktop^.ExecView(D)=cmOK then
  637. begin
  638. MouseReverse:=CB^.Mark(0);
  639. DoubleDelay:=SB^.Value;
  640. CtrlMouseAction:=RB1^.Value;
  641. AltMouseAction:=RB2^.Value;
  642. end;
  643. Dispose(D, Done);
  644. end;
  645. procedure TIDEApp.Colors;
  646. var D: PColorDialog;
  647. begin
  648. New(D, Init(AppPalette,
  649. ColorGroup('Browser',
  650. ColorItem('Frame passive' , 215,
  651. ColorItem('Frame active' , 216,
  652. ColorItem('Frame icon' , 217,
  653. ColorItem('Scroll bar page' , 218,
  654. ColorItem('Scroll bar icons', 219,
  655. ColorItem('Normal text' , 220,
  656. ColorItem('Selected text' , 221,
  657. ColorItem('Active item' , 222,
  658. ColorItem('Inactive item' , 223,
  659. ColorItem('Focused item' , 224,
  660. ColorItem('Selected item' , 225,
  661. ColorItem('Divider' , 226,
  662. nil)))))))))))),
  663. ColorGroup('Desktop', DesktopColorItems(nil),
  664. ColorGroup('Dialogs', DialogColorItems(dpGrayDialog,nil),
  665. ColorGroup('Editor',
  666. ColorItem('Frame passive' , 167,
  667. ColorItem('Frame active' , 168,
  668. ColorItem('Frame icon' , 169,
  669. ColorItem('Scroll bar page' , 170,
  670. ColorItem('Scroll bar icons', 171,
  671. ColorItem('Normal text' , 199,
  672. ColorItem('Selected text' , 208,
  673. ColorItem('Highlight column', 209,
  674. ColorItem('Highlight row' , 210,
  675. ColorItem('Error messages' , 214,
  676. nil)))))))))),
  677. ColorGroup('Help',
  678. ColorItem('Frame passive' , 128,
  679. ColorItem('Frame active' , 129,
  680. ColorItem('Frame icon' , 130,
  681. ColorItem('Scroll bar page' , 131,
  682. ColorItem('Scroll bar icons', 132,
  683. ColorItem('Help text' , 160,
  684. ColorItem('Help links' , 161,
  685. ColorItem('Selected link' , 162,
  686. ColorItem('Selected text' , 163,
  687. nil))))))))),
  688. ColorGroup('Menus', MenuColorItems(nil),
  689. ColorGroup('Syntax',
  690. ColorItem('Whitespace' , 200,
  691. ColorItem('Comments' , 201,
  692. ColorItem('Reserved words' , 202,
  693. ColorItem('Identifiers' , 203,
  694. ColorItem('Strings' , 204,
  695. ColorItem('Numbers' , 205,
  696. ColorItem('Hex numbers' , 212,
  697. ColorItem('Assembler' , 206,
  698. ColorItem('Symbols' , 207,
  699. ColorItem('Directives' , 211,
  700. ColorItem('Tabs' , 213,
  701. nil))))))))))),
  702. nil)))))))));
  703. if ExecuteDialog(D, @AppPalette)=cmOK then
  704. begin
  705. DoneMemory;
  706. Message(Application,evBroadcast,cmUpdate,nil);
  707. ReDraw;
  708. UpdateScreen(true);
  709. end;
  710. end;
  711. procedure TIDEApp.OpenINI;
  712. var D: PFileDialog;
  713. FileName: string;
  714. begin
  715. New(D, Init(ININame,'Open Options',ININame,fdOpenButton,0));
  716. if Desktop^.ExecView(D)<>cmCancel then
  717. begin
  718. D^.GetFileName(FileName);
  719. if ExistsFile(FileName)=false then ErrorBox('Can''t open config file.',nil) else
  720. begin
  721. INIPath:=FileName;
  722. ReadINIFile;
  723. Message(Application,evBroadcast,cmUpdate,nil);
  724. end;
  725. end;
  726. Dispose(D, Done);
  727. end;
  728. procedure TIDEApp.SaveINI;
  729. begin
  730. if WriteINIFile=false then
  731. ErrorBox('Error saving config file.',nil);
  732. end;
  733. procedure TIDEApp.SaveAsINI;
  734. var D: PFileDialog;
  735. FileName: string;
  736. CanWrite: boolean;
  737. begin
  738. New(D, Init(ININame,'Save Options',ININame,fdOpenButton,0));
  739. if Desktop^.ExecView(D)<>cmCancel then
  740. begin
  741. D^.GetFileName(FileName);
  742. CanWrite:=(ExistsFile(FileName)=false);
  743. if CanWrite=false then
  744. CanWrite:=ConfirmBox('File '+SmartPath(FileName)+' already exists. Overwrite?',nil,false)=cmYes;
  745. if CanWrite then
  746. begin
  747. INIPath:=FileName;
  748. if WriteINIFile=false then
  749. ErrorBox('Error saving config file.',nil);
  750. Message(Application,evBroadcast,cmUpdate,nil);
  751. end;
  752. end;
  753. Dispose(D, Done);
  754. end;
  755. {
  756. $Log$
  757. Revision 1.17 1999-02-22 11:51:37 peter
  758. * browser updates from gabor
  759. Revision 1.16 1999/02/18 13:44:32 peter
  760. * search fixed
  761. + backward search
  762. * help fixes
  763. * browser updates
  764. Revision 1.15 1999/02/16 17:15:28 pierre
  765. * Peter's debug code commented
  766. Revision 1.14 1999/02/16 10:43:56 peter
  767. * use -dGDB for the compiler
  768. * only use gdb_file when -dDEBUG is used
  769. * profiler switch is now a toggle instead of radiobutton
  770. Revision 1.13 1999/02/10 09:52:43 pierre
  771. * MemorySizeSwitches -> MemorySwitches (were duplicates)
  772. Revision 1.12 1999/02/08 17:41:34 pierre
  773. + CustomArg added to debug dialog
  774. Revision 1.11 1999/02/08 10:37:45 peter
  775. + html helpviewer
  776. Revision 1.10 1999/02/06 00:07:47 florian
  777. * speed/size optimization is now a radio button
  778. Revision 1.9 1999/02/05 12:11:58 pierre
  779. + SourceDir that stores directories for sources that the
  780. compiler should not know about
  781. Automatically asked for addition when a new file that
  782. needed filedialog to be found is in an unknown directory
  783. Stored and retrieved from INIFile
  784. + Breakpoints conditions added to INIFile
  785. * Breakpoints insterted and removed at debin and end of debug session
  786. Revision 1.8 1999/02/04 13:32:06 pierre
  787. * Several things added (I cannot commit them independently !)
  788. + added TBreakpoint and TBreakpointCollection
  789. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  790. + Breakpoint list in INIFile
  791. * Select items now also depend of SwitchMode
  792. * Reading of option '-g' was not possible !
  793. + added search for -Fu args pathes in TryToOpen
  794. + added code for automatic opening of FileDialog
  795. if source not found
  796. Revision 1.7 1999/01/22 10:24:04 peter
  797. * first debugger things
  798. Revision 1.6 1999/01/21 11:54:19 peter
  799. + tools menu
  800. + speedsearch in symbolbrowser
  801. * working run command
  802. Revision 1.5 1999/01/12 14:29:35 peter
  803. + Implemented still missing 'switch' entries in Options menu
  804. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  805. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  806. ASCII chars and inserted directly in the text.
  807. + Added symbol browser
  808. * splitted fp.pas to fpide.pas
  809. Revision 1.4 1999/01/04 11:49:47 peter
  810. * 'Use tab characters' now works correctly
  811. + Syntax highlight now acts on File|Save As...
  812. + Added a new class to syntax highlight: 'hex numbers'.
  813. * There was something very wrong with the palette managment. Now fixed.
  814. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  815. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  816. process revised
  817. Revision 1.2 1998/12/28 15:47:49 peter
  818. + Added user screen support, display & window
  819. + Implemented Editor,Mouse Options dialog
  820. + Added location of .INI and .CFG file
  821. + Option (INI) file managment implemented (see bottom of Options Menu)
  822. + Switches updated
  823. + Run program
  824. Revision 1.1 1998/12/22 14:27:54 peter
  825. * moved
  826. Revision 1.3 1998/12/22 10:39:48 peter
  827. + Switches are now written/read
  828. + find and replace routines
  829. }