fpmopts.inc 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720
  1. {
  2. This file is part of the Free Pascal Integrated Development Environment
  3. Copyright (c) 1998 by Berczi Gabor
  4. Options menu entries
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. procedure TIDEApp.SetSwitchesMode;
  12. var R,R2: TRect;
  13. D: PCenterDialog;
  14. RB: PRadioButtons;
  15. i : TSwitchMode;
  16. SwitchesCount : integer;
  17. LastItem: PSItem;
  18. L: longint;
  19. OldCompilerMode: TCompilerMode;
  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. OldCompilerMode:=TCompilerMode(CompilerModeSwitches^.GetCurrSelParamID());
  52. if Desktop^.ExecView(D)=cmOK then
  53. begin
  54. SwitchesMode:=TSwitchMode(RB^.Value);
  55. UpdateEditorsCompilerMode(OldCompilerMode);
  56. end;
  57. Dispose(D, Done);
  58. UpdateMode;
  59. UpdateTarget;
  60. end;
  61. procedure TIDEApp.DoCompilerSwitch;
  62. var R,R2,R3,TabR,TabIR: TRect;
  63. D: PCenterDialog;
  64. CB1,CB2,CB3,CB4,CB5: PCheckBoxes;
  65. RB1,RB1b: PScrollerRadioButtons;
  66. RB2,RB4,RB5,RB6: PRadioButtons;
  67. VScrollBar1,VScrollBar2 : PScrollBar;
  68. Items: PSItem;
  69. IL: PEditorInputLine;
  70. IL2: PEditorInputLine;
  71. Count : integer;
  72. I,L: longint;
  73. Tab: PTab;
  74. Label11,Label12,
  75. Label21,Label22,Label23,Label23b,
  76. Label31,Label41,
  77. Label51,Label52,Label53: PLabel;
  78. TargetHeight,ProcessorHeight: sw_integer;
  79. OldCompilerMode: TCompilerMode;
  80. begin
  81. {decide height of dialog view}
  82. GetExtent(R);
  83. Count:=ProcessorOptimizationSwitches^.ItemCount;
  84. Count:=max(Count,ProcessorCodeGenerationSwitches^.ItemCount); {lines we need to be able to show}
  85. if Count < 10 then Count:=10; {10 lines are needed in Assembler page}
  86. TargetHeight:=Count+11; {11 lines for rest (empty lines, borders, pages, conditions...)}
  87. if TargetHeight> 31 then TargetHeight:=31; {don't go wild, limit ourselvs on 31 line}
  88. if (R.B.Y-R.A.Y) < (TargetHeight+5) then
  89. TargetHeight:= (R.B.Y-R.A.Y)-5; {screen allow exactly this much lines}
  90. if TargetHeight<21 then
  91. TargetHeight:=21; {at last 21 for our view}
  92. {actual height will be TargetHeight + 2 border lines + 3 lines for Ok buttons (min 26 lines)}
  93. R.Assign(0,0,76,TargetHeight);
  94. New(D, Init(R, dialog_compilerswitches));
  95. with D^ do
  96. begin
  97. HelpCtx:=hcCompilerNoAltX;
  98. GetExtent(R);
  99. R.Grow(-2,-1);
  100. Dec(R.B.Y,2);
  101. TabR.Copy(R);
  102. Dec(TabR.B.Y,2);
  103. TabIR.Copy(R);
  104. Inc(TabIR.A.Y,2);
  105. TabIR.Grow(0,-1);
  106. { --- Sheet 1 --- }
  107. Count:=SyntaxSwitches^.ItemCount;
  108. R.Copy(TabIR);
  109. R2.Copy(R);
  110. R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-3;{ R2.B.X:=R2.B.X-4;}
  111. { R2.B.Y:=R2.A.Y+((Count+1) div 2);}
  112. R2.B.Y:=R2.A.Y+Count;
  113. Items:=nil;
  114. for I:=Count-1 downto 0 do
  115. Items:=NewSItem(SyntaxSwitches^.ItemName(I), Items);
  116. New(CB1, Init(R2, Items));
  117. for I:=0 to Count-1 do
  118. if SyntaxSwitches^.GetBooleanItem(I) then
  119. CB1^.Press(I);
  120. Dec(R2.A.Y);
  121. R2.B.Y:=R2.A.Y+1;
  122. New(Label11, Init(R2, label_compiler_syntaxswitches, CB1));
  123. Count:=CompilerModeSwitches^.ItemCount;
  124. R.Copy(TabIR);
  125. R2.Copy(R);
  126. R2.A.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;
  127. R2.B.X:=R2.B.X-3;
  128. { R2.B.Y:=R2.A.Y+((Count+1) div 2);}
  129. R2.B.Y:=R2.A.Y+Count;
  130. Items:=nil;
  131. for I:=Count-1 downto 0 do
  132. Items:=NewSItem(CompilerModeSwitches^.ItemName(I), Items);
  133. New(RB2, Init(R2, Items));
  134. L:=CompilerModeSwitches^.GetCurrSel;
  135. RB2^.SetData(L);
  136. Dec(R2.A.Y);
  137. R2.B.Y:=R2.A.Y+1;
  138. New(Label12, Init(R2, label_compiler_mode, RB2));
  139. { --- Sheet 2 --- }
  140. Count:=CodegenSwitches^.ItemCount;
  141. R2.Copy(TabIR);
  142. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2-2;
  143. R2.B.Y:=R2.A.Y+Count;
  144. Items:=nil;
  145. for I:=Count-1 downto 0 do
  146. Items:=NewSItem(CodegenSwitches^.ItemName(I), Items);
  147. New(CB3, Init(R2, Items));
  148. for I:=0 to Count-1 do
  149. if CodegenSwitches^.GetBooleanItem(I) then
  150. CB3^.Press(I);
  151. Dec(R2.A.Y);
  152. R2.B.Y:=R2.A.Y+1;
  153. New(Label21, Init(R2, label_compiler_codegeneration, CB3));
  154. Count:=OptimizationSwitches^.ItemCount;
  155. R2.Copy(TabIR);
  156. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  157. Dec(R2.B.X,4);
  158. R2.B.Y:=R2.A.Y+Count;
  159. Items:=nil;
  160. for I:=Count-1 downto 0 do
  161. Items:=NewSItem(OptimizationSwitches^.ItemName(I), Items);
  162. New(CB2, Init(R2, Items));
  163. for I:=0 to Count-1 do
  164. if OptimizationSwitches^.GetBooleanItem(I) then
  165. CB2^.Press(I);
  166. Dec(R2.A.Y);
  167. R2.B.Y:=R2.A.Y+1;
  168. New(Label22, Init(R2, label_compiler_optimizations, CB2));
  169. { --- Sheet 3 --- }
  170. Count:=ProcessorOptimizationSwitches^.ItemCount;
  171. ProcessorHeight:=Count;
  172. if (ProcessorHeight+11 > TargetHeight) then
  173. ProcessorHeight:=ProcessorHeight-((ProcessorHeight+11) -TargetHeight);
  174. R.Copy(TabIR);
  175. R2.Copy(R);
  176. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  177. Dec(R2.B.X,4);
  178. R2.B.Y:=R2.A.Y+ProcessorHeight;
  179. VScrollBar1:=nil;
  180. if ProcessorHeight<>Count then
  181. begin
  182. R3.Copy(R2);R3.A.X:=R3.B.X; R3.B.X:=R3.B.X+1;
  183. VScrollBar1:=New(PScrollBar, Init(R3));
  184. end;
  185. Items:=nil;
  186. for I:=Count-1 downto 0 do
  187. Items:=NewSItem(ProcessorOptimizationSwitches^.ItemName(I), Items);
  188. New(RB1, Init(R2, Items, VScrollBar1));
  189. L:=ProcessorOptimizationSwitches^.GetCurrSel;
  190. RB1^.SetData(L);
  191. RB1^.CentreSelected;
  192. Dec(R2.A.Y);
  193. R2.B.Y:=R2.A.Y+1;
  194. New(Label23, Init(R2, label_compiler_opt_targetprocessor, RB1));
  195. Count:=ProcessorCodeGenerationSwitches^.ItemCount;
  196. ProcessorHeight:=Count;
  197. if (ProcessorHeight+11 > TargetHeight) then
  198. ProcessorHeight:=ProcessorHeight-((ProcessorHeight+11) -TargetHeight);
  199. R.Copy(TabIR);
  200. R2.Copy(R);
  201. R2.A.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  202. R2.B.X:=R2.B.X-4;
  203. R2.B.Y:=R2.A.Y+ProcessorHeight;
  204. VScrollBar2:=nil;
  205. if ProcessorHeight<>Count then
  206. begin
  207. Dec(R2.B.X);
  208. R3.Copy(R2);R3.A.X:=R3.B.X; R3.B.X:=R3.B.X+1;
  209. VScrollBar2:=New(PScrollBar, Init(R3));
  210. end;
  211. Items:=nil;
  212. for I:=Count-1 downto 0 do
  213. Items:=NewSItem(ProcessorCodeGenerationSwitches^.ItemName(I), Items);
  214. New(RB1b, Init(R2, Items, VScrollBar2));
  215. L:=ProcessorCodeGenerationSwitches^.GetCurrSel;
  216. RB1b^.SetData(L);
  217. RB1b^.CentreSelected;
  218. Dec(R2.A.Y);
  219. R2.B.Y:=R2.A.Y+1;
  220. New(Label23b, Init(R2, label_compiler_codegen_targetprocessor, RB1b));
  221. { --- Sheet 4 --- }
  222. Count:=VerboseSwitches^.ItemCount;
  223. R.Copy(TabIR);
  224. R2.Copy(R);
  225. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  226. R2.B.Y:=R2.A.Y+Count;
  227. Items:=nil;
  228. for I:=Count-1 downto 0 do
  229. Items:=NewSItem(VerboseSwitches^.ItemName(I), Items);
  230. New(CB4, Init(R2, Items));
  231. for I:=0 to Count-1 do
  232. if VerboseSwitches^.GetBooleanItem(I) then
  233. CB4^.Press(I);
  234. Dec(R2.A.Y);
  235. R2.B.Y:=R2.A.Y+1;
  236. New(Label31, Init(R2, label_compiler_verboseswitches, CB4));
  237. { --- Sheet 5 --- }
  238. Count:=BrowserSwitches^.ItemCount;
  239. R.Copy(TabIR);
  240. R2.Copy(R);
  241. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2;
  242. R2.B.Y:=R2.A.Y+Count;
  243. Items:=nil;
  244. for I:=Count-1 downto 0 do
  245. Items:=NewSItem(BrowserSwitches^.ItemName(I), Items);
  246. New(RB4, Init(R2, Items));
  247. L:=BrowserSwitches^.GetCurrSel;
  248. RB4^.SetData(L);
  249. Dec(R2.A.Y);
  250. R2.B.Y:=R2.A.Y+1;
  251. New(Label41, Init(R2, label_compiler_browser, RB4));
  252. { --- Sheet 6 --- }
  253. Count:=AsmReaderSwitches^.ItemCount;
  254. R2.Copy(TabIR);
  255. R2.B.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  256. Dec(R2.B.X,4);
  257. R2.B.Y:=R2.A.Y+Count;
  258. Items:=nil;
  259. for I:=Count-1 downto 0 do
  260. Items:=NewSItem(AsmReaderSwitches^.ItemName(I), Items);
  261. New(RB5, Init(R2, Items));
  262. L:=AsmReaderSwitches^.GetCurrSel;
  263. RB5^.SetData(L);
  264. Dec(R2.A.Y);
  265. R2.B.Y:=R2.A.Y+1;
  266. New(Label51, Init(R2, label_compiler_assemblerreader, RB5));
  267. R2.Copy(TabIR);
  268. R2.B.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  269. Dec(R2.B.X,4);
  270. R2.A.Y:=R2.A.Y+Count+2;
  271. Count:=AsmInfoSwitches^.ItemCount;
  272. R2.B.Y:=R2.A.Y+Count;
  273. Items:=nil;
  274. for I:=Count-1 downto 0 do
  275. Items:=NewSItem(AsmInfoSwitches^.ItemName(I), Items);
  276. New(CB5, Init(R2, Items));
  277. for I:=0 to Count-1 do
  278. if AsmInfoSwitches^.GetBooleanItem(I) then
  279. CB5^.Press(I);
  280. Dec(R2.A.Y);
  281. R2.B.Y:=R2.A.Y+1;
  282. New(Label52, Init(R2, label_compiler_assemblerinfo, CB5));
  283. UpdateAsmOutputSwitches;
  284. Count:=AsmOutputSwitches[SwitchesMode]^.ItemCount;
  285. R2.Copy(TabIR);
  286. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2;
  287. Dec(R2.B.X,4);
  288. R2.B.Y:=R2.A.Y+Count;
  289. Items:=nil;
  290. for I:=Count-1 downto 0 do
  291. Items:=NewSItem(AsmOutputSwitches[SwitchesMode]^.ItemName(I), Items);
  292. New(RB6, Init(R2, Items));
  293. L:=AsmOutputSwitches[SwitchesMode]^.GetCurrSel;
  294. RB6^.SetData(L);
  295. Dec(R2.A.Y);
  296. R2.B.Y:=R2.A.Y+1;
  297. New(Label53, Init(R2, label_compiler_assembleroutput, RB6));
  298. { create tabs }
  299. New(Tab, Init(TabR,
  300. NewTabDef(page_compiler_syntax,CB1,
  301. NewTabItem(Label11,
  302. NewTabItem(CB1,
  303. NewTabItem(Label12,
  304. NewTabItem(RB2,
  305. nil)))),
  306. NewTabDef(page_compiler_codegeneration,CB3,
  307. NewTabItem(Label21,
  308. NewTabItem(CB3,
  309. NewTabItem(Label22,
  310. NewTabItem(CB2,
  311. nil)))),
  312. NewTabDef('~P~rocessor',RB1,
  313. NewTabItem(Label23,
  314. NewTabItem(VScrollBar1,
  315. NewTabItem(RB1,
  316. NewTabItem(Label23b,
  317. NewTabItem(VScrollBar2,
  318. NewTabItem(RB1b,
  319. nil)))))),
  320. NewTabDef(page_compiler_verbose,CB4,
  321. NewTabItem(Label31,
  322. NewTabItem(CB4,
  323. nil)),
  324. NewTabDef(page_compiler_browser,RB4,
  325. NewTabItem(Label41,
  326. NewTabItem(RB4,
  327. nil)),
  328. NewTabDef(page_compiler_assembler,CB1,
  329. NewTabItem(Label51,
  330. NewTabItem(RB5,
  331. NewTabItem(Label52,
  332. NewTabItem(CB5,
  333. NewTabItem(Label53,
  334. NewTabItem(RB6,
  335. nil)))))),
  336. nil))))))));
  337. Tab^.GrowMode:=0;
  338. Insert(Tab);
  339. { conditionnals }
  340. R2.Copy(TabR); R2.A.Y:=R2.B.Y+1; R2.B.Y:=R2.A.Y+1; Dec(R2.B.X,4);
  341. New(IL, Init(R2, 255));
  342. IL^.Data^:=ConditionalSwitches^.GetStringItem(0);
  343. Insert(IL);
  344. R3.Copy(R2); R3.A.X:=R2.B.X+1; R3.B.X:=R3.A.X+3;
  345. Insert(New(PHistory, Init(R3, IL, hidConditionalDefines)));
  346. R2.Move(0,-1);
  347. Insert(New(PLabel, Init(R2,ConditionalSwitches^.ItemName(0), IL)));
  348. {custom }
  349. inc(R2.A.Y,3); inc(R2.B.Y,3);
  350. New(IL2, Init(R2, 255));
  351. IL2^.Data^:=CustomArg[SwitchesMode];
  352. Insert(IL2);
  353. R3.Copy(R2); R3.A.X:=R2.B.X+1; R3.B.X:=R3.A.X+3;
  354. Insert(New(PHistory, Init(R3, IL2, hidCompilerArgs)));
  355. R2.Move(0,-1);
  356. Insert(New(PLabel, Init(R2,label_debugger_compilerargs, IL2)));
  357. end;
  358. InsertButtons(D);
  359. if Desktop^.ExecView(D)=cmOK then
  360. begin
  361. OldCompilerMode:= TCompilerMode(CompilerModeSwitches^.GetCurrSelParamID());
  362. for I:=0 to SyntaxSwitches^.ItemCount-1 do
  363. SyntaxSwitches^.SetBooleanItem(I,CB1^.Mark(I));
  364. CompilerModeSwitches^.SetCurrSel(RB2^.Value);
  365. for I:=0 to CodeGenSwitches^.ItemCount-1 do
  366. CodegenSwitches^.SetBooleanItem(I,CB3^.Mark(I));
  367. for I:=0 to OptimizationSwitches^.ItemCount-1 do
  368. OptimizationSwitches^.SetBooleanItem(I,CB2^.Mark(I));
  369. for I:=0 to VerboseSwitches^.ItemCount-1 do
  370. VerboseSwitches^.SetBooleanItem(I,CB4^.Mark(I));
  371. ProcessorOptimizationSwitches^.SetCurrSel(RB1^.Value);
  372. ProcessorCodeGenerationSwitches^.SetCurrSel(RB1b^.Value);
  373. AsmReaderSwitches^.SetCurrSel(RB5^.Value);
  374. for I:=0 to AsmInfoSwitches^.ItemCount-1 do
  375. AsmInfoSwitches^.SetBooleanItem(I,CB5^.Mark(I));
  376. AsmOutputSwitches[SwitchesMode]^.SetCurrSel(RB6^.Value);
  377. BrowserSwitches^.SetCurrSel(RB4^.Value);
  378. ConditionalSwitches^.SetStringItem(0,IL^.Data^);
  379. CustomArg[SwitchesMode]:=IL2^.Data^;
  380. UpdateEditorsCompilerMode(OldCompilerMode);
  381. end;
  382. Dispose(D, Done);
  383. end;
  384. procedure TIDEApp.UpdateEditorsCompilerMode(OldMode:TCompilerMode);
  385. procedure UpdateEditor(P: PView);
  386. begin
  387. if assigned(P) and (TypeOf(P^)=TypeOf(TSourceWindow)) then
  388. begin
  389. PSourceWindow(P)^.Editor^.UpdateAttrs(0,attrForceFull);
  390. PSourceWindow(P)^.ReDraw;
  391. end;
  392. end;
  393. var NewMode:TCompilerMode;
  394. begin
  395. NewMode:=TCompilerMode(CompilerModeSwitches^.GetCurrSelParamID());
  396. if (OldMode in [moFpc,moObjfpc]) and not (NewMode in [moFpc,moObjfpc]) then
  397. Desktop^.ForEach(TCallbackProcParam(@UpdateEditor))
  398. else
  399. if not (OldMode in [moFpc,moObjfpc]) and (NewMode in [moFpc,moObjfpc]) then
  400. Desktop^.ForEach(TCallbackProcParam(@UpdateEditor));
  401. end;
  402. procedure TIDEApp.MemorySizes;
  403. var R,R2,R3: TRect;
  404. D: PCenterDialog;
  405. ILs: array[0..10] of PIntegerLine;
  406. I: integer;
  407. begin
  408. R.Assign(0,0,40,2+MemorySwitches^.ItemCount*2);
  409. New(D, Init(R, dialog_memorysizes));
  410. with D^ do
  411. begin
  412. HelpCtx:=hcmemorysizes;
  413. GetExtent(R); R.Grow(-3,-1);
  414. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  415. for I:=0 to MemorySwitches^.ItemCount-1 do
  416. begin
  417. R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  418. New(ILs[I], Init(R3, MinMemSize, MaxMemSize));
  419. ILs[I]^.Data^:=IntToStr(MemorySwitches^.GetLongintItem(I));
  420. Insert(ILs[I]);
  421. R3.Copy(R2); R3.B.X:=21;
  422. Insert(New(PLabel, Init(R3, MemorySwitches^.ItemName(I), ILs[I])));
  423. R2.Move(0,2);
  424. end;
  425. { R3.Copy(R2); R3.A.X:=21; R3.B.X:=R3.A.X+10;
  426. New(IL2, Init(R3, MinHeapSize, MaxHeapSize));
  427. IL2^.Data^:=IntToStr(GetHeapSize);
  428. Insert(IL2);
  429. R3.Copy(R2); R3.B.X:=21;
  430. Insert(New(PLabel, Init(R3, 'Local ~h~eap size', IL2)));}
  431. end;
  432. InsertButtons(D);
  433. ILs[0]^.Select;
  434. if Desktop^.ExecView(D)=cmOK then
  435. begin
  436. for I:=0 to MemorySwitches^.ItemCount-1 do
  437. begin
  438. MemorySwitches^.SetLongintItem(I,StrToInt(ILs[I]^.Data^));
  439. end;
  440. { SetStackSize(StrToInt(IL1^.Data^));
  441. SetHeapSize(StrToInt(IL2^.Data^));}
  442. end;
  443. Dispose(D, Done);
  444. end;
  445. procedure TIDEApp.DoLinkerSwitch;
  446. var R,R2: TRect;
  447. D: PCenterDialog;
  448. RB2: PRadioButtons;
  449. CB,CB2 : PCheckBoxes;
  450. Count,I: longint;
  451. Items: PSItem;
  452. L: longint;
  453. begin
  454. R.Assign(0,0,66,8);
  455. New(D, Init(R, dialog_linker));
  456. with D^ do
  457. begin
  458. HelpCtx:=hclinker;
  459. GetExtent(R); R.Grow(-3,-1);
  460. Count:=LinkAfterSwitches^.ItemCount;
  461. R2.Copy(R);
  462. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 - 1;
  463. Inc(R2.A.Y,1);
  464. R2.B.Y:=R2.A.Y+Count;
  465. Items:=nil;
  466. for I:=Count-1 downto 0 do
  467. Items:=NewSItem(LinkAfterSwitches^.ItemName(I), Items);
  468. New(CB, Init(R2, Items));
  469. for I:=0 to Count-1 do
  470. if LinkAfterSwitches^.GetBooleanItem(I) then
  471. CB^.Press(I);
  472. Insert(CB);
  473. Dec(R2.A.Y);
  474. R2.B.Y:=R2.A.Y+1;
  475. Insert(New(PLabel, Init(R2, label_compiler_linkafter, CB)));
  476. R2.Copy(R);
  477. R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 - 1;
  478. Inc(R2.A.Y,Count+2);
  479. R2.B.Y:=R2.A.Y+1;
  480. Items:=NewSItem(OtherLinkerSwitches^.ItemName(1), Nil);
  481. New(CB2, Init(R2, Items));
  482. if OtherLinkerSwitches^.GetBooleanItem(1) then
  483. CB2^.Press(0);
  484. Insert(CB2);
  485. R2.Copy(R); Inc(R2.A.Y);
  486. R2.B.Y:=R2.A.Y+LibLinkerSwitches^.ItemCount;
  487. R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2+1;
  488. Items:=nil;
  489. for I:=LibLinkerSwitches^.ItemCount-1 downto 0 do
  490. Items:=NewSItem(LibLinkerSwitches^.ItemName(I), Items);
  491. New(RB2, Init(R2, Items));
  492. L:=LibLinkerSwitches^.GetCurrSel;
  493. RB2^.SetData(L);
  494. Insert(RB2);
  495. 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;
  496. Insert(New(PLabel, Init(R2, label_linker_preferredlibtype, RB2)));
  497. end;
  498. InsertButtons(D);
  499. RB2^.Select;
  500. if Desktop^.ExecView(D)=cmOK then
  501. begin
  502. { SetEXEFormat(TEXEFormat(RB1^.Value+1));}
  503. LibLinkerSwitches^.SetCurrSel(RB2^.Value);
  504. OtherLinkerSwitches^.SetBooleanItem(1,CB2^.Mark(0));
  505. if LibLinkerSwitches^.GetCurrSelParam='X' then
  506. if CompareText(TargetSwitches^.GetCurrSelParam,'Windows')=0 then
  507. if CompareText(AsmOutputSwitches[SwitchesMode]^.GetCurrSelParam,'pecoff')<>0 then
  508. if ConfirmBox(
  509. FormatStrStr3(msg_xmustbesettoyforz_doyouwanttochangethis,
  510. label_compiler_assembleroutput,'pecoff','smartlinking'),nil,false)=cmYes then
  511. AsmOutputSwitches[SwitchesMode]^.SetCurrSelParam('pecoff');
  512. for I:=0 to LinkAfterSwitches^.ItemCount-1 do
  513. LinkAfterSwitches^.SetBooleanItem(I,CB^.Mark(I));
  514. end;
  515. Dispose(D, Done);
  516. end;
  517. procedure TIDEApp.DoDebuggerSwitch;
  518. var R,R2,R3: TRect;
  519. D: PCenterDialog;
  520. RB,RB2 : PRadioButtons;
  521. CBStrip: PCheckBoxes;
  522. {$ifdef Windows}
  523. CB2: PCheckBoxes;
  524. {$endif Windows}
  525. {$ifdef Unix}
  526. IL: PEditorInputLine;
  527. {$endif Unix}
  528. L,I: longint;
  529. Items: PSItem;
  530. const
  531. {$ifdef Windows}
  532. OtherFieldLines = 3;
  533. {$else not Windows}
  534. {$ifdef Unix}
  535. OtherFieldLines = 3;
  536. {$else not Unix}
  537. OtherFieldLines = 0;
  538. {$endif Unix}
  539. {$endif Windows}
  540. begin
  541. R.Assign(0,0,60,2+DebugInfoSwitches^.ItemCount+1+2
  542. +ProfileInfoSwitches^.ItemCount+2+OtherFieldLines);
  543. New(D, Init(R, dialog_debugger));
  544. with D^ do
  545. begin
  546. HelpCtx:=hcdebugger;
  547. { Strip all }
  548. GetExtent(R); R.Grow(-3,-1);
  549. R2.Copy(R); Inc(R2.A.Y,2); R2.B.Y:=R2.A.Y+1;
  550. Items:=NewSItem(OtherLinkerSwitches^.ItemName(0), Nil);
  551. New(CBStrip, Init(R2, Items));
  552. if OtherLinkerSwitches^.GetBooleanItem(0) then
  553. CBStrip^.Press(0);
  554. Insert(CBStrip);
  555. GetExtent(R); R.Grow(-3,-1);
  556. R2.Copy(R); Inc(R2.A.Y,3); R2.B.Y:=R2.A.Y+DebugInfoSwitches^.ItemCount;
  557. Items:=nil;
  558. for I:=DebugInfoSwitches^.ItemCount-1 downto 0 do
  559. Items:=NewSItem(DebugInfoSwitches^.ItemName(I), Items);
  560. New(RB, Init(R2, Items));
  561. L:=DebugInfoSwitches^.GetCurrSel;
  562. RB^.SetData(L);
  563. Insert(RB);
  564. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  565. Insert(New(PLabel, Init(R2, label_debugger_debuginfo, RB)));
  566. R2.Copy(R); Inc(R2.A.Y,3+DebugInfoSwitches^.ItemCount+2); R2.B.Y:=R2.A.Y+ProfileInfoSwitches^.ItemCount;
  567. Items:=nil;
  568. for I:=ProfileInfoSwitches^.ItemCount-1 downto 0 do
  569. Items:=NewSItem(ProfileInfoSwitches^.ItemName(I), Items);
  570. New(RB2, Init(R2, Items));
  571. L:=ProfileInfoSwitches^.GetCurrSel;
  572. RB2^.SetData(L);
  573. Insert(RB2);
  574. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  575. Insert(New(PLabel, Init(R2, label_debugger_profileswitches, RB2)));
  576. {$ifdef Windows}
  577. R2.Move(0,ProfileInfoSwitches^.ItemCount+3);
  578. New(CB2,Init(R2,NewSItem(label_debugger_useanotherconsole, nil)));
  579. Insert(CB2);
  580. if DebuggeeTTY<>'' then
  581. L:=1
  582. else
  583. L:=0;
  584. CB2^.SetData(L);
  585. {$ifdef GDB_WINDOWS_ALWAYS_USE_ANOTHER_CONSOLE}
  586. { EnableMask type is longint, avoid range check error here }
  587. CB2^.EnableMask := CB2^.EnableMask and longint($7ffffffe);
  588. {$endif GDB_WINDOWS_ALWAYS_USE_ANOTHER_CONSOLE}
  589. R2.Move(0,-1);
  590. Insert(New(PLabel, Init(R2,label_debugger_redirection, CB2)));
  591. {$endif Windows}
  592. {$ifdef Unix}
  593. R2.Move(0,ProfileInfoSwitches^.ItemCount+3);
  594. New(IL, Init(R2, 255));
  595. IL^.Data^:=DebuggeeTTY;
  596. Insert(IL);
  597. R2.Move(0,-1);
  598. Insert(New(PLabel, Init(R2,label_debugger_useanothertty, IL)));
  599. {$endif Unix}
  600. end;
  601. InsertButtons(D);
  602. RB^.Select;
  603. if Desktop^.ExecView(D)=cmOK then
  604. begin
  605. DebugInfoSwitches^.SetCurrSel(RB^.Value);
  606. ProfileInfoSwitches^.SetCurrSel(RB2^.Value);
  607. OtherLinkerSwitches^.SetBooleanItem(0,CBStrip^.Mark(0));
  608. {$ifdef Windows}
  609. if CB2^.value<>0 then
  610. DebuggeeTTY:='on'
  611. else
  612. DebuggeeTTY:='';
  613. {$endif Windows}
  614. {$ifdef Unix}
  615. DebuggeeTTY:=IL^.Data^;
  616. {$endif Unix}
  617. end;
  618. Dispose(D, Done);
  619. end;
  620. {$ifdef SUPPORT_REMOTE}
  621. procedure TIDEApp.DoRemote;
  622. var R,R2: TRect;
  623. IL1,IL2,IL3,IL4,IL5,IL6,IL7,IL8: PEditorInputLine;
  624. IL9,IL10,IL11 : PEditorInputLine;
  625. D: PCenterDialog;
  626. const
  627. FieldLines = 11;
  628. begin
  629. {
  630. RemoteMachine : string = '';
  631. RemotePort : string = '2345';
  632. RemoteConfig : string = '';
  633. RemoteIdent : string = '';
  634. RemoteDir : string = '';
  635. RemoteSendCommand : string = 'scp $CONFIG $IDENT $LOCALFILE $REMOTEMACHINE:$REMOTEDIR';
  636. }
  637. R.Assign(0,0,60,2+2*FieldLines+2);
  638. New(D, Init(R, dialog_remote));
  639. with D^ do
  640. begin
  641. HelpCtx:=hcremotedialog;
  642. GetExtent(R); R.Grow(-3,-1);
  643. R2.Copy(R);
  644. R2.B.Y:=R2.A.Y+1;
  645. { remote machine name }
  646. R2.Move(0,3);
  647. New(IL1, Init(R2, 255));
  648. IL1^.Data^:=RemoteMachine;
  649. Insert(IL1);
  650. R2.Move(0,-1);
  651. Insert(New(PLabel, Init(R2,label_remote_machine, IL1)));
  652. { remote machine port }
  653. R2.Move(0,3);
  654. New(IL2, Init(R2, 255));
  655. IL2^.Data^:=RemotePort;
  656. Insert(IL2);
  657. R2.Move(0,-1);
  658. Insert(New(PLabel, Init(R2,label_remote_port, IL2)));
  659. { remote machine dir }
  660. R2.Move(0,3);
  661. New(IL3, Init(R2, 255));
  662. IL3^.Data^:=RemoteDir;
  663. Insert(IL3);
  664. R2.Move(0,-1);
  665. Insert(New(PLabel, Init(R2,label_remote_dir, IL3)));
  666. { remote machine config }
  667. R2.Move(0,3);
  668. New(IL4, Init(R2, 255));
  669. IL4^.Data^:=RemoteConfig;
  670. Insert(IL4);
  671. R2.Move(0,-1);
  672. Insert(New(PLabel, Init(R2,label_remote_config, IL4)));
  673. { remote machine ident }
  674. R2.Move(0,3);
  675. New(IL5, Init(R2, 255));
  676. IL5^.Data^:=RemoteIdent;
  677. Insert(IL5);
  678. R2.Move(0,-1);
  679. Insert(New(PLabel, Init(R2,label_remote_ident, IL5)));
  680. { remote machine send command }
  681. R2.Move(0,3);
  682. New(IL6, Init(R2, 255));
  683. IL6^.Data^:=RemoteSendCommand;
  684. Insert(IL6);
  685. R2.Move(0,-1);
  686. Insert(New(PLabel, Init(R2,label_remote_send_command, IL6)));
  687. { remote machine exec command }
  688. R2.Move(0,3);
  689. New(IL7, Init(R2, 255));
  690. IL7^.Data^:=RemoteExecCommand;
  691. Insert(IL7);
  692. R2.Move(0,-1);
  693. Insert(New(PLabel, Init(R2,label_remote_exec_command, IL7)));
  694. { remote machine exec command using ssh }
  695. R2.Move(0,3);
  696. New(IL8, Init(R2, 255));
  697. IL8^.Data^:=RemoteSshExecCommand;
  698. Insert(IL8);
  699. R2.Move(0,-1);
  700. Insert(New(PLabel, Init(R2,label_remote_ssh_exec_command, IL8)));
  701. { Remote shell executable }
  702. R2.Move(0,3);
  703. New(IL9, Init(R2, 255));
  704. IL9^.Data^:=RemoteShell;
  705. Insert(IL9);
  706. R2.Move(0,-1);
  707. Insert(New(PLabel, Init(R2,label_remote_shell, IL9)));
  708. { Remote copy executable }
  709. R2.Move(0,3);
  710. New(IL10, Init(R2, 255));
  711. IL10^.Data^:=RemoteCopy;
  712. Insert(IL10);
  713. R2.Move(0,-1);
  714. Insert(New(PLabel, Init(R2,label_remote_copy, IL10)));
  715. R2.Move(0,3);
  716. { Remote gdbserver }
  717. New(IL11, Init(R2, 255));
  718. IL11^.Data^:=RemoteGdbServer;
  719. Insert(IL11);
  720. R2.Move(0,-1);
  721. Insert(New(PLabel, Init(R2,label_remote_gdbserver, IL11)));
  722. end;
  723. InsertButtons(D);
  724. if Desktop^.ExecView(D)=cmOK then
  725. begin
  726. RemoteMachine:=IL1^.Data^;
  727. RemotePort:=IL2^.Data^;
  728. RemoteDir:=IL3^.Data^;
  729. RemoteConfig:=IL4^.Data^;
  730. RemoteIdent:=IL5^.Data^;
  731. RemoteSendCommand:=IL6^.Data^;
  732. RemoteExecCommand:=IL7^.Data^;
  733. RemoteSshExecCommand:=IL8^.Data^;
  734. RemoteShell:=IL9^.Data^;
  735. RemoteCopy:=IL10^.Data^;
  736. RemoteGdbServer:=IL11^.Data^;
  737. end;
  738. Dispose(D, Done);
  739. end;
  740. {$endif SUPPORT_REMOTE}
  741. procedure TIDEApp.directories;
  742. {Shows a window where the user can configure the directories the compilerproc
  743. will search files or output files to.}
  744. var tab:Ptab;
  745. tabR,R,R2:Trect;
  746. D:PCenterDialog;
  747. s,misc_string:string;
  748. E_units,E_includes,E_libraries,E_objects,e:Pfpmemo;
  749. L_units,L_includes,L_libraries,L_objects:Plabel;
  750. c:PunsortedStringCollection;
  751. count,i,j:integer;
  752. IL:array[0..11] of PEditorInputLine;
  753. misc_items:PTabItem;
  754. misc_tabfocus:Pview;
  755. newmisc_items,
  756. temp : PTabItem;
  757. const LW=25;
  758. begin
  759. R.assign(0,0,screenwidth*64 div 80,18);
  760. new(D,init(R,dialog_directories));
  761. if d^.size.x<72 then
  762. misc_string:='~M~isc.'
  763. else
  764. misc_string:='~M~iscellaneous';
  765. {Create editors.}
  766. R.assign(1,4,d^.size.x-4,d^.size.y-4);
  767. new(E_units,init(R,nil,nil,nil));
  768. R.assign(1,3,d^.size.x-4,4);
  769. new(L_units,init(R,'Unit ~d~irectories:',E_units));
  770. R.assign(1,4,d^.size.x-4,d^.size.y-4);
  771. new(E_includes,init(R,nil,nil,nil));
  772. R.assign(1,3,d^.size.x-4,4);
  773. new(L_includes,init(R,'Include ~d~irectories:',E_includes));
  774. R.assign(1,4,d^.size.x-4,d^.size.y-4);
  775. new(E_libraries,init(R,nil,nil,nil));
  776. R.assign(1,3,d^.size.x-4,4);
  777. new(L_libraries,init(R,'Library ~d~irectories:',E_libraries));
  778. R.assign(1,4,d^.size.x-4,d^.size.y-4);
  779. new(E_objects,init(R,nil,nil,nil));
  780. R.assign(1,3,d^.size.x-4,4);
  781. new(L_objects,init(R,'Object file ~d~irectories:',E_objects));
  782. {The switches that are put into the editors are of type multistring.
  783. We add multistrings to the editor. Other inputboxes are created on
  784. demand on the "Miscellaneous" tab.}
  785. R.assign(1,4,d^.size.x-5,5);
  786. count:=DirectorySwitches^.ItemCount;
  787. misc_items:=nil;
  788. misc_tabfocus:=nil;
  789. for i:=0 to count-1 do
  790. begin
  791. if directorySwitches^.GetItemTyp(i)=ot_MultiString then
  792. begin
  793. case directorySwitches^.itemParam(i)[3] of
  794. 'u':
  795. e:=E_units;
  796. 'i':
  797. e:=E_includes;
  798. 'l':
  799. e:=E_libraries;
  800. 'o':
  801. e:=E_objects;
  802. else
  803. messagebox('Internal error: Unknown switch.',nil,mfOkButton);
  804. end;
  805. e^.SetContent(directorySwitches^.getMultiStringItem(i));
  806. e^.addline(''); {Empty line so user can scroll below existing dirs.}
  807. IL[i]:=nil;
  808. end
  809. else
  810. begin
  811. R2.copy(R);
  812. R2.A.X:=LW;
  813. new(IL[i],init(R2,255));
  814. IL[i]^.data^:=DirectorySwitches^.GetStringItem(i);
  815. misc_items:=newTabItem(IL[i],misc_items);
  816. if misc_tabfocus=nil then
  817. misc_tabfocus:=IL[i];
  818. R2.copy(R);
  819. R2.B.X:=LW;
  820. misc_items:=newTabItem(
  821. new(Plabel,init(R2,
  822. DirectorySwitches^.ItemName(i),
  823. IL[i])),
  824. misc_items);
  825. R.move(0,2);
  826. end;
  827. end;
  828. { revert items for correct tab order }
  829. newmisc_items:=nil;
  830. while assigned(misc_items) do
  831. begin
  832. { get element }
  833. temp:=misc_items;
  834. misc_items:=temp^.next;
  835. { put element }
  836. temp^.next:=newmisc_items;
  837. newmisc_items:=temp;
  838. end;
  839. misc_items:=newmisc_items;
  840. {Create some tabs in the window.}
  841. tabR.assign(1,1,d^.size.x-2,d^.size.y-1);
  842. new(tab,init(tabR,
  843. newtabdef('~U~nits',e_units,
  844. NewTabItem(L_units,
  845. NewTabItem(E_units,
  846. nil)),
  847. NewTabDef('~I~nclude files',E_includes,
  848. NewTabItem(L_includes,
  849. NewTabItem(E_includes,
  850. nil)),
  851. NewTabDef('~L~ibraries',E_libraries,
  852. NewTabItem(L_libraries,
  853. NewTabItem(E_libraries,
  854. nil)),
  855. NewTabDef('~O~bject files',E_objects,
  856. NewTabItem(L_objects,
  857. NewTabItem(E_objects,
  858. nil)),
  859. NewTabDef(misc_string,misc_tabfocus,
  860. misc_items,
  861. nil)))))
  862. ));
  863. tab^.growmode:=0;
  864. d^.insert(tab);
  865. insertbuttons(D);
  866. if desktop^.execview(D)=cmOK then
  867. begin
  868. {Move the data from the window back into the switches.}
  869. for i:=0 to count-1 do
  870. if directorySwitches^.GetItemTyp(i)=ot_MultiString then
  871. begin
  872. case directorySwitches^.itemParam(i)[3] of
  873. 'u':
  874. e:=E_units;
  875. 'i':
  876. e:=E_includes;
  877. 'l':
  878. e:=E_libraries;
  879. 'o':
  880. e:=E_objects;
  881. else
  882. messagebox('Internal error: Unknown switch.',nil,mfOkButton);
  883. end;
  884. c:=directorySwitches^.getMultiStringItem(i);
  885. c^.freeall;
  886. for j:=0 to e^.GetLineCount-1 do
  887. begin
  888. s:=e^.GetLineText(j); { Note: AnsiString to ShortString convertino}
  889. s:=Trim(s);
  890. if s<>'' then
  891. c^.insert(newstr(s));
  892. end;
  893. end
  894. else
  895. begin
  896. s:=IL[i]^.data^;
  897. s:=Trim(s);
  898. DirectorySwitches^.SetStringItem(i,s);
  899. end;
  900. end;
  901. dispose(D,done);
  902. end;
  903. procedure TIDEApp.Tools;
  904. var
  905. D : PToolsDialog;
  906. begin
  907. D:=New(PToolsDialog, Init);
  908. ExecuteDialog(D,nil);
  909. end;
  910. (*procedure TIDEApp.Preferences;
  911. var R,R2: TRect;
  912. D: PCenterDialog;
  913. RB1 : PRadioButtons;
  914. CountModes : integer;
  915. hp : pvideomodelist;
  916. items : PSItem;
  917. videomode : tvideomode;
  918. i,modevalue : longint;
  919. function ToStr(l : longint) : string;
  920. var
  921. s : string;
  922. begin
  923. str(l,s);
  924. ToStr:=s;
  925. end;
  926. const
  927. color2str : array[false..true] of string = ('in b/w','in color');
  928. begin
  929. GetVideoMode(videomode);
  930. CountModes:=0;
  931. i:=0;
  932. modevalue:=0;
  933. R.Assign(0,0,64,18);
  934. New(D, Init(R, 'Preferences'));
  935. with D^ do
  936. begin
  937. hp:=video.modes;
  938. items:=nil;
  939. r2.assign(2,3,24,17);
  940. while assigned(hp) do
  941. begin
  942. items:=NewSItem(ToStr(hp^.col)+'x'+ToStr(hp^.row)+' '+color2str[hp^.color],items);
  943. if (hp^.col=videomode.col) and (hp^.row=videomode.row) and
  944. (hp^.color=videomode.color) then
  945. modevalue:=i;
  946. inc(CountModes);
  947. { we can't display an infinite number of modes }
  948. if CountModes>=r.b.y-r.a.y+1 then
  949. break;
  950. inc(i);
  951. hp:=hp^.next;
  952. end;
  953. modevalue:=CountModes-modevalue-1;
  954. new(rb1,init(r2,items));
  955. insert(rb1);
  956. rb1^.value:=modevalue;
  957. r2.move(0,-1);r2.b.y:=r2.a.y+1;
  958. insert(new(plabel,init(r2,'~V~ideo mode',rb1)));
  959. end;
  960. InsertButtons(D);
  961. if Desktop^.ExecView(D)=cmOK then
  962. begin
  963. { change video mode ? }
  964. if rb1^.value<>modevalue then
  965. begin
  966. modevalue:=CountModes-rb1^.value-1;
  967. hp:=video.modes;
  968. for i:=1 to modevalue do
  969. hp:=hp^.next;
  970. videomode.col:=hp^.col;
  971. videomode.row:=hp^.row;
  972. videomode.color:=hp^.color;
  973. SetScreenVideoMode(videomode);
  974. end;
  975. end;
  976. Dispose(D, Done);
  977. end;*)
  978. type
  979. PVideoModeCollection = ^TVideoModeCollection;
  980. TVideoModeCollection = object(TSortedCollection)
  981. function Compare(Key1, Key2: Pointer): Sw_Integer; virtual;
  982. procedure FreeItem(Item: Pointer); virtual;
  983. end;
  984. function TVideoModeCollection.Compare(Key1, Key2: Pointer): Sw_Integer;
  985. var R: Sw_integer;
  986. K1: PVideoMode absolute Key1;
  987. K2: PVideoMode absolute Key2;
  988. begin
  989. if K1^.Col<K2^.Col then R:=-1 else
  990. if K1^.Col>K2^.Col then R:= 1 else
  991. if K1^.Row<K2^.Row then R:=-1 else
  992. if K1^.Row>K2^.Row then R:= 1 else
  993. if (K1^.Color=false) and (K2^.Color=true ) then R:=-1 else
  994. if (K1^.Color=true ) and (K2^.Color=false) then R:= 1 else
  995. R:=0;
  996. Compare:=R;
  997. end;
  998. procedure TVideoModeCollection.FreeItem(Item: Pointer);
  999. begin
  1000. FreeMem(Item,sizeof(TVideoMode));
  1001. end;
  1002. procedure TIDEApp.Preferences;
  1003. var R,R2: TRect;
  1004. D: PCenterDialog;
  1005. C: PVideoModeCollection;
  1006. VMLB: PVideoModeListBox;
  1007. OldScreenMode,VM: TVideoMode;
  1008. ScreenModeInfo : array[1..3] of longint;
  1009. CurVP,VP: PVideoMode;
  1010. RB1: PPlainRadioButtons;
  1011. CB1,CB2: PPlainCheckBoxes;
  1012. CurIdx: integer;
  1013. i : word;
  1014. begin
  1015. New(C, Init(10,50));
  1016. CurVP:=nil;
  1017. for i:=0 to GetVideoModeCount-1 do
  1018. begin
  1019. GetVideoModeData(i,VM);
  1020. GetMem(VP,sizeof(TVideoMode));
  1021. Move(VM,VP^,sizeof(TVideoMode));
  1022. C^.Insert(VP);
  1023. if (VM.Row=ScreenMode.Row) and (VM.Col=ScreenMode.Col) and
  1024. (VM.Color=ScreenMode.Color) then
  1025. CurVP:=VP;
  1026. end;
  1027. R.Assign(0,0,64,15);
  1028. New(D, Init(R, dialog_preferences));
  1029. with D^ do
  1030. begin
  1031. HelpCtx:=hcpreferences;
  1032. GetExtent(R); R.Grow(-2,-2);
  1033. R.B.X:=R.A.X+(R.B.X-R.A.X) div 2 - 1;
  1034. R.B.Y:=R.A.Y+3;
  1035. R2.Copy(R); R2.Grow(-1,-1);
  1036. New(VMLB, Init(R2, Min(4,C^.Count), C));
  1037. if CurVP=nil then CurIdx:=-1 else
  1038. CurIdx:=C^.IndexOf(CurVP);
  1039. if CurIdx<>-1 then
  1040. VMLB^.FocusItem(CurIdx);
  1041. Insert(New(PGroupView, Init(R, label_preferences_videomode, VMLB)));
  1042. Insert(VMLB);
  1043. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+4;
  1044. R2.Copy(R); R2.Grow(-1,-1);
  1045. New(RB1, Init(R2,
  1046. NewSItem(label_preferences_currentdirectory,
  1047. NewSItem(label_preferences_configdirectory,
  1048. nil))));
  1049. RB1^.Press(DesktopLocation);
  1050. Insert(New(PGroupView, Init(R, label_preferences_desktopfile, RB1)));
  1051. Insert(RB1);
  1052. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  1053. R2.Copy(R); R2.Grow(-1,-1);
  1054. New(CB1, Init(R2,
  1055. NewSItem(label_preferences_editorfiles,
  1056. NewSItem(label_preferences_environment,
  1057. NewSItem(label_preferences_desktop,
  1058. nil)))));
  1059. CB1^.Value:=AutoSaveOptions;
  1060. Insert(New(PGroupView, Init(R, label_preferences_autosave, CB1)));
  1061. Insert(CB1);
  1062. GetExtent(R); R.Grow(-2,-2);
  1063. R.A.X:=R.B.X-(R.B.X-R.A.X) div 2 + 1;
  1064. R.B.Y:=R.A.Y+7;
  1065. R.Move(0,R.B.Y-R.A.Y{+1}); R.B.Y:=R.A.Y+5;
  1066. R2.Copy(R); R2.Grow(-1,-1);
  1067. New(CB2, Init(R2,
  1068. NewSItem(label_preferences_autotracksource,
  1069. NewSItem(label_preferences_closeongotosource,
  1070. NewSItem(label_preferences_changedironopen,
  1071. nil)))));
  1072. CB2^.Value:=MiscOptions;
  1073. Insert(New(PGroupView, Init(R, label_preferences_options, CB2)));
  1074. Insert(CB2);
  1075. end;
  1076. InsertButtons(D);
  1077. if Desktop^.ExecView(D)=cmOK then
  1078. begin
  1079. if (C^.count>0) then
  1080. begin
  1081. with PVideoMode(C^.At(VMLB^.Focused))^ do
  1082. begin
  1083. VM.Col:=Col;
  1084. VM.Row:=Row;
  1085. VM.Color:=Color;
  1086. end;
  1087. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  1088. Begin
  1089. OldScreenMode:=ScreenMode;
  1090. SetScreenVideoMode(VM);
  1091. if (VM.Col<>ScreenMode.Col) or (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color) then
  1092. begin
  1093. SetScreenVideoMode(OldScreenMode);
  1094. ScreenModeInfo[1]:=VM.col;
  1095. ScreenModeInfo[2]:=VM.row;
  1096. ScreenModeInfo[3]:=byte(VM.color);
  1097. ErrorBox(msg_cantsetscreenmode,@ScreenModeInfo);
  1098. end
  1099. else
  1100. if TimedMessageBox (msg_confirmnewscreenmode, nil,
  1101. mfConfirmation or mfOKCancel, 15) = cmCancel then
  1102. begin
  1103. SetScreenVideoMode (OldScreenMode);
  1104. ScreenModeInfo [1] := VM.Col;
  1105. ScreenModeInfo [2] := VM.Row;
  1106. ScreenModeInfo [3] := byte (VM.Color);
  1107. end;
  1108. End;
  1109. end;
  1110. AutoSaveOptions:=CB1^.Value;
  1111. MiscOptions:=CB2^.Value;
  1112. DesktopLocation:=RB1^.Value;
  1113. end;
  1114. Dispose(D, Done);
  1115. Dispose(C, Done);
  1116. end;
  1117. procedure TIDEApp.EditorOptions(Editor: PEditor);
  1118. var D: PCenterDialog;
  1119. R,R2,R3: TRect;
  1120. CB: PCheckBoxes;
  1121. ILTab,ILIdent: PIntegerLine;
  1122. ExtIL,TabExtIL: PEditorInputLine;
  1123. TabSize,IndentSize: Integer;
  1124. EFlags,EFValue: Longint;
  1125. Title: string;
  1126. begin
  1127. if Editor=nil then
  1128. begin
  1129. TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags;
  1130. IndentSize:=DefaultIndentSize;
  1131. Title:=dialog_defaulteditoroptions;
  1132. end
  1133. else
  1134. begin
  1135. TabSize:=Editor^.GetTabSize; EFlags:=Editor^.GetFlags;
  1136. IndentSize:=Editor^.GetIndentSize;
  1137. Title:=dialog_editoroptions;
  1138. end;
  1139. EFValue:=0;
  1140. if (EFlags and efBackupFiles )<>0 then EFValue:=EFValue or (1 shl 0);
  1141. if (EFlags and efInsertMode )<>0 then EFValue:=EFValue or (1 shl 1);
  1142. if (EFlags and efAutoIndent )<>0 then EFValue:=EFValue or (1 shl 2);
  1143. if (EFlags and efUseTabCharacters )<>0 then EFValue:=EFValue or (1 shl 3);
  1144. if (EFlags and efBackSpaceUnindents)<>0 then EFValue:=EFValue or (1 shl 4);
  1145. if (EFlags and efPersistentBlocks )<>0 then EFValue:=EFValue or (1 shl 5);
  1146. if (EFlags and efOverwriteBlocks )<>0 then EFValue:=EFValue or (1 shl 6);
  1147. if (EFlags and efSyntaxHighlight )<>0 then EFValue:=EFValue or (1 shl 7);
  1148. if (EFlags and efShowIndent )<>0 then EFValue:=EFValue or (1 shl 8);
  1149. if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 9);
  1150. if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 10);
  1151. if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 11);
  1152. if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 12);
  1153. if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 13);
  1154. if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 14);
  1155. if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 15);
  1156. if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 16);
  1157. R.Assign(0,0,66,21);
  1158. New(D, Init(R, Title));
  1159. with D^ do
  1160. begin
  1161. HelpCtx:=hcEditor;
  1162. GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+10;
  1163. R2.Copy(R); Inc(R2.A.Y);
  1164. New(CB, Init(R2,
  1165. NewSItem(label_editor_backupfiles,
  1166. NewSItem(label_editor_insertmode,
  1167. NewSItem(label_editor_autoindentmode,
  1168. NewSItem(label_editor_usetabcharacters,
  1169. NewSItem(label_editor_backspaceunindents,
  1170. NewSItem(label_editor_persistentblocks,
  1171. NewSItem(label_editor_overwriteblocks,
  1172. NewSItem(label_editor_syntaxhighlight,
  1173. NewSItem(label_editor_showlineindents,
  1174. NewSItem(label_editor_verticalblocks,
  1175. NewSItem(label_editor_highlightcolumn,
  1176. NewSItem(label_editor_highlightrow,
  1177. NewSItem(label_editor_autoclosingbrackets,
  1178. NewSItem(label_editor_keeptrailingspaces,
  1179. NewSItem(label_editor_codecomplete,
  1180. NewSItem(label_editor_folds,
  1181. NewSItem(label_editor_blockinsertcursor,
  1182. nil)))))))))))))))))));
  1183. CB^.Value:=EFValue;
  1184. Insert(CB);
  1185. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1186. Insert(New(PLabel, Init(R2, label_editor_editoroptions, CB)));
  1187. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+1;
  1188. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y;
  1189. R3.Copy(R); Inc(R3.A.X,10); R3.B.X:=R3.A.X+5;
  1190. New(ILTab, Init(R3, 0,100));
  1191. ILTab^.Data^:=IntToStr(TabSize);
  1192. Insert(ILTab);
  1193. R3.Copy(R); R3.B.X:=R3.A.X+10;
  1194. Insert(New(PLabel, Init(R3, label_editor_tabsize, ILTab)));
  1195. R3.Copy(R); Inc(R3.A.X,40); R3.B.X:=R3.A.X+5;
  1196. New(ILIdent, Init(R3, 0,100));
  1197. ILIdent^.Data^:=IntToStr(IndentSize);
  1198. Insert(ILIdent);
  1199. R3.Copy(R); Inc(R3.A.X,28); R3.B.X:=R3.A.X+12;
  1200. Insert(New(PLabel, Init(R3, label_editor_IndentSize, ILIdent)));
  1201. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  1202. R2.Copy(R); Inc(R2.A.Y);
  1203. New(ExtIL, Init(R2, 128));
  1204. ExtIL^.SetData(HighlightExts);
  1205. Insert(ExtIL);
  1206. R2.Move(0,-1);
  1207. Insert(New(PLabel, Init(R2, label_editor_highlightextensions, ExtIL)));
  1208. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  1209. R2.Copy(R); Inc(R2.A.Y);
  1210. New(TabExtIL, Init(R2, 128));
  1211. TabExtIL^.SetData(TabsPattern);
  1212. Insert(TabExtIL);
  1213. R2.Move(0,-1);
  1214. Insert(New(PLabel, Init(R2, label_editor_filepatternsneedingtabs, TabExtIL)));
  1215. end;
  1216. InsertButtons(D);
  1217. CB^.Select;
  1218. if Desktop^.ExecView(D)=cmOK then
  1219. begin
  1220. EFlags:=0;
  1221. if (CB^.Value and (1 shl 0))<>0 then EFlags:=EFlags or efBackupFiles;
  1222. if (CB^.Value and (1 shl 1))<>0 then EFlags:=EFlags or efInsertMode;
  1223. if (CB^.Value and (1 shl 2))<>0 then EFlags:=EFlags or efAutoIndent;
  1224. if (CB^.Value and (1 shl 3))<>0 then EFlags:=EFlags or efUseTabCharacters;
  1225. if (CB^.Value and (1 shl 4))<>0 then EFlags:=EFlags or efBackSpaceUnindents;
  1226. if (CB^.Value and (1 shl 5))<>0 then EFlags:=EFlags or efPersistentBlocks;
  1227. if (CB^.Value and (1 shl 6))<>0 then EFlags:=EFlags or efOverwriteBlocks;
  1228. if (CB^.Value and (1 shl 7))<>0 then EFlags:=EFlags or efSyntaxHighlight;
  1229. if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efShowIndent;
  1230. if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efVerticalBlocks;
  1231. if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightColumn;
  1232. if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efHighlightRow;
  1233. if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efAutoBrackets;
  1234. if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efKeepTrailingSpaces;
  1235. if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efCodeComplete;
  1236. if (CB^.Value and (1 shl 15))<>0 then EFlags:=EFlags or efFolds;
  1237. if (CB^.Value and (1 shl 16))<>0 then EFlags:=EFlags or efBlockInsCursor;
  1238. TabSize:=StrToInt(ILTab^.Data^);
  1239. IndentSize:=StrToInt(ILIdent^.Data^);
  1240. if Editor=nil then
  1241. begin
  1242. DefaultTabSize:=TabSize;
  1243. DefaultIndentSize:=IndentSize;
  1244. DefaultCodeEditorFlags:=EFlags;
  1245. end
  1246. else
  1247. begin
  1248. Editor^.SetIndentSize(IndentSize);
  1249. Editor^.SetTabSize(TabSize);
  1250. Editor^.SetFlags(EFlags);
  1251. end;
  1252. ExtIL^.GetData(HighlightExts);
  1253. TabExtIL^.GetData(TabsPattern);
  1254. end;
  1255. Dispose(D, Done);
  1256. end;
  1257. procedure TIDEApp.CodeComplete;
  1258. var
  1259. D : PCodeCompleteDialog;
  1260. begin
  1261. D:=New(PCodeCompleteDialog, Init);
  1262. ExecuteDialog(D,nil);
  1263. end;
  1264. procedure TIDEApp.CodeTemplates;
  1265. begin
  1266. ExecuteDialog(New(PCodeTemplatesDialog, Init(false,'')),nil);
  1267. end;
  1268. procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
  1269. var D: PCenterDialog;
  1270. R,R2,R3 : TRect;
  1271. TitleS: string;
  1272. CB1,CB2: PCheckBoxes;
  1273. RB1,RB2: PRadioButtons;
  1274. SymbolsFlags,DisplayFlags,BrowserFlags : Longint;
  1275. BrowserSub,BrowserPane : Longint;
  1276. DialogWidth : sw_integer;
  1277. SymbolsHight: sw_integer;
  1278. DisplayHight: sw_integer;
  1279. begin
  1280. if Browser=nil then
  1281. begin { Default browser options }
  1282. TitleS:=dialog_browseroptions;
  1283. SymbolsFlags := DefaultSymbolFlags;
  1284. DisplayFlags := DefaultDispayFlags;
  1285. BrowserSub:=DefaultBrowserSub;
  1286. BrowserPane:=DefaultBrowserPane;
  1287. DialogWidth:=56;
  1288. SymbolsHight:=4;
  1289. DisplayHight:=1;
  1290. end else
  1291. begin { Local browser options }
  1292. TitleS:=dialog_localbrowseroptions;
  1293. {BrowserFlags := DefaultBrowserFlags;}
  1294. BrowserFlags := Browser^.GetFlags;
  1295. DisplayFlags := BrowserFlags shr 30;
  1296. SymbolsFlags := BrowserFlags and $7f;
  1297. DialogWidth:=56-20;
  1298. SymbolsHight:=7;
  1299. DisplayHight:=2;
  1300. RB1:=nil; {it is not suppoused to be valid}
  1301. end;
  1302. R.Assign(0,0,DialogWidth,16);
  1303. New(D, Init(R, TitleS));
  1304. with D^ do
  1305. begin
  1306. HelpCtx:=hcBrowser;
  1307. GetExtent(R); R.Grow(-2,-2);
  1308. R.B.Y:=R.A.Y+1+SymbolsHight; R2.Copy(R); Inc(R2.A.Y);
  1309. New(CB1, Init(R2,
  1310. NewSItem(RExpand(label_browser_units,21+2),
  1311. NewSItem(label_browser_labels,
  1312. NewSItem(label_browser_constants,
  1313. NewSItem(label_browser_types,
  1314. NewSItem(label_browser_variables,
  1315. NewSItem(label_browser_procedures,
  1316. NewSItem(label_browser_inherited,
  1317. nil))))))))
  1318. );
  1319. Insert(CB1);
  1320. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1321. Insert(New(PLabel, Init(R2, label_browser_symbols, CB1)));
  1322. CB1^.Value := SymbolsFlags;
  1323. if Browser=nil then
  1324. begin
  1325. R.Move(0,R.B.Y-R.A.Y+1);
  1326. R.B.Y:=R.A.Y+1+2; R2.Copy(R);
  1327. R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
  1328. New(RB1, Init(R3,
  1329. NewSItem(label_browser_newbrowser,
  1330. NewSItem(label_browser_currentbrowser,
  1331. nil)))
  1332. );
  1333. Insert(RB1);
  1334. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1335. Insert(New(PLabel, Init(R3, label_browser_subbrowsing, RB1)));
  1336. R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
  1337. New(RB2, Init(R3,
  1338. NewSItem(label_browser_scope,
  1339. NewSItem(label_browser_reference,
  1340. nil)))
  1341. );
  1342. Insert(RB2);
  1343. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1344. Insert(New(PLabel, Init(R3, label_browser_preferredpane, RB2)));
  1345. RB1^.Value:=BrowserSub;
  1346. RB2^.Value:=BrowserPane;
  1347. end;
  1348. R.Move(0,R.B.Y-R.A.Y+1);
  1349. R.B.Y:=R.A.Y+1+DisplayHight; R2.Copy(R); Inc(R2.A.Y);
  1350. New(CB2, Init(R2,
  1351. NewSItem(RExpand(label_browser_qualifiedsymbols,21+2),
  1352. NewSItem(label_browser_sortsymbols,
  1353. nil)))
  1354. );
  1355. Insert(CB2);
  1356. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1357. Insert(New(PLabel, Init(R2, label_browser_display, CB2)));
  1358. CB2^.Value:=DisplayFlags;
  1359. end;
  1360. InsertButtons(D);
  1361. CB1^.Select;
  1362. if Desktop^.ExecView(D)=cmOK then
  1363. begin
  1364. SymbolsFlags:=CB1^.Value;
  1365. DisplayFlags:=CB2^.Value;
  1366. if Browser=nil then
  1367. begin
  1368. {DefaultBrowserFlags:=BrowserFlags;}
  1369. DefaultSymbolFlags:=SymbolsFlags;
  1370. DefaultDispayFlags:=DisplayFlags;
  1371. DefaultBrowserSub:=RB1^.Value;
  1372. DefaultBrowserPane:=RB2^.Value;
  1373. end else
  1374. begin
  1375. BrowserFlags:=DisplayFlags shl 30 or SymbolsFlags;
  1376. Browser^.SetFlags(BrowserFlags);
  1377. end;
  1378. end;
  1379. Dispose(D, Done);
  1380. end;
  1381. procedure TIDEApp.Startup;
  1382. begin
  1383. NotImplemented;
  1384. end;
  1385. procedure TIDEApp.DesktopOptions;
  1386. var R: TRect;
  1387. D: PCenterDialog;
  1388. CB: PCheckBoxes;
  1389. begin
  1390. R.Assign(0,0,40,13);
  1391. New(D, Init(R, dialog_desktoppreferences));
  1392. with D^ do
  1393. begin
  1394. HelpCtx:=hcDesktopOptions;
  1395. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.Y:=R.A.Y+9;
  1396. New(CB, Init(R,
  1397. NewSItem(label_desktop_historylists,
  1398. NewSItem(label_desktop_clipboard,
  1399. NewSItem(label_desktop_watches,
  1400. NewSItem(label_desktop_breakpoints,
  1401. NewSItem(label_desktop_openwindow,
  1402. NewSItem(label_desktop_symbolinfo,
  1403. NewSItem(label_desktop_codecompletewords,
  1404. NewSItem(label_desktop_codetemplates,
  1405. NewSItem(label_desktop_returntolastdir,
  1406. nil)))))))))));
  1407. CB^.Value:=DesktopFileFlags;
  1408. Insert(CB);
  1409. R.Move(0,-1); R.B.Y:=R.A.Y+1;
  1410. Insert(New(PLabel, Init(R, label_desktop_preservedacrosssessions, CB)));
  1411. end;
  1412. InsertButtons(D);
  1413. CB^.Select;
  1414. if Desktop^.ExecView(D)=cmOK then
  1415. begin
  1416. DesktopFileFlags:=CB^.Value;
  1417. end;
  1418. Dispose(D, Done);
  1419. end;
  1420. procedure TIDEApp.Mouse;
  1421. var R,R2: TRect;
  1422. D: PCenterDialog;
  1423. SB: PScrollBar;
  1424. CB: PCheckBoxes;
  1425. RB1,RB2,RBKB: PRadioButtons;
  1426. begin
  1427. R.Assign(0,0,62,19);
  1428. New(D, Init(R, dialog_mouseoptions));
  1429. with D^ do
  1430. begin
  1431. HelpCtx:=hcMouse;
  1432. GetExtent(R); R.Grow(-3,-2); inc(R.A.Y); R.B.Y:=R.A.Y+2;
  1433. New(RBkb, Init(R,
  1434. NewSItem('~C~UA-91 convention (Shift+Del,Ctrl+Ins,Shift+Ins)',
  1435. NewSItem('~M~icrosoft convention (Ctrl+X,Ctrl+C,Ctrl+V)',
  1436. nil))));
  1437. RBkb^.Press(integer(EditKeys));
  1438. Insert(RBkb);
  1439. R.move(0,-1); R.B.Y:=R.A.Y+1;
  1440. Insert(New(PLabel, Init(R, '~K~eys for cut, copy and paste:', RBkb)));
  1441. R.Move(0,(R.B.Y-R.A.Y)+3); R.B.Y:=R.A.Y+3;
  1442. R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1443. New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
  1444. SB^.SetParams(DoubleDelay,1,20,1,1);
  1445. Insert(SB);
  1446. R2.Move(0,-1);
  1447. Insert(New(PStaticText, Init(R2, label_mouse_speedbar)));
  1448. R2.Move(-1,-1);
  1449. Insert(New(PLabel, Init(R2, label_mouse_doubleclickspeed, SB)));
  1450. R2.Copy(R); Inc(R2.A.Y,2); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1451. New(CB, Init(R2, NewSItem(label_mouse_reversebuttons, nil) ));
  1452. if MouseReverse then CB^.Press(0);
  1453. Insert(CB);
  1454. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+8;
  1455. R2.Copy(R); Inc(R2.A.Y); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1456. New(RB1, Init(R2,
  1457. NewSItem(label_mouse_act_nothing,
  1458. NewSItem(label_mouse_act_topicsearch,
  1459. NewSItem(label_mouse_act_gotocursor,
  1460. NewSItem(label_mouse_act_breakpoint,
  1461. NewSItem(label_mouse_act_evaluate,
  1462. NewSItem(label_mouse_act_addwatch,
  1463. NewSItem(label_mouse_act_browsesymbol,
  1464. nil)))))))));
  1465. RB1^.Press(CtrlMouseAction);
  1466. Insert(RB1);
  1467. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1468. Insert(New(PLabel, Init(R2, label_mouse_crtlrightmousebuttonaction, RB1)));
  1469. R2.Copy(R); Inc(R2.A.Y); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1470. New(RB2, Init(R2,
  1471. NewSItem(label_mouse_act_nothing,
  1472. NewSItem(label_mouse_act_topicsearch,
  1473. NewSItem(label_mouse_act_gotocursor,
  1474. NewSItem(label_mouse_act_breakpoint,
  1475. NewSItem(label_mouse_act_evaluate,
  1476. NewSItem(label_mouse_act_addwatch,
  1477. NewSItem(label_mouse_act_browsesymbol,
  1478. nil)))))))));
  1479. RB2^.Press(AltMouseAction);
  1480. Insert(RB2);
  1481. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1482. Insert(New(PLabel, Init(R2, label_mouse_altrightmousebuttonaction, RB2)));
  1483. end;
  1484. InsertButtons(D);
  1485. RBkb^.Select;
  1486. if Desktop^.ExecView(D)=cmOK then
  1487. begin
  1488. MouseReverse:=CB^.Mark(0);
  1489. DoubleDelay:=SB^.Value;
  1490. CtrlMouseAction:=RB1^.Value;
  1491. AltMouseAction:=RB2^.Value;
  1492. if Tedit_key_modes(RBkb^.value)<>EditKeys then
  1493. begin
  1494. EditKeys:=Tedit_key_modes(RBkb^.value);
  1495. reload_menubar;
  1496. end;
  1497. end;
  1498. Dispose(D, Done);
  1499. end;
  1500. procedure TIDEApp.Colors;
  1501. {$Ifdef COLORSEL}
  1502. var D: PColorDialog;
  1503. begin
  1504. New(D, Init(AppPalette,
  1505. ColorGroup(label_colors_grp_browser,
  1506. ColorItem(label_colors_framepassive , 215,
  1507. ColorItem(label_colors_frameactive , 216,
  1508. ColorItem(label_colors_frameicon , 217,
  1509. ColorItem(label_colors_scrollbarpage , 218,
  1510. ColorItem(label_colors_scrollbaricons , 219,
  1511. ColorItem(label_colors_normaltext , 220,
  1512. ColorItem(label_colors_selectedtext , 221,
  1513. ColorItem(label_colors_activeitem , 222,
  1514. ColorItem(label_colors_inactiveitem , 223,
  1515. ColorItem(label_colors_focuseditem , 224,
  1516. ColorItem(label_colors_selecteditem , 225,
  1517. ColorItem(label_colors_divider , 226,
  1518. nil)))))))))))),
  1519. ColorGroup(label_colors_grp_clock,
  1520. ColorItem(label_colors_clockview , 227,
  1521. nil),
  1522. ColorGroup(label_colors_grp_desktop, DesktopColorItems(nil),
  1523. ColorGroup(label_colors_grp_dialogs, DialogColorItems(dpGrayDialog,nil),
  1524. ColorGroup(label_colors_grp_editor,
  1525. ColorItem(label_colors_framepassive , 167,
  1526. ColorItem(label_colors_frameactive , 168,
  1527. ColorItem(label_colors_frameicon , 169,
  1528. ColorItem(label_colors_scrollbarpage , 170,
  1529. ColorItem(label_colors_scrollbaricons , 171,
  1530. ColorItem(label_colors_normaltext , 199,
  1531. ColorItem(label_colors_selectedtext , 208,
  1532. ColorItem(label_colors_highlighcolumn , 209,
  1533. ColorItem(label_colors_highlightrow , 210,
  1534. ColorItem(label_colors_errormessages , 214,
  1535. nil)))))))))),
  1536. ColorGroup(label_colors_grp_help,
  1537. ColorItem(label_colors_framepassive , 128,
  1538. ColorItem(label_colors_frameactive , 129,
  1539. ColorItem(label_colors_frameicon , 130,
  1540. ColorItem(label_colors_scrollbarpage , 131,
  1541. ColorItem(label_colors_scrollbaricons , 132,
  1542. ColorItem(label_colors_helptext , 160,
  1543. ColorItem(label_colors_helplinks , 161,
  1544. ColorItem(label_colors_selectedlink , 162,
  1545. ColorItem(label_colors_selectedtext , 163,
  1546. ColorItem(label_colors_html_heading1 , 229,
  1547. ColorItem(label_colors_html_heading2 , 230,
  1548. ColorItem(label_colors_html_heading3 , 231,
  1549. ColorItem(label_colors_html_heading4 , 232,
  1550. ColorItem(label_colors_html_heading5 , 233,
  1551. ColorItem(label_colors_html_heading6 , 234,
  1552. nil))))))))))))))),
  1553. ColorGroup(label_colors_grp_menus, MenuColorItems(nil),
  1554. ColorGroup(label_colors_grp_syntax,
  1555. ColorItem(label_colors_whitespace , 200,
  1556. ColorItem(label_colors_comments , 201,
  1557. ColorItem(label_colors_reservedwords , 202,
  1558. ColorItem(label_colors_identifiers , 203,
  1559. ColorItem(label_colors_strings , 204,
  1560. ColorItem(label_colors_numbers , 205,
  1561. ColorItem(label_colors_hexnumbers , 212,
  1562. ColorItem(label_colors_assembler , 206,
  1563. ColorItem(label_colors_symbols , 207,
  1564. ColorItem(label_colors_directives , 211,
  1565. ColorItem(label_colors_tabs , 213,
  1566. nil))))))))))),
  1567. nil))))))))));
  1568. D^.HelpCtx:=hcColors;
  1569. if ExecuteDialog(D, @AppPalette)=cmOK then
  1570. begin
  1571. {DoneMemory;}
  1572. Message(Application,evBroadcast,cmUpdate,nil);
  1573. ReDraw;
  1574. UpdateScreen(true);
  1575. end;
  1576. end;
  1577. {$else COLORSEL}
  1578. begin
  1579. end;
  1580. {$endif COLORSEL}
  1581. procedure TIDEApp.OpenINI;
  1582. var D : PFPFileDialog;
  1583. FileName: string;
  1584. begin
  1585. New(D, Init('*'+ExtOf(INIFilePath),dialog_openoptions,dialog_ini_filename,fdOpenButton,hidOpenIniFile));
  1586. D^.HelpCtx:=hcOpenIni;
  1587. if Desktop^.ExecView(D)<>cmCancel then
  1588. begin
  1589. D^.GetFileName(FileName);
  1590. if ExistsFile(FileName)=false then ErrorBox(msg_cantopenconfigfile,nil) else
  1591. begin
  1592. IniFilePath:=FileName;
  1593. ReadINIFile;
  1594. Message(Application,evBroadcast,cmUpdate,nil);
  1595. end;
  1596. end;
  1597. Dispose(D, Done);
  1598. end;
  1599. procedure TIDEApp.SaveINI;
  1600. begin
  1601. if WriteINIFile(false)=false then
  1602. ErrorBox(msg_errorsavingconfigfile,nil);
  1603. end;
  1604. procedure TIDEApp.SaveAsINI;
  1605. var D : PFPFileDialog;
  1606. FileName: string;
  1607. CanWrite: boolean;
  1608. begin
  1609. New(D, Init('*'+ExtOf(INIFilePath),dialog_saveoptions,dialog_ini_filename,fdOkButton,hidSaveIniFile));
  1610. D^.HelpCtx:=hcSaveAsINI;
  1611. if Desktop^.ExecView(D)<>cmCancel then
  1612. begin
  1613. D^.GetFileName(FileName);
  1614. CanWrite:=(ExistsFile(FileName)=false);
  1615. if CanWrite=false then
  1616. CanWrite:=ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,SmartPath(FileName)),nil,false)=cmYes;
  1617. if CanWrite then
  1618. begin
  1619. IniFilePath:=FileName;
  1620. if WriteINIFile(true)=false then
  1621. ErrorBox(msg_errorsavingconfigfile,nil);
  1622. Message(Application,evBroadcast,cmUpdate,nil);
  1623. end;
  1624. end;
  1625. Dispose(D, Done);
  1626. end;