fpmopts.inc 47 KB

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