fpmopts.inc 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  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, dialog_switchesmode));
  24. with D^ do
  25. begin
  26. HelpCtx:=hcSwitchesMode;
  27. GetExtent(R);
  28. R.Grow(-3,-1);
  29. Inc(R.A.Y);
  30. R2.Copy(R);
  31. Inc(R2.A.Y);
  32. R2.B.Y:=R2.A.Y+SwitchesCount;
  33. LastItem:=nil;
  34. for I:=high(TSwitchMode) downto low(TSwitchMode) do
  35. LastItem:=NewSItem(SwitchesModeName[I], LastItem);
  36. New(RB, Init(R2, LastItem));
  37. L:=ord(SwitchesMode);
  38. { ^^^ this is necessary, since TRadioButtons.GetData() reads a full
  39. longint and by just specifying the SwitchesMode var (only 1 bytes),
  40. the three bytes located next to it in the memory will determine the
  41. three most significant bytes of the longint. And if they aren't all
  42. zero, then we will select some items outside the actual ones... }
  43. RB^.SetData(L);
  44. Insert(RB);
  45. R2.Copy(R);
  46. R2.B.Y:=R2.A.Y+1;
  47. Insert(New(PLabel, Init(R2, static_switchesmode_switchesmode, RB)));
  48. end;
  49. InsertButtons(D);
  50. RB^.Select;
  51. if Desktop^.ExecView(D)=cmOK then
  52. SwitchesMode:=TSwitchMode(RB^.Value);
  53. Dispose(D, Done);
  54. UpdateMode;
  55. UpdateTarget;
  56. end;
  57. procedure TIDEApp.DoCompilerSwitch;
  58. var R,R2,R3,TabR,TabIR: TRect;
  59. D: PCenterDialog;
  60. CB1,CB2,CB3,CB4,CB5: PCheckBoxes;
  61. RB1,{RB2,}RB3,RB4,RB5,RB6: PRadioButtons;
  62. Items: PSItem;
  63. IL: PInputLine;
  64. Count : integer;
  65. I,L: longint;
  66. Tab: PTab;
  67. Label11,{Label12,}
  68. Label21,Label22,Label23,
  69. Label31,Label41,
  70. Label51,Label52,Label53: PLabel;
  71. begin
  72. R.Assign(0,0,72,18);
  73. New(D, Init(R, dialog_compilerswitches));
  74. with D^ do
  75. begin
  76. HelpCtx:=hcCompilerNoAltX;
  77. GetExtent(R);
  78. R.Grow(-2,-1);
  79. Dec(R.B.Y,2);
  80. TabR.Copy(R);
  81. TabIR.Copy(R);
  82. Inc(TabIR.A.Y,2);
  83. TabIR.Grow(0,-1);
  84. { --- Sheet 1 --- }
  85. Count:=SyntaxSwitches^.ItemCount;
  86. R.Copy(TabIR);
  87. R2.Copy(R);
  88. { R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;} R2.B.X:=R2.B.X-4;
  89. R2.B.Y:=R2.A.Y+((Count+1) div 2);
  90. Items:=nil;
  91. for I:=Count-1 downto 0 do
  92. Items:=NewSItem(SyntaxSwitches^.ItemName(I), Items);
  93. New(CB1, Init(R2, Items));
  94. for I:=0 to Count-1 do
  95. if SyntaxSwitches^.GetBooleanItem(I) then
  96. CB1^.Press(I);
  97. Dec(R2.A.Y);
  98. R2.B.Y:=R2.A.Y+1;
  99. New(Label11, Init(R2, label_compiler_syntaxswitches, CB1));
  100. { --- Sheet 2 --- }
  101. Count:=CodegenSwitches^.ItemCount;
  102. R2.Copy(TabIR);
  103. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2-2;
  104. R2.B.Y:=R2.A.Y+Count;
  105. Items:=nil;
  106. for I:=Count-1 downto 0 do
  107. Items:=NewSItem(CodegenSwitches^.ItemName(I), Items);
  108. New(CB3, Init(R2, Items));
  109. for I:=0 to Count-1 do
  110. if CodegenSwitches^.GetBooleanItem(I) then
  111. CB3^.Press(I);
  112. Dec(R2.A.Y);
  113. R2.B.Y:=R2.A.Y+1;
  114. New(Label21, Init(R2, label_compiler_runtimechecks, CB3));
  115. Count:=OptimizingGoalSwitches^.ItemCount;
  116. R2.Copy(TabIR);
  117. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  118. Dec(R2.B.X,4);
  119. R2.B.Y:=R2.A.Y+Count;
  120. Items:=nil;
  121. for I:=Count-1 downto 0 do
  122. Items:=NewSItem(OptimizingGoalSwitches^.ItemName(I), Items);
  123. New(RB3, Init(R2, Items));
  124. L:=OptimizingGoalSwitches^.GetCurrSel;
  125. RB3^.SetData(L);
  126. Dec(R2.A.Y);
  127. R2.B.Y:=R2.A.Y+1;
  128. New(Label22, Init(R2, label_compiler_optimizations, RB3));
  129. Count:=OptimizationSwitches^.ItemCount;
  130. R2.Copy(TabIR);
  131. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  132. Dec(R2.B.X,4);
  133. Inc(R2.A.Y, OptimizingGoalSwitches^.ItemCount);
  134. R2.B.Y:=R2.A.Y+Count;
  135. Items:=nil;
  136. for I:=Count-1 downto 0 do
  137. Items:=NewSItem(OptimizationSwitches^.ItemName(I), Items);
  138. New(CB2, Init(R2, Items));
  139. for I:=0 to Count-1 do
  140. if OptimizationSwitches^.GetBooleanItem(I) then
  141. CB2^.Press(I);
  142. Dec(R2.A.Y);
  143. R2.B.Y:=R2.A.Y+1;
  144. Count:=ProcessorSwitches^.ItemCount;
  145. R2.Copy(TabIR);
  146. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2-2;
  147. Inc(R2.A.Y,CodegenSwitches^.ItemCount+2);
  148. R2.B.Y:=R2.A.Y+Count;
  149. Items:=nil;
  150. for I:=Count-1 downto 0 do
  151. Items:=NewSItem(ProcessorSwitches^.ItemName(I), Items);
  152. New(RB1, Init(R2, Items));
  153. L:=ProcessorSwitches^.GetCurrSel;
  154. RB1^.SetData(L);
  155. Dec(R2.A.Y);
  156. R2.B.Y:=R2.A.Y+1;
  157. New(Label23, Init(R2, label_compiler_targetprocessor, RB1));
  158. { --- Sheet 3 --- }
  159. Count:=VerboseSwitches^.ItemCount;
  160. R.Copy(TabIR);
  161. R2.Copy(R);
  162. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  163. R2.B.Y:=R2.A.Y+Count;
  164. Items:=nil;
  165. for I:=Count-1 downto 0 do
  166. Items:=NewSItem(VerboseSwitches^.ItemName(I), Items);
  167. New(CB4, Init(R2, Items));
  168. for I:=0 to Count-1 do
  169. if VerboseSwitches^.GetBooleanItem(I) then
  170. CB4^.Press(I);
  171. Dec(R2.A.Y);
  172. R2.B.Y:=R2.A.Y+1;
  173. New(Label31, Init(R2, label_compiler_verboseswitches, CB4));
  174. { --- Sheet 4 --- }
  175. Count:=BrowserSwitches^.ItemCount;
  176. R.Copy(TabIR);
  177. R2.Copy(R);
  178. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  179. R2.B.Y:=R2.A.Y+Count;
  180. Items:=nil;
  181. for I:=Count-1 downto 0 do
  182. Items:=NewSItem(BrowserSwitches^.ItemName(I), Items);
  183. New(RB4, Init(R2, Items));
  184. L:=BrowserSwitches^.GetCurrSel;
  185. RB4^.SetData(L);
  186. Dec(R2.A.Y);
  187. R2.B.Y:=R2.A.Y+1;
  188. New(Label41, Init(R2, label_compiler_browser, RB4));
  189. { --- Sheet 5 --- }
  190. Count:=AsmReaderSwitches^.ItemCount;
  191. R2.Copy(TabIR);
  192. R2.B.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  193. Dec(R2.B.X,4);
  194. R2.B.Y:=R2.A.Y+Count;
  195. Items:=nil;
  196. for I:=Count-1 downto 0 do
  197. Items:=NewSItem(AsmReaderSwitches^.ItemName(I), Items);
  198. New(RB5, Init(R2, Items));
  199. L:=AsmReaderSwitches^.GetCurrSel;
  200. RB5^.SetData(L);
  201. Dec(R2.A.Y);
  202. R2.B.Y:=R2.A.Y+1;
  203. New(Label51, Init(R2, label_compiler_assemblerreader, RB5));
  204. R2.Copy(TabIR);
  205. R2.B.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  206. Dec(R2.B.X,4);
  207. R2.A.Y:=R2.A.Y+Count+2;
  208. Count:=AsmInfoSwitches^.ItemCount;
  209. R2.B.Y:=R2.A.Y+Count;
  210. Items:=nil;
  211. for I:=Count-1 downto 0 do
  212. Items:=NewSItem(AsmInfoSwitches^.ItemName(I), Items);
  213. New(CB5, Init(R2, Items));
  214. for I:=0 to Count-1 do
  215. if AsmInfoSwitches^.GetBooleanItem(I) then
  216. CB5^.Press(I);
  217. Dec(R2.A.Y);
  218. R2.B.Y:=R2.A.Y+1;
  219. New(Label52, Init(R2, label_compiler_assemblerinfo, CB5));
  220. Count:=AsmOutputSwitches^.ItemCount;
  221. R2.Copy(TabIR);
  222. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  223. Dec(R2.B.X,4);
  224. R2.B.Y:=R2.A.Y+Count;
  225. Items:=nil;
  226. for I:=Count-1 downto 0 do
  227. Items:=NewSItem(AsmOutputSwitches^.ItemName(I), Items);
  228. New(RB6, Init(R2, Items));
  229. L:=AsmOutputSwitches^.GetCurrSel;
  230. RB6^.SetData(L);
  231. Dec(R2.A.Y);
  232. R2.B.Y:=R2.A.Y+1;
  233. New(Label53, Init(R2, label_compiler_assembleroutput, RB6));
  234. { create tabs }
  235. New(Tab, Init(TabR,
  236. NewTabDef(page_compiler_syntax,CB1,
  237. NewTabItem(Label11,
  238. NewTabItem(CB1,
  239. nil)),
  240. NewTabDef(page_compiler_codegeneration,CB3,
  241. NewTabItem(Label21,
  242. NewTabItem(CB3,
  243. NewTabItem(Label22,
  244. NewTabItem(CB2,
  245. NewTabItem(Label23,
  246. NewTabItem(RB3,
  247. NewTabItem(RB1,
  248. nil))))))),
  249. NewTabDef(page_compiler_verbose,CB4,
  250. NewTabItem(Label31,
  251. NewTabItem(CB4,
  252. nil)),
  253. NewTabDef(page_compiler_browser,RB4,
  254. NewTabItem(Label41,
  255. NewTabItem(RB4,
  256. nil)),
  257. NewTabDef(page_compiler_assembler,CB1,
  258. NewTabItem(Label51,
  259. NewTabItem(RB5,
  260. NewTabItem(Label52,
  261. NewTabItem(CB5,
  262. NewTabItem(Label53,
  263. NewTabItem(RB6,
  264. nil)))))),
  265. nil)))))));
  266. Tab^.GrowMode:=0;
  267. Insert(Tab);
  268. { conditionnals }
  269. R2.Copy(TabR); R2.A.Y:=R2.B.Y+1; R2.B.Y:=R2.A.Y+1; Dec(R2.B.X,4);
  270. New(IL, Init(R2, 128));
  271. IL^.Data^:=ConditionalSwitches^.GetStringItem(0);
  272. Insert(IL);
  273. R3.Copy(R2); R3.A.X:=R2.B.X+1; R3.B.X:=R3.A.X+3;
  274. Insert(New(PHistory, Init(R3, IL, hidConditionalDefines)));
  275. R2.Move(0,-1);
  276. Insert(New(PLabel, Init(R2,ConditionalSwitches^.ItemName(0), IL)));
  277. end;
  278. InsertButtons(D);
  279. if Desktop^.ExecView(D)=cmOK then
  280. begin
  281. for I:=0 to SyntaxSwitches^.ItemCount-1 do
  282. SyntaxSwitches^.SetBooleanItem(I,CB1^.Mark(I));
  283. for I:=0 to CodeGenSwitches^.ItemCount-1 do
  284. CodegenSwitches^.SetBooleanItem(I,CB3^.Mark(I));
  285. for I:=0 to OptimizationSwitches^.ItemCount-1 do
  286. OptimizationSwitches^.SetBooleanItem(I,CB2^.Mark(I));
  287. for I:=0 to VerboseSwitches^.ItemCount-1 do
  288. VerboseSwitches^.SetBooleanItem(I,CB4^.Mark(I));
  289. OptimizingGoalSwitches^.SetCurrSel(RB3^.Value);
  290. ProcessorSwitches^.SetCurrSel(RB1^.Value);
  291. AsmReaderSwitches^.SetCurrSel(RB5^.Value);
  292. for I:=0 to AsmInfoSwitches^.ItemCount-1 do
  293. AsmInfoSwitches^.SetBooleanItem(I,CB5^.Mark(I));
  294. AsmOutputSwitches^.SetCurrSel(RB6^.Value);
  295. BrowserSwitches^.SetCurrSel(RB4^.Value);
  296. ConditionalSwitches^.SetStringItem(0,IL^.Data^);
  297. end;
  298. Dispose(D, Done);
  299. end;
  300. procedure TIDEApp.MemorySizes;
  301. var R,R2,R3: TRect;
  302. D: PCenterDialog;
  303. ILs: array[0..10] of PIntegerLine;
  304. I: integer;
  305. begin
  306. R.Assign(0,0,40,2+MemorySwitches^.ItemCount*2);
  307. New(D, Init(R, dialog_memorysizes));
  308. with D^ do
  309. begin
  310. HelpCtx:=hcmemorysizes;
  311. GetExtent(R); R.Grow(-3,-1);
  312. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  313. for I:=0 to MemorySwitches^.ItemCount-1 do
  314. begin
  315. R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  316. New(ILs[I], Init(R3, MinMemSize, MaxMemSize));
  317. ILs[I]^.Data^:=IntToStr(MemorySwitches^.GetLongintItem(I));
  318. Insert(ILs[I]);
  319. R3.Copy(R2); R3.B.X:=21;
  320. Insert(New(PLabel, Init(R3, MemorySwitches^.ItemName(I), ILs[I])));
  321. R2.Move(0,2);
  322. end;
  323. { R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  324. New(IL2, Init(R3, MinHeapSize, MaxHeapSize));
  325. IL2^.Data^:=IntToStr(GetHeapSize);
  326. Insert(IL2);
  327. R3.Copy(R2); R3.B.X:=21;
  328. Insert(New(PLabel, Init(R3, 'Local ~h~eap size', IL2)));}
  329. end;
  330. InsertButtons(D);
  331. ILs[0]^.Select;
  332. if Desktop^.ExecView(D)=cmOK then
  333. begin
  334. for I:=0 to MemorySwitches^.ItemCount-1 do
  335. begin
  336. MemorySwitches^.SetLongintItem(I,StrToInt(ILs[I]^.Data^));
  337. end;
  338. { SetStackSize(StrToInt(IL1^.Data^));
  339. SetHeapSize(StrToInt(IL2^.Data^));}
  340. end;
  341. Dispose(D, Done);
  342. end;
  343. procedure TIDEApp.DoLinkerSwitch;
  344. var R,R2: TRect;
  345. D: PCenterDialog;
  346. RB2: PRadioButtons;
  347. CB,CB2 : PCheckBoxes;
  348. Count,I: longint;
  349. Items: PSItem;
  350. L: longint;
  351. begin
  352. R.Assign(0,0,66,8);
  353. New(D, Init(R, dialog_linker));
  354. with D^ do
  355. begin
  356. HelpCtx:=hclinker;
  357. GetExtent(R); R.Grow(-3,-1);
  358. Count:=LinkAfterSwitches^.ItemCount;
  359. R2.Copy(R);
  360. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 - 1;
  361. Inc(R2.A.Y,1);
  362. R2.B.Y:=R2.A.Y+Count;
  363. Items:=nil;
  364. for I:=Count-1 downto 0 do
  365. Items:=NewSItem(LinkAfterSwitches^.ItemName(I), Items);
  366. New(CB, Init(R2, Items));
  367. for I:=0 to Count-1 do
  368. if LinkAfterSwitches^.GetBooleanItem(I) then
  369. CB^.Press(I);
  370. Insert(CB);
  371. Dec(R2.A.Y);
  372. R2.B.Y:=R2.A.Y+1;
  373. Insert(New(PLabel, Init(R2, label_compiler_linkafter, CB)));
  374. R2.Copy(R);
  375. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 - 1;
  376. Inc(R2.A.Y,Count+2);
  377. R2.B.Y:=R2.A.Y+1;
  378. Items:=NewSItem(OtherLinkerSwitches^.ItemName(1), Nil);
  379. New(CB2, Init(R2, Items));
  380. if OtherLinkerSwitches^.GetBooleanItem(1) then
  381. CB2^.Press(0);
  382. Insert(CB2);
  383. R2.Copy(R); Inc(R2.A.Y);
  384. R2.B.Y:=R2.A.Y+LibLinkerSwitches^.ItemCount;
  385. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2+1;
  386. Items:=nil;
  387. for I:=LibLinkerSwitches^.ItemCount-1 downto 0 do
  388. Items:=NewSItem(LibLinkerSwitches^.ItemName(I), Items);
  389. New(RB2, Init(R2, Items));
  390. L:=LibLinkerSwitches^.GetCurrSel;
  391. RB2^.SetData(L);
  392. Insert(RB2);
  393. 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;
  394. Insert(New(PLabel, Init(R2, label_linker_preferredlibtype, RB2)));
  395. end;
  396. InsertButtons(D);
  397. RB2^.Select;
  398. if Desktop^.ExecView(D)=cmOK then
  399. begin
  400. { SetEXEFormat(TEXEFormat(RB1^.Value+1));}
  401. LibLinkerSwitches^.SetCurrSel(RB2^.Value);
  402. OtherLinkerSwitches^.SetBooleanItem(1,CB2^.Mark(0));
  403. if LibLinkerSwitches^.GetCurrSelParam='X' then
  404. if CompareText(TargetSwitches^.GetCurrSelParam,'win32')=0 then
  405. if CompareText(AsmOutputSwitches^.GetCurrSelParam,'pecoff')<>0 then
  406. if ConfirmBox(
  407. FormatStrStr3(msg_xmustbesettoyforz_doyouwanttochangethis,
  408. label_compiler_assembleroutput,'pecoff','smartlinking'),nil,false)=cmYes then
  409. AsmOutputSwitches^.SetCurrSelParam('pecoff');
  410. for I:=0 to LinkAfterSwitches^.ItemCount-1 do
  411. LinkAfterSwitches^.SetBooleanItem(I,CB^.Mark(I));
  412. end;
  413. Dispose(D, Done);
  414. end;
  415. procedure TIDEApp.DoDebuggerSwitch;
  416. var R,R2,R3: TRect;
  417. D: PCenterDialog;
  418. RB,RB2 : PRadioButtons;
  419. CBStrip: PCheckBoxes;
  420. {$ifdef win32}
  421. CB2: PCheckBoxes;
  422. {$endif win32}
  423. {$ifdef Unix}
  424. IL: PInputLine;
  425. {$endif Unix}
  426. IL2: PInputLine;
  427. L,I: longint;
  428. Items: PSItem;
  429. const
  430. {$ifdef win32}
  431. OtherFieldLines = 3;
  432. {$else not win32}
  433. {$ifdef Unix}
  434. OtherFieldLines = 3;
  435. {$else not Unix}
  436. OtherFieldLines = 0;
  437. {$endif Unix}
  438. {$endif win32}
  439. begin
  440. R.Assign(0,0,60,2+DebugInfoSwitches^.ItemCount+1+2
  441. +ProfileInfoSwitches^.ItemCount+2+2+1+OtherFieldLines);
  442. New(D, Init(R, dialog_debugger));
  443. with D^ do
  444. begin
  445. HelpCtx:=hcdebugger;
  446. { Strip all }
  447. GetExtent(R); R.Grow(-3,-1);
  448. R2.Copy(R); Inc(R2.A.Y,2); R2.B.Y:=R2.A.Y+1;
  449. Items:=NewSItem(OtherLinkerSwitches^.ItemName(0), Nil);
  450. New(CBStrip, Init(R2, Items));
  451. if OtherLinkerSwitches^.GetBooleanItem(0) then
  452. CBStrip^.Press(0);
  453. Insert(CBStrip);
  454. GetExtent(R); R.Grow(-3,-1);
  455. R2.Copy(R); Inc(R2.A.Y,3); R2.B.Y:=R2.A.Y+DebugInfoSwitches^.ItemCount;
  456. Items:=nil;
  457. for I:=DebugInfoSwitches^.ItemCount-1 downto 0 do
  458. Items:=NewSItem(DebugInfoSwitches^.ItemName(I), Items);
  459. New(RB, Init(R2, Items));
  460. L:=DebugInfoSwitches^.GetCurrSel;
  461. RB^.SetData(L);
  462. Insert(RB);
  463. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  464. Insert(New(PLabel, Init(R2, label_debugger_debuginfo, RB)));
  465. R2.Copy(R); Inc(R2.A.Y,3+DebugInfoSwitches^.ItemCount+2); R2.B.Y:=R2.A.Y+ProfileInfoSwitches^.ItemCount;
  466. Items:=nil;
  467. for I:=ProfileInfoSwitches^.ItemCount-1 downto 0 do
  468. Items:=NewSItem(ProfileInfoSwitches^.ItemName(I), Items);
  469. New(RB2, Init(R2, Items));
  470. L:=ProfileInfoSwitches^.GetCurrSel;
  471. RB2^.SetData(L);
  472. Insert(RB2);
  473. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  474. Insert(New(PLabel, Init(R2, label_debugger_profileswitches, RB2)));
  475. {custom }
  476. Inc(R2.A.Y,2+ProfileInfoSwitches^.ItemCount+1); R2.B.Y:=R2.A.Y+1;
  477. R3.Copy(R2); Dec(R3.B.X,4);
  478. New(IL2, Init(R3, 255));
  479. IL2^.Data^:=CustomArg[SwitchesMode];
  480. Insert(IL2);
  481. R3.Copy(R2); R3.A.X:=R3.B.X-3; R3.B.X:=R3.A.X+3;
  482. Insert(New(PHistory, Init(R3, IL2, hidCompilerArgs)));
  483. R2.Move(0,-1);
  484. Insert(New(PLabel, Init(R2,label_debugger_compilerargs, IL2)));
  485. {$ifdef win32}
  486. R2.Move(0,4);
  487. New(CB2,Init(R2,NewSItem(label_debugger_useanotherconsole, nil)));
  488. Insert(CB2);
  489. if DebuggeeTTY<>'' then
  490. L:=1
  491. else
  492. L:=0;
  493. CB2^.SetData(L);
  494. R2.Move(0,-1);
  495. Insert(New(PLabel, Init(R2,label_debugger_redirection, CB2)));
  496. {$endif win32}
  497. {$ifdef Unix}
  498. R2.Move(0,4);
  499. New(IL, Init(R2, 255));
  500. IL^.Data^:=DebuggeeTTY;
  501. Insert(IL);
  502. R2.Move(0,-1);
  503. Insert(New(PLabel, Init(R2,label_debugger_useanothertty, IL)));
  504. {$endif win32}
  505. end;
  506. InsertButtons(D);
  507. RB^.Select;
  508. if Desktop^.ExecView(D)=cmOK then
  509. begin
  510. DebugInfoSwitches^.SetCurrSel(RB^.Value);
  511. ProfileInfoSwitches^.SetCurrSel(RB2^.Value);
  512. OtherLinkerSwitches^.SetBooleanItem(0,CBStrip^.Mark(0));
  513. CustomArg[SwitchesMode]:=IL2^.Data^;
  514. {$ifdef win32}
  515. if CB2^.value<>0 then
  516. DebuggeeTTY:='on'
  517. else
  518. DebuggeeTTY:='';
  519. {$endif win32}
  520. {$ifdef Unix}
  521. DebuggeeTTY:=IL^.Data^;
  522. {$endif Unix}
  523. end;
  524. Dispose(D, Done);
  525. end;
  526. procedure TIDEApp.Directories;
  527. var R,R2: TRect;
  528. D: PCenterDialog;
  529. IL : array[0..11] of PInputLine;
  530. Count,I : integer;
  531. const
  532. LW = 25;
  533. begin
  534. Count:=DirectorySwitches^.ItemCount;
  535. R.Assign(0,0,round(ScreenWidth*64/80),2+Count*2);
  536. New(D, Init(R, dialog_directories));
  537. with D^ do
  538. begin
  539. HelpCtx:=hcdirectories;
  540. GetExtent(R);
  541. R.Grow(-2,-2);
  542. Dec(R.B.X);
  543. R.B.Y:=R.A.Y+1;
  544. for i:=Count-1 downto 0 do
  545. begin
  546. R2.Copy(R);
  547. R2.A.X:=LW;
  548. New(IL[i], Init(R2, 255));
  549. IL[i]^.Data^:=DirectorySwitches^.GetStringItem(i);
  550. Insert(IL[i]);
  551. R2.Copy(R);
  552. R2.B.X:=LW;
  553. Insert(New(PLabel, Init(R2, DirectorySwitches^.ItemName(i), IL[i])));
  554. R.Move(0,2);
  555. end;
  556. end;
  557. InsertButtons(D);
  558. IL[Count-1]^.Select;
  559. if Desktop^.ExecView(D)=cmOK then
  560. begin
  561. for i:=Count-1 downto 0 do
  562. DirectorySwitches^.SetStringItem(i,IL[i]^.Data^);
  563. end;
  564. Dispose(D, Done);
  565. end;
  566. procedure TIDEApp.Tools;
  567. var
  568. D : PToolsDialog;
  569. begin
  570. D:=New(PToolsDialog, Init);
  571. ExecuteDialog(D,nil);
  572. end;
  573. (*procedure TIDEApp.Preferences;
  574. var R,R2: TRect;
  575. D: PCenterDialog;
  576. RB1 : PRadioButtons;
  577. CountModes : integer;
  578. hp : pvideomodelist;
  579. items : PSItem;
  580. videomode : tvideomode;
  581. i,modevalue : longint;
  582. function ToStr(l : longint) : string;
  583. var
  584. s : string;
  585. begin
  586. str(l,s);
  587. ToStr:=s;
  588. end;
  589. const
  590. color2str : array[false..true] of string = ('in b/w','in color');
  591. begin
  592. GetVideoMode(videomode);
  593. CountModes:=0;
  594. i:=0;
  595. modevalue:=0;
  596. R.Assign(0,0,64,18);
  597. New(D, Init(R, 'Preferences'));
  598. with D^ do
  599. begin
  600. hp:=video.modes;
  601. items:=nil;
  602. r2.assign(2,3,24,17);
  603. while assigned(hp) do
  604. begin
  605. items:=NewSItem(ToStr(hp^.col)+'x'+ToStr(hp^.row)+' '+color2str[hp^.color],items);
  606. if (hp^.col=videomode.col) and (hp^.row=videomode.row) and
  607. (hp^.color=videomode.color) then
  608. modevalue:=i;
  609. inc(CountModes);
  610. { we can't display an infinite number of modes }
  611. if CountModes>=r.b.y-r.a.y+1 then
  612. break;
  613. inc(i);
  614. hp:=hp^.next;
  615. end;
  616. modevalue:=CountModes-modevalue-1;
  617. new(rb1,init(r2,items));
  618. insert(rb1);
  619. rb1^.value:=modevalue;
  620. r2.move(0,-1);r2.b.y:=r2.a.y+1;
  621. insert(new(plabel,init(r2,'~V~ideo mode',rb1)));
  622. end;
  623. InsertButtons(D);
  624. if Desktop^.ExecView(D)=cmOK then
  625. begin
  626. { change video mode ? }
  627. if rb1^.value<>modevalue then
  628. begin
  629. modevalue:=CountModes-rb1^.value-1;
  630. hp:=video.modes;
  631. for i:=1 to modevalue do
  632. hp:=hp^.next;
  633. videomode.col:=hp^.col;
  634. videomode.row:=hp^.row;
  635. videomode.color:=hp^.color;
  636. SetScreenVideoMode(videomode);
  637. end;
  638. end;
  639. Dispose(D, Done);
  640. end;*)
  641. type
  642. PVideoModeCollection = ^TVideoModeCollection;
  643. TVideoModeCollection = object(TSortedCollection)
  644. function Compare(Key1, Key2: Pointer): Sw_Integer; virtual;
  645. procedure FreeItem(Item: Pointer); virtual;
  646. end;
  647. function TVideoModeCollection.Compare(Key1, Key2: Pointer): Sw_Integer;
  648. var R: Sw_integer;
  649. K1: PVideoMode absolute Key1;
  650. K2: PVideoMode absolute Key2;
  651. begin
  652. if K1^.Col<K2^.Col then R:=-1 else
  653. if K1^.Col>K2^.Col then R:= 1 else
  654. if K1^.Row<K2^.Row then R:=-1 else
  655. if K1^.Row>K2^.Row then R:= 1 else
  656. if (K1^.Color=false) and (K2^.Color=true ) then R:=-1 else
  657. if (K1^.Color=true ) and (K2^.Color=false) then R:= 1 else
  658. R:=0;
  659. Compare:=R;
  660. end;
  661. procedure TVideoModeCollection.FreeItem(Item: Pointer);
  662. begin
  663. FreeMem(Item,sizeof(TVideoMode));
  664. end;
  665. procedure TIDEApp.Preferences;
  666. var R,R2: TRect;
  667. D: PCenterDialog;
  668. C: PVideoModeCollection;
  669. VMLB: PVideoModeListBox;
  670. OldScreenMode,VM: TVideoMode;
  671. ScreenModeInfo : array[1..3] of longint;
  672. CurVP,VP: PVideoMode;
  673. RB1: PPlainRadioButtons;
  674. CB1,CB2: PPlainCheckBoxes;
  675. CurIdx: integer;
  676. i : word;
  677. begin
  678. New(C, Init(10,50));
  679. for i:=0 to GetVideoModeCount-1 do
  680. begin
  681. GetVideoModeData(i,VM);
  682. GetMem(VP,sizeof(TVideoMode));
  683. Move(VM,VP^,sizeof(TVideoMode));
  684. C^.Insert(VP);
  685. if (VM.Row=ScreenMode.Row) and (VM.Col=ScreenMode.Col) and
  686. (VM.Color=ScreenMode.Color) then
  687. CurVP:=VP;
  688. end;
  689. R.Assign(0,0,64,15);
  690. New(D, Init(R, dialog_preferences));
  691. with D^ do
  692. begin
  693. HelpCtx:=hcpreferences;
  694. GetExtent(R); R.Grow(-2,-2);
  695. R.B.X:=R.A.X+(R.B.X-R.A.X) div 2 - 1;
  696. R.B.Y:=R.A.Y+3;
  697. R2.Copy(R); R2.Grow(-1,-1);
  698. New(VMLB, Init(R2, Min(4,C^.Count), C));
  699. if CurVP=nil then CurIdx:=-1 else
  700. CurIdx:=C^.IndexOf(CurVP);
  701. if CurIdx<>-1 then
  702. VMLB^.FocusItem(CurIdx);
  703. Insert(New(PGroupView, Init(R, label_preferences_videomode, VMLB)));
  704. Insert(VMLB);
  705. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+4;
  706. R2.Copy(R); R2.Grow(-1,-1);
  707. New(RB1, Init(R2,
  708. NewSItem(label_preferences_currentdirectory,
  709. NewSItem(label_preferences_configdirectory,
  710. nil))));
  711. RB1^.Press(DesktopLocation);
  712. Insert(New(PGroupView, Init(R, label_preferences_desktopfile, RB1)));
  713. Insert(RB1);
  714. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  715. R2.Copy(R); R2.Grow(-1,-1);
  716. New(CB1, Init(R2,
  717. NewSItem(label_preferences_editorfiles,
  718. NewSItem(label_preferences_environment,
  719. NewSItem(label_preferences_desktop,
  720. nil)))));
  721. CB1^.Value:=AutoSaveOptions;
  722. Insert(New(PGroupView, Init(R, label_preferences_autosave, CB1)));
  723. Insert(CB1);
  724. GetExtent(R); R.Grow(-2,-2);
  725. R.A.X:=R.B.X-(R.B.X-R.A.X) div 2 + 1;
  726. R.B.Y:=R.A.Y+7;
  727. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  728. R2.Copy(R); R2.Grow(-1,-1);
  729. New(CB2, Init(R2,
  730. NewSItem(label_preferences_autotracksource,
  731. NewSItem(label_preferences_closeongotosource,
  732. NewSItem(label_preferences_changedironopen,
  733. nil)))));
  734. CB2^.Value:=MiscOptions;
  735. Insert(New(PGroupView, Init(R, label_preferences_options, CB2)));
  736. Insert(CB2);
  737. end;
  738. InsertButtons(D);
  739. if Desktop^.ExecView(D)=cmOK then
  740. begin
  741. if (C^.count>0) then
  742. begin
  743. with PVideoMode(C^.At(VMLB^.Focused))^ do
  744. begin
  745. VM.Col:=Col;
  746. VM.Row:=Row;
  747. VM.Color:=Color;
  748. end;
  749. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  750. Begin
  751. OldScreenMode:=ScreenMode;
  752. SetScreenVideoMode(VM);
  753. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  754. begin
  755. SetScreenVideoMode(OldScreenMode);
  756. ScreenModeInfo[1]:=VM.col;
  757. ScreenModeInfo[2]:=VM.row;
  758. ScreenModeInfo[3]:=byte(VM.color);
  759. ErrorBox(msg_cantsetscreenmode,@ScreenModeInfo);
  760. end;
  761. End;
  762. end;
  763. AutoSaveOptions:=CB1^.Value;
  764. MiscOptions:=CB2^.Value;
  765. DesktopLocation:=RB1^.Value;
  766. end;
  767. Dispose(D, Done);
  768. Dispose(C, Done);
  769. end;
  770. procedure TIDEApp.EditorOptions(Editor: PEditor);
  771. var D: PCenterDialog;
  772. R,R2,R3: TRect;
  773. CB: PCheckBoxes;
  774. ILTab,ILIdent: PIntegerLine;
  775. ExtIL,TabExtIL: PInputLine;
  776. TabSize,IndentSize: Integer;
  777. EFlags,EFValue: Longint;
  778. Title: string;
  779. begin
  780. if Editor=nil then
  781. begin
  782. TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags;
  783. IndentSize:=DefaultIndentSize;
  784. Title:=dialog_defaulteditoroptions;
  785. end
  786. else
  787. begin
  788. TabSize:=Editor^.GetTabSize; EFlags:=Editor^.GetFlags;
  789. IndentSize:=Editor^.GetIndentSize;
  790. Title:=dialog_editoroptions;
  791. end;
  792. EFValue:=0;
  793. if (EFlags and efBackupFiles )<>0 then EFValue:=EFValue or (1 shl 0);
  794. if (EFlags and efInsertMode )<>0 then EFValue:=EFValue or (1 shl 1);
  795. if (EFlags and efAutoIndent )<>0 then EFValue:=EFValue or (1 shl 2);
  796. if (EFlags and efUseTabCharacters )<>0 then EFValue:=EFValue or (1 shl 3);
  797. if (EFlags and efBackSpaceUnindents)<>0 then EFValue:=EFValue or (1 shl 4);
  798. if (EFlags and efPersistentBlocks )<>0 then EFValue:=EFValue or (1 shl 5);
  799. if (EFlags and efSyntaxHighlight )<>0 then EFValue:=EFValue or (1 shl 6);
  800. if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 7);
  801. if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 8);
  802. if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 9);
  803. if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 10);
  804. if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 11);
  805. if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 12);
  806. if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 13);
  807. if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 14);
  808. R.Assign(0,0,66,20);
  809. New(D, Init(R, Title));
  810. with D^ do
  811. begin
  812. HelpCtx:=hcEditor;
  813. GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+9;
  814. R2.Copy(R); Inc(R2.A.Y);
  815. New(CB, Init(R2,
  816. NewSItem(label_editor_backupfiles,
  817. NewSItem(label_editor_insertmode,
  818. NewSItem(label_editor_autoindentmode,
  819. NewSItem(label_editor_usetabcharacters,
  820. NewSItem(label_editor_backspaceunindents,
  821. NewSItem(label_editor_persistentblocks,
  822. NewSItem(label_editor_syntaxhighlight,
  823. NewSItem(label_editor_blockinsertcursor,
  824. NewSItem(label_editor_verticalblocks,
  825. NewSItem(label_editor_highlightcolumn,
  826. NewSItem(label_editor_highlightrow,
  827. NewSItem(label_editor_autoclosingbrackets,
  828. NewSItem(label_editor_keeptrailingspaces,
  829. NewSItem(label_editor_codecomplete,
  830. NewSItem(label_editor_folds,
  831. nil)))))))))))))))));
  832. CB^.Value:=EFValue;
  833. Insert(CB);
  834. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  835. Insert(New(PLabel, Init(R2, label_editor_editoroptions, CB)));
  836. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+1;
  837. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y;
  838. R3.Copy(R); Inc(R3.A.X,10); R3.B.X:=R3.A.X+5;
  839. New(ILTab, Init(R3, 0,100));
  840. ILTab^.Data^:=IntToStr(TabSize);
  841. Insert(ILTab);
  842. R3.Copy(R); R3.B.X:=R3.A.X+10;
  843. Insert(New(PLabel, Init(R3, label_editor_tabsize, ILTab)));
  844. R3.Copy(R); Inc(R3.A.X,40); R3.B.X:=R3.A.X+5;
  845. New(ILIdent, Init(R3, 0,100));
  846. ILIdent^.Data^:=IntToStr(IndentSize);
  847. Insert(ILIdent);
  848. R3.Copy(R); Inc(R3.A.X,28); R3.B.X:=R3.A.X+12;
  849. Insert(New(PLabel, Init(R3, label_editor_IndentSize, ILIdent)));
  850. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  851. R2.Copy(R); Inc(R2.A.Y);
  852. New(ExtIL, Init(R2, 128));
  853. ExtIL^.SetData(HighlightExts);
  854. Insert(ExtIL);
  855. R2.Move(0,-1);
  856. Insert(New(PLabel, Init(R2, label_editor_highlightextensions, ExtIL)));
  857. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  858. R2.Copy(R); Inc(R2.A.Y);
  859. New(TabExtIL, Init(R2, 128));
  860. TabExtIL^.SetData(TabsPattern);
  861. Insert(TabExtIL);
  862. R2.Move(0,-1);
  863. Insert(New(PLabel, Init(R2, label_editor_filepatternsneedingtabs, TabExtIL)));
  864. end;
  865. InsertButtons(D);
  866. CB^.Select;
  867. if Desktop^.ExecView(D)=cmOK then
  868. begin
  869. EFlags:=0;
  870. if (CB^.Value and (1 shl 0))<>0 then EFlags:=EFlags or efBackupFiles;
  871. if (CB^.Value and (1 shl 1))<>0 then EFlags:=EFlags or efInsertMode;
  872. if (CB^.Value and (1 shl 2))<>0 then EFlags:=EFlags or efAutoIndent;
  873. if (CB^.Value and (1 shl 3))<>0 then EFlags:=EFlags or efUseTabCharacters;
  874. if (CB^.Value and (1 shl 4))<>0 then EFlags:=EFlags or efBackSpaceUnindents;
  875. if (CB^.Value and (1 shl 5))<>0 then EFlags:=EFlags or efPersistentBlocks;
  876. if (CB^.Value and (1 shl 6))<>0 then EFlags:=EFlags or efSyntaxHighlight;
  877. if (CB^.Value and (1 shl 7))<>0 then EFlags:=EFlags or efBlockInsCursor;
  878. if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efVerticalBlocks;
  879. if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efHighlightColumn;
  880. if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightRow;
  881. if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efAutoBrackets;
  882. if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efKeepTrailingSpaces;
  883. if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efCodeComplete;
  884. if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efFolds;
  885. TabSize:=StrToInt(ILTab^.Data^);
  886. IndentSize:=StrToInt(ILIdent^.Data^);
  887. if Editor=nil then
  888. begin
  889. DefaultTabSize:=TabSize;
  890. DefaultIndentSize:=IndentSize;
  891. DefaultCodeEditorFlags:=EFlags;
  892. end
  893. else
  894. begin
  895. Editor^.SetIndentSize(IndentSize);
  896. Editor^.SetTabSize(TabSize);
  897. Editor^.SetFlags(EFlags);
  898. end;
  899. ExtIL^.GetData(HighlightExts);
  900. TabExtIL^.GetData(TabsPattern);
  901. end;
  902. Dispose(D, Done);
  903. end;
  904. procedure TIDEApp.CodeComplete;
  905. var
  906. D : PCodeCompleteDialog;
  907. begin
  908. D:=New(PCodeCompleteDialog, Init);
  909. ExecuteDialog(D,nil);
  910. end;
  911. procedure TIDEApp.CodeTemplates;
  912. begin
  913. ExecuteDialog(New(PCodeTemplatesDialog, Init(false,'')),nil);
  914. end;
  915. procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
  916. var D: PCenterDialog;
  917. R,R2,R3 : TRect;
  918. TitleS: string;
  919. CB1,CB2: PCheckBoxes;
  920. RB1,RB2: PRadioButtons;
  921. begin
  922. if Browser=nil then
  923. TitleS:=dialog_browseroptions
  924. else
  925. TitleS:=dialog_localbrowseroptions;
  926. R.Assign(0,0,56,15);
  927. New(D, Init(R, TitleS));
  928. with D^ do
  929. begin
  930. HelpCtx:=hcBrowser;
  931. GetExtent(R); R.Grow(-2,-2);
  932. R.B.Y:=R.A.Y+1+3; R2.Copy(R); Inc(R2.A.Y);
  933. New(CB1, Init(R2,
  934. NewSItem(RExpand(label_browser_labels,21+2),
  935. NewSItem(label_browser_constants,
  936. NewSItem(label_browser_types,
  937. NewSItem(label_browser_variables,
  938. NewSItem(label_browser_procedures,
  939. NewSItem(label_browser_inherited,
  940. nil)))))))
  941. );
  942. Insert(CB1);
  943. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  944. Insert(New(PLabel, Init(R2, label_browser_symbols, CB1)));
  945. R.Move(0,R.B.Y-R.A.Y+1);
  946. R.B.Y:=R.A.Y+1+2; R2.Copy(R);
  947. R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
  948. New(RB1, Init(R3,
  949. NewSItem(label_browser_newbrowser,
  950. NewSItem(label_browser_currentbrowser,
  951. nil)))
  952. );
  953. Insert(RB1);
  954. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  955. Insert(New(PLabel, Init(R3, label_browser_subbrowsing, RB1)));
  956. R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
  957. New(RB2, Init(R3,
  958. NewSItem(label_browser_scope,
  959. NewSItem(label_browser_reference,
  960. nil)))
  961. );
  962. Insert(RB2);
  963. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  964. Insert(New(PLabel, Init(R3, label_browser_preferredpane, RB2)));
  965. R.Move(0,R.B.Y-R.A.Y+1);
  966. R.B.Y:=R.A.Y+1+1; R2.Copy(R); Inc(R2.A.Y);
  967. New(CB2, Init(R2,
  968. NewSItem(RExpand(label_browser_qualifiedsymbols,21+2),
  969. NewSItem(label_browser_sortsymbols,
  970. nil)))
  971. );
  972. Insert(CB2);
  973. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  974. Insert(New(PLabel, Init(R2, label_browser_display, CB2)));
  975. end;
  976. InsertButtons(D);
  977. CB1^.Select;
  978. if Desktop^.ExecView(D)=cmOK then
  979. begin
  980. end;
  981. Dispose(D, Done);
  982. end;
  983. procedure TIDEApp.Startup;
  984. begin
  985. NotImplemented;
  986. end;
  987. procedure TIDEApp.DesktopOptions;
  988. var R: TRect;
  989. D: PCenterDialog;
  990. CB: PCheckBoxes;
  991. begin
  992. R.Assign(0,0,40,12);
  993. New(D, Init(R, dialog_desktoppreferences));
  994. with D^ do
  995. begin
  996. HelpCtx:=hcDesktopOptions;
  997. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.Y:=R.A.Y+8;
  998. New(CB, Init(R,
  999. NewSItem(label_desktop_historylists,
  1000. NewSItem(label_desktop_clipboard,
  1001. NewSItem(label_desktop_watches,
  1002. NewSItem(label_desktop_breakpoints,
  1003. NewSItem(label_desktop_openwindow,
  1004. NewSItem(label_desktop_symbolinfo,
  1005. NewSItem(label_desktop_codecompletewords,
  1006. NewSItem(label_desktop_codetemplates,
  1007. nil))))))))));
  1008. CB^.Value:=DesktopFileFlags;
  1009. Insert(CB);
  1010. R.Move(0,-1); R.B.Y:=R.A.Y+1;
  1011. Insert(New(PLabel, Init(R, label_desktop_preservedacrosssessions, CB)));
  1012. end;
  1013. InsertButtons(D);
  1014. CB^.Select;
  1015. if Desktop^.ExecView(D)=cmOK then
  1016. begin
  1017. DesktopFileFlags:=CB^.Value;
  1018. end;
  1019. Dispose(D, Done);
  1020. end;
  1021. procedure TIDEApp.Mouse;
  1022. var R,R2: TRect;
  1023. D: PCenterDialog;
  1024. SB: PScrollBar;
  1025. CB: PCheckBoxes;
  1026. RB1,RB2: PRadioButtons;
  1027. begin
  1028. R.Assign(0,0,62,15);
  1029. New(D, Init(R, dialog_mouseoptions));
  1030. with D^ do
  1031. begin
  1032. HelpCtx:=hcMouse;
  1033. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+3;
  1034. R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1035. New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
  1036. SB^.SetParams(DoubleDelay,1,20,1,1);
  1037. Insert(SB);
  1038. R2.Move(0,-1);
  1039. Insert(New(PStaticText, Init(R2, label_mouse_speedbar)));
  1040. R2.Move(-1,-1);
  1041. Insert(New(PLabel, Init(R2, label_mouse_doubleclickspeed, SB)));
  1042. R2.Copy(R); Inc(R2.A.Y,2); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1043. New(CB, Init(R2, NewSItem(label_mouse_reversebuttons, nil) ));
  1044. if MouseReverse then CB^.Press(0);
  1045. Insert(CB);
  1046. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+8;
  1047. R2.Copy(R); Inc(R2.A.Y); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1048. New(RB1, Init(R2,
  1049. NewSItem(label_mouse_act_nothing,
  1050. NewSItem(label_mouse_act_topicsearch,
  1051. NewSItem(label_mouse_act_gotocursor,
  1052. NewSItem(label_mouse_act_breakpoint,
  1053. NewSItem(label_mouse_act_evaluate,
  1054. NewSItem(label_mouse_act_addwatch,
  1055. NewSItem(label_mouse_act_browsesymbol,
  1056. nil)))))))));
  1057. RB1^.Press(CtrlMouseAction);
  1058. Insert(RB1);
  1059. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1060. Insert(New(PLabel, Init(R2, label_mouse_crtlrightmousebuttonaction, RB1)));
  1061. R2.Copy(R); Inc(R2.A.Y); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1062. New(RB2, Init(R2,
  1063. NewSItem(label_mouse_act_nothing,
  1064. NewSItem(label_mouse_act_topicsearch,
  1065. NewSItem(label_mouse_act_gotocursor,
  1066. NewSItem(label_mouse_act_breakpoint,
  1067. NewSItem(label_mouse_act_evaluate,
  1068. NewSItem(label_mouse_act_addwatch,
  1069. NewSItem(label_mouse_act_browsesymbol,
  1070. nil)))))))));
  1071. RB2^.Press(AltMouseAction);
  1072. Insert(RB2);
  1073. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1074. Insert(New(PLabel, Init(R2, label_mouse_altrightmousebuttonaction, RB2)));
  1075. end;
  1076. InsertButtons(D);
  1077. RB1^.Select;
  1078. if Desktop^.ExecView(D)=cmOK then
  1079. begin
  1080. MouseReverse:=CB^.Mark(0);
  1081. DoubleDelay:=SB^.Value;
  1082. CtrlMouseAction:=RB1^.Value;
  1083. AltMouseAction:=RB2^.Value;
  1084. end;
  1085. Dispose(D, Done);
  1086. end;
  1087. procedure TIDEApp.Colors;
  1088. {$Ifdef FVISION}
  1089. begin
  1090. end;
  1091. {$else FVISION}
  1092. var D: PColorDialog;
  1093. begin
  1094. New(D, Init(AppPalette,
  1095. ColorGroup(label_colors_grp_browser,
  1096. ColorItem(label_colors_framepassive , 215,
  1097. ColorItem(label_colors_frameactive , 216,
  1098. ColorItem(label_colors_frameicon , 217,
  1099. ColorItem(label_colors_scrollbarpage , 218,
  1100. ColorItem(label_colors_scrollbaricons , 219,
  1101. ColorItem(label_colors_normaltext , 220,
  1102. ColorItem(label_colors_selectedtext , 221,
  1103. ColorItem(label_colors_activeitem , 222,
  1104. ColorItem(label_colors_inactiveitem , 223,
  1105. ColorItem(label_colors_focuseditem , 224,
  1106. ColorItem(label_colors_selecteditem , 225,
  1107. ColorItem(label_colors_divider , 226,
  1108. nil)))))))))))),
  1109. ColorGroup(label_colors_grp_clock,
  1110. ColorItem(label_colors_clockview , 227,
  1111. nil),
  1112. ColorGroup(label_colors_grp_desktop, DesktopColorItems(nil),
  1113. ColorGroup(label_colors_grp_dialogs, DialogColorItems(dpGrayDialog,nil),
  1114. ColorGroup(label_colors_grp_editor,
  1115. ColorItem(label_colors_framepassive , 167,
  1116. ColorItem(label_colors_frameactive , 168,
  1117. ColorItem(label_colors_frameicon , 169,
  1118. ColorItem(label_colors_scrollbarpage , 170,
  1119. ColorItem(label_colors_scrollbaricons , 171,
  1120. ColorItem(label_colors_normaltext , 199,
  1121. ColorItem(label_colors_selectedtext , 208,
  1122. ColorItem(label_colors_highlighcolumn , 209,
  1123. ColorItem(label_colors_highlightrow , 210,
  1124. ColorItem(label_colors_errormessages , 214,
  1125. nil)))))))))),
  1126. ColorGroup(label_colors_grp_help,
  1127. ColorItem(label_colors_framepassive , 128,
  1128. ColorItem(label_colors_frameactive , 129,
  1129. ColorItem(label_colors_frameicon , 130,
  1130. ColorItem(label_colors_scrollbarpage , 131,
  1131. ColorItem(label_colors_scrollbaricons , 132,
  1132. ColorItem(label_colors_helptext , 160,
  1133. ColorItem(label_colors_helplinks , 161,
  1134. ColorItem(label_colors_selectedlink , 162,
  1135. ColorItem(label_colors_selectedtext , 163,
  1136. ColorItem(label_colors_html_heading1 , 229,
  1137. ColorItem(label_colors_html_heading2 , 230,
  1138. ColorItem(label_colors_html_heading3 , 231,
  1139. ColorItem(label_colors_html_heading4 , 232,
  1140. ColorItem(label_colors_html_heading5 , 233,
  1141. ColorItem(label_colors_html_heading6 , 234,
  1142. nil))))))))))))))),
  1143. ColorGroup(label_colors_grp_menus, MenuColorItems(nil),
  1144. ColorGroup(label_colors_grp_syntax,
  1145. ColorItem(label_colors_whitespace , 200,
  1146. ColorItem(label_colors_comments , 201,
  1147. ColorItem(label_colors_reservedwords , 202,
  1148. ColorItem(label_colors_identifiers , 203,
  1149. ColorItem(label_colors_strings , 204,
  1150. ColorItem(label_colors_numbers , 205,
  1151. ColorItem(label_colors_hexnumbers , 212,
  1152. ColorItem(label_colors_assembler , 206,
  1153. ColorItem(label_colors_symbols , 207,
  1154. ColorItem(label_colors_directives , 211,
  1155. ColorItem(label_colors_tabs , 213,
  1156. nil))))))))))),
  1157. nil))))))))));
  1158. D^.HelpCtx:=hcColors;
  1159. if ExecuteDialog(D, @AppPalette)=cmOK then
  1160. begin
  1161. DoneMemory;
  1162. Message(Application,evBroadcast,cmUpdate,nil);
  1163. ReDraw;
  1164. UpdateScreen(true);
  1165. end;
  1166. end;
  1167. {$endif FVISION}
  1168. procedure TIDEApp.OpenINI;
  1169. var D: PFileDialog;
  1170. FileName: string;
  1171. begin
  1172. New(D, Init('*'+ExtOf(INIFileName),dialog_openoptions,dialog_ini_filename,fdOpenButton,hidOpenIniFile));
  1173. D^.HelpCtx:=hcOpenIni;
  1174. if Desktop^.ExecView(D)<>cmCancel then
  1175. begin
  1176. D^.GetFileName(FileName);
  1177. if ExistsFile(FileName)=false then ErrorBox(msg_cantopenconfigfile,nil) else
  1178. begin
  1179. IniFileName:=FileName;
  1180. ReadINIFile;
  1181. Message(Application,evBroadcast,cmUpdate,nil);
  1182. end;
  1183. end;
  1184. Dispose(D, Done);
  1185. end;
  1186. procedure TIDEApp.SaveINI;
  1187. begin
  1188. if WriteINIFile(false)=false then
  1189. ErrorBox(msg_errorsavingconfigfile,nil);
  1190. end;
  1191. procedure TIDEApp.SaveAsINI;
  1192. var D: PFileDialog;
  1193. FileName: string;
  1194. CanWrite: boolean;
  1195. begin
  1196. New(D, Init('*'+ExtOf(INIFileName),dialog_saveoptions,dialog_ini_filename,fdOpenButton,hidSaveIniFile));
  1197. D^.HelpCtx:=hcSaveAsINI;
  1198. if Desktop^.ExecView(D)<>cmCancel then
  1199. begin
  1200. D^.GetFileName(FileName);
  1201. CanWrite:=(ExistsFile(FileName)=false);
  1202. if CanWrite=false then
  1203. CanWrite:=ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,SmartPath(FileName)),nil,false)=cmYes;
  1204. if CanWrite then
  1205. begin
  1206. IniFileName:=FileName;
  1207. if WriteINIFile(true)=false then
  1208. ErrorBox(msg_errorsavingconfigfile,nil);
  1209. Message(Application,evBroadcast,cmUpdate,nil);
  1210. end;
  1211. end;
  1212. Dispose(D, Done);
  1213. end;
  1214. {
  1215. $Log$
  1216. Revision 1.8 2002-09-07 15:40:44 peter
  1217. * old logs removed and tabs fixed
  1218. Revision 1.7 2002/09/04 08:52:46 pierre
  1219. * adapt to fpcodtmp interface change
  1220. Revision 1.6 2002/01/24 09:21:42 pierre
  1221. * only disable Alt-X in Options|Compiler dialog
  1222. }