fpide.pas 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989
  1. {
  2. This file is part of the Free Pascal Integrated Development Environment
  3. Copyright (c) 1998 by Berczi Gabor
  4. Main IDEApp object
  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. unit fpide;
  12. {$i globdir.inc}
  13. interface
  14. uses
  15. Objects,Drivers,Views,App,Gadgets,MsgBox,Tabs,
  16. WEditor,WCEdit,
  17. Comphook,Browcol,
  18. WHTMLScn,
  19. FPViews,FPSymbol,FPSwitch
  20. {$ifndef NODEBUG}
  21. ,fpevalw
  22. {$endif};
  23. type
  24. TExecType = (exNormal,exNoSwap,exDosShell);
  25. Tdisplaymode = (dmIDE,dmUser);
  26. TIDEApp = object(TApplication)
  27. IsRunning : boolean;
  28. displaymode : Tdisplaymode;
  29. constructor Init;
  30. procedure InitDesktop; virtual;
  31. procedure LoadMenuBar;
  32. procedure InitMenuBar; virtual;
  33. procedure reload_menubar;
  34. procedure InitStatusLine; virtual;
  35. procedure Open(FileName: string;FileDir:string);
  36. function OpenSearch(FileName: string) : boolean;
  37. function AskSaveAll: boolean;
  38. function SaveAll: boolean;
  39. function AutoSave: boolean;
  40. procedure Idle; virtual;
  41. procedure Update;
  42. procedure UpdateMode;
  43. procedure UpdateRunMenu(DebuggeeRunning : boolean);
  44. procedure UpdateTarget;
  45. procedure UpdateEditorsCompilerMode(OldMode:TCompilerMode);
  46. procedure GetEvent(var Event: TEvent); virtual;
  47. procedure HandleEvent(var Event: TEvent); virtual;
  48. procedure GetTileRect(var R: TRect); virtual;
  49. function GetPalette: PPalette; virtual;
  50. procedure DosShell; {virtual;}
  51. procedure ShowReadme;
  52. destructor Done; virtual;
  53. procedure ShowUserScreen;
  54. procedure ShowIDEScreen;
  55. function IsClosing : boolean;
  56. private
  57. procedure NewEditor;
  58. procedure NewFromTemplate;
  59. procedure OpenRecentFile(RecentIndex: integer);
  60. procedure ChangeDir;
  61. procedure Print;
  62. procedure PrinterSetup;
  63. procedure ShowClipboard;
  64. procedure FindProcedure;
  65. procedure Objects;
  66. procedure Modules;
  67. procedure Globals;
  68. procedure SearchSymbol;
  69. procedure RunDir;
  70. procedure Parameters;
  71. procedure DoStepOver;
  72. procedure DoTraceInto;
  73. procedure DoRun;
  74. procedure DoResetDebugger;
  75. procedure DoContToCursor;
  76. procedure DoContUntilReturn;
  77. procedure Target;
  78. procedure DoCompilerMessages;
  79. procedure DoPrimaryFile;
  80. procedure DoClearPrimary;
  81. procedure DoUserScreenWindow;
  82. procedure DoCloseUserScreenWindow;
  83. procedure DoUserScreen;
  84. procedure DoOpenGDBWindow;
  85. procedure DoToggleBreak;
  86. procedure DoShowCallStack;
  87. procedure DoShowDisassembly;
  88. procedure DoShowBreakpointList;
  89. procedure DoShowWatches;
  90. procedure DoAddWatch;
  91. procedure do_evaluate;
  92. procedure DoShowRegisters;
  93. procedure DoShowFPU;
  94. procedure DoShowVector;
  95. function CheckModifiedEditor:boolean;
  96. function AskRecompileIfModified:boolean;
  97. procedure Messages;
  98. procedure Calculator;
  99. procedure DoAsciiTable;
  100. procedure ExecuteTool(Idx: integer);
  101. procedure SetSwitchesMode;
  102. procedure DoCompilerSwitch;
  103. procedure MemorySizes;
  104. procedure DoLinkerSwitch;
  105. procedure DoDebuggerSwitch;
  106. {$ifdef SUPPORT_REMOTE}
  107. procedure DoRemote;
  108. procedure TransferRemote;
  109. {$endif SUPPORT_REMOTE}
  110. procedure Directories;
  111. procedure Tools;
  112. procedure DoGrep;
  113. procedure Preferences;
  114. procedure EditorOptions(Editor: PEditor);
  115. procedure CodeComplete;
  116. procedure CodeTemplates;
  117. procedure BrowserOptions(Browser: PBrowserWindow);
  118. procedure DesktopOptions;
  119. procedure ResizeApplication(x, y : longint);
  120. procedure Mouse;
  121. procedure StartUp;
  122. procedure Colors;
  123. procedure OpenINI;
  124. procedure SaveINI;
  125. procedure SaveAsINI;
  126. procedure TileVertical;
  127. procedure Stepped(aDirection:boolean);
  128. procedure CloseAll;
  129. procedure WindowList;
  130. procedure HelpContents;
  131. procedure HelpHelpIndex;
  132. procedure HelpTopicSearch;
  133. procedure HelpPrevTopic;
  134. procedure HelpUsingHelp;
  135. procedure HelpFiles;
  136. procedure About;
  137. procedure CreateAnsiFile;
  138. public
  139. procedure SourceWindowClosed;
  140. function DoExecute(ProgramPath, Params, InFile, OutFile, ErrFile: string; ExecType: TExecType): boolean;
  141. private
  142. SaveCancelled: boolean;
  143. InsideDone : boolean;
  144. LastEvent: longint;
  145. procedure AddRecentFile(AFileName: string; CurX, CurY: sw_integer);
  146. function SearchRecentFile(AFileName: string): integer;
  147. procedure RemoveRecentFile(Index: integer);
  148. public
  149. procedure CurDirChanged;
  150. procedure UpdateClockAndHeap; { update visiblity of ClockView and HeapView }
  151. private
  152. procedure UpdatePrimaryFile;
  153. procedure UpdateINIFile;
  154. procedure UpdateRecentFileList;
  155. procedure UpdateTools;
  156. end;
  157. procedure PutEvent(TargetView: PView; E: TEvent);
  158. procedure PutCommand(TargetView: PView; What, Command: Word; InfoPtr: Pointer);
  159. var
  160. IDEApp: TIDEApp;
  161. implementation
  162. uses
  163. {$ifdef HasSignal}
  164. fpcatch,
  165. {$endif HasSignal}
  166. {$ifdef WinClipSupported}
  167. WinClip,
  168. {$endif WinClipSupported}
  169. {$ifdef Unix}
  170. fpKeys,FVClip,
  171. {$endif Unix}
  172. FpDpAnsi,WConsts,
  173. Video,Mouse,Keyboard,
  174. Compiler,Version,
  175. FVConsts,
  176. Dos{,Memory},Menus,Dialogs,StdDlg,timeddlg,
  177. {$Ifdef COLORSEL}
  178. ColorSel,
  179. {$endif}
  180. Systems,
  181. WUtils,WHlpView,WViews,WHTMLHlp,WHelp,WConsole,
  182. FPConst,FPVars,FPUtils,FPIni,FPIntf,FPCompil,FPHelp,
  183. FPTemplt,FPCalc,FPUsrScr,FPTools,
  184. {$ifndef NODEBUG}
  185. FPDebug,FPRegs,
  186. {$endif}
  187. FPRedir,
  188. FPDesk,FPCodCmp,FPCodTmp;
  189. type
  190. TTargetedEvent = record
  191. Target: PView;
  192. Event: TEvent;
  193. end;
  194. const
  195. TargetedEventHead : integer = 0;
  196. TargetedEventTail : integer = 0;
  197. var
  198. TargetedEvents : array[0..10] of TTargetedEvent;
  199. resourcestring menu_local_gotosource = '~G~oto source';
  200. menu_local_tracksource = '~T~rack source';
  201. menu_local_options = '~O~ptions...';
  202. menu_local_clear = '~C~lear';
  203. menu_local_saveas = 'Save ~a~s';
  204. { menu_key_common_helpindex = 'Shift+F1';
  205. menu_key_common_topicsearch = 'Ctrl+F1';
  206. menu_key_common_prevtopic = 'Alt+F1';}
  207. { menu entries }
  208. menu_file = '~F~ile';
  209. menu_file_new = '~N~ew';
  210. menu_file_template = 'New from ~t~emplate...';
  211. menu_file_open = '~O~pen...';
  212. menu_file_save = '~S~ave';
  213. menu_file_saveas = 'Save ~a~s...';
  214. menu_file_saveall = 'Save a~l~l';
  215. menu_file_reload = '~R~eload';
  216. menu_file_print = '~P~rint';
  217. menu_file_printsetup = 'Print s~e~tup';
  218. menu_file_changedir = '~C~hange dir...';
  219. menu_file_dosshell = 'Comman~d~ shell';
  220. menu_file_exit = 'E~x~it';
  221. menu_edit = '~E~dit';
  222. {$ifdef HASAMIGA}
  223. {$ifdef AROS}
  224. menu_edit_copywin = 'Cop~y~ to AROS';
  225. menu_edit_pastewin = 'Paste from A~R~OS';
  226. {$else}
  227. menu_edit_copywin = 'Cop~y~ to System';
  228. menu_edit_pastewin = 'Paste from Syste~m~';
  229. {$endif}
  230. {$else}
  231. menu_edit_copywin = 'Cop~y~ to Windows';
  232. menu_edit_pastewin = 'Paste from ~W~indows';
  233. {$endif}
  234. menu_edit_undo = '~U~ndo';
  235. menu_edit_redo = '~R~edo';
  236. menu_edit_cut = 'Cu~t~';
  237. menu_edit_copy = '~C~opy';
  238. menu_edit_paste = '~P~aste';
  239. menu_edit_clear = 'C~l~ear';
  240. menu_edit_showclipboard= '~S~how clipboard';
  241. menu_edit_selectall = 'Select ~A~ll';
  242. menu_edit_unselect = 'U~n~select';
  243. menu_edit_comment = 'Com~m~ent';
  244. menu_edit_uncomment = 'Unc~o~mment';
  245. menu_search = '~S~earch';
  246. menu_search_find = '~F~ind...';
  247. menu_search_replace = '~R~eplace...';
  248. menu_search_searchagain= '~S~earch again';
  249. menu_search_jumpline = '~G~o to line number...';
  250. menu_search_findproc = 'Find ~p~rocedure...';
  251. menu_search_objects = '~O~bjects';
  252. menu_search_modules = 'Mod~u~les';
  253. menu_search_globals = 'G~l~obals';
  254. menu_search_symbol = 'S~y~mbol...';
  255. menu_run = '~R~un';
  256. menu_run_run = '~R~un';
  257. menu_run_continue = '~C~ontinue';
  258. menu_run_stepover = '~S~tep over';
  259. menu_run_traceinto = '~T~race into';
  260. menu_run_conttocursor = '~G~oto Cursor';
  261. menu_run_untilreturn = '~U~ntil return';
  262. menu_run_rundir = 'Run ~D~irectory...';
  263. menu_run_parameters = 'P~a~rameters...';
  264. menu_run_resetdebugger = '~P~rogram reset';
  265. menu_compile = '~C~ompile';
  266. menu_compile_compile = '~C~ompile';
  267. menu_compile_make = '~M~ake';
  268. menu_compile_build = '~B~uild';
  269. menu_compile_target = '~T~arget...';
  270. menu_compile_primaryfile = '~P~rimary file...';
  271. menu_compile_clearprimaryfile = 'C~l~ear primary file';
  272. menu_compile_information = '~I~nformation...';
  273. menu_compile_compilermessages = 'C~o~mpiler messages';
  274. menu_debug = '~D~ebug';
  275. menu_debug_output = '~O~utput';
  276. menu_debug_userscreen = '~U~ser screen';
  277. menu_debug_breakpoint = '~B~reakpoint';
  278. menu_debug_callstack = '~C~all stack';
  279. menu_debug_remote = '~S~end to remote';
  280. menu_debug_registers = '~R~egisters';
  281. menu_debug_fpu_registers = '~F~loating Point Unit';
  282. menu_debug_vector_registers = '~V~ector Unit';
  283. menu_debug_addwatch = '~A~dd Watch';
  284. menu_debug_watches = '~W~atches';
  285. menu_debug_breakpointlist = 'Breakpoint ~L~ist';
  286. menu_debug_gdbwindow = '~G~DB window';
  287. menu_debug_disassemble = '~D~isassemble';
  288. menu_tools = '~T~ools';
  289. menu_tools_messages = '~M~essages';
  290. menu_tools_msgnext = 'Goto ~n~ext';
  291. menu_tools_msgprev = 'Goto ~p~revious';
  292. menu_tools_grep = '~G~rep';
  293. menu_tools_calculator = '~C~alculator';
  294. menu_tools_asciitable = 'Ascii ~t~able';
  295. menu_options = '~O~ptions';
  296. menu_options_mode = 'Mode~.~..';
  297. menu_options_compiler = '~C~ompiler...';
  298. menu_options_memory = '~M~emory sizes...';
  299. menu_options_linker = '~L~inker...';
  300. menu_options_debugger = 'De~b~ugger...';
  301. menu_options_remote = '~R~emote...';
  302. menu_options_directories = '~D~irectories...';
  303. menu_options_browser = 'Bro~w~ser...';
  304. menu_options_tools = '~T~ools...';
  305. menu_options_env = '~E~nvironment';
  306. menu_options_env_preferences = '~P~references...';
  307. menu_options_env_editor= '~E~ditor...';
  308. menu_options_env_codecomplete = 'Code~C~omplete...';
  309. menu_options_env_codetemplates = 'Code~T~emplates...';
  310. menu_options_env_desktop = '~D~esktop...';
  311. menu_options_env_keybmouse = 'Keyboard & ~m~ouse...';
  312. menu_options_env_startup = '~S~tartup...';
  313. menu_options_env_colors= 'C~o~lors';
  314. menu_options_learn_keys= 'Learn ~K~eys';
  315. menu_options_open = '~O~pen...';
  316. menu_options_save = '~S~ave';
  317. menu_options_saveas = 'Save ~a~s...';
  318. menu_window = '~W~indow';
  319. menu_window_tile = '~T~ile';
  320. menu_window_tile_vertical = 'Tile ~v~ertical';
  321. menu_window_cascade = 'C~a~scade';
  322. menu_window_stepped = 'Steppe~d~';
  323. menu_window_stepped_reverse = 'Stepp~e~d reverse';
  324. menu_window_closeall = 'Cl~o~se all';
  325. menu_window_resize = '~S~ize/Move';
  326. menu_window_zoom = '~Z~oom';
  327. menu_window_next = '~N~ext';
  328. menu_window_previous = '~P~revious';
  329. menu_window_hide = '~H~ide';
  330. menu_window_close = '~C~lose';
  331. menu_window_list = '~L~ist...';
  332. menu_window_update = '~R~efresh display';
  333. menu_help = '~H~elp';
  334. menu_help_contents = '~C~ontents';
  335. menu_help_index = '~I~ndex';
  336. menu_help_topicsearch = '~T~opic search';
  337. menu_help_prevtopic = '~P~revious topic';
  338. menu_help_using = '~U~sing help';
  339. menu_help_files = '~F~iles...';
  340. menu_help_about = '~A~bout...';
  341. { Source editor local menu items }
  342. menu_srclocal_openfileatcursor = 'Open ~f~ile at cursor';
  343. menu_srclocal_browseatcursor = '~B~rowse symbol at cursor';
  344. menu_srclocal_topicsearch = 'Topic ~s~earch';
  345. menu_srclocal_options = '~O~ptions...';
  346. menu_srclocal_reload = '~R~eload modified file';
  347. { Help viewer local menu items }
  348. menu_hlplocal_contents = '~C~ontents';
  349. menu_hlplocal_index = '~I~ndex';
  350. menu_hlplocal_topicsearch = '~T~opic search';
  351. menu_hlplocal_prevtopic = '~P~revious topic';
  352. menu_hlplocal_copy = '~C~opy';
  353. { Messages local menu items }
  354. menu_msglocal_clear = '~C~lear';
  355. menu_msglocal_gotosource = '~G~oto source';
  356. menu_msglocal_tracksource = '~T~rack source';
  357. { menu_msglocal_saveas = menu_local_saveas;}
  358. { short cut entries in menu }
  359. menu_key_file_open = 'F3';
  360. menu_key_file_save = 'F2';
  361. menu_key_file_exit = 'Alt+X';
  362. menu_key_edit_undo = 'Alt+BkSp';
  363. menu_key_edit_cut_borland = 'Shift+Del';
  364. menu_key_edit_copy_borland = menu_key_common_copy_borland;
  365. menu_key_edit_paste_borland = 'Shift+Ins';
  366. menu_key_edit_cut_microsoft = 'Ctrl+X';
  367. menu_key_edit_copy_microsoft = menu_key_common_copy_microsoft;
  368. menu_key_edit_paste_microsoft = 'Ctrl+V';
  369. menu_key_edit_clear = 'Ctrl+Del';
  370. menu_key_edit_all_microsoft = 'Ctrl+A';
  371. menu_key_edit_all_borland = '';
  372. menu_key_run_run = 'Ctrl+F9';
  373. menu_key_run_stepover = 'F8';
  374. menu_key_run_traceinto = 'F7';
  375. menu_key_run_conttocursor = 'F4';
  376. menu_key_run_untilreturn= 'Alt+F4';
  377. menu_key_run_resetdebugger = 'Ctrl+F2';
  378. menu_key_compile_compile = 'Alt+F9';
  379. menu_key_compile_make = 'F9';
  380. menu_key_compile_compilermessages = 'F12';
  381. menu_key_debug_userscreen = 'Alt+F5';
  382. menu_key_debug_breakpoint = 'Ctrl+F8';
  383. menu_key_debug_callstack = 'Ctrl+F3';
  384. menu_key_debug_addwatch = 'Ctrl+F7';
  385. menu_key_tools_messages= 'F11';
  386. menu_key_tools_msgnext = 'Alt+F8';
  387. menu_key_tools_msgprev = 'Alt+F7';
  388. menu_key_tools_grep = 'Shift+F2';
  389. menu_key_window_resize = 'Ctrl+F5';
  390. menu_key_window_zoom = 'F5';
  391. menu_key_window_next = 'F6';
  392. menu_key_window_previous = 'Shift+F6';
  393. menu_key_window_close = 'Alt+F3';
  394. menu_key_window_list = 'Alt+0';
  395. menu_key_window_hide = 'Ctrl+F6';
  396. menu_key_help_helpindex = menu_key_common_helpindex;
  397. menu_key_help_topicsearch = menu_key_common_topicsearch;
  398. menu_key_help_prevtopic= menu_key_common_prevtopic;
  399. menu_key_hlplocal_index = menu_key_common_helpindex;
  400. menu_key_hlplocal_topicsearch = menu_key_common_topicsearch;
  401. menu_key_hlplocal_prevtopic = menu_key_common_prevtopic;
  402. menu_key_hlplocal_copy_borland = menu_key_common_copy_borland;
  403. menu_key_hlplocal_copy_microsoft = menu_key_common_copy_microsoft;
  404. { status line entries }
  405. status_help = '~F1~ Help';
  406. status_help_on_help = '~F1~ Help on help';
  407. status_help_previoustopic = '~Alt+F1~ Previous topic';
  408. status_help_index = '~Shift+F1~ Help index';
  409. status_help_close = '~Esc~ Close help';
  410. status_save = '~F2~ Save';
  411. status_open = '~F3~ Open';
  412. status_compile = '~Alt+F9~ Compile';
  413. status_make = '~F9~ Make';
  414. status_localmenu = '~Alt+F10~ Local menu';
  415. status_transferchar = '~Ctrl+Enter~ Transfer AnsiChar';
  416. status_msggotosource = '~'+EnterSign+'~ Goto source';
  417. status_msgtracksource = '~Space~ Track source';
  418. status_close = '~Esc~ Close';
  419. status_calculatorpaste = '~Ctrl+Enter~ Transfer result';
  420. status_disassemble = '~Alt+I~ Disassemble';
  421. { error messages }
  422. error_saving_cfg_file = 'Error saving configuration.';
  423. error_saving_dsk_file = 'Error saving desktop file.'#13+
  424. 'Desktop layout could not be stored.';
  425. error_user_screen_not_avail = 'Sorry, user screen not available.';
  426. { standard button texts }
  427. button_OK = 'O~K~';
  428. button_Cancel = 'Cancel';
  429. button_New = '~N~ew';
  430. button_Delete = '~D~elete';
  431. button_Show = '~S~how';
  432. button_Hide = '~H~ide';
  433. { dialogs }
  434. dialog_fillintemplateparameter = 'Fill in template parameter';
  435. dialog_calculator = 'Calculator';
  436. dialog_openafile = 'Open a file';
  437. dialog_browsesymbol = 'Browse Symbol';
  438. msg_confirmsourcediradd = 'Directory %s is not in search path for source files. '+
  439. 'Should we add it ?';
  440. msg_quitconfirm = 'Do You really want to quit?';
  441. msg_printernotopened = 'Can''t open printer,'#13#3'check device name in "print setup"';
  442. msg_printerror = 'Error while printing';
  443. msg_impossibletoreachcursor = 'Impossible to reach current cursor';
  444. msg_impossibletosetbreakpoint = 'Impossible to set breakpoints here';
  445. msg_nothingtorun = 'Oooops, nothing to run.';
  446. msg_cannotrununit = 'Can''t run a unit';
  447. msg_cannotrunlibrary = 'Can''t run a library';
  448. msg_errorexecutingshell = 'Error cannot run shell';
  449. msg_userscreennotavailable = 'Sorry, user screen not available.';
  450. msg_cantsetscreenmode = #3'Impossible to set'#13#3'%dx%d mode';
  451. msg_confirmnewscreenmode = 'Please, confirm that new mode'#13 +
  452. 'is displayed correctly';
  453. { Debugger confirmations and messages }
  454. msg_nodebuginfoavailable = 'No debug info available.';
  455. msg_nodebuggersupportavailable = 'No debugger support available.';
  456. msg_invalidfilename = 'Invalid filename %s';
  457. { File|New from template dialog }
  458. msg_notemplatesavailable = 'No templates available.';
  459. dialog_newfromtemplate = 'New from template';
  460. label_availabletemplates = 'Available ~t~emplates';
  461. label_filetoopen = 'File to ope~n~';
  462. label_lookingfor = 'Looking for %s';
  463. {Printing.}
  464. dialog_setupprinter = 'Setup printer';
  465. label_setupprinter_device = '~D~evice';
  466. {Find procedure.}
  467. dialog_proceduredialog = 'Find Procedure';
  468. label_enterproceduretofind = 'Enter ~m~atching expr.';
  469. label_sym_findprocedure = 'Procedures';
  470. label_sym_findprocedure2 = 'Matching ';
  471. { Browser messages }
  472. { msg_symbolnotfound = #3'Symbol %s not found';
  473. msg_nobrowserinfoavailable = 'No Browser info available';}
  474. msg_toomanysymbolscantdisplayall= 'Too many symbols. Can''t display all of them.';
  475. label_sym_objects = 'Objects';
  476. label_sym_globalscope = 'Global scope';
  477. label_sym_globals = 'Globals';
  478. dialog_units = 'Units';
  479. label_entersymboltobrowse = 'Enter S~y~mbol to browse';
  480. {Program parameters dialog.}
  481. dialog_programparameters = 'Program parameters';
  482. label_parameters_parameter = '~P~arameter';
  483. msg_programnotrundoserroris = #3'Program %s'#13#3'not run'#13#3'DosError = %d';
  484. msg_programfileexitedwithexitcode = #3'Program %s'#13#3'exited with '#13#3'exitcode = %d';
  485. {Target platform dialog.}
  486. dialog_target = 'Target';
  487. label_target_platform = 'Target platform';
  488. {Primary file dialog.}
  489. label_primaryfile_primaryfile = 'Primary file';
  490. {Switches mode.}
  491. dialog_switchesmode = 'SwitchesMode';
  492. static_switchesmode_switchesmode = 'Switches Mode';
  493. {Compiler options.}
  494. dialog_compilerswitches = 'Compiler Switches';
  495. label_compiler_syntaxswitches = 'S~y~ntax Switches';
  496. label_compiler_mode = 'Compiler ~m~ode';
  497. label_compiler_codegeneration = 'Code generation';
  498. label_compiler_optimizations = 'Optimizations';
  499. label_compiler_opt_targetprocessor = 'Optimization target processor';
  500. label_compiler_codegen_targetprocessor = 'Code generation target processor';
  501. label_compiler_linkafter = 'Linking stage';
  502. label_compiler_verboseswitches = 'Verbose Switches';
  503. label_compiler_browser = 'Browser';
  504. label_compiler_assemblerreader = 'Assembler reader';
  505. label_compiler_assemblerinfo = 'Assembler info';
  506. label_compiler_assembleroutput = 'Assembler output';
  507. page_compiler_syntax = 'S~y~ntax';
  508. page_compiler_codegeneration = '~G~enerated code';
  509. page_compiler_verbose = '~V~erbose';
  510. page_compiler_browser = '~B~rowser';
  511. page_compiler_assembler = '~A~ssembler';
  512. {Memory sizes dialog.}
  513. dialog_memorysizes = 'Memory sizes';
  514. {Linker options dialog.}
  515. dialog_linker = 'Linker';
  516. label_linker_preferredlibtype = 'Preferred library type';
  517. {Debugger options dialog.}
  518. dialog_debugger = 'Browsing/Debugging/Profiling';
  519. label_debugger_debuginfo = 'Debugging information';
  520. label_debugger_profileswitches = 'Profiling Switches';
  521. label_debugger_compilerargs = 'Additional ~c~ompiler args';
  522. label_debugger_useanotherconsole = '~U~se another console';
  523. label_debugger_redirection = 'Debuggee ~R~edirection';
  524. label_debugger_useanothertty = '~U~se Another tty for Debuggee';
  525. { Remote options dialog }
  526. dialog_remote = 'Remote setup';
  527. label_remote_machine = 'Remote machine ~n~ame';
  528. label_remote_port = 'Remote ~p~ort number';
  529. label_remote_dir = 'Remote ~d~irectory';
  530. label_remote_config = 'Remote config ~o~ptions';
  531. label_remote_ident = 'Remote ~i~dent';
  532. label_remote_send_command = 'Remote ~S~end command';
  533. label_remote_exec_command = 'Remote ~E~xec command';
  534. label_remote_ssh_exec_command = 'Remote Ss~h~ exec command';
  535. label_remote_copy = 'Remote copy executable';
  536. label_remote_shell = 'Remote shell executable';
  537. label_remote_gdbserver = 'Remote gdbserver executable';
  538. {Directories dialog.}
  539. dialog_directories = 'Directories';
  540. {Editor options window.}
  541. dialog_defaulteditoroptions = 'Default Editor Options';
  542. dialog_editoroptions = 'Editor Options';
  543. label_editor_backupfiles = 'Create backup ~f~iles';
  544. label_editor_insertmode = '~I~nsert mode';
  545. label_editor_autoindentmode = '~A~uto indent mode';
  546. label_editor_usetabcharacters = '~U~se tab characters';
  547. label_editor_backspaceunindents = '~B~ackspace unindents';
  548. label_editor_persistentblocks = '~P~ersistent blocks';
  549. label_editor_overwriteblocks = '~O~verwrite blocks';
  550. label_editor_syntaxhighlight = '~S~yntax highlight';
  551. label_editor_showlineindents = 'Sho~w~ line indents';
  552. label_editor_blockinsertcursor = 'B~l~ock insert cursor';
  553. label_editor_verticalblocks = '~V~ertical blocks';
  554. label_editor_highlightcolumn = 'Highlight ~c~olumn';
  555. label_editor_highlightrow = 'Highlight ~r~ow';
  556. label_editor_autoclosingbrackets = 'Aut~o~-closing brackets';
  557. label_editor_keeptrailingspaces = '~K~eep trailing spaces';
  558. label_editor_codecomplete = 'Co~d~eComplete enabled';
  559. label_editor_folds = 'E~n~able folds';
  560. label_editor_editoroptions = '~E~ditor options';
  561. label_editor_tabsize = '~T~ab size';
  562. label_editor_indentsize = 'Indent si~z~e';
  563. label_editor_highlightextensions = '~H~ighlight extensions';
  564. label_editor_filepatternsneedingtabs = 'File ~p~atterns needing tabs';
  565. {Browser options dialog.}
  566. dialog_browseroptions = 'Browser Options';
  567. dialog_localbrowseroptions = 'Local Browser Options';
  568. label_browser_units = '~U~nits';
  569. label_browser_labels = '~L~abels';
  570. label_browser_constants = '~C~onstants';
  571. label_browser_types = '~T~ypes';
  572. label_browser_variables = '~V~ariables';
  573. label_browser_procedures = '~P~rocedures';
  574. label_browser_inherited = '~I~nherited';
  575. label_browser_symbols = 'Symbols';
  576. label_browser_newbrowser = '~N~ew browser';
  577. label_browser_currentbrowser = '~R~eplace current';
  578. label_browser_subbrowsing = 'Sub-browsing';
  579. label_browser_scope = '~S~cope';
  580. label_browser_reference = 'R~e~ference';
  581. label_browser_preferredpane = 'Preferred pane';
  582. label_browser_qualifiedsymbols = '~Q~ualified symbols';
  583. label_browser_sortsymbols = 'S~o~rt always';
  584. label_browser_display = 'Display';
  585. {Preferences dialog.}
  586. dialog_preferences = 'Preferences';
  587. label_preferences_videomode = 'Video mode';
  588. label_preferences_currentdirectory = 'C~u~rrent directory';
  589. label_preferences_configdirectory = 'Conf~i~g file directory';
  590. label_preferences_desktopfile = 'Desktop file';
  591. label_preferences_editorfiles = 'Editor ~f~iles';
  592. label_preferences_environment = '~E~nvironment';
  593. label_preferences_desktop = '~D~esktop';
  594. label_preferences_autosave = 'Auto save';
  595. label_preferences_autotracksource = '~A~uto track source';
  596. label_preferences_closeongotosource = 'C~l~ose on go to source';
  597. label_preferences_changedironopen = 'C~h~ange dir on open';
  598. label_preferences_options = 'Options';
  599. label_preferences_showclock = 'Show ~c~lock';
  600. label_preferences_showheapmonitor = 'Show heap ~m~onitor';
  601. label_preferences_clockheap = 'Desktop';
  602. {Desktop preferences dialog.}
  603. dialog_desktoppreferences = 'Desktop Preferences';
  604. label_desktop_historylists = '~H~istory lists';
  605. label_desktop_clipboard = '~C~lipboard content';
  606. label_desktop_watches = '~W~atch expressions';
  607. label_desktop_breakpoints = '~B~reakpoints';
  608. label_desktop_openwindow = '~O~pen windows';
  609. label_desktop_symbolinfo = '~S~ymbol information';
  610. label_desktop_codecompletewords = 'Co~d~eComplete wordlist';
  611. label_desktop_codetemplates = 'Code~T~emplates';
  612. label_desktop_returntolastdir = '~R~eturn to last directory';
  613. label_desktop_preservedacrosssessions = '~P~reserved across sessions';
  614. {Mouse options dialog.}
  615. dialog_mouseoptions = 'Mouse Options';
  616. label_mouse_speedbar = 'Fast Medium Slow';
  617. label_mouse_doubleclickspeed = 'Mouse ~d~ouble click';
  618. label_mouse_reversebuttons = '~R~everse mouse buttons';
  619. label_mouse_crtlrightmousebuttonaction = 'Ctrl+Right mouse button';
  620. label_mouse_altrightmousebuttonaction = 'Alt+Right mouse button';
  621. label_mouse_act_nothing = 'Nothing';
  622. label_mouse_act_topicsearch = 'Topic search';
  623. label_mouse_act_gotocursor = 'Go to cursor';
  624. label_mouse_act_breakpoint = 'Breakpoint';
  625. label_mouse_act_evaluate = 'Evaluate';
  626. label_mouse_act_addwatch = 'Add watch';
  627. label_mouse_act_browsesymbol = 'Browse symbol';
  628. {Color select dialog.}
  629. label_colors_grp_menus = 'Menu';
  630. label_colors_grp_desktop = 'Desktop';
  631. label_colors_grp_dialogs = 'Dialogs';
  632. label_colors_grp_browser = 'Browser';
  633. label_colors_grp_editor = 'Editor';
  634. label_colors_grp_help = 'Help';
  635. label_colors_grp_syntax = 'Syntax';
  636. label_colors_grp_clock = 'Clock';
  637. label_colors_clockview = 'Clock view';
  638. label_colors_highlighcolumn = 'Higlight column';
  639. label_colors_highlightrow = 'Higlight row';
  640. label_colors_errormessages = 'Error message';
  641. label_colors_helptext = 'Text';
  642. label_colors_helplinks = 'Link';
  643. label_colors_selectedlink = 'Selected link';
  644. label_colors_html_heading1 = 'Html heading 1';
  645. label_colors_html_heading2 = 'Html heading 2';
  646. label_colors_html_heading3 = 'Html heading 3';
  647. label_colors_html_heading4 = 'Html heading 4';
  648. label_colors_html_heading5 = 'Html heading 5';
  649. label_colors_html_heading6 = 'Html heading 6';
  650. label_colors_whitespace = 'Whitesapce';
  651. label_colors_comments = 'Comments';
  652. label_colors_reservedwords = 'Reserved words';
  653. label_colors_identifiers = 'Identifiers';
  654. label_colors_strings = 'Strings';
  655. label_colors_numbers = 'Numbers';
  656. label_colors_hexnumbers = 'Hexadecimal numbers';
  657. label_colors_assembler = 'Assembler block';
  658. label_colors_symbols = 'Symbols';
  659. label_colors_directives = 'Directives';
  660. label_colors_tabs = 'Tabs';
  661. {Open options dialog.}
  662. dialog_openoptions = 'Open Options';
  663. msg_cantopenconfigfile = 'Can''t open config file.';
  664. msg_errorsavingconfigfile = 'Error saving config file.';
  665. {Save options dialog.}
  666. dialog_saveoptions = 'Save Options As';
  667. dialog_ini_filename = 'Name of INI file';
  668. {Window list dialog.}
  669. dialog_windowlist = 'Window List';
  670. label_wndlist_windows = '~W~indows';
  671. msg_windowlist_hidden = 'hidden';
  672. {Help files dialog.}
  673. dialog_helpfiles = 'Install Help Files';
  674. label_helpfiles_helpfiles = '~H~elp files';
  675. {Install help file.}
  676. dialog_installhelpfile = 'Install a help file';
  677. label_installhelpfile_filename = '~H~elp file name';
  678. {Topic title dialog.}
  679. dialog_topictitle = 'Topic title';
  680. label_topictitle_title = 'Title';
  681. { About window }
  682. { dialog_about = 'About';
  683. label_about_compilerversion = 'Compiler Version';
  684. label_about_debugger = 'Debugger';}
  685. msg_errorparsingtoolparams = 'Error parsing tool params.';
  686. msg_executingtool = 'Executing tool %s ...';
  687. msg_errorreadingoutput = 'Error reading output.';
  688. msg_executingfilterfor = 'Executing filter for %s ...';
  689. msg_cantfindfilteredoutput = 'Can''t find filtered output.';
  690. msg_errorprocessingfilteredoutput = 'Error processing filtered output.';
  691. msg_errorexecutingfilter = 'Error executing filter %s';
  692. msg_errorexecutingtool = 'Error executing tool %s';
  693. msg_filterexecutionsuccessfulexitcodeis = 'Filter execution successful. Exit code = %d';
  694. msg_toolexecutionsuccessfulexitcodeis = 'Tool execution successful. Exit code = %d';
  695. msg_xmustbesettoyforz_doyouwanttochangethis =
  696. '%s must be set to "%s" for %s. '+
  697. 'Do you want to change this option automatically?';
  698. dialog_greparguments = 'Grep arguments';
  699. msg_grepprogramnotfound = 'Grep program not found';
  700. label_grep_texttofind = '~T~ext to find';
  701. label_grep_greparguments = '~G~rep arguments';
  702. msg_runninggrepwithargs = 'Running Grep -n %s';
  703. msg_errorrunninggrep = #3'Error running Grep'#13#3'DosError = %d'#13#3'Exit code = %d';
  704. msg_errorreadinggrepoutput = #3'Error reading Grep output'#13#3'In line %d of %s';
  705. msg_filealreadyexistsoverwrite = 'File %s already exists. Overwrite?';
  706. msg_createkeywordindexforhelpfile = 'Create keyword index from help file?';
  707. msg_pleasewaitwhilecreatingindex = 'Please wait while creating index...';
  708. msg_buildingindexfile = 'Building index file %s';
  709. msg_filedoesnotcontainanylinks = '%s doesn''t contain any links, thus it isn''t suitable for indexing.';
  710. msg_storinghtmlindexinfile = 'Storing HTML index in %s';
  711. msg_errorstoringindexdata = 'Error storing index data (%d)';
  712. msg_cantcreatefile = 'Can''t create %s';
  713. {ANSI screenshots.}
  714. msg_saveansifile = 'Save previous screen as Ansi File';
  715. msg_click_upper_left = 'Click to select upper left corner; Escape to cancel; Enter to select (0,0)';
  716. msg_click_lower_right = 'Click to select lower right corner; Escape to cancel; Enter to select (maxX,maxY)';
  717. function IncTargetedEventPtr(I: integer): integer;
  718. begin
  719. Inc(I);
  720. if I>High(TargetedEvents) then I:=Low(TargetedEvents);
  721. IncTargetedEventPtr:=I;
  722. end;
  723. procedure PutEvent(TargetView: PView; E: TEvent);
  724. begin
  725. if IncTargetedEventPtr(TargetedEventHead)=TargetedEventTail then Exit;
  726. with TargetedEvents[TargetedEventHead] do
  727. begin
  728. Target:=TargetView;
  729. Event:=E;
  730. end;
  731. TargetedEventHead:=IncTargetedEventPtr(TargetedEventHead);
  732. end;
  733. procedure PutCommand(TargetView: PView; What, Command: Word; InfoPtr: Pointer);
  734. var E: TEvent;
  735. begin
  736. FillChar(E,Sizeof(E),0);
  737. E.What:=What;
  738. E.Command:=Command;
  739. E.InfoPtr:=InfoPtr;
  740. PutEvent(TargetView,E);
  741. end;
  742. function GetTargetedEvent(var P: PView; var E: TEvent): boolean;
  743. var OK: boolean;
  744. begin
  745. OK:=TargetedEventHead<>TargetedEventTail;
  746. if OK then
  747. begin
  748. with TargetedEvents[TargetedEventTail] do
  749. begin
  750. P:=Target;
  751. E:=Event;
  752. end;
  753. TargetedEventTail:=IncTargetedEventPtr(TargetedEventTail);
  754. end;
  755. GetTargetedEvent:=OK;
  756. end;
  757. function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean;
  758. begin
  759. IDEUseSyntaxHighlight:=(Editor^.IsFlagSet(efSyntaxHighlight)) and ((Editor^.FileName='') or MatchesMaskList(NameAndExtOf(Editor^.FileName),HighlightExts));
  760. end;
  761. function IDEUseTabsPattern(Editor: PFileEditor): boolean;
  762. begin
  763. { the commented code lead all new files
  764. to become with TAB use enabled which is wrong in my opinion PM }
  765. IDEUseTabsPattern:={(Editor^.FileName='') or }MatchesMaskList(NameAndExtOf(Editor^.FileName),TabsPattern);
  766. end;
  767. constructor TIDEApp.Init;
  768. var R: TRect;
  769. begin
  770. displaymode:=dmIDE;
  771. UseSyntaxHighlight:=@IDEUseSyntaxHighlight;
  772. UseTabsPattern:=@IDEUseTabsPattern;
  773. inherited Init;
  774. InitAdvMsgBox;
  775. InsideDone:=false;
  776. IsRunning:=true;
  777. MenuBar^.GetBounds(R); R.A.X:=R.B.X-9;
  778. New(ClockView, Init(R));
  779. ClockView^.GrowMode:=gfGrowLoX+gfGrowHiX;
  780. { Insert only if and when we are going to look at it (hide is not sufficient measure)
  781. Application^.Insert(ClockView); }
  782. New(ClipboardWindow, Init);
  783. Desktop^.Insert(ClipboardWindow);
  784. New(CalcWindow, Init); CalcWindow^.Hide;
  785. Desktop^.Insert(CalcWindow);
  786. New(CompilerMessageWindow, Init);
  787. CompilerMessageWindow^.Hide;
  788. Desktop^.Insert(CompilerMessageWindow);
  789. Message(@Self,evBroadcast,cmUpdate,nil);
  790. { heap viewer }
  791. GetExtent(R); Dec(R.B.X); R.A.X:=R.B.X-8; R.A.Y:=R.B.Y-1;
  792. New(HeapView, InitKb(R));
  793. if OverrideHeapMonitor and ((StartupOptions and soHeapMonitor)<>0) then
  794. Insert(HeapView);
  795. Drivers.ShowMouse;
  796. {$ifdef Windows}
  797. // WindowsShowMouse;
  798. {$endif Windows}
  799. end;
  800. procedure TIDEApp.InitDesktop;
  801. var
  802. R: TRect;
  803. begin
  804. GetExtent(R);
  805. Inc(R.A.Y);
  806. Dec(R.B.Y);
  807. Desktop:=New(PFPDesktop, Init(R));
  808. end;
  809. procedure TIDEApp.LoadMenuBar;
  810. var R: TRect;
  811. WinPMI : PMenuItem;
  812. begin
  813. GetExtent(R); R.B.Y:=R.A.Y+1;
  814. WinPMI:=nil;
  815. {$ifdef WinClipSupported}
  816. if WinClipboardSupported then
  817. WinPMI:=NewLine(
  818. NewItem(menu_edit_copywin,'', kbNoKey, cmCopyWin, hcCopyWin,
  819. NewItem(menu_edit_pastewin,'', kbNoKey, cmPasteWin, hcPasteWin,
  820. nil)));
  821. {$endif WinClipSupported}
  822. MenuBar:=New(PAdvancedMenuBar, Init(R, NewMenu(
  823. NewSubMenu(menu_file,hcFileMenu, NewMenu(
  824. NewItem(menu_file_new,'',kbNoKey,cmNew,hcNew,
  825. NewItem(menu_file_template,'',kbNoKey,cmNewFromTemplate,hcNewFromTemplate,
  826. NewItem(menu_file_open,menu_key_file_open,kbF3,cmOpen,hcOpen,
  827. NewItem(menu_file_reload,'',kbNoKey,cmDoReload,hcDoReload,
  828. NewItem(menu_file_save,menu_key_file_save,kbF2,cmSave,hcSave,
  829. NewItem(menu_file_saveas,'',kbNoKey,cmSaveAs,hcSaveAs,
  830. NewItem(menu_file_saveall,'',kbNoKey,cmSaveAll,hcSaveAll,
  831. NewLine(
  832. NewItem(menu_file_print,'',kbNoKey,cmPrint,hcPrint,
  833. NewItem(menu_file_printsetup,'',kbNoKey,cmPrinterSetup,hcPrinterSetup,
  834. NewLine(
  835. NewItem(menu_file_changedir,'',kbNoKey,cmChangeDir,hcChangeDir,
  836. NewItem(menu_file_dosshell,'',kbNoKey,cmDOSShell,hcDOSShell,
  837. NewItem(menu_file_exit,menu_key_file_exit,kbNoKey,cmQuit,hcQuit,
  838. nil))))))))))))))),
  839. NewSubMenu(menu_edit,hcEditMenu, NewMenu(
  840. NewItem(menu_edit_undo,menu_key_edit_undo, kbAltBack, cmUndo, hcUndo,
  841. NewItem(menu_edit_redo,'', kbNoKey, cmRedo, hcRedo,
  842. {$ifdef DebugUndo}
  843. NewItem('~D~ump Undo','', kbNoKey, cmDumpUndo, hcUndo,
  844. NewItem('U~n~do All','', kbNoKey, cmUndoAll, hcUndo,
  845. NewItem('R~e~do All','', kbNoKey, cmRedoAll, hcRedo,
  846. {$endif DebugUndo}
  847. NewLine(
  848. NewItem(menu_edit_cut,menu_key_edit_cut, cut_key, cmCut, hcCut,
  849. NewItem(menu_edit_copy,menu_key_edit_copy, copy_key, cmCopy, hcCopy,
  850. NewItem(menu_edit_paste,menu_key_edit_paste, paste_key, cmPaste, hcPaste,
  851. NewItem(menu_edit_clear,menu_key_edit_clear, kbCtrlDel, cmClear, hcClear,
  852. NewItem(menu_edit_selectall,menu_key_edit_all, all_Key, cmSelectAll, hcSelectAll,
  853. NewItem(menu_edit_unselect,'', kbNoKey, cmUnselect, hcUnselect,
  854. NewItem(menu_edit_comment,'', kbNoKey, cmCommentSel, hcCommentSel,
  855. NewItem(menu_edit_uncomment,'', kbNoKey, cmUnCommentSel, hcUnCommentSel,
  856. NewLine(
  857. NewItem(menu_edit_showclipboard,'', kbNoKey, cmShowClipboard, hcShowClipboard,
  858. WinPMI))))))))))
  859. {$ifdef DebugUndo}))){$endif DebugUndo}
  860. )))),
  861. NewSubMenu(menu_search,hcSearchMenu, NewMenu(
  862. NewItem(menu_search_find,'', kbNoKey, cmFind, hcFind,
  863. NewItem(menu_search_replace,'', kbNoKey, cmReplace, hcReplace,
  864. NewItem(menu_search_searchagain,'', kbNoKey, cmSearchAgain, hcSearchAgain,
  865. NewLine(
  866. NewItem(menu_search_jumpline,'', kbNoKey, cmJumpLine, hcGotoLine,
  867. NewItem(menu_search_findproc,'', kbNoKey, cmFindProcedure, hcFindProcedure,
  868. NewLine(
  869. NewItem(menu_search_objects,'', kbNoKey, cmObjects, hcObjects,
  870. NewItem(menu_search_modules,'', kbNoKey, cmModules, hcModules,
  871. NewItem(menu_search_globals,'', kbNoKey, cmGlobals, hcGlobals,
  872. NewLine(
  873. NewItem(menu_search_symbol,'', kbNoKey, cmSymbol, hcSymbol,
  874. nil))))))))))))),
  875. NewSubMenu(menu_run,hcRunMenu, NewMenu(
  876. NewItem(menu_run_run,menu_key_run_run, kbCtrlF9, cmRun, hcRun,
  877. NewItem(menu_run_stepover,menu_key_run_stepover, kbF8, cmStepOver, hcRun,
  878. NewItem(menu_run_traceinto,menu_key_run_traceinto, kbF7, cmTraceInto, hcRun,
  879. NewItem(menu_run_conttocursor,menu_key_run_conttocursor, kbF4, cmContToCursor, hcContToCursor,
  880. NewItem(menu_run_untilreturn,menu_key_run_untilreturn, kbAltF4,cmUntilReturn,hcUntilReturn,
  881. NewItem(menu_run_rundir,'', kbNoKey, cmRunDir, hcRunDir,
  882. NewItem(menu_run_parameters,'', kbNoKey, cmParameters, hcParameters,
  883. NewItem(menu_run_resetdebugger,menu_key_run_resetdebugger, kbCtrlF2, cmResetDebugger, hcResetDebugger,
  884. nil))))))))),
  885. NewSubMenu(menu_compile,hcCompileMenu, NewMenu(
  886. NewItem(menu_compile_compile,menu_key_compile_compile, kbAltF9, cmCompile, hcCompile,
  887. NewItem(menu_compile_make,menu_key_compile_make, kbF9, cmMake, hcMake,
  888. NewItem(menu_compile_build,'', kbNoKey, cmBuild, hcBuild,
  889. NewLine(
  890. NewItem(menu_compile_target,'', kbNoKey, cmTarget, hcTarget,
  891. NewItem(menu_compile_primaryfile,'', kbNoKey, cmPrimaryFile, hcPrimaryFile,
  892. NewItem(menu_compile_clearprimaryfile,'', kbNoKey, cmClearPrimary, hcClearPrimary,
  893. NewLine(
  894. NewItem(menu_compile_compilermessages,menu_key_compile_compilermessages, kbF12, cmCompilerMessages, hcCompilerMessages,
  895. nil)))))))))),
  896. NewSubMenu(menu_debug, hcDebugMenu, NewMenu(
  897. NewItem(menu_debug_output,'', kbNoKey, cmUserScreenWindow, hcUserScreenWindow,
  898. NewItem(menu_debug_userscreen,menu_key_debug_userscreen, kbAltF5, cmUserScreen, hcUserScreen,
  899. NewLine(
  900. {$ifdef SUPPORT_REMOTE}
  901. NewItem(menu_debug_remote,'', kbNoKey, cmTransferRemote, hcTransferRemote,
  902. {$endif SUPPORT_REMOTE}
  903. NewItem(menu_debug_addwatch,menu_key_debug_addwatch, kbCtrlF7, cmAddWatch, hcAddWatch,
  904. NewItem(menu_debug_watches,'', kbNoKey, cmWatches, hcWatchesWindow,
  905. NewItem(menu_debug_breakpoint,menu_key_debug_breakpoint, kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint,
  906. NewItem(menu_debug_breakpointlist,'', kbNoKey, cmBreakpointList, hcBreakpointList,
  907. NewItem('~E~valuate...','Ctrl+F4', kbCtrlF4, cmEvaluate, hcEvaluate,
  908. NewItem(menu_debug_callstack,menu_key_debug_callstack, kbCtrlF3, cmStack, hcStackWindow,
  909. NewLine(
  910. NewItem(menu_debug_disassemble,'', kbNoKey, cmDisassemble, hcDisassemblyWindow,
  911. NewItem(menu_debug_registers,'', kbNoKey, cmRegisters, hcRegistersWindow,
  912. NewItem(menu_debug_fpu_registers,'', kbNoKey, cmFPURegisters, hcFPURegisters,
  913. NewItem(menu_debug_vector_registers,'', kbNoKey, cmVectorRegisters, hcVectorRegisters,
  914. NewLine(
  915. NewItem(menu_debug_gdbwindow,'', kbNoKey, cmOpenGDBWindow, hcOpenGDBWindow,
  916. nil
  917. {$ifdef SUPPORT_REMOTE}
  918. )
  919. {$endif SUPPORT_REMOTE}
  920. ))))))))))))))))),
  921. NewSubMenu(menu_tools, hcToolsMenu, NewMenu(
  922. NewItem(menu_tools_messages,menu_key_tools_messages, kbF11, cmToolsMessages, hcToolsMessages,
  923. NewItem(menu_tools_msgnext,menu_key_tools_msgnext, kbAltF8, cmToolsMsgNext, hcToolsMsgNext,
  924. NewItem(menu_tools_msgprev,menu_key_tools_msgprev, kbAltF7, cmToolsMsgPrev, hcToolsMsgPrev,
  925. NewLine(
  926. NewItem(menu_tools_grep,menu_key_tools_grep, kbShiftF2, cmGrep, hcGrep,
  927. NewItem(menu_tools_calculator, '', kbNoKey, cmCalculator, hcCalculator,
  928. NewItem(menu_tools_asciitable, '', kbNoKey, cmAsciiTable, hcAsciiTable,
  929. nil)))))))),
  930. NewSubMenu(menu_options, hcOptionsMenu, NewMenu(
  931. NewItem(menu_options_mode,'', kbNoKey, cmSwitchesMode, hcSwitchesMode,
  932. NewItem(menu_options_compiler,'', kbNoKey, cmCompiler, hcCompiler,
  933. NewItem(menu_options_memory,'', kbNoKey, cmMemorySizes, hcMemorySizes,
  934. NewItem(menu_options_linker,'', kbNoKey, cmLinker, hcLinker,
  935. NewItem(menu_options_debugger,'', kbNoKey, cmDebugger, hcDebugger,
  936. {$ifdef SUPPORT_REMOTE}
  937. NewItem(menu_options_remote,'', kbNoKey, cmRemoteDialog, hcRemoteDialog,
  938. {$endif SUPPORT_REMOTE}
  939. NewItem(menu_options_directories,'', kbNoKey, cmDirectories, hcDirectories,
  940. NewItem(menu_options_browser,'',kbNoKey, cmBrowser, hcBrowser,
  941. NewItem(menu_options_tools,'', kbNoKey, cmTools, hcTools,
  942. NewLine(
  943. NewSubMenu(menu_options_env, hcEnvironmentMenu, NewMenu(
  944. NewItem(menu_options_env_preferences,'', kbNoKey, cmPreferences, hcPreferences,
  945. NewItem(menu_options_env_editor,'', kbNoKey, cmEditor, hcEditor,
  946. NewItem(menu_options_env_codecomplete,'', kbNoKey, cmCodeCompleteOptions, hcCodeCompleteOptions,
  947. NewItem(menu_options_env_codetemplates,'', kbNoKey, cmCodeTemplateOptions, hcCodeTemplateOptions,
  948. NewItem(menu_options_env_desktop,'', kbNoKey, cmDesktopOptions, hcDesktopOptions,
  949. NewItem(menu_options_env_keybmouse,'', kbNoKey, cmMouse, hcMouse,
  950. { NewItem(menu_options_env_startup,'', kbNoKey, cmStartup, hcStartup,}
  951. NewItem(menu_options_env_colors,'', kbNoKey, cmColors, hcColors,
  952. {$ifdef Unix}
  953. NewItem(menu_options_learn_keys,'', kbNoKey, cmKeys, hcKeys,
  954. {$endif Unix}
  955. nil
  956. {$ifdef Unix}
  957. )
  958. {$endif Unix}
  959. ){)}))))))),
  960. NewLine(
  961. NewItem(menu_options_open,'', kbNoKey, cmOpenINI, hcOpenINI,
  962. NewItem(menu_options_save,'', kbNoKey, cmSaveINI, hcSaveINI,
  963. NewItem(menu_options_saveas,'', kbNoKey, cmSaveAsINI, hcSaveAsINI,
  964. nil
  965. {$ifdef SUPPORT_REMOTE}
  966. )
  967. {$endif SUPPORT_REMOTE}
  968. ))))))))))))))),
  969. NewSubMenu(menu_window, hcWindowMenu, NewMenu(
  970. NewItem(menu_window_tile,'', kbNoKey, cmTile, hcTile,
  971. NewItem(menu_window_cascade,'', kbNoKey, cmCascade, hcCascade,
  972. NewItem(menu_window_stepped,'', kbNoKey, cmSteppedReverse, hcStepped,
  973. NewItem(menu_window_closeall,'', kbNoKey, cmCloseAll, hcCloseAll,
  974. NewLine(
  975. NewItem(menu_window_resize,menu_key_window_resize, kbCtrlF5, cmResize, hcResize,
  976. NewItem(menu_window_zoom,menu_key_window_zoom, kbF5, cmZoom, hcZoom,
  977. NewItem(menu_window_next,menu_key_window_next, kbF6, cmNext, hcNext,
  978. NewItem(menu_window_previous,menu_key_window_previous, kbShiftF6, cmPrev, hcPrev,
  979. NewItem(menu_window_hide,menu_key_window_hide, kbCtrlF6, cmHide, hcHide,
  980. NewItem(menu_window_close,menu_key_window_close, kbAltF3, cmClose, hcClose,
  981. NewLine(
  982. NewItem(menu_window_list,menu_key_window_list, kbAlt0, cmWindowList, hcWindowList,
  983. NewItem(menu_window_update,'', kbNoKey, cmUpdate, hcUpdate,
  984. nil))))))))))))))),
  985. NewSubMenu(menu_help, hcHelpMenu, NewMenu(
  986. NewItem(menu_help_contents,'', kbNoKey, cmHelpContents, hcHelpContents,
  987. NewItem(menu_help_index,menu_key_help_helpindex, kbShiftF1, cmHelpIndex, hcHelpIndex,
  988. NewItem(menu_help_topicsearch,menu_key_help_topicsearch, kbCtrlF1, cmHelpTopicSearch, hcHelpTopicSearch,
  989. NewItem(menu_help_prevtopic,menu_key_help_prevtopic, kbAltF1, cmHelpPrevTopic, hcHelpPrevTopic,
  990. NewItem(menu_help_using,'',kbNoKey, cmHelpUsingHelp, hcHelpUsingHelp,
  991. NewItem(menu_help_files,'',kbNoKey, cmHelpFiles, hcHelpFiles,
  992. NewLine(
  993. NewItem(menu_help_about,'',kbNoKey, cmAbout, hcAbout,
  994. nil))))))))),
  995. nil)))))))))))));
  996. SetCmdState(ToClipCmds+FromClipCmds+NulClipCmds+UndoCmd+RedoCmd,false);
  997. end;
  998. procedure TIDEApp.InitMenuBar;
  999. begin
  1000. LoadMenuBar;
  1001. DisableCommands(EditorCmds+SourceCmds+CompileCmds);
  1002. SetCmdState([cmTile,cmCascade],false);
  1003. // Update; Desktop is still nil at that point ...
  1004. end;
  1005. procedure Tideapp.reload_menubar;
  1006. begin
  1007. delete(menubar);
  1008. dispose(menubar,done);
  1009. case EditKeys of
  1010. ekm_microsoft:
  1011. begin
  1012. menu_key_edit_cut:=menu_key_edit_cut_microsoft;
  1013. menu_key_edit_copy:=menu_key_edit_copy_microsoft;
  1014. menu_key_edit_paste:=menu_key_edit_paste_microsoft;
  1015. menu_key_edit_all:=menu_key_edit_all_microsoft;
  1016. menu_key_hlplocal_copy:=menu_key_hlplocal_copy_microsoft;
  1017. cut_key:=kbCtrlX;
  1018. copy_key:=kbCtrlC;
  1019. paste_key:=kbCtrlV;
  1020. all_key:=kbCtrlA;
  1021. end;
  1022. ekm_borland:
  1023. begin
  1024. menu_key_edit_cut:=menu_key_edit_cut_borland;
  1025. menu_key_edit_copy:=menu_key_edit_copy_borland;
  1026. menu_key_edit_paste:=menu_key_edit_paste_borland;
  1027. menu_key_edit_all:=menu_key_edit_all_borland;
  1028. menu_key_hlplocal_copy:=menu_key_hlplocal_copy_borland;
  1029. cut_key:=kbShiftDel;
  1030. copy_key:=kbCtrlIns;
  1031. paste_key:=kbShiftIns;
  1032. all_key:=kbNoKey;
  1033. end;
  1034. end;
  1035. loadmenubar;
  1036. Insert(MenuBar);
  1037. if (DesktopPreferences and dpClockView)<>0 then
  1038. begin
  1039. { In theory InsertBefore should do the trick, but it does not }
  1040. { Push ClockView in front of MenuBar }
  1041. Delete(ClockView);
  1042. Insert(ClockView);
  1043. end;
  1044. end;
  1045. procedure TIDEApp.InitStatusLine;
  1046. var
  1047. R: TRect;
  1048. begin
  1049. GetExtent(R);
  1050. R.A.Y := R.B.Y - 1;
  1051. StatusLine:=New(PIDEStatusLine, Init(R,
  1052. NewStatusDef(hcDragging, hcDragging,
  1053. NewStatusKey(status_help, kbF1, cmHelp,
  1054. StdStatusKeys(
  1055. NewStatusKey('~Cursor~ Move', kbNoKey, 65535,
  1056. NewStatusKey('~Shift+Cursor~ Size', kbNoKey, 65535,
  1057. NewStatusKey('~'#17#$C4#$D9'~ Done', kbNoKey, 65535, {#17 = left arrow}
  1058. NewStatusKey('~Esc~ Cancel', kbNoKey, 65535,
  1059. nil)))))),
  1060. NewStatusDef(hcStackWindow, hcStackWindow,
  1061. NewStatusKey(status_help, kbF1, cmHelp,
  1062. NewStatusKey(status_disassemble, kbAltI, cmDisassemble,
  1063. StdStatusKeys(
  1064. nil))),
  1065. NewStatusDef(hcFirstCommand, hcLastNormalCommand,
  1066. NewStatusKey(status_help, kbF1, cmHelp,
  1067. StdStatusKeys(
  1068. nil)),
  1069. NewStatusDef(hcFirstNoAltXCommand, hcLastCommand,
  1070. NewStatusKey(status_help, kbF1, cmHelp,
  1071. NewStatusKey('', kbF10, cmMenu,
  1072. NewStatusKey('', kbAltF3, cmClose,
  1073. NewStatusKey('', kbF5, cmZoom,
  1074. NewStatusKey('', kbCtrlF5, cmResize,
  1075. NewStatusKey('', kbF6, cmNext,
  1076. NewStatusKey('', kbShiftF6, cmPrev,
  1077. nil))))))),
  1078. NewStatusDef(hcHelpWindow, hcHelpWindow,
  1079. NewStatusKey(status_help_on_help, kbF1, cmHelpUsingHelp,
  1080. NewStatusKey(status_help_previoustopic, kbAltF1, cmHelpPrevTopic,
  1081. NewStatusKey(status_help_index, kbShiftF1, cmHelpIndex,
  1082. NewStatusKey(status_help_close, kbEsc, cmClose,
  1083. StdStatusKeys(
  1084. nil))))),
  1085. NewStatusDef(hcSourceWindow, hcSourceWindow,
  1086. NewStatusKey(status_help, kbF1, cmHelp,
  1087. NewStatusKey(status_save, kbF2, cmSave,
  1088. NewStatusKey(status_open, kbF3, cmOpen,
  1089. NewStatusKey(status_compile, kbAltF9, cmCompile,
  1090. NewStatusKey(status_make, kbF9, cmMake,
  1091. NewStatusKey(status_localmenu, kbAltF10, cmLocalMenu,
  1092. StdStatusKeys
  1093. (
  1094. nil))))))),
  1095. NewStatusDef(hcASCIITableWindow, hcASCIITableWindow,
  1096. NewStatusKey(status_help, kbF1, cmHelp,
  1097. NewStatusKey(status_transferchar, kbCtrlEnter, cmTransfer,
  1098. StdStatusKeys(
  1099. nil))),
  1100. NewStatusDef(hcMessagesWindow, hcMessagesWindow,
  1101. NewStatusKey(status_help, kbF1, cmHelp,
  1102. NewStatusKey(status_msggotosource, kbEnter, cmMsgGotoSource,
  1103. NewStatusKey(status_msgtracksource, kbNoKey, cmMsgTrackSource,
  1104. NewStatusKey(status_localmenu, kbAltF10, cmLocalMenu,
  1105. NewStatusKey('', kbEsc, cmClose,
  1106. StdStatusKeys(
  1107. nil)))))),
  1108. NewStatusDef(hcCalcWindow, hcCalcWindow,
  1109. NewStatusKey(status_help, kbF1, cmHelp,
  1110. NewStatusKey(status_close, kbEsc, cmClose,
  1111. NewStatusKey(status_calculatorpaste, kbCtrlEnter, cmCalculatorPaste,
  1112. StdStatusKeys(
  1113. nil)))),
  1114. NewStatusDef(0, $FFFF,
  1115. NewStatusKey(status_help, kbF1, cmHelp,
  1116. NewStatusKey(status_open, kbF3, cmOpen,
  1117. NewStatusKey(status_compile, kbAltF9, cmCompile,
  1118. NewStatusKey(status_make, kbF9, cmMake,
  1119. NewStatusKey(status_localmenu, kbAltF10, cmLocalMenu,
  1120. StdStatusKeys(
  1121. nil)))))),
  1122. nil))))))))))));
  1123. end;
  1124. procedure TIDEApp.Idle;
  1125. begin
  1126. inherited Idle;
  1127. Message(Application,evIdle,0,nil);
  1128. end;
  1129. procedure TIDEApp.GetEvent(var Event: TEvent);
  1130. var P: PView;
  1131. begin
  1132. { first of all dispatch queued targeted events }
  1133. while GetTargetedEvent(P,Event) do
  1134. P^.HandleEvent(Event);
  1135. { Handle System events directly }
  1136. Drivers.GetSystemEvent(Event); { Load system event }
  1137. If (Event.What <> evNothing) Then
  1138. HandleEvent(Event);
  1139. inherited GetEvent(Event);
  1140. {$ifdef DEBUG}
  1141. if (Event.What=evKeyDown) and (Event.KeyCode=kbAltF11) then
  1142. begin
  1143. {$ifdef HasSignal}
  1144. Generate_SIGSEGV;
  1145. {$else}
  1146. Halt(1);
  1147. {$endif}
  1148. end;
  1149. if (Event.What=evKeyDown) and (Event.KeyCode=kbCtrlF11) then
  1150. begin
  1151. RunError(250);
  1152. end;
  1153. {$endif DEBUG}
  1154. if (Event.What=evKeyDown) and (Event.KeyCode=kbAltF12) then
  1155. begin
  1156. CreateAnsiFile;
  1157. ClearEvent(Event);
  1158. end;
  1159. if Event.What<>evNothing then
  1160. LastEvent:=GetDosTicks
  1161. else
  1162. begin
  1163. if abs(GetDosTicks-LastEvent)>SleepTimeOut then
  1164. GiveUpTimeSlice;
  1165. end;
  1166. end;
  1167. procedure TIDEApp.HandleEvent(var Event: TEvent);
  1168. var DontClear: boolean;
  1169. TempS: string;
  1170. ForceDlg: boolean;
  1171. W : PSourceWindow;
  1172. DS : DirStr;
  1173. NS : NameStr;
  1174. ES : ExtStr;
  1175. {$ifdef HasSignal}
  1176. CtrlCCatched : boolean;
  1177. {$endif HasSignal}
  1178. begin
  1179. {$ifdef HasSignal}
  1180. if (Event.What=evKeyDown) and (Event.keyCode=kbCtrlC) and
  1181. (CtrlCPressed) then
  1182. begin
  1183. CtrlCCatched:=true;
  1184. {$ifdef DEBUG}
  1185. Writeln(stderr,'One Ctrl-C caught');
  1186. {$endif DEBUG}
  1187. end
  1188. else
  1189. CtrlCCatched:=false;
  1190. {$endif HasSignal}
  1191. case Event.What of
  1192. evKeyDown :
  1193. begin
  1194. DontClear:=true;
  1195. { just for debugging purposes }
  1196. end;
  1197. evCommand :
  1198. begin
  1199. DontClear:=false;
  1200. case Event.Command of
  1201. cmUpdate : Message(Application,evBroadcast,cmUpdate,nil);
  1202. { -- File menu -- }
  1203. cmNew : NewEditor;
  1204. cmNewFromTemplate: NewFromTemplate;
  1205. cmOpen : begin
  1206. ForceDlg:=false;
  1207. if (OpenFileName<>'') and
  1208. ((DirOf(OpenFileName)='') or (Pos(ListSeparator,OpenFileName)<>0)) then
  1209. begin
  1210. TempS:=LocateSourceFile(OpenFileName,false);
  1211. if TempS='' then
  1212. ForceDlg:=true
  1213. else
  1214. OpenFileName:=TempS;
  1215. end;
  1216. if ForceDlg then
  1217. OpenSearch(OpenFileName)
  1218. else
  1219. begin
  1220. W:=LastSourceEditor;
  1221. if assigned(W) then
  1222. FSplit(W^.Editor^.FileName,DS,NS,ES)
  1223. else
  1224. DS:='';
  1225. Open(OpenFileName,DS);
  1226. end;
  1227. OpenFileName:='';
  1228. end;
  1229. cmPrint : Print;
  1230. cmPrinterSetup : PrinterSetup;
  1231. cmSaveAll : SaveAll;
  1232. cmChangeDir : ChangeDir;
  1233. cmDOSShell : DOSShell;
  1234. cmRecentFileBase..
  1235. cmRecentFileBase+10
  1236. : OpenRecentFile(Event.Command-cmRecentFileBase);
  1237. { -- Edit menu -- }
  1238. cmShowClipboard : ShowClipboard;
  1239. { -- Search menu -- }
  1240. cmFindProcedure : FindProcedure;
  1241. cmObjects : Objects;
  1242. cmModules : Modules;
  1243. cmGlobals : Globals;
  1244. cmSymbol : SearchSymbol;
  1245. { -- Run menu -- }
  1246. cmRunDir : RunDir;
  1247. cmParameters : Parameters;
  1248. cmStepOver : DoStepOver;
  1249. cmTraceInto : DoTraceInto;
  1250. cmRun,
  1251. cmContinue : DoRun;
  1252. cmResetDebugger : DoResetDebugger;
  1253. cmContToCursor : DoContToCursor;
  1254. cmUntilReturn : DoContUntilReturn;
  1255. { -- Compile menu -- }
  1256. cmCompile : DoCompile(cCompile);
  1257. cmBuild : DoCompile(cBuild);
  1258. cmMake : DoCompile(cMake);
  1259. cmTarget : Target;
  1260. cmPrimaryFile : DoPrimaryFile;
  1261. cmClearPrimary : DoClearPrimary;
  1262. cmCompilerMessages : DoCompilerMessages;
  1263. { -- Debug menu -- }
  1264. cmUserScreen : DoUserScreen;
  1265. cmToggleBreakpoint : DoToggleBreak;
  1266. cmStack : DoShowCallStack;
  1267. cmDisassemble : DoShowDisassembly;
  1268. cmBreakpointList : DoShowBreakpointList;
  1269. cmWatches : DoShowWatches;
  1270. cmAddWatch : DoAddWatch;
  1271. cmOpenGDBWindow : DoOpenGDBWindow;
  1272. cmRegisters : DoShowRegisters;
  1273. cmFPURegisters : DoShowFPU;
  1274. cmVectorRegisters : DoShowVector;
  1275. cmEvaluate : do_evaluate;
  1276. { -- Options menu -- }
  1277. cmSwitchesMode : SetSwitchesMode;
  1278. cmCompiler : DoCompilerSwitch;
  1279. cmMemorySizes : MemorySizes;
  1280. cmLinker : DoLinkerSwitch;
  1281. cmDebugger : DoDebuggerSwitch;
  1282. {$ifdef SUPPORT_REMOTE}
  1283. cmRemoteDialog : DoRemote;
  1284. cmTransferRemote: TransferRemote;
  1285. {$endif SUPPORT_REMOTE}
  1286. cmDirectories : Directories;
  1287. cmTools : Tools;
  1288. cmPreferences : Preferences;
  1289. cmEditor : EditorOptions(nil);
  1290. cmEditorOptions : EditorOptions(Event.InfoPtr);
  1291. cmCodeTemplateOptions: CodeTemplates;
  1292. cmCodeCompleteOptions: CodeComplete;
  1293. cmBrowser : BrowserOptions(nil);
  1294. cmBrowserOptions : BrowserOptions(Event.InfoPtr);
  1295. cmMouse : Mouse;
  1296. cmStartup : StartUp;
  1297. cmDesktopOptions: DesktopOptions;
  1298. cmColors : Colors;
  1299. {$ifdef Unix}
  1300. cmKeys : LearnKeysDialog;
  1301. {$endif Unix}
  1302. cmOpenINI : OpenINI;
  1303. cmSaveINI : SaveINI;
  1304. cmSaveAsINI : SaveAsINI;
  1305. { -- Tools menu -- }
  1306. cmToolsMessages : Messages;
  1307. cmCalculator : Calculator;
  1308. cmAsciiTable : DoAsciiTable;
  1309. cmGrep : DoGrep;
  1310. cmToolsBase+1..
  1311. cmToolsBase+MaxToolCount
  1312. : ExecuteTool(Event.Command-cmToolsBase);
  1313. { -- Window menu -- }
  1314. cmTileVertical : TileVertical;
  1315. cmStepped : Stepped(True);
  1316. cmSteppedReverse: Stepped(False);
  1317. cmCloseAll : CloseAll;
  1318. cmWindowList : WindowList;
  1319. cmUserScreenWindow: DoUserScreenWindow;
  1320. { -- Help menu -- }
  1321. cmHelp,
  1322. cmHelpContents : HelpContents;
  1323. cmHelpIndex : HelpHelpIndex;
  1324. cmHelpDebug : HelpDebugInfos;
  1325. cmHelpTopicSearch: HelpTopicSearch;
  1326. cmHelpPrevTopic : HelpPrevTopic;
  1327. cmHelpUsingHelp : HelpUsingHelp;
  1328. cmHelpFiles : HelpFiles;
  1329. cmAbout : About;
  1330. cmShowReadme : ShowReadme;
  1331. cmResizeApp : ResizeApplication(Event.Id, Event.InfoWord);
  1332. cmQuitApp : Message(@Self, evCommand, cmQuit, nil);
  1333. else DontClear:=true;
  1334. end;
  1335. if DontClear=false then ClearEvent(Event);
  1336. end;
  1337. evBroadcast :
  1338. case Event.Command of
  1339. cmSaveCancelled :
  1340. SaveCancelled:=true;
  1341. cmUpdateTools :
  1342. UpdateTools;
  1343. cmCommandSetChanged :
  1344. UpdateMenu(MenuBar^.Menu);
  1345. cmUpdate :
  1346. Update;
  1347. cmSourceWndClosing :
  1348. begin
  1349. with PSourceWindow(Event.InfoPtr)^ do
  1350. if Editor^.FileName<>'' then
  1351. AddRecentFile(Editor^.FileName,Editor^.CurPos.X,Editor^.CurPos.Y);
  1352. {$ifndef NODEBUG}
  1353. if assigned(Debugger) and (PView(Event.InfoPtr)=Debugger^.LastSource) then
  1354. Debugger^.LastSource:=nil;
  1355. {$endif}
  1356. end;
  1357. end;
  1358. end;
  1359. inherited HandleEvent(Event);
  1360. {$ifdef HasSignal}
  1361. { Reset flag if CrtlC was handled }
  1362. if CtrlCCatched and (Event.What=evNothing) then
  1363. begin
  1364. CtrlCPressed:=false;
  1365. {$ifdef DEBUG}
  1366. Writeln(stderr,'One CtrlC handled');
  1367. {$endif DEBUG}
  1368. end;
  1369. {$endif HasSignal}
  1370. end;
  1371. procedure TIDEApp.GetTileRect(var R: TRect);
  1372. begin
  1373. Desktop^.GetExtent(R);
  1374. { Leave the compiler messages window in the bottom }
  1375. if assigned(CompilerMessageWindow) and (CompilerMessageWindow^.GetState(sfVisible)) then
  1376. R.B.Y:=Min(CompilerMessageWindow^.Origin.Y,R.B.Y);
  1377. { Leave the messages window in the bottom }
  1378. if assigned(MessagesWindow) and (MessagesWindow^.GetState(sfVisible)) then
  1379. R.B.Y:=Min(MessagesWindow^.Origin.Y,R.B.Y);
  1380. {$ifndef NODEBUG}
  1381. { Leave the watch window in the bottom }
  1382. if assigned(WatchesWindow) and (WatchesWindow^.GetState(sfVisible)) then
  1383. R.B.Y:=Min(WatchesWindow^.Origin.Y,R.B.Y);
  1384. {$endif NODEBUG}
  1385. end;
  1386. {****************************************************************************
  1387. Switch Screens
  1388. ****************************************************************************}
  1389. procedure TIDEApp.ShowUserScreen;
  1390. begin
  1391. displaymode:=dmUser;
  1392. if Assigned(UserScreen) then
  1393. UserScreen^.SaveIDEScreen;
  1394. DoneSysError;
  1395. DoneEvents;
  1396. {$ifdef unix}DoneClip;{$endif}
  1397. { DoneKeyboard should be called last to
  1398. restore the keyboard correctly PM }
  1399. {$ifndef go32v2}
  1400. donevideo;
  1401. {$endif ndef go32v2}
  1402. DoneKeyboard;
  1403. If UseMouse then
  1404. DoneMouse
  1405. else
  1406. ButtonCount:=0;
  1407. { DoneDosMem;}
  1408. if Assigned(UserScreen) then
  1409. UserScreen^.SwitchToConsoleScreen;
  1410. end;
  1411. procedure TIDEApp.ShowIDEScreen;
  1412. var oldH,oldW : Sw_Word;
  1413. begin
  1414. if Assigned(UserScreen) then
  1415. UserScreen^.SaveConsoleScreen;
  1416. { InitDosMem;}
  1417. InitKeyboard;
  1418. If UseMouse then
  1419. InitMouse
  1420. else
  1421. ButtonCount:=0;
  1422. oldH:=ScreenHeight;
  1423. oldW:=ScreenWidth;
  1424. {$ifdef unix}InitClip(@Self);{$endif}
  1425. {$ifndef go32v2}
  1426. initvideo;
  1427. {$endif ndef go32v2}
  1428. {Videobuffer has been reallocated, need passive video situation detection
  1429. again.}
  1430. initscreen;
  1431. {$ifdef Windows}
  1432. { write the empty screen to dummy console handle }
  1433. UpdateScreen(true);
  1434. {$endif ndef Windows}
  1435. InitEvents;
  1436. InitSysError;
  1437. CurDirChanged;
  1438. {$ifndef Windows}
  1439. if (oldH<>ScreenHeight) or (oldW<>ScreenWidth) then
  1440. begin
  1441. { acknowledge new screen dimensions }
  1442. { prevents to draw out of boundaries of new video buffer }
  1443. ResizeApplication(ScreenWidth,ScreenHeight);
  1444. end else
  1445. Message(Application,evBroadcast,cmUpdate,nil);
  1446. {$endif Windows}
  1447. {$ifdef Windows}
  1448. // WindowsShowMouse;
  1449. {$endif Windows}
  1450. if Assigned(UserScreen) then
  1451. {$ifdef unix}
  1452. if (oldH=ScreenHeight) and (oldW=ScreenWidth) then
  1453. {$endif unix}
  1454. UserScreen^.SwitchBackToIDEScreen;
  1455. {$ifdef Windows}
  1456. { This message was sent when the VideoBuffer was smaller
  1457. than was the IdeApp thought => writes to random memory and random crashes... PM }
  1458. Message(Application,evBroadcast,cmUpdate,nil);
  1459. {$endif Windows}
  1460. {$ifdef Unix}
  1461. SetKnownKeys;
  1462. {$endif Unix}
  1463. {$ifndef Windows}
  1464. {$ifndef go32v2}
  1465. UpdateScreen(true);
  1466. {$endif go32v2}
  1467. {$endif Windows}
  1468. displaymode:=dmIDE;
  1469. end;
  1470. function TIDEApp.AutoSave: boolean;
  1471. var IOK,SOK,DOK: boolean;
  1472. begin
  1473. IOK:=true; SOK:=true; DOK:=true;
  1474. if (AutoSaveOptions and asEnvironment)<>0 then
  1475. begin
  1476. IOK:=WriteINIFile(false);
  1477. if IOK=false then
  1478. ErrorBox(error_saving_cfg_file,nil);
  1479. end;
  1480. if (AutoSaveOptions and asEditorFiles)<>0 then { was a typo here ("=0") - Gabor }
  1481. SOK:=SaveAll;
  1482. if (AutoSaveOptions and asDesktop)<>0 then
  1483. begin
  1484. { destory all help & browser windows - we don't want to store them }
  1485. { UserScreenWindow is also not registered PM }
  1486. DoCloseUserScreenWindow;
  1487. {$IFNDEF NODEBUG}
  1488. DoneDisassemblyWindow;
  1489. {$ENDIF}
  1490. CloseHelpWindows;
  1491. CloseAllBrowsers;
  1492. DOK:=SaveDesktop;
  1493. if DOK=false then
  1494. ErrorBox(error_saving_dsk_file,nil);
  1495. end;
  1496. AutoSave:=IOK and SOK and DOK;
  1497. end;
  1498. function TIDEApp.DoExecute(ProgramPath, Params, InFile,OutFile,ErrFile: string; ExecType: TExecType): boolean;
  1499. var CanRun: boolean;
  1500. ConsoleMode : TConsoleMode;
  1501. {$ifndef Unix}
  1502. PosExe: sw_integer;
  1503. {$endif Unix}
  1504. begin
  1505. SaveCancelled:=false;
  1506. CanRun:=AutoSave;
  1507. if (CanRun=false) and (SaveCancelled=false) then
  1508. CanRun:=true; { do not care about .DSK or .INI saving problems - just like TP }
  1509. if CanRun then
  1510. begin
  1511. if UserScreen=nil then
  1512. begin
  1513. ErrorBox(error_user_screen_not_avail,nil);
  1514. Exit;
  1515. end;
  1516. if ExecType<>exNoSwap then
  1517. ShowUserScreen;
  1518. SaveConsoleMode(ConsoleMode);
  1519. if ExecType=exDosShell then
  1520. WriteShellMsg
  1521. else if ExecType<>exNoSwap then
  1522. Writeln('Running "'+ProgramPath+' '+Params+'"');
  1523. { DO NOT use COMSPEC for exe files as the
  1524. ExitCode is lost in those cases PM }
  1525. {$ifdef HASAMIGA}
  1526. DosExecute(ProgramPath, Params);
  1527. {$else}
  1528. {$ifndef Unix}
  1529. posexe:=Pos('.EXE',UpCaseStr(ProgramPath));
  1530. { if programpath was three AnsiChar long => bug }
  1531. if (posexe>0) and (posexe=Length(ProgramPath)-3) then
  1532. begin
  1533. {$endif Unix}
  1534. if (InFile='') and (OutFile='') and (ErrFile='') then
  1535. DosExecute(ProgramPath,Params)
  1536. else
  1537. begin
  1538. if ErrFile='' then
  1539. ErrFile:='stderr';
  1540. ExecuteRedir(ProgramPath,Params,InFile,OutFile,ErrFile);
  1541. end;
  1542. {$ifndef Unix}
  1543. end
  1544. else if (InFile='') and (OutFile='') and (ErrFile='') then
  1545. DosExecute(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params)
  1546. else
  1547. begin
  1548. if ErrFile='' then
  1549. ErrFile:='stderr';
  1550. ExecuteRedir(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params,
  1551. InFile,OutFile,ErrFile);
  1552. end;
  1553. {$endif Unix}
  1554. {$endif HASAMIGA}
  1555. {$ifdef Unix}
  1556. if (DebuggeeTTY='') and (OutFile='') and (ExecType<>exDosShell) then
  1557. begin
  1558. Write(' Press any key to return to IDE');
  1559. InitKeyBoard;
  1560. Keyboard.GetKeyEvent;
  1561. while (Keyboard.PollKeyEvent<>0) do
  1562. Keyboard.GetKeyEvent;
  1563. DoneKeyboard;
  1564. end;
  1565. {$endif}
  1566. RestoreConsoleMode(ConsoleMode);
  1567. if ExecType<>exNoSwap then
  1568. ShowIDEScreen;
  1569. end;
  1570. DoExecute:=CanRun;
  1571. end;
  1572. procedure TIDEApp.Update;
  1573. begin
  1574. SetCmdState([cmSaveAll],IsThereAnyEditor);
  1575. SetCmdState([cmCloseAll,cmWindowList],IsThereAnyWindow);
  1576. SetCmdState([cmTile,cmCascade,cmTileVertical,cmStepped,cmSteppedReverse],IsThereAnyVisibleEditorWindow);
  1577. SetCmdState([cmFindProcedure,cmObjects,cmModules,cmGlobals,cmSymbol],IsSymbolInfoAvailable);
  1578. {$ifndef NODEBUG}
  1579. SetCmdState([cmResetDebugger,cmUntilReturn],assigned(debugger) and debugger^.debuggee_started);
  1580. {$endif}
  1581. SetCmdState([cmToolsMsgNext,cmToolsMsgPrev],MessagesWindow<>nil);
  1582. UpdateTools;
  1583. UpdateRecentFileList;
  1584. UpdatePrimaryFile;
  1585. UpdateINIFile;
  1586. Message(Application,evBroadcast,cmCommandSetChanged,nil);
  1587. application^.redraw;
  1588. end;
  1589. procedure TIDEApp.SourceWindowClosed;
  1590. begin
  1591. if not IsClosing then
  1592. Update;
  1593. end;
  1594. procedure TIDEApp.CurDirChanged;
  1595. begin
  1596. Message(Application,evBroadcast,cmUpdateTitle,nil);
  1597. UpdatePrimaryFile;
  1598. UpdateINIFile;
  1599. UpdateMenu(MenuBar^.Menu);
  1600. end;
  1601. procedure TIDEApp.UpdatePrimaryFile;
  1602. begin
  1603. SetMenuItemParam(SearchMenuItem(MenuBar^.Menu,cmPrimaryFile),SmartPath(PrimaryFile));
  1604. SetCmdState([cmClearPrimary],PrimaryFile<>'');
  1605. if PrimaryFile<>'' then
  1606. SetCmdState(CompileCmds,true);
  1607. UpdateMenu(MenuBar^.Menu);
  1608. end;
  1609. procedure TIDEApp.UpdateINIFile;
  1610. begin
  1611. SetMenuItemParam(SearchMenuItem(MenuBar^.Menu,cmSaveINI),SmartPath(IniFilePath));
  1612. end;
  1613. procedure TIDEApp.UpdateRecentFileList;
  1614. var P: PMenuItem;
  1615. {ID,}I: word;
  1616. FileMenu: PMenuItem;
  1617. R: TRect;
  1618. AdjustRecentCount : word;
  1619. begin
  1620. if not assigned(MenuBar) then exit;
  1621. { ID:=cmRecentFileBase;}
  1622. FileMenu:=SearchSubMenu(MenuBar^.Menu,menuFile);
  1623. repeat
  1624. { Inc(ID);
  1625. P:=SearchMenuItem(FileMenu^.SubMenu,ID);
  1626. if FileMenu^.SubMenu^.Default=P then
  1627. FileMenu^.SubMenu^.Default:=FileMenu^.SubMenu^.Items;
  1628. if P<>nil then RemoveMenuItem(FileMenu^.SubMenu,P);}
  1629. P:=GetMenuItemBefore(FileMenu^.SubMenu,nil);
  1630. if (P<>nil) then
  1631. begin
  1632. if (cmRecentFileBase<P^.Command) and (P^.Command<=cmRecentFileBase+MaxRecentFileCount) then
  1633. begin
  1634. RemoveMenuItem(FileMenu^.SubMenu,P);
  1635. if FileMenu^.SubMenu^.Default=P then
  1636. FileMenu^.SubMenu^.Default:=FileMenu^.SubMenu^.Items;
  1637. end
  1638. else
  1639. P:=nil;
  1640. end;
  1641. until P=nil;
  1642. P:=GetMenuItemBefore(FileMenu^.SubMenu,nil);
  1643. if (P<>nil) and IsSeparator(P) then
  1644. RemoveMenuItem(FileMenu^.SubMenu,P);
  1645. GetExtent(R);
  1646. AdjustRecentCount :=0;
  1647. {calculate how much lines on screen for reacent files can be used }
  1648. if r.b.y-r.a.y -19 > 0 then AdjustRecentCount:=r.b.y-r.a.y -19;
  1649. {only if there is enough space then show all reacent files }
  1650. {else cut list shorter }
  1651. if RecentFileCount < AdjustRecentCount then
  1652. AdjustRecentCount:=RecentFileCount;
  1653. if AdjustRecentCount>0 then
  1654. begin
  1655. AppendMenuItem(FileMenu^.SubMenu,NewLine(nil));
  1656. for I:=1 to AdjustRecentCount do
  1657. begin
  1658. P:=NewItem('~'+IntToStr(I)+'~ '+ShrinkPath(SmartPath(RecentFiles[I].FileName),27),' ',
  1659. kbNoKey,cmRecentFileBase+I,hcRecentFileBase+I,nil);
  1660. AppendMenuItem(FileMenu^.SubMenu,P);
  1661. end;
  1662. end;
  1663. end;
  1664. procedure TIDEApp.UpdateTools;
  1665. var P: PMenuItem;
  1666. { ID,}I: word;
  1667. ToolsMenu: PMenuItem;
  1668. S1,S2,S3: string;
  1669. W: word;
  1670. begin
  1671. { ID:=cmToolsBase;}
  1672. ToolsMenu:=SearchSubMenu(MenuBar^.Menu,menuTools);
  1673. repeat
  1674. P:=GetMenuItemBefore(ToolsMenu^.SubMenu,nil);
  1675. if (P<>nil) then
  1676. begin
  1677. if (cmToolsBase<P^.Command) and (P^.Command<=cmToolsBase+MaxToolCount) then
  1678. begin
  1679. RemoveMenuItem(ToolsMenu^.SubMenu,P);
  1680. if ToolsMenu^.SubMenu^.Default=P then
  1681. ToolsMenu^.SubMenu^.Default:=ToolsMenu^.SubMenu^.Items;
  1682. end
  1683. else
  1684. P:=nil;
  1685. end;
  1686. until P=nil;
  1687. P:=GetMenuItemBefore(ToolsMenu^.SubMenu,nil);
  1688. if (P<>nil) and IsSeparator(P) then
  1689. RemoveMenuItem(ToolsMenu^.SubMenu,P);
  1690. if GetToolCount>0 then
  1691. AppendMenuItem(ToolsMenu^.SubMenu,NewLine(nil));
  1692. for I:=1 to GetToolCount do
  1693. begin
  1694. GetToolParams(I-1,S1,S2,S3,W);
  1695. P:=NewItem(S1,KillTilde(GetHotKeyName(W)),W,cmToolsBase+I,hcToolsBase+I,nil);
  1696. AppendMenuItem(ToolsMenu^.SubMenu,P);
  1697. end;
  1698. end;
  1699. procedure TIDEApp.UpdateClockAndHeap;
  1700. begin
  1701. if not OverrideHeapMonitor then
  1702. begin
  1703. Application^.Delete(HeapView);
  1704. if ((DesktopPreferences and dpHeapMonitor)<>0) then
  1705. Application^.Insert(HeapView);
  1706. end;
  1707. Application^.Delete(ClockView);
  1708. if (DesktopPreferences and dpClockView)<>0 then
  1709. Application^.Insert(ClockView);
  1710. end;
  1711. procedure TIDEApp.DosShell;
  1712. var
  1713. s : string;
  1714. begin
  1715. {$ifdef HASAMIGA}
  1716. s := 'C:NewShell';
  1717. {$else}
  1718. {$ifdef Unix}
  1719. s:=GetEnv('SHELL');
  1720. if s='' then
  1721. if ExistsFile('/bin/sh') then
  1722. s:='/bin/sh';
  1723. {$else}
  1724. s:=GetEnv('COMSPEC');
  1725. if s='' then
  1726. if ExistsFile('c:\command.com') then
  1727. s:='c:\command.com'
  1728. else
  1729. begin
  1730. s:='command.com';
  1731. if Not LocateExeFile(s) then
  1732. s:='';
  1733. end;
  1734. {$endif}
  1735. {$endif}
  1736. if s='' then
  1737. ErrorBox(msg_errorexecutingshell,nil)
  1738. else
  1739. DoExecute(s, '', '', '', '', exDosShell);
  1740. { In case we have something that the compiler touched }
  1741. AskToReloadAllModifiedFiles;
  1742. end;
  1743. procedure TIDEApp.ShowReadme;
  1744. var R,R2: TRect;
  1745. D: PCenterDialog;
  1746. M: PFPMemo;
  1747. VSB: PScrollBar;
  1748. S: PFastBufStream;
  1749. begin
  1750. New(S, Init(ReadmeName, stOpenRead, 4096));
  1751. if S^.Status=stOK then
  1752. begin
  1753. R.Assign(0,0,63,18);
  1754. New(D, Init(R, 'Free Pascal IDE'));
  1755. with D^ do
  1756. begin
  1757. GetExtent(R);
  1758. R.Grow(-2,-2); Inc(R.B.Y);
  1759. R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
  1760. New(VSB, Init(R2)); VSB^.GrowMode:=0; Insert(VSB);
  1761. New(M, Init(R,nil,VSB,nil));
  1762. M^.LoadFromStream(S);
  1763. M^.ReadOnly:=true;
  1764. Insert(M);
  1765. end;
  1766. InsertOK(D);
  1767. ExecuteDialog(D,nil);
  1768. end;
  1769. Dispose(S, Done);
  1770. end;
  1771. {$I FPMFILE.INC}
  1772. {$I FPMEDIT.INC}
  1773. {$I FPMSRCH.INC}
  1774. {$I FPMRUN.INC}
  1775. {$I FPMCOMP.INC}
  1776. {$I FPMDEBUG.INC}
  1777. {$I FPMTOOLS.INC}
  1778. {$I FPMOPTS.INC}
  1779. {$I FPMWND.INC}
  1780. {$I FPMHELP.INC}
  1781. {$I fpmansi.inc}
  1782. procedure TIDEApp.AddRecentFile(AFileName: string; CurX, CurY: sw_integer);
  1783. begin
  1784. if SearchRecentFile(AFileName)<>-1 then Exit;
  1785. if RecentFileCount>0 then
  1786. Move(RecentFiles[1],RecentFiles[2],SizeOf(RecentFiles[1])*Min(RecentFileCount,High(RecentFiles)-1));
  1787. if RecentFileCount<High(RecentFiles) then Inc(RecentFileCount);
  1788. with RecentFiles[1] do
  1789. begin
  1790. FileName:=AFileName;
  1791. LastPos.X:=CurX; LastPos.Y:=CurY;
  1792. end;
  1793. UpdateRecentFileList;
  1794. end;
  1795. function TIDEApp.SearchRecentFile(AFileName: string): integer;
  1796. var Idx,I: integer;
  1797. begin
  1798. Idx:=-1;
  1799. for I:=1 to RecentFileCount do
  1800. if UpcaseStr(AFileName)=UpcaseStr(RecentFiles[I].FileName) then
  1801. begin Idx:=I; Break; end;
  1802. SearchRecentFile:=Idx;
  1803. end;
  1804. procedure TIDEApp.RemoveRecentFile(Index: integer);
  1805. begin
  1806. if Index<RecentFileCount then
  1807. Move(RecentFiles[Index+1],RecentFiles[Index],SizeOf(RecentFiles[1])*(RecentFileCount-Index));
  1808. Dec(RecentFileCount);
  1809. UpdateRecentFileList;
  1810. end;
  1811. function TIDEApp.GetPalette: PPalette;
  1812. begin
  1813. GetPalette:=@AppPalette;
  1814. end;
  1815. function TIDEApp.IsClosing: Boolean;
  1816. begin
  1817. IsClosing:=InsideDone;
  1818. end;
  1819. destructor TIDEApp.Done;
  1820. begin
  1821. InsideDone:=true;
  1822. IsRunning:=false;
  1823. {manualy dispose ClockView and HeapView}
  1824. Delete(ClockView);
  1825. Dispose(ClockView);
  1826. Delete(HeapView);
  1827. Dispose(HeapView);
  1828. inherited Done;
  1829. Desktop:=nil;
  1830. RemoveBrowsersCollection;
  1831. DoneHelpSystem;
  1832. end;
  1833. end.