fpmopts.inc 42 KB

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