fpmopts.inc 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408
  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: PEditorInputLine;
  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: PEditorInputLine;
  425. {$endif Unix}
  426. IL2: PEditorInputLine;
  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. {$ifdef SUPPORT_REMOTE}
  527. procedure TIDEApp.DoRemote;
  528. var R,R2: TRect;
  529. IL1,IL2,IL3,IL4,IL5,IL6: PEditorInputLine;
  530. D: PCenterDialog;
  531. const
  532. FieldLines = 6;
  533. begin
  534. {
  535. RemoteMachine : string = '';
  536. RemotePort : string = '2345';
  537. RemoteConfig : string = '';
  538. RemoteIdent : string = '';
  539. RemoteDir : string = '';
  540. RemoteSendCommand : string = 'scp $CONFIG $IDENT $LOCALFILE $REMOTEMACHINE:$REMOTEDIR';
  541. }
  542. R.Assign(0,0,60,2+2*FieldLines+2);
  543. New(D, Init(R, dialog_remote));
  544. with D^ do
  545. begin
  546. HelpCtx:=hcremotedialog;
  547. GetExtent(R); R.Grow(-3,-1);
  548. R2.Copy(R);
  549. R2.B.Y:=R2.A.Y+1;
  550. { remote machine name }
  551. R2.Move(0,3);
  552. New(IL1, Init(R2, 255));
  553. IL1^.Data^:=RemoteMachine;
  554. Insert(IL1);
  555. R2.Move(0,-1);
  556. Insert(New(PLabel, Init(R2,label_remote_machine, IL1)));
  557. { remote machine port }
  558. R2.Move(0,3);
  559. New(IL2, Init(R2, 255));
  560. IL2^.Data^:=RemotePort;
  561. Insert(IL2);
  562. R2.Move(0,-1);
  563. Insert(New(PLabel, Init(R2,label_remote_port, IL2)));
  564. { remote machine dir }
  565. R2.Move(0,3);
  566. New(IL3, Init(R2, 255));
  567. IL3^.Data^:=RemoteDir;
  568. Insert(IL3);
  569. R2.Move(0,-1);
  570. Insert(New(PLabel, Init(R2,label_remote_dir, IL3)));
  571. { remote machine config }
  572. R2.Move(0,3);
  573. New(IL4, Init(R2, 255));
  574. IL4^.Data^:=RemoteConfig;
  575. Insert(IL4);
  576. R2.Move(0,-1);
  577. Insert(New(PLabel, Init(R2,label_remote_config, IL4)));
  578. { remote machine ident }
  579. R2.Move(0,3);
  580. New(IL5, Init(R2, 255));
  581. IL5^.Data^:=RemoteIdent;
  582. Insert(IL5);
  583. R2.Move(0,-1);
  584. Insert(New(PLabel, Init(R2,label_remote_ident, IL5)));
  585. { remote machine command }
  586. R2.Move(0,3);
  587. New(IL6, Init(R2, 255));
  588. IL6^.Data^:=RemoteSendCommand;
  589. Insert(IL6);
  590. R2.Move(0,-1);
  591. Insert(New(PLabel, Init(R2,label_remote_command, IL6)));
  592. end;
  593. InsertButtons(D);
  594. if Desktop^.ExecView(D)=cmOK then
  595. begin
  596. RemoteMachine:=IL1^.Data^;
  597. RemotePort:=IL2^.Data^;
  598. RemoteDir:=IL3^.Data^;
  599. RemoteConfig:=IL4^.Data^;
  600. RemoteIdent:=IL5^.Data^;
  601. RemoteSendCommand:=IL6^.Data^;
  602. end;
  603. Dispose(D, Done);
  604. end;
  605. {$endif SUPPORT_REMOTE}
  606. procedure TIDEApp.Directories;
  607. var R,R2: TRect;
  608. D: PCenterDialog;
  609. IL : array[0..11] of PEditorInputLine;
  610. Count,I : integer;
  611. const
  612. LW = 25;
  613. begin
  614. Count:=DirectorySwitches^.ItemCount;
  615. R.Assign(0,0,round(ScreenWidth*64/80),2+Count*2);
  616. New(D, Init(R, dialog_directories));
  617. with D^ do
  618. begin
  619. HelpCtx:=hcdirectories;
  620. GetExtent(R);
  621. R.Grow(-2,-2);
  622. Dec(R.B.X);
  623. R.B.Y:=R.A.Y+1;
  624. for i:=Count-1 downto 0 do
  625. begin
  626. R2.Copy(R);
  627. R2.A.X:=LW;
  628. New(IL[i], Init(R2, 255));
  629. IL[i]^.Data^:=DirectorySwitches^.GetStringItem(i);
  630. Insert(IL[i]);
  631. R2.Copy(R);
  632. R2.B.X:=LW;
  633. Insert(New(PLabel, Init(R2, DirectorySwitches^.ItemName(i), IL[i])));
  634. R.Move(0,2);
  635. end;
  636. end;
  637. InsertButtons(D);
  638. IL[Count-1]^.Select;
  639. if Desktop^.ExecView(D)=cmOK then
  640. begin
  641. for i:=Count-1 downto 0 do
  642. DirectorySwitches^.SetStringItem(i,IL[i]^.Data^);
  643. end;
  644. Dispose(D, Done);
  645. end;
  646. procedure TIDEApp.Tools;
  647. var
  648. D : PToolsDialog;
  649. begin
  650. D:=New(PToolsDialog, Init);
  651. ExecuteDialog(D,nil);
  652. end;
  653. (*procedure TIDEApp.Preferences;
  654. var R,R2: TRect;
  655. D: PCenterDialog;
  656. RB1 : PRadioButtons;
  657. CountModes : integer;
  658. hp : pvideomodelist;
  659. items : PSItem;
  660. videomode : tvideomode;
  661. i,modevalue : longint;
  662. function ToStr(l : longint) : string;
  663. var
  664. s : string;
  665. begin
  666. str(l,s);
  667. ToStr:=s;
  668. end;
  669. const
  670. color2str : array[false..true] of string = ('in b/w','in color');
  671. begin
  672. GetVideoMode(videomode);
  673. CountModes:=0;
  674. i:=0;
  675. modevalue:=0;
  676. R.Assign(0,0,64,18);
  677. New(D, Init(R, 'Preferences'));
  678. with D^ do
  679. begin
  680. hp:=video.modes;
  681. items:=nil;
  682. r2.assign(2,3,24,17);
  683. while assigned(hp) do
  684. begin
  685. items:=NewSItem(ToStr(hp^.col)+'x'+ToStr(hp^.row)+' '+color2str[hp^.color],items);
  686. if (hp^.col=videomode.col) and (hp^.row=videomode.row) and
  687. (hp^.color=videomode.color) then
  688. modevalue:=i;
  689. inc(CountModes);
  690. { we can't display an infinite number of modes }
  691. if CountModes>=r.b.y-r.a.y+1 then
  692. break;
  693. inc(i);
  694. hp:=hp^.next;
  695. end;
  696. modevalue:=CountModes-modevalue-1;
  697. new(rb1,init(r2,items));
  698. insert(rb1);
  699. rb1^.value:=modevalue;
  700. r2.move(0,-1);r2.b.y:=r2.a.y+1;
  701. insert(new(plabel,init(r2,'~V~ideo mode',rb1)));
  702. end;
  703. InsertButtons(D);
  704. if Desktop^.ExecView(D)=cmOK then
  705. begin
  706. { change video mode ? }
  707. if rb1^.value<>modevalue then
  708. begin
  709. modevalue:=CountModes-rb1^.value-1;
  710. hp:=video.modes;
  711. for i:=1 to modevalue do
  712. hp:=hp^.next;
  713. videomode.col:=hp^.col;
  714. videomode.row:=hp^.row;
  715. videomode.color:=hp^.color;
  716. SetScreenVideoMode(videomode);
  717. end;
  718. end;
  719. Dispose(D, Done);
  720. end;*)
  721. type
  722. PVideoModeCollection = ^TVideoModeCollection;
  723. TVideoModeCollection = object(TSortedCollection)
  724. function Compare(Key1, Key2: Pointer): Sw_Integer; virtual;
  725. procedure FreeItem(Item: Pointer); virtual;
  726. end;
  727. function TVideoModeCollection.Compare(Key1, Key2: Pointer): Sw_Integer;
  728. var R: Sw_integer;
  729. K1: PVideoMode absolute Key1;
  730. K2: PVideoMode absolute Key2;
  731. begin
  732. if K1^.Col<K2^.Col then R:=-1 else
  733. if K1^.Col>K2^.Col then R:= 1 else
  734. if K1^.Row<K2^.Row then R:=-1 else
  735. if K1^.Row>K2^.Row then R:= 1 else
  736. if (K1^.Color=false) and (K2^.Color=true ) then R:=-1 else
  737. if (K1^.Color=true ) and (K2^.Color=false) then R:= 1 else
  738. R:=0;
  739. Compare:=R;
  740. end;
  741. procedure TVideoModeCollection.FreeItem(Item: Pointer);
  742. begin
  743. FreeMem(Item,sizeof(TVideoMode));
  744. end;
  745. procedure TIDEApp.Preferences;
  746. var R,R2: TRect;
  747. D: PCenterDialog;
  748. C: PVideoModeCollection;
  749. VMLB: PVideoModeListBox;
  750. OldScreenMode,VM: TVideoMode;
  751. ScreenModeInfo : array[1..3] of longint;
  752. CurVP,VP: PVideoMode;
  753. RB1: PPlainRadioButtons;
  754. CB1,CB2: PPlainCheckBoxes;
  755. CurIdx: integer;
  756. i : word;
  757. begin
  758. New(C, Init(10,50));
  759. for i:=0 to GetVideoModeCount-1 do
  760. begin
  761. GetVideoModeData(i,VM);
  762. GetMem(VP,sizeof(TVideoMode));
  763. Move(VM,VP^,sizeof(TVideoMode));
  764. C^.Insert(VP);
  765. if (VM.Row=ScreenMode.Row) and (VM.Col=ScreenMode.Col) and
  766. (VM.Color=ScreenMode.Color) then
  767. CurVP:=VP;
  768. end;
  769. R.Assign(0,0,64,15);
  770. New(D, Init(R, dialog_preferences));
  771. with D^ do
  772. begin
  773. HelpCtx:=hcpreferences;
  774. GetExtent(R); R.Grow(-2,-2);
  775. R.B.X:=R.A.X+(R.B.X-R.A.X) div 2 - 1;
  776. R.B.Y:=R.A.Y+3;
  777. R2.Copy(R); R2.Grow(-1,-1);
  778. New(VMLB, Init(R2, Min(4,C^.Count), C));
  779. if CurVP=nil then CurIdx:=-1 else
  780. CurIdx:=C^.IndexOf(CurVP);
  781. if CurIdx<>-1 then
  782. VMLB^.FocusItem(CurIdx);
  783. Insert(New(PGroupView, Init(R, label_preferences_videomode, VMLB)));
  784. Insert(VMLB);
  785. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+4;
  786. R2.Copy(R); R2.Grow(-1,-1);
  787. New(RB1, Init(R2,
  788. NewSItem(label_preferences_currentdirectory,
  789. NewSItem(label_preferences_configdirectory,
  790. nil))));
  791. RB1^.Press(DesktopLocation);
  792. Insert(New(PGroupView, Init(R, label_preferences_desktopfile, RB1)));
  793. Insert(RB1);
  794. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  795. R2.Copy(R); R2.Grow(-1,-1);
  796. New(CB1, Init(R2,
  797. NewSItem(label_preferences_editorfiles,
  798. NewSItem(label_preferences_environment,
  799. NewSItem(label_preferences_desktop,
  800. nil)))));
  801. CB1^.Value:=AutoSaveOptions;
  802. Insert(New(PGroupView, Init(R, label_preferences_autosave, CB1)));
  803. Insert(CB1);
  804. GetExtent(R); R.Grow(-2,-2);
  805. R.A.X:=R.B.X-(R.B.X-R.A.X) div 2 + 1;
  806. R.B.Y:=R.A.Y+7;
  807. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  808. R2.Copy(R); R2.Grow(-1,-1);
  809. New(CB2, Init(R2,
  810. NewSItem(label_preferences_autotracksource,
  811. NewSItem(label_preferences_closeongotosource,
  812. NewSItem(label_preferences_changedironopen,
  813. nil)))));
  814. CB2^.Value:=MiscOptions;
  815. Insert(New(PGroupView, Init(R, label_preferences_options, CB2)));
  816. Insert(CB2);
  817. end;
  818. InsertButtons(D);
  819. if Desktop^.ExecView(D)=cmOK then
  820. begin
  821. if (C^.count>0) then
  822. begin
  823. with PVideoMode(C^.At(VMLB^.Focused))^ do
  824. begin
  825. VM.Col:=Col;
  826. VM.Row:=Row;
  827. VM.Color:=Color;
  828. end;
  829. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  830. Begin
  831. OldScreenMode:=ScreenMode;
  832. SetScreenVideoMode(VM);
  833. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  834. begin
  835. SetScreenVideoMode(OldScreenMode);
  836. ScreenModeInfo[1]:=VM.col;
  837. ScreenModeInfo[2]:=VM.row;
  838. ScreenModeInfo[3]:=byte(VM.color);
  839. ErrorBox(msg_cantsetscreenmode,@ScreenModeInfo);
  840. end
  841. else
  842. if TimedMessageBox (msg_confirmnewscreenmode, nil,
  843. mfConfirmation or mfOKCancel, 15) = cmCancel then
  844. begin
  845. SetScreenVideoMode (OldScreenMode);
  846. ScreenModeInfo [1] := VM.Col;
  847. ScreenModeInfo [2] := VM.Row;
  848. ScreenModeInfo [3] := byte (VM.Color);
  849. end;
  850. End;
  851. end;
  852. AutoSaveOptions:=CB1^.Value;
  853. MiscOptions:=CB2^.Value;
  854. DesktopLocation:=RB1^.Value;
  855. end;
  856. Dispose(D, Done);
  857. Dispose(C, Done);
  858. end;
  859. procedure TIDEApp.EditorOptions(Editor: PEditor);
  860. var D: PCenterDialog;
  861. R,R2,R3: TRect;
  862. CB: PCheckBoxes;
  863. ILTab,ILIdent: PIntegerLine;
  864. ExtIL,TabExtIL: PEditorInputLine;
  865. TabSize,IndentSize: Integer;
  866. EFlags,EFValue: Longint;
  867. Title: string;
  868. begin
  869. if Editor=nil then
  870. begin
  871. TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags;
  872. IndentSize:=DefaultIndentSize;
  873. Title:=dialog_defaulteditoroptions;
  874. end
  875. else
  876. begin
  877. TabSize:=Editor^.GetTabSize; EFlags:=Editor^.GetFlags;
  878. IndentSize:=Editor^.GetIndentSize;
  879. Title:=dialog_editoroptions;
  880. end;
  881. EFValue:=0;
  882. if (EFlags and efBackupFiles )<>0 then EFValue:=EFValue or (1 shl 0);
  883. if (EFlags and efInsertMode )<>0 then EFValue:=EFValue or (1 shl 1);
  884. if (EFlags and efAutoIndent )<>0 then EFValue:=EFValue or (1 shl 2);
  885. if (EFlags and efUseTabCharacters )<>0 then EFValue:=EFValue or (1 shl 3);
  886. if (EFlags and efBackSpaceUnindents)<>0 then EFValue:=EFValue or (1 shl 4);
  887. if (EFlags and efPersistentBlocks )<>0 then EFValue:=EFValue or (1 shl 5);
  888. if (EFlags and efSyntaxHighlight )<>0 then EFValue:=EFValue or (1 shl 6);
  889. if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 7);
  890. if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 8);
  891. if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 9);
  892. if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 10);
  893. if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 11);
  894. if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 12);
  895. if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 13);
  896. if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 14);
  897. R.Assign(0,0,66,20);
  898. New(D, Init(R, Title));
  899. with D^ do
  900. begin
  901. HelpCtx:=hcEditor;
  902. GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+9;
  903. R2.Copy(R); Inc(R2.A.Y);
  904. New(CB, Init(R2,
  905. NewSItem(label_editor_backupfiles,
  906. NewSItem(label_editor_insertmode,
  907. NewSItem(label_editor_autoindentmode,
  908. NewSItem(label_editor_usetabcharacters,
  909. NewSItem(label_editor_backspaceunindents,
  910. NewSItem(label_editor_persistentblocks,
  911. NewSItem(label_editor_syntaxhighlight,
  912. NewSItem(label_editor_blockinsertcursor,
  913. NewSItem(label_editor_verticalblocks,
  914. NewSItem(label_editor_highlightcolumn,
  915. NewSItem(label_editor_highlightrow,
  916. NewSItem(label_editor_autoclosingbrackets,
  917. NewSItem(label_editor_keeptrailingspaces,
  918. NewSItem(label_editor_codecomplete,
  919. NewSItem(label_editor_folds,
  920. nil)))))))))))))))));
  921. CB^.Value:=EFValue;
  922. Insert(CB);
  923. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  924. Insert(New(PLabel, Init(R2, label_editor_editoroptions, CB)));
  925. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+1;
  926. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y;
  927. R3.Copy(R); Inc(R3.A.X,10); R3.B.X:=R3.A.X+5;
  928. New(ILTab, Init(R3, 0,100));
  929. ILTab^.Data^:=IntToStr(TabSize);
  930. Insert(ILTab);
  931. R3.Copy(R); R3.B.X:=R3.A.X+10;
  932. Insert(New(PLabel, Init(R3, label_editor_tabsize, ILTab)));
  933. R3.Copy(R); Inc(R3.A.X,40); R3.B.X:=R3.A.X+5;
  934. New(ILIdent, Init(R3, 0,100));
  935. ILIdent^.Data^:=IntToStr(IndentSize);
  936. Insert(ILIdent);
  937. R3.Copy(R); Inc(R3.A.X,28); R3.B.X:=R3.A.X+12;
  938. Insert(New(PLabel, Init(R3, label_editor_IndentSize, ILIdent)));
  939. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  940. R2.Copy(R); Inc(R2.A.Y);
  941. New(ExtIL, Init(R2, 128));
  942. ExtIL^.SetData(HighlightExts);
  943. Insert(ExtIL);
  944. R2.Move(0,-1);
  945. Insert(New(PLabel, Init(R2, label_editor_highlightextensions, ExtIL)));
  946. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  947. R2.Copy(R); Inc(R2.A.Y);
  948. New(TabExtIL, Init(R2, 128));
  949. TabExtIL^.SetData(TabsPattern);
  950. Insert(TabExtIL);
  951. R2.Move(0,-1);
  952. Insert(New(PLabel, Init(R2, label_editor_filepatternsneedingtabs, TabExtIL)));
  953. end;
  954. InsertButtons(D);
  955. CB^.Select;
  956. if Desktop^.ExecView(D)=cmOK then
  957. begin
  958. EFlags:=0;
  959. if (CB^.Value and (1 shl 0))<>0 then EFlags:=EFlags or efBackupFiles;
  960. if (CB^.Value and (1 shl 1))<>0 then EFlags:=EFlags or efInsertMode;
  961. if (CB^.Value and (1 shl 2))<>0 then EFlags:=EFlags or efAutoIndent;
  962. if (CB^.Value and (1 shl 3))<>0 then EFlags:=EFlags or efUseTabCharacters;
  963. if (CB^.Value and (1 shl 4))<>0 then EFlags:=EFlags or efBackSpaceUnindents;
  964. if (CB^.Value and (1 shl 5))<>0 then EFlags:=EFlags or efPersistentBlocks;
  965. if (CB^.Value and (1 shl 6))<>0 then EFlags:=EFlags or efSyntaxHighlight;
  966. if (CB^.Value and (1 shl 7))<>0 then EFlags:=EFlags or efBlockInsCursor;
  967. if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efVerticalBlocks;
  968. if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efHighlightColumn;
  969. if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightRow;
  970. if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efAutoBrackets;
  971. if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efKeepTrailingSpaces;
  972. if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efCodeComplete;
  973. if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efFolds;
  974. TabSize:=StrToInt(ILTab^.Data^);
  975. IndentSize:=StrToInt(ILIdent^.Data^);
  976. if Editor=nil then
  977. begin
  978. DefaultTabSize:=TabSize;
  979. DefaultIndentSize:=IndentSize;
  980. DefaultCodeEditorFlags:=EFlags;
  981. end
  982. else
  983. begin
  984. Editor^.SetIndentSize(IndentSize);
  985. Editor^.SetTabSize(TabSize);
  986. Editor^.SetFlags(EFlags);
  987. end;
  988. ExtIL^.GetData(HighlightExts);
  989. TabExtIL^.GetData(TabsPattern);
  990. end;
  991. Dispose(D, Done);
  992. end;
  993. procedure TIDEApp.CodeComplete;
  994. var
  995. D : PCodeCompleteDialog;
  996. begin
  997. D:=New(PCodeCompleteDialog, Init);
  998. ExecuteDialog(D,nil);
  999. end;
  1000. procedure TIDEApp.CodeTemplates;
  1001. begin
  1002. ExecuteDialog(New(PCodeTemplatesDialog, Init(false,'')),nil);
  1003. end;
  1004. procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
  1005. var D: PCenterDialog;
  1006. R,R2,R3 : TRect;
  1007. TitleS: string;
  1008. CB1,CB2: PCheckBoxes;
  1009. RB1,RB2: PRadioButtons;
  1010. begin
  1011. if Browser=nil then
  1012. TitleS:=dialog_browseroptions
  1013. else
  1014. TitleS:=dialog_localbrowseroptions;
  1015. R.Assign(0,0,56,15);
  1016. New(D, Init(R, TitleS));
  1017. with D^ do
  1018. begin
  1019. HelpCtx:=hcBrowser;
  1020. GetExtent(R); R.Grow(-2,-2);
  1021. R.B.Y:=R.A.Y+1+3; R2.Copy(R); Inc(R2.A.Y);
  1022. New(CB1, Init(R2,
  1023. NewSItem(RExpand(label_browser_labels,21+2),
  1024. NewSItem(label_browser_constants,
  1025. NewSItem(label_browser_types,
  1026. NewSItem(label_browser_variables,
  1027. NewSItem(label_browser_procedures,
  1028. NewSItem(label_browser_inherited,
  1029. nil)))))))
  1030. );
  1031. Insert(CB1);
  1032. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1033. Insert(New(PLabel, Init(R2, label_browser_symbols, CB1)));
  1034. R.Move(0,R.B.Y-R.A.Y+1);
  1035. R.B.Y:=R.A.Y+1+2; R2.Copy(R);
  1036. R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
  1037. New(RB1, Init(R3,
  1038. NewSItem(label_browser_newbrowser,
  1039. NewSItem(label_browser_currentbrowser,
  1040. nil)))
  1041. );
  1042. Insert(RB1);
  1043. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1044. Insert(New(PLabel, Init(R3, label_browser_subbrowsing, RB1)));
  1045. R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
  1046. New(RB2, Init(R3,
  1047. NewSItem(label_browser_scope,
  1048. NewSItem(label_browser_reference,
  1049. nil)))
  1050. );
  1051. Insert(RB2);
  1052. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1053. Insert(New(PLabel, Init(R3, label_browser_preferredpane, RB2)));
  1054. R.Move(0,R.B.Y-R.A.Y+1);
  1055. R.B.Y:=R.A.Y+1+1; R2.Copy(R); Inc(R2.A.Y);
  1056. New(CB2, Init(R2,
  1057. NewSItem(RExpand(label_browser_qualifiedsymbols,21+2),
  1058. NewSItem(label_browser_sortsymbols,
  1059. nil)))
  1060. );
  1061. Insert(CB2);
  1062. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1063. Insert(New(PLabel, Init(R2, label_browser_display, CB2)));
  1064. end;
  1065. InsertButtons(D);
  1066. CB1^.Select;
  1067. if Desktop^.ExecView(D)=cmOK then
  1068. begin
  1069. end;
  1070. Dispose(D, Done);
  1071. end;
  1072. procedure TIDEApp.Startup;
  1073. begin
  1074. NotImplemented;
  1075. end;
  1076. procedure TIDEApp.DesktopOptions;
  1077. var R: TRect;
  1078. D: PCenterDialog;
  1079. CB: PCheckBoxes;
  1080. begin
  1081. R.Assign(0,0,40,12);
  1082. New(D, Init(R, dialog_desktoppreferences));
  1083. with D^ do
  1084. begin
  1085. HelpCtx:=hcDesktopOptions;
  1086. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.Y:=R.A.Y+8;
  1087. New(CB, Init(R,
  1088. NewSItem(label_desktop_historylists,
  1089. NewSItem(label_desktop_clipboard,
  1090. NewSItem(label_desktop_watches,
  1091. NewSItem(label_desktop_breakpoints,
  1092. NewSItem(label_desktop_openwindow,
  1093. NewSItem(label_desktop_symbolinfo,
  1094. NewSItem(label_desktop_codecompletewords,
  1095. NewSItem(label_desktop_codetemplates,
  1096. nil))))))))));
  1097. CB^.Value:=DesktopFileFlags;
  1098. Insert(CB);
  1099. R.Move(0,-1); R.B.Y:=R.A.Y+1;
  1100. Insert(New(PLabel, Init(R, label_desktop_preservedacrosssessions, CB)));
  1101. end;
  1102. InsertButtons(D);
  1103. CB^.Select;
  1104. if Desktop^.ExecView(D)=cmOK then
  1105. begin
  1106. DesktopFileFlags:=CB^.Value;
  1107. end;
  1108. Dispose(D, Done);
  1109. end;
  1110. procedure TIDEApp.Mouse;
  1111. var R,R2: TRect;
  1112. D: PCenterDialog;
  1113. SB: PScrollBar;
  1114. CB: PCheckBoxes;
  1115. RB1,RB2: PRadioButtons;
  1116. begin
  1117. R.Assign(0,0,62,15);
  1118. New(D, Init(R, dialog_mouseoptions));
  1119. with D^ do
  1120. begin
  1121. HelpCtx:=hcMouse;
  1122. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+3;
  1123. R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1124. New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
  1125. SB^.SetParams(DoubleDelay,1,20,1,1);
  1126. Insert(SB);
  1127. R2.Move(0,-1);
  1128. Insert(New(PStaticText, Init(R2, label_mouse_speedbar)));
  1129. R2.Move(-1,-1);
  1130. Insert(New(PLabel, Init(R2, label_mouse_doubleclickspeed, SB)));
  1131. R2.Copy(R); Inc(R2.A.Y,2); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1132. New(CB, Init(R2, NewSItem(label_mouse_reversebuttons, nil) ));
  1133. if MouseReverse then CB^.Press(0);
  1134. Insert(CB);
  1135. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+8;
  1136. R2.Copy(R); Inc(R2.A.Y); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1137. New(RB1, Init(R2,
  1138. NewSItem(label_mouse_act_nothing,
  1139. NewSItem(label_mouse_act_topicsearch,
  1140. NewSItem(label_mouse_act_gotocursor,
  1141. NewSItem(label_mouse_act_breakpoint,
  1142. NewSItem(label_mouse_act_evaluate,
  1143. NewSItem(label_mouse_act_addwatch,
  1144. NewSItem(label_mouse_act_browsesymbol,
  1145. nil)))))))));
  1146. RB1^.Press(CtrlMouseAction);
  1147. Insert(RB1);
  1148. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1149. Insert(New(PLabel, Init(R2, label_mouse_crtlrightmousebuttonaction, RB1)));
  1150. R2.Copy(R); Inc(R2.A.Y); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1151. New(RB2, Init(R2,
  1152. NewSItem(label_mouse_act_nothing,
  1153. NewSItem(label_mouse_act_topicsearch,
  1154. NewSItem(label_mouse_act_gotocursor,
  1155. NewSItem(label_mouse_act_breakpoint,
  1156. NewSItem(label_mouse_act_evaluate,
  1157. NewSItem(label_mouse_act_addwatch,
  1158. NewSItem(label_mouse_act_browsesymbol,
  1159. nil)))))))));
  1160. RB2^.Press(AltMouseAction);
  1161. Insert(RB2);
  1162. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1163. Insert(New(PLabel, Init(R2, label_mouse_altrightmousebuttonaction, RB2)));
  1164. end;
  1165. InsertButtons(D);
  1166. RB1^.Select;
  1167. if Desktop^.ExecView(D)=cmOK then
  1168. begin
  1169. MouseReverse:=CB^.Mark(0);
  1170. DoubleDelay:=SB^.Value;
  1171. CtrlMouseAction:=RB1^.Value;
  1172. AltMouseAction:=RB2^.Value;
  1173. end;
  1174. Dispose(D, Done);
  1175. end;
  1176. procedure TIDEApp.Colors;
  1177. {$Ifdef COLORSEL}
  1178. var D: PColorDialog;
  1179. begin
  1180. New(D, Init(AppPalette,
  1181. ColorGroup(label_colors_grp_browser,
  1182. ColorItem(label_colors_framepassive , 215,
  1183. ColorItem(label_colors_frameactive , 216,
  1184. ColorItem(label_colors_frameicon , 217,
  1185. ColorItem(label_colors_scrollbarpage , 218,
  1186. ColorItem(label_colors_scrollbaricons , 219,
  1187. ColorItem(label_colors_normaltext , 220,
  1188. ColorItem(label_colors_selectedtext , 221,
  1189. ColorItem(label_colors_activeitem , 222,
  1190. ColorItem(label_colors_inactiveitem , 223,
  1191. ColorItem(label_colors_focuseditem , 224,
  1192. ColorItem(label_colors_selecteditem , 225,
  1193. ColorItem(label_colors_divider , 226,
  1194. nil)))))))))))),
  1195. ColorGroup(label_colors_grp_clock,
  1196. ColorItem(label_colors_clockview , 227,
  1197. nil),
  1198. ColorGroup(label_colors_grp_desktop, DesktopColorItems(nil),
  1199. ColorGroup(label_colors_grp_dialogs, DialogColorItems(dpGrayDialog,nil),
  1200. ColorGroup(label_colors_grp_editor,
  1201. ColorItem(label_colors_framepassive , 167,
  1202. ColorItem(label_colors_frameactive , 168,
  1203. ColorItem(label_colors_frameicon , 169,
  1204. ColorItem(label_colors_scrollbarpage , 170,
  1205. ColorItem(label_colors_scrollbaricons , 171,
  1206. ColorItem(label_colors_normaltext , 199,
  1207. ColorItem(label_colors_selectedtext , 208,
  1208. ColorItem(label_colors_highlighcolumn , 209,
  1209. ColorItem(label_colors_highlightrow , 210,
  1210. ColorItem(label_colors_errormessages , 214,
  1211. nil)))))))))),
  1212. ColorGroup(label_colors_grp_help,
  1213. ColorItem(label_colors_framepassive , 128,
  1214. ColorItem(label_colors_frameactive , 129,
  1215. ColorItem(label_colors_frameicon , 130,
  1216. ColorItem(label_colors_scrollbarpage , 131,
  1217. ColorItem(label_colors_scrollbaricons , 132,
  1218. ColorItem(label_colors_helptext , 160,
  1219. ColorItem(label_colors_helplinks , 161,
  1220. ColorItem(label_colors_selectedlink , 162,
  1221. ColorItem(label_colors_selectedtext , 163,
  1222. ColorItem(label_colors_html_heading1 , 229,
  1223. ColorItem(label_colors_html_heading2 , 230,
  1224. ColorItem(label_colors_html_heading3 , 231,
  1225. ColorItem(label_colors_html_heading4 , 232,
  1226. ColorItem(label_colors_html_heading5 , 233,
  1227. ColorItem(label_colors_html_heading6 , 234,
  1228. nil))))))))))))))),
  1229. ColorGroup(label_colors_grp_menus, MenuColorItems(nil),
  1230. ColorGroup(label_colors_grp_syntax,
  1231. ColorItem(label_colors_whitespace , 200,
  1232. ColorItem(label_colors_comments , 201,
  1233. ColorItem(label_colors_reservedwords , 202,
  1234. ColorItem(label_colors_identifiers , 203,
  1235. ColorItem(label_colors_strings , 204,
  1236. ColorItem(label_colors_numbers , 205,
  1237. ColorItem(label_colors_hexnumbers , 212,
  1238. ColorItem(label_colors_assembler , 206,
  1239. ColorItem(label_colors_symbols , 207,
  1240. ColorItem(label_colors_directives , 211,
  1241. ColorItem(label_colors_tabs , 213,
  1242. nil))))))))))),
  1243. nil))))))))));
  1244. D^.HelpCtx:=hcColors;
  1245. if ExecuteDialog(D, @AppPalette)=cmOK then
  1246. begin
  1247. DoneMemory;
  1248. Message(Application,evBroadcast,cmUpdate,nil);
  1249. ReDraw;
  1250. UpdateScreen(true);
  1251. end;
  1252. end;
  1253. {$else COLORSEL}
  1254. begin
  1255. end;
  1256. {$endif COLORSEL}
  1257. procedure TIDEApp.OpenINI;
  1258. var D: PFileDialog;
  1259. FileName: string;
  1260. begin
  1261. New(D, Init('*'+ExtOf(INIFileName),dialog_openoptions,dialog_ini_filename,fdOpenButton,hidOpenIniFile));
  1262. D^.HelpCtx:=hcOpenIni;
  1263. if Desktop^.ExecView(D)<>cmCancel then
  1264. begin
  1265. D^.GetFileName(FileName);
  1266. if ExistsFile(FileName)=false then ErrorBox(msg_cantopenconfigfile,nil) else
  1267. begin
  1268. IniFileName:=FileName;
  1269. ReadINIFile;
  1270. Message(Application,evBroadcast,cmUpdate,nil);
  1271. end;
  1272. end;
  1273. Dispose(D, Done);
  1274. end;
  1275. procedure TIDEApp.SaveINI;
  1276. begin
  1277. if WriteINIFile(false)=false then
  1278. ErrorBox(msg_errorsavingconfigfile,nil);
  1279. end;
  1280. procedure TIDEApp.SaveAsINI;
  1281. var D: PFileDialog;
  1282. FileName: string;
  1283. CanWrite: boolean;
  1284. begin
  1285. New(D, Init('*'+ExtOf(INIFileName),dialog_saveoptions,dialog_ini_filename,fdOpenButton,hidSaveIniFile));
  1286. D^.HelpCtx:=hcSaveAsINI;
  1287. if Desktop^.ExecView(D)<>cmCancel then
  1288. begin
  1289. D^.GetFileName(FileName);
  1290. CanWrite:=(ExistsFile(FileName)=false);
  1291. if CanWrite=false then
  1292. CanWrite:=ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,SmartPath(FileName)),nil,false)=cmYes;
  1293. if CanWrite then
  1294. begin
  1295. IniFileName:=FileName;
  1296. if WriteINIFile(true)=false then
  1297. ErrorBox(msg_errorsavingconfigfile,nil);
  1298. Message(Application,evBroadcast,cmUpdate,nil);
  1299. end;
  1300. end;
  1301. Dispose(D, Done);
  1302. end;
  1303. {
  1304. $Log$
  1305. Revision 1.13 2004-12-19 20:38:35 hajny
  1306. + confirmation box after video mode switch (bug 2933)
  1307. Revision 1.12 2004/11/08 20:28:26 peter
  1308. * Breakpoints are now deleted when removed from source, disabling is
  1309. still possible from the breakpoint list
  1310. * COMPILER_1_0, FVISION, GABOR defines removed, only support new
  1311. FV and 1.9.x compilers
  1312. * Run directory added to Run menu
  1313. * Useless programinfo window removed
  1314. Revision 1.11 2002/12/18 01:21:42 pierre
  1315. + Use TEditorInputLine instead of TInputLine
  1316. Revision 1.10 2002/11/28 12:56:23 pierre
  1317. + Remote dialog added
  1318. Revision 1.9 2002/11/21 00:37:56 pierre
  1319. + some cross gdb enhancements
  1320. Revision 1.8 2002/09/07 15:40:44 peter
  1321. * old logs removed and tabs fixed
  1322. Revision 1.7 2002/09/04 08:52:46 pierre
  1323. * adapt to fpcodtmp interface change
  1324. Revision 1.6 2002/01/24 09:21:42 pierre
  1325. * only disable Alt-X in Options|Compiler dialog
  1326. }