fpide.pas 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  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_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 = 'Higlight column';
  641. label_colors_highlightrow = 'Higlight 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. {$ifdef unix}DoneClip;{$endif}
  1401. { DoneKeyboard should be called last to
  1402. restore the keyboard correctly PM }
  1403. {$ifndef go32v2}
  1404. donevideo;
  1405. {$endif ndef go32v2}
  1406. DoneKeyboard;
  1407. If UseMouse then
  1408. DoneMouse
  1409. else
  1410. ButtonCount:=0;
  1411. { DoneDosMem;}
  1412. if Assigned(UserScreen) then
  1413. UserScreen^.SwitchToConsoleScreen;
  1414. end;
  1415. procedure TIDEApp.ShowIDEScreen;
  1416. var oldH,oldW : Sw_Word;
  1417. begin
  1418. if Assigned(UserScreen) then
  1419. UserScreen^.SaveConsoleScreen;
  1420. { InitDosMem;}
  1421. InitKeyboard;
  1422. If UseMouse then
  1423. InitMouse
  1424. else
  1425. ButtonCount:=0;
  1426. oldH:=ScreenHeight;
  1427. oldW:=ScreenWidth;
  1428. {$ifdef unix}InitClip(@Self);{$endif}
  1429. {$ifndef go32v2}
  1430. initvideo;
  1431. {$endif ndef go32v2}
  1432. {Videobuffer has been reallocated, need passive video situation detection
  1433. again.}
  1434. initscreen;
  1435. {$ifdef Windows}
  1436. { write the empty screen to dummy console handle }
  1437. UpdateScreen(true);
  1438. {$endif ndef Windows}
  1439. InitEvents;
  1440. InitSysError;
  1441. {$ifndef Windows}
  1442. if (oldH<>ScreenHeight) or (oldW<>ScreenWidth) then
  1443. begin
  1444. { acknowledge new screen dimensions }
  1445. { prevents to draw out of boundaries of new video buffer }
  1446. ResizeApplication(ScreenWidth,ScreenHeight);
  1447. end else
  1448. Message(Application,evBroadcast,cmUpdate,nil);
  1449. {$endif Windows}
  1450. {$ifdef Windows}
  1451. // WindowsShowMouse;
  1452. {$endif Windows}
  1453. if Assigned(UserScreen) then
  1454. {$ifdef unix}
  1455. if (oldH=ScreenHeight) and (oldW=ScreenWidth) then
  1456. {$endif unix}
  1457. UserScreen^.SwitchBackToIDEScreen;
  1458. {$ifdef Windows}
  1459. { This message was sent when the VideoBuffer was smaller
  1460. than was the IdeApp thought => writes to random memory and random crashes... PM }
  1461. Message(Application,evBroadcast,cmUpdate,nil);
  1462. {$endif Windows}
  1463. {$ifdef Unix}
  1464. SetKnownKeys;
  1465. {$endif Unix}
  1466. {$ifndef Windows}
  1467. {$ifndef go32v2}
  1468. UpdateScreen(true);
  1469. {$endif go32v2}
  1470. {$endif Windows}
  1471. CurDirChanged; {To avoid memory corruption, palce this call after screen resize has been done.}
  1472. displaymode:=dmIDE;
  1473. end;
  1474. function TIDEApp.AutoSave: boolean;
  1475. var IOK,SOK,DOK: boolean;
  1476. begin
  1477. IOK:=true; SOK:=true; DOK:=true;
  1478. if (AutoSaveOptions and asEnvironment)<>0 then
  1479. begin
  1480. IOK:=WriteINIFile(false);
  1481. if IOK=false then
  1482. ErrorBox(error_saving_cfg_file,nil);
  1483. end;
  1484. if (AutoSaveOptions and asEditorFiles)<>0 then { was a typo here ("=0") - Gabor }
  1485. SOK:=SaveAll;
  1486. if (AutoSaveOptions and asDesktop)<>0 then
  1487. begin
  1488. { destory all help & browser windows - we don't want to store them }
  1489. { UserScreenWindow is also not registered PM }
  1490. DoCloseUserScreenWindow;
  1491. {$IFNDEF NODEBUG}
  1492. DoneDisassemblyWindow;
  1493. {$ENDIF}
  1494. CloseHelpWindows;
  1495. CloseAllBrowsers;
  1496. DOK:=SaveDesktop;
  1497. if DOK=false then
  1498. ErrorBox(error_saving_dsk_file,nil);
  1499. end;
  1500. AutoSave:=IOK and SOK and DOK;
  1501. end;
  1502. function TIDEApp.DoExecute(ProgramPath, Params, InFile,OutFile,ErrFile: string; ExecType: TExecType): boolean;
  1503. var CanRun: boolean;
  1504. ConsoleMode : TConsoleMode;
  1505. {$ifndef Unix}
  1506. PosExe: sw_integer;
  1507. {$endif Unix}
  1508. begin
  1509. SaveCancelled:=false;
  1510. CanRun:=AutoSave;
  1511. if (CanRun=false) and (SaveCancelled=false) then
  1512. CanRun:=true; { do not care about .DSK or .INI saving problems - just like TP }
  1513. if CanRun then
  1514. begin
  1515. if UserScreen=nil then
  1516. begin
  1517. ErrorBox(error_user_screen_not_avail,nil);
  1518. Exit;
  1519. end;
  1520. if ExecType<>exNoSwap then
  1521. ShowUserScreen;
  1522. SaveConsoleMode(ConsoleMode);
  1523. if ExecType=exDosShell then
  1524. WriteShellMsg
  1525. else if ExecType<>exNoSwap then
  1526. Writeln('Running "'+ProgramPath+' '+Params+'"');
  1527. { DO NOT use COMSPEC for exe files as the
  1528. ExitCode is lost in those cases PM }
  1529. {$ifdef HASAMIGA}
  1530. DosExecute(ProgramPath, Params);
  1531. {$else}
  1532. {$ifndef Unix}
  1533. posexe:=Pos('.EXE',UpCaseStr(ProgramPath));
  1534. { if programpath was three AnsiChar long => bug }
  1535. if (posexe>0) and (posexe=Length(ProgramPath)-3) then
  1536. begin
  1537. {$endif Unix}
  1538. if (InFile='') and (OutFile='') and (ErrFile='') then
  1539. DosExecute(ProgramPath,Params)
  1540. else
  1541. begin
  1542. if ErrFile='' then
  1543. ErrFile:='stderr';
  1544. ExecuteRedir(ProgramPath,Params,InFile,OutFile,ErrFile);
  1545. end;
  1546. {$ifndef Unix}
  1547. end
  1548. else if (InFile='') and (OutFile='') and (ErrFile='') then
  1549. DosExecute(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params)
  1550. else
  1551. begin
  1552. if ErrFile='' then
  1553. ErrFile:='stderr';
  1554. ExecuteRedir(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params,
  1555. InFile,OutFile,ErrFile);
  1556. end;
  1557. {$endif Unix}
  1558. {$endif HASAMIGA}
  1559. {$ifdef Unix}
  1560. if (DebuggeeTTY='') and (OutFile='') and (ExecType<>exDosShell) then
  1561. begin
  1562. Write(' Press any key to return to IDE');
  1563. InitKeyBoard;
  1564. Keyboard.GetKeyEvent;
  1565. while (Keyboard.PollKeyEvent<>0) do
  1566. Keyboard.GetKeyEvent;
  1567. DoneKeyboard;
  1568. end;
  1569. {$endif}
  1570. RestoreConsoleMode(ConsoleMode);
  1571. if ExecType<>exNoSwap then
  1572. ShowIDEScreen;
  1573. end;
  1574. DoExecute:=CanRun;
  1575. end;
  1576. procedure TIDEApp.Update;
  1577. begin
  1578. SetCmdState([cmSaveAll],IsThereAnyEditor);
  1579. SetCmdState([cmCloseAll,cmWindowList],IsThereAnyWindow);
  1580. SetCmdState([cmTile,cmCascade,cmTileVertical,cmStepped,cmSteppedReverse],IsThereAnyVisibleEditorWindow);
  1581. SetCmdState([cmFindProcedure,cmObjects,cmModules,cmGlobals,cmSymbol],IsSymbolInfoAvailable);
  1582. {$ifndef NODEBUG}
  1583. SetCmdState([cmResetDebugger,cmUntilReturn],assigned(debugger) and debugger^.debuggee_started);
  1584. {$endif}
  1585. SetCmdState([cmToolsMsgNext,cmToolsMsgPrev],MessagesWindow<>nil);
  1586. UpdateTools;
  1587. UpdateRecentFileList;
  1588. UpdatePrimaryFile;
  1589. UpdateINIFile;
  1590. Message(Application,evBroadcast,cmCommandSetChanged,nil);
  1591. application^.redraw;
  1592. end;
  1593. procedure TIDEApp.SourceWindowClosed;
  1594. begin
  1595. if not IsClosing then
  1596. Update;
  1597. end;
  1598. procedure TIDEApp.CurDirChanged;
  1599. begin
  1600. Message(Application,evBroadcast,cmUpdateTitle,nil);
  1601. UpdatePrimaryFile;
  1602. UpdateINIFile;
  1603. UpdateMenu(MenuBar^.Menu);
  1604. end;
  1605. procedure TIDEApp.UpdatePrimaryFile;
  1606. begin
  1607. SetMenuItemParam(SearchMenuItem(MenuBar^.Menu,cmPrimaryFile),SmartPath(PrimaryFile));
  1608. SetCmdState([cmClearPrimary],PrimaryFile<>'');
  1609. if PrimaryFile<>'' then
  1610. SetCmdState(CompileCmds,true);
  1611. UpdateMenu(MenuBar^.Menu);
  1612. end;
  1613. procedure TIDEApp.UpdateINIFile;
  1614. begin
  1615. SetMenuItemParam(SearchMenuItem(MenuBar^.Menu,cmSaveINI),SmartPath(IniFilePath));
  1616. end;
  1617. procedure TIDEApp.UpdateRecentFileList;
  1618. var P: PMenuItem;
  1619. {ID,}I: word;
  1620. FileMenu: PMenuItem;
  1621. R: TRect;
  1622. AdjustRecentCount : word;
  1623. begin
  1624. if not assigned(MenuBar) then exit;
  1625. { ID:=cmRecentFileBase;}
  1626. FileMenu:=SearchSubMenu(MenuBar^.Menu,menuFile);
  1627. repeat
  1628. { Inc(ID);
  1629. P:=SearchMenuItem(FileMenu^.SubMenu,ID);
  1630. if FileMenu^.SubMenu^.Default=P then
  1631. FileMenu^.SubMenu^.Default:=FileMenu^.SubMenu^.Items;
  1632. if P<>nil then RemoveMenuItem(FileMenu^.SubMenu,P);}
  1633. P:=GetMenuItemBefore(FileMenu^.SubMenu,nil);
  1634. if (P<>nil) then
  1635. begin
  1636. if (cmRecentFileBase<P^.Command) and (P^.Command<=cmRecentFileBase+MaxRecentFileCount) then
  1637. begin
  1638. RemoveMenuItem(FileMenu^.SubMenu,P);
  1639. if FileMenu^.SubMenu^.Default=P then
  1640. FileMenu^.SubMenu^.Default:=FileMenu^.SubMenu^.Items;
  1641. end
  1642. else
  1643. P:=nil;
  1644. end;
  1645. until P=nil;
  1646. P:=GetMenuItemBefore(FileMenu^.SubMenu,nil);
  1647. if (P<>nil) and IsSeparator(P) then
  1648. RemoveMenuItem(FileMenu^.SubMenu,P);
  1649. GetExtent(R);
  1650. AdjustRecentCount :=0;
  1651. {calculate how much lines on screen for reacent files can be used }
  1652. if r.b.y-r.a.y -19 > 0 then AdjustRecentCount:=r.b.y-r.a.y -19;
  1653. {only if there is enough space then show all reacent files }
  1654. {else cut list shorter }
  1655. if RecentFileCount < AdjustRecentCount then
  1656. AdjustRecentCount:=RecentFileCount;
  1657. if AdjustRecentCount>0 then
  1658. begin
  1659. AppendMenuItem(FileMenu^.SubMenu,NewLine(nil));
  1660. for I:=1 to AdjustRecentCount do
  1661. begin
  1662. P:=NewItem('~'+IntToStr(I)+'~ '+ShrinkPath(SmartPath(RecentFiles[I].FileName),27),' ',
  1663. kbNoKey,cmRecentFileBase+I,hcRecentFileBase+I,nil);
  1664. AppendMenuItem(FileMenu^.SubMenu,P);
  1665. end;
  1666. end;
  1667. end;
  1668. procedure TIDEApp.UpdateTools;
  1669. var P: PMenuItem;
  1670. { ID,}I: word;
  1671. ToolsMenu: PMenuItem;
  1672. S1,S2,S3: string;
  1673. W: word;
  1674. begin
  1675. { ID:=cmToolsBase;}
  1676. ToolsMenu:=SearchSubMenu(MenuBar^.Menu,menuTools);
  1677. repeat
  1678. P:=GetMenuItemBefore(ToolsMenu^.SubMenu,nil);
  1679. if (P<>nil) then
  1680. begin
  1681. if (cmToolsBase<P^.Command) and (P^.Command<=cmToolsBase+MaxToolCount) then
  1682. begin
  1683. RemoveMenuItem(ToolsMenu^.SubMenu,P);
  1684. if ToolsMenu^.SubMenu^.Default=P then
  1685. ToolsMenu^.SubMenu^.Default:=ToolsMenu^.SubMenu^.Items;
  1686. end
  1687. else
  1688. P:=nil;
  1689. end;
  1690. until P=nil;
  1691. P:=GetMenuItemBefore(ToolsMenu^.SubMenu,nil);
  1692. if (P<>nil) and IsSeparator(P) then
  1693. RemoveMenuItem(ToolsMenu^.SubMenu,P);
  1694. if GetToolCount>0 then
  1695. AppendMenuItem(ToolsMenu^.SubMenu,NewLine(nil));
  1696. for I:=1 to GetToolCount do
  1697. begin
  1698. GetToolParams(I-1,S1,S2,S3,W);
  1699. P:=NewItem(S1,KillTilde(GetHotKeyName(W)),W,cmToolsBase+I,hcToolsBase+I,nil);
  1700. AppendMenuItem(ToolsMenu^.SubMenu,P);
  1701. end;
  1702. end;
  1703. procedure TIDEApp.UpdateClockAndHeap;
  1704. var R : TRect;
  1705. begin
  1706. if not OverrideHeapMonitor then
  1707. begin
  1708. Application^.Delete(HeapView);
  1709. GetExtent(R); Dec(R.B.X); R.A.X:=R.B.X-8; R.A.Y:=R.B.Y-1;
  1710. HeapView^.MoveTo(R.A.X,R.A.Y); {move to correct position}
  1711. if ((DesktopPreferences and dpHeapMonitor)<>0) then
  1712. Application^.Insert(HeapView);
  1713. end;
  1714. Application^.Delete(ClockView);
  1715. MenuBar^.GetBounds(R); R.A.X:=R.B.X-9;
  1716. ClockView^.MoveTo(R.A.X,R.A.Y); {move to correct position}
  1717. if (DesktopPreferences and dpClockView)<>0 then
  1718. Application^.Insert(ClockView);
  1719. end;
  1720. procedure TIDEApp.DosShell;
  1721. var
  1722. s : string;
  1723. begin
  1724. {$ifdef HASAMIGA}
  1725. s := 'C:NewShell';
  1726. {$else}
  1727. {$ifdef Unix}
  1728. s:=GetEnv('SHELL');
  1729. if s='' then
  1730. if ExistsFile('/bin/sh') then
  1731. s:='/bin/sh';
  1732. {$else}
  1733. s:=GetEnv('COMSPEC');
  1734. if s='' then
  1735. if ExistsFile('c:\command.com') then
  1736. s:='c:\command.com'
  1737. else
  1738. begin
  1739. s:='command.com';
  1740. if Not LocateExeFile(s) then
  1741. s:='';
  1742. end;
  1743. {$endif}
  1744. {$endif}
  1745. if s='' then
  1746. ErrorBox(msg_errorexecutingshell,nil)
  1747. else
  1748. DoExecute(s, '', '', '', '', exDosShell);
  1749. { In case we have something that the compiler touched }
  1750. AskToReloadAllModifiedFiles;
  1751. end;
  1752. procedure TIDEApp.ShowReadme;
  1753. var R,R2: TRect;
  1754. D: PCenterDialog;
  1755. M: PFPMemo;
  1756. VSB: PScrollBar;
  1757. S: PFastBufStream;
  1758. begin
  1759. New(S, Init(ReadmeName, stOpenRead, 4096));
  1760. if S^.Status=stOK then
  1761. begin
  1762. R.Assign(0,0,63,18);
  1763. New(D, Init(R, 'Free Pascal IDE'));
  1764. with D^ do
  1765. begin
  1766. GetExtent(R);
  1767. R.Grow(-2,-2); Inc(R.B.Y);
  1768. R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
  1769. New(VSB, Init(R2)); VSB^.GrowMode:=0; Insert(VSB);
  1770. New(M, Init(R,nil,VSB,nil));
  1771. M^.LoadFromStream(S);
  1772. M^.ReadOnly:=true;
  1773. Insert(M);
  1774. end;
  1775. InsertOK(D);
  1776. ExecuteDialog(D,nil);
  1777. end;
  1778. Dispose(S, Done);
  1779. end;
  1780. {$I FPMFILE.INC}
  1781. {$I FPMEDIT.INC}
  1782. {$I FPMSRCH.INC}
  1783. {$I FPMRUN.INC}
  1784. {$I FPMCOMP.INC}
  1785. {$I FPMDEBUG.INC}
  1786. {$I FPMTOOLS.INC}
  1787. {$I FPMOPTS.INC}
  1788. {$I FPMWND.INC}
  1789. {$I FPMHELP.INC}
  1790. {$I fpmansi.inc}
  1791. procedure TIDEApp.AddRecentFile(AFileName: string; CurX, CurY: sw_integer);
  1792. begin
  1793. if SearchRecentFile(AFileName)<>-1 then Exit;
  1794. if RecentFileCount>0 then
  1795. Move(RecentFiles[1],RecentFiles[2],SizeOf(RecentFiles[1])*Min(RecentFileCount,High(RecentFiles)-1));
  1796. if RecentFileCount<High(RecentFiles) then Inc(RecentFileCount);
  1797. with RecentFiles[1] do
  1798. begin
  1799. FileName:=AFileName;
  1800. LastPos.X:=CurX; LastPos.Y:=CurY;
  1801. end;
  1802. UpdateRecentFileList;
  1803. end;
  1804. function TIDEApp.SearchRecentFile(AFileName: string): integer;
  1805. var Idx,I: integer;
  1806. begin
  1807. Idx:=-1;
  1808. for I:=1 to RecentFileCount do
  1809. if UpcaseStr(AFileName)=UpcaseStr(RecentFiles[I].FileName) then
  1810. begin Idx:=I; Break; end;
  1811. SearchRecentFile:=Idx;
  1812. end;
  1813. procedure TIDEApp.RemoveRecentFile(Index: integer);
  1814. begin
  1815. if Index<RecentFileCount then
  1816. Move(RecentFiles[Index+1],RecentFiles[Index],SizeOf(RecentFiles[1])*(RecentFileCount-Index));
  1817. Dec(RecentFileCount);
  1818. UpdateRecentFileList;
  1819. end;
  1820. function TIDEApp.GetPalette: PPalette;
  1821. begin
  1822. GetPalette:=@AppPalette;
  1823. end;
  1824. function TIDEApp.IsClosing: Boolean;
  1825. begin
  1826. IsClosing:=InsideDone;
  1827. end;
  1828. destructor TIDEApp.Done;
  1829. begin
  1830. InsideDone:=true;
  1831. IsRunning:=false;
  1832. {manualy dispose ClockView and HeapView}
  1833. Delete(ClockView);
  1834. Dispose(ClockView);
  1835. Delete(HeapView);
  1836. Dispose(HeapView);
  1837. inherited Done;
  1838. Desktop:=nil;
  1839. RemoveBrowsersCollection;
  1840. DoneHelpSystem;
  1841. end;
  1842. end.