fpmopts.inc 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388
  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. End;
  842. end;
  843. AutoSaveOptions:=CB1^.Value;
  844. MiscOptions:=CB2^.Value;
  845. DesktopLocation:=RB1^.Value;
  846. end;
  847. Dispose(D, Done);
  848. Dispose(C, Done);
  849. end;
  850. procedure TIDEApp.EditorOptions(Editor: PEditor);
  851. var D: PCenterDialog;
  852. R,R2,R3: TRect;
  853. CB: PCheckBoxes;
  854. ILTab,ILIdent: PIntegerLine;
  855. ExtIL,TabExtIL: PEditorInputLine;
  856. TabSize,IndentSize: Integer;
  857. EFlags,EFValue: Longint;
  858. Title: string;
  859. begin
  860. if Editor=nil then
  861. begin
  862. TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags;
  863. IndentSize:=DefaultIndentSize;
  864. Title:=dialog_defaulteditoroptions;
  865. end
  866. else
  867. begin
  868. TabSize:=Editor^.GetTabSize; EFlags:=Editor^.GetFlags;
  869. IndentSize:=Editor^.GetIndentSize;
  870. Title:=dialog_editoroptions;
  871. end;
  872. EFValue:=0;
  873. if (EFlags and efBackupFiles )<>0 then EFValue:=EFValue or (1 shl 0);
  874. if (EFlags and efInsertMode )<>0 then EFValue:=EFValue or (1 shl 1);
  875. if (EFlags and efAutoIndent )<>0 then EFValue:=EFValue or (1 shl 2);
  876. if (EFlags and efUseTabCharacters )<>0 then EFValue:=EFValue or (1 shl 3);
  877. if (EFlags and efBackSpaceUnindents)<>0 then EFValue:=EFValue or (1 shl 4);
  878. if (EFlags and efPersistentBlocks )<>0 then EFValue:=EFValue or (1 shl 5);
  879. if (EFlags and efSyntaxHighlight )<>0 then EFValue:=EFValue or (1 shl 6);
  880. if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 7);
  881. if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 8);
  882. if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 9);
  883. if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 10);
  884. if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 11);
  885. if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 12);
  886. if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 13);
  887. if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 14);
  888. R.Assign(0,0,66,20);
  889. New(D, Init(R, Title));
  890. with D^ do
  891. begin
  892. HelpCtx:=hcEditor;
  893. GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+9;
  894. R2.Copy(R); Inc(R2.A.Y);
  895. New(CB, Init(R2,
  896. NewSItem(label_editor_backupfiles,
  897. NewSItem(label_editor_insertmode,
  898. NewSItem(label_editor_autoindentmode,
  899. NewSItem(label_editor_usetabcharacters,
  900. NewSItem(label_editor_backspaceunindents,
  901. NewSItem(label_editor_persistentblocks,
  902. NewSItem(label_editor_syntaxhighlight,
  903. NewSItem(label_editor_blockinsertcursor,
  904. NewSItem(label_editor_verticalblocks,
  905. NewSItem(label_editor_highlightcolumn,
  906. NewSItem(label_editor_highlightrow,
  907. NewSItem(label_editor_autoclosingbrackets,
  908. NewSItem(label_editor_keeptrailingspaces,
  909. NewSItem(label_editor_codecomplete,
  910. NewSItem(label_editor_folds,
  911. nil)))))))))))))))));
  912. CB^.Value:=EFValue;
  913. Insert(CB);
  914. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  915. Insert(New(PLabel, Init(R2, label_editor_editoroptions, CB)));
  916. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+1;
  917. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y;
  918. R3.Copy(R); Inc(R3.A.X,10); R3.B.X:=R3.A.X+5;
  919. New(ILTab, Init(R3, 0,100));
  920. ILTab^.Data^:=IntToStr(TabSize);
  921. Insert(ILTab);
  922. R3.Copy(R); R3.B.X:=R3.A.X+10;
  923. Insert(New(PLabel, Init(R3, label_editor_tabsize, ILTab)));
  924. R3.Copy(R); Inc(R3.A.X,40); R3.B.X:=R3.A.X+5;
  925. New(ILIdent, Init(R3, 0,100));
  926. ILIdent^.Data^:=IntToStr(IndentSize);
  927. Insert(ILIdent);
  928. R3.Copy(R); Inc(R3.A.X,28); R3.B.X:=R3.A.X+12;
  929. Insert(New(PLabel, Init(R3, label_editor_IndentSize, ILIdent)));
  930. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  931. R2.Copy(R); Inc(R2.A.Y);
  932. New(ExtIL, Init(R2, 128));
  933. ExtIL^.SetData(HighlightExts);
  934. Insert(ExtIL);
  935. R2.Move(0,-1);
  936. Insert(New(PLabel, Init(R2, label_editor_highlightextensions, ExtIL)));
  937. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
  938. R2.Copy(R); Inc(R2.A.Y);
  939. New(TabExtIL, Init(R2, 128));
  940. TabExtIL^.SetData(TabsPattern);
  941. Insert(TabExtIL);
  942. R2.Move(0,-1);
  943. Insert(New(PLabel, Init(R2, label_editor_filepatternsneedingtabs, TabExtIL)));
  944. end;
  945. InsertButtons(D);
  946. CB^.Select;
  947. if Desktop^.ExecView(D)=cmOK then
  948. begin
  949. EFlags:=0;
  950. if (CB^.Value and (1 shl 0))<>0 then EFlags:=EFlags or efBackupFiles;
  951. if (CB^.Value and (1 shl 1))<>0 then EFlags:=EFlags or efInsertMode;
  952. if (CB^.Value and (1 shl 2))<>0 then EFlags:=EFlags or efAutoIndent;
  953. if (CB^.Value and (1 shl 3))<>0 then EFlags:=EFlags or efUseTabCharacters;
  954. if (CB^.Value and (1 shl 4))<>0 then EFlags:=EFlags or efBackSpaceUnindents;
  955. if (CB^.Value and (1 shl 5))<>0 then EFlags:=EFlags or efPersistentBlocks;
  956. if (CB^.Value and (1 shl 6))<>0 then EFlags:=EFlags or efSyntaxHighlight;
  957. if (CB^.Value and (1 shl 7))<>0 then EFlags:=EFlags or efBlockInsCursor;
  958. if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efVerticalBlocks;
  959. if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efHighlightColumn;
  960. if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightRow;
  961. if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efAutoBrackets;
  962. if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efKeepTrailingSpaces;
  963. if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efCodeComplete;
  964. if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efFolds;
  965. TabSize:=StrToInt(ILTab^.Data^);
  966. IndentSize:=StrToInt(ILIdent^.Data^);
  967. if Editor=nil then
  968. begin
  969. DefaultTabSize:=TabSize;
  970. DefaultIndentSize:=IndentSize;
  971. DefaultCodeEditorFlags:=EFlags;
  972. end
  973. else
  974. begin
  975. Editor^.SetIndentSize(IndentSize);
  976. Editor^.SetTabSize(TabSize);
  977. Editor^.SetFlags(EFlags);
  978. end;
  979. ExtIL^.GetData(HighlightExts);
  980. TabExtIL^.GetData(TabsPattern);
  981. end;
  982. Dispose(D, Done);
  983. end;
  984. procedure TIDEApp.CodeComplete;
  985. var
  986. D : PCodeCompleteDialog;
  987. begin
  988. D:=New(PCodeCompleteDialog, Init);
  989. ExecuteDialog(D,nil);
  990. end;
  991. procedure TIDEApp.CodeTemplates;
  992. begin
  993. ExecuteDialog(New(PCodeTemplatesDialog, Init(false,'')),nil);
  994. end;
  995. procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
  996. var D: PCenterDialog;
  997. R,R2,R3 : TRect;
  998. TitleS: string;
  999. CB1,CB2: PCheckBoxes;
  1000. RB1,RB2: PRadioButtons;
  1001. begin
  1002. if Browser=nil then
  1003. TitleS:=dialog_browseroptions
  1004. else
  1005. TitleS:=dialog_localbrowseroptions;
  1006. R.Assign(0,0,56,15);
  1007. New(D, Init(R, TitleS));
  1008. with D^ do
  1009. begin
  1010. HelpCtx:=hcBrowser;
  1011. GetExtent(R); R.Grow(-2,-2);
  1012. R.B.Y:=R.A.Y+1+3; R2.Copy(R); Inc(R2.A.Y);
  1013. New(CB1, Init(R2,
  1014. NewSItem(RExpand(label_browser_labels,21+2),
  1015. NewSItem(label_browser_constants,
  1016. NewSItem(label_browser_types,
  1017. NewSItem(label_browser_variables,
  1018. NewSItem(label_browser_procedures,
  1019. NewSItem(label_browser_inherited,
  1020. nil)))))))
  1021. );
  1022. Insert(CB1);
  1023. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1024. Insert(New(PLabel, Init(R2, label_browser_symbols, CB1)));
  1025. R.Move(0,R.B.Y-R.A.Y+1);
  1026. R.B.Y:=R.A.Y+1+2; R2.Copy(R);
  1027. R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
  1028. New(RB1, Init(R3,
  1029. NewSItem(label_browser_newbrowser,
  1030. NewSItem(label_browser_currentbrowser,
  1031. nil)))
  1032. );
  1033. Insert(RB1);
  1034. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1035. Insert(New(PLabel, Init(R3, label_browser_subbrowsing, RB1)));
  1036. R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
  1037. New(RB2, Init(R3,
  1038. NewSItem(label_browser_scope,
  1039. NewSItem(label_browser_reference,
  1040. nil)))
  1041. );
  1042. Insert(RB2);
  1043. R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
  1044. Insert(New(PLabel, Init(R3, label_browser_preferredpane, RB2)));
  1045. R.Move(0,R.B.Y-R.A.Y+1);
  1046. R.B.Y:=R.A.Y+1+1; R2.Copy(R); Inc(R2.A.Y);
  1047. New(CB2, Init(R2,
  1048. NewSItem(RExpand(label_browser_qualifiedsymbols,21+2),
  1049. NewSItem(label_browser_sortsymbols,
  1050. nil)))
  1051. );
  1052. Insert(CB2);
  1053. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1054. Insert(New(PLabel, Init(R2, label_browser_display, CB2)));
  1055. end;
  1056. InsertButtons(D);
  1057. CB1^.Select;
  1058. if Desktop^.ExecView(D)=cmOK then
  1059. begin
  1060. end;
  1061. Dispose(D, Done);
  1062. end;
  1063. procedure TIDEApp.Startup;
  1064. begin
  1065. NotImplemented;
  1066. end;
  1067. procedure TIDEApp.DesktopOptions;
  1068. var R: TRect;
  1069. D: PCenterDialog;
  1070. CB: PCheckBoxes;
  1071. begin
  1072. R.Assign(0,0,40,12);
  1073. New(D, Init(R, dialog_desktoppreferences));
  1074. with D^ do
  1075. begin
  1076. HelpCtx:=hcDesktopOptions;
  1077. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.Y:=R.A.Y+8;
  1078. New(CB, Init(R,
  1079. NewSItem(label_desktop_historylists,
  1080. NewSItem(label_desktop_clipboard,
  1081. NewSItem(label_desktop_watches,
  1082. NewSItem(label_desktop_breakpoints,
  1083. NewSItem(label_desktop_openwindow,
  1084. NewSItem(label_desktop_symbolinfo,
  1085. NewSItem(label_desktop_codecompletewords,
  1086. NewSItem(label_desktop_codetemplates,
  1087. nil))))))))));
  1088. CB^.Value:=DesktopFileFlags;
  1089. Insert(CB);
  1090. R.Move(0,-1); R.B.Y:=R.A.Y+1;
  1091. Insert(New(PLabel, Init(R, label_desktop_preservedacrosssessions, CB)));
  1092. end;
  1093. InsertButtons(D);
  1094. CB^.Select;
  1095. if Desktop^.ExecView(D)=cmOK then
  1096. begin
  1097. DesktopFileFlags:=CB^.Value;
  1098. end;
  1099. Dispose(D, Done);
  1100. end;
  1101. procedure TIDEApp.Mouse;
  1102. var R,R2: TRect;
  1103. D: PCenterDialog;
  1104. SB: PScrollBar;
  1105. CB: PCheckBoxes;
  1106. RB1,RB2: PRadioButtons;
  1107. begin
  1108. R.Assign(0,0,62,15);
  1109. New(D, Init(R, dialog_mouseoptions));
  1110. with D^ do
  1111. begin
  1112. HelpCtx:=hcMouse;
  1113. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+3;
  1114. R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1115. New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
  1116. SB^.SetParams(DoubleDelay,1,20,1,1);
  1117. Insert(SB);
  1118. R2.Move(0,-1);
  1119. Insert(New(PStaticText, Init(R2, label_mouse_speedbar)));
  1120. R2.Move(-1,-1);
  1121. Insert(New(PLabel, Init(R2, label_mouse_doubleclickspeed, SB)));
  1122. R2.Copy(R); Inc(R2.A.Y,2); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1123. New(CB, Init(R2, NewSItem(label_mouse_reversebuttons, nil) ));
  1124. if MouseReverse then CB^.Press(0);
  1125. Insert(CB);
  1126. R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+8;
  1127. R2.Copy(R); Inc(R2.A.Y); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
  1128. New(RB1, Init(R2,
  1129. NewSItem(label_mouse_act_nothing,
  1130. NewSItem(label_mouse_act_topicsearch,
  1131. NewSItem(label_mouse_act_gotocursor,
  1132. NewSItem(label_mouse_act_breakpoint,
  1133. NewSItem(label_mouse_act_evaluate,
  1134. NewSItem(label_mouse_act_addwatch,
  1135. NewSItem(label_mouse_act_browsesymbol,
  1136. nil)))))))));
  1137. RB1^.Press(CtrlMouseAction);
  1138. Insert(RB1);
  1139. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1140. Insert(New(PLabel, Init(R2, label_mouse_crtlrightmousebuttonaction, RB1)));
  1141. R2.Copy(R); Inc(R2.A.Y); R2.A.X:=R2.B.X-(R2.B.X-R2.A.X) div 2 +1;
  1142. New(RB2, Init(R2,
  1143. NewSItem(label_mouse_act_nothing,
  1144. NewSItem(label_mouse_act_topicsearch,
  1145. NewSItem(label_mouse_act_gotocursor,
  1146. NewSItem(label_mouse_act_breakpoint,
  1147. NewSItem(label_mouse_act_evaluate,
  1148. NewSItem(label_mouse_act_addwatch,
  1149. NewSItem(label_mouse_act_browsesymbol,
  1150. nil)))))))));
  1151. RB2^.Press(AltMouseAction);
  1152. Insert(RB2);
  1153. R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
  1154. Insert(New(PLabel, Init(R2, label_mouse_altrightmousebuttonaction, RB2)));
  1155. end;
  1156. InsertButtons(D);
  1157. RB1^.Select;
  1158. if Desktop^.ExecView(D)=cmOK then
  1159. begin
  1160. MouseReverse:=CB^.Mark(0);
  1161. DoubleDelay:=SB^.Value;
  1162. CtrlMouseAction:=RB1^.Value;
  1163. AltMouseAction:=RB2^.Value;
  1164. end;
  1165. Dispose(D, Done);
  1166. end;
  1167. procedure TIDEApp.Colors;
  1168. {$Ifdef FVISION}
  1169. begin
  1170. end;
  1171. {$else FVISION}
  1172. var D: PColorDialog;
  1173. begin
  1174. New(D, Init(AppPalette,
  1175. ColorGroup(label_colors_grp_browser,
  1176. ColorItem(label_colors_framepassive , 215,
  1177. ColorItem(label_colors_frameactive , 216,
  1178. ColorItem(label_colors_frameicon , 217,
  1179. ColorItem(label_colors_scrollbarpage , 218,
  1180. ColorItem(label_colors_scrollbaricons , 219,
  1181. ColorItem(label_colors_normaltext , 220,
  1182. ColorItem(label_colors_selectedtext , 221,
  1183. ColorItem(label_colors_activeitem , 222,
  1184. ColorItem(label_colors_inactiveitem , 223,
  1185. ColorItem(label_colors_focuseditem , 224,
  1186. ColorItem(label_colors_selecteditem , 225,
  1187. ColorItem(label_colors_divider , 226,
  1188. nil)))))))))))),
  1189. ColorGroup(label_colors_grp_clock,
  1190. ColorItem(label_colors_clockview , 227,
  1191. nil),
  1192. ColorGroup(label_colors_grp_desktop, DesktopColorItems(nil),
  1193. ColorGroup(label_colors_grp_dialogs, DialogColorItems(dpGrayDialog,nil),
  1194. ColorGroup(label_colors_grp_editor,
  1195. ColorItem(label_colors_framepassive , 167,
  1196. ColorItem(label_colors_frameactive , 168,
  1197. ColorItem(label_colors_frameicon , 169,
  1198. ColorItem(label_colors_scrollbarpage , 170,
  1199. ColorItem(label_colors_scrollbaricons , 171,
  1200. ColorItem(label_colors_normaltext , 199,
  1201. ColorItem(label_colors_selectedtext , 208,
  1202. ColorItem(label_colors_highlighcolumn , 209,
  1203. ColorItem(label_colors_highlightrow , 210,
  1204. ColorItem(label_colors_errormessages , 214,
  1205. nil)))))))))),
  1206. ColorGroup(label_colors_grp_help,
  1207. ColorItem(label_colors_framepassive , 128,
  1208. ColorItem(label_colors_frameactive , 129,
  1209. ColorItem(label_colors_frameicon , 130,
  1210. ColorItem(label_colors_scrollbarpage , 131,
  1211. ColorItem(label_colors_scrollbaricons , 132,
  1212. ColorItem(label_colors_helptext , 160,
  1213. ColorItem(label_colors_helplinks , 161,
  1214. ColorItem(label_colors_selectedlink , 162,
  1215. ColorItem(label_colors_selectedtext , 163,
  1216. ColorItem(label_colors_html_heading1 , 229,
  1217. ColorItem(label_colors_html_heading2 , 230,
  1218. ColorItem(label_colors_html_heading3 , 231,
  1219. ColorItem(label_colors_html_heading4 , 232,
  1220. ColorItem(label_colors_html_heading5 , 233,
  1221. ColorItem(label_colors_html_heading6 , 234,
  1222. nil))))))))))))))),
  1223. ColorGroup(label_colors_grp_menus, MenuColorItems(nil),
  1224. ColorGroup(label_colors_grp_syntax,
  1225. ColorItem(label_colors_whitespace , 200,
  1226. ColorItem(label_colors_comments , 201,
  1227. ColorItem(label_colors_reservedwords , 202,
  1228. ColorItem(label_colors_identifiers , 203,
  1229. ColorItem(label_colors_strings , 204,
  1230. ColorItem(label_colors_numbers , 205,
  1231. ColorItem(label_colors_hexnumbers , 212,
  1232. ColorItem(label_colors_assembler , 206,
  1233. ColorItem(label_colors_symbols , 207,
  1234. ColorItem(label_colors_directives , 211,
  1235. ColorItem(label_colors_tabs , 213,
  1236. nil))))))))))),
  1237. nil))))))))));
  1238. D^.HelpCtx:=hcColors;
  1239. if ExecuteDialog(D, @AppPalette)=cmOK then
  1240. begin
  1241. DoneMemory;
  1242. Message(Application,evBroadcast,cmUpdate,nil);
  1243. ReDraw;
  1244. UpdateScreen(true);
  1245. end;
  1246. end;
  1247. {$endif FVISION}
  1248. procedure TIDEApp.OpenINI;
  1249. var D: PFileDialog;
  1250. FileName: string;
  1251. begin
  1252. New(D, Init('*'+ExtOf(INIFileName),dialog_openoptions,dialog_ini_filename,fdOpenButton,hidOpenIniFile));
  1253. D^.HelpCtx:=hcOpenIni;
  1254. if Desktop^.ExecView(D)<>cmCancel then
  1255. begin
  1256. D^.GetFileName(FileName);
  1257. if ExistsFile(FileName)=false then ErrorBox(msg_cantopenconfigfile,nil) else
  1258. begin
  1259. IniFileName:=FileName;
  1260. ReadINIFile;
  1261. Message(Application,evBroadcast,cmUpdate,nil);
  1262. end;
  1263. end;
  1264. Dispose(D, Done);
  1265. end;
  1266. procedure TIDEApp.SaveINI;
  1267. begin
  1268. if WriteINIFile(false)=false then
  1269. ErrorBox(msg_errorsavingconfigfile,nil);
  1270. end;
  1271. procedure TIDEApp.SaveAsINI;
  1272. var D: PFileDialog;
  1273. FileName: string;
  1274. CanWrite: boolean;
  1275. begin
  1276. New(D, Init('*'+ExtOf(INIFileName),dialog_saveoptions,dialog_ini_filename,fdOpenButton,hidSaveIniFile));
  1277. D^.HelpCtx:=hcSaveAsINI;
  1278. if Desktop^.ExecView(D)<>cmCancel then
  1279. begin
  1280. D^.GetFileName(FileName);
  1281. CanWrite:=(ExistsFile(FileName)=false);
  1282. if CanWrite=false then
  1283. CanWrite:=ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,SmartPath(FileName)),nil,false)=cmYes;
  1284. if CanWrite then
  1285. begin
  1286. IniFileName:=FileName;
  1287. if WriteINIFile(true)=false then
  1288. ErrorBox(msg_errorsavingconfigfile,nil);
  1289. Message(Application,evBroadcast,cmUpdate,nil);
  1290. end;
  1291. end;
  1292. Dispose(D, Done);
  1293. end;
  1294. {
  1295. $Log$
  1296. Revision 1.11 2002-12-18 01:21:42 pierre
  1297. + Use TEditorInputLine instead of TInputLine
  1298. Revision 1.10 2002/11/28 12:56:23 pierre
  1299. + Remote dialog added
  1300. Revision 1.9 2002/11/21 00:37:56 pierre
  1301. + some cross gdb enhancements
  1302. Revision 1.8 2002/09/07 15:40:44 peter
  1303. * old logs removed and tabs fixed
  1304. Revision 1.7 2002/09/04 08:52:46 pierre
  1305. * adapt to fpcodtmp interface change
  1306. Revision 1.6 2002/01/24 09:21:42 pierre
  1307. * only disable Alt-X in Options|Compiler dialog
  1308. }