fpide.pas 76 KB

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