2
0

fpide.pas 77 KB

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