fpviews.pas 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Views and view-related functions for the IDE
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit FPViews;
  13. {$i globdir.inc}
  14. interface
  15. uses
  16. Dos,Objects,Drivers,Commands,HelpCtx,Views,Menus,Dialogs,App,Gadgets,
  17. ASCIITAB,
  18. {$ifdef EDITORS}
  19. Editors,
  20. {$else}
  21. WEditor,
  22. {$endif}
  23. WUtils,WHelp,WHlpView,WViews,
  24. Comphook,
  25. FPConst,FPUsrScr;
  26. type
  27. {$IFNDEF EDITORS}
  28. TEditor = TCodeEditor; PEditor = PCodeEditor;
  29. {$ENDIF}
  30. PStoreCollection = ^TStoreCollection;
  31. TStoreCollection = object(TStringCollection)
  32. function Add(const S: string): PString;
  33. end;
  34. PIntegerLine = ^TIntegerLine;
  35. TIntegerLine = object(TInputLine)
  36. constructor Init(var Bounds: TRect; AMin, AMax: longint);
  37. end;
  38. PFPHeapView = ^TFPHeapView;
  39. TFPHeapView = object(THeapView)
  40. constructor Init(var Bounds: TRect);
  41. constructor InitKb(var Bounds: TRect);
  42. procedure HandleEvent(var Event: TEvent); virtual;
  43. end;
  44. PFPClockView = ^TFPClockView;
  45. TFPClockView = object(TClockView)
  46. constructor Init(var Bounds: TRect);
  47. procedure HandleEvent(var Event: TEvent); virtual;
  48. function GetPalette: PPalette; virtual;
  49. end;
  50. TFPWindow = object(TWindow)
  51. AutoNumber: boolean;
  52. procedure HandleEvent(var Event: TEvent); virtual;
  53. procedure SetState(AState: Word; Enable: Boolean); virtual;
  54. constructor Load(var S: TStream);
  55. procedure Store(var S: TStream);
  56. procedure Update;
  57. end;
  58. PFPHelpViewer = ^TFPHelpViewer;
  59. TFPHelpViewer = object(THelpViewer)
  60. function GetLocalMenu: PMenu; virtual;
  61. function GetCommandTarget: PView; virtual;
  62. end;
  63. PFPHelpWindow = ^TFPHelpWindow;
  64. TFPHelpWindow = object(THelpWindow)
  65. constructor Init(var Bounds: TRect; ATitle: TTitleStr; ASourceFileID: word; AContext: THelpCtx; ANumber: Integer);
  66. destructor Done;virtual;
  67. procedure InitHelpView; virtual;
  68. procedure Show; virtual;
  69. procedure Hide; virtual;
  70. procedure HandleEvent(var Event: TEvent); virtual;
  71. function GetPalette: PPalette; virtual;
  72. constructor Load(var S: TStream);
  73. procedure Store(var S: TStream);
  74. end;
  75. PTextScroller = ^TTextScroller;
  76. TTextScroller = object(TStaticText)
  77. TopLine: integer;
  78. Speed : integer;
  79. Lines : PUnsortedStringCollection;
  80. constructor Init(var Bounds: TRect; ASpeed: integer; AText: PUnsortedStringCollection);
  81. function GetLineCount: integer; virtual;
  82. function GetLine(I: integer): string; virtual;
  83. procedure HandleEvent(var Event: TEvent); virtual;
  84. procedure Update; virtual;
  85. procedure Reset; virtual;
  86. procedure Scroll; virtual;
  87. procedure Draw; virtual;
  88. destructor Done; virtual;
  89. private
  90. LastTT: longint;
  91. end;
  92. PSourceEditor = ^TSourceEditor;
  93. TSourceEditor = object(TFileEditor)
  94. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
  95. PScrollBar; AIndicator: PIndicator;const AFileName: string);
  96. {$ifndef EDITORS}
  97. function IsReservedWord(const S: string): boolean; virtual;
  98. function GetSpecSymbolCount(SpecClass: TSpecSymbolClass): integer; virtual;
  99. function GetSpecSymbol(SpecClass: TSpecSymbolClass; Index: integer): string; virtual;
  100. {$endif}
  101. procedure HandleEvent(var Event: TEvent); virtual;
  102. {$ifdef DebugUndo}
  103. procedure DumpUndo;
  104. procedure UndoAll;
  105. procedure RedoAll;
  106. {$endif DebugUndo}
  107. function GetLocalMenu: PMenu; virtual;
  108. function GetCommandTarget: PView; virtual;
  109. function CreateLocalMenuView(var Bounds: TRect; M: PMenu): PMenuPopup; virtual;
  110. procedure ModifiedChanged; virtual;
  111. end;
  112. PSourceWindow = ^TSourceWindow;
  113. TSourceWindow = object(TFPWindow)
  114. Editor : PSourceEditor;
  115. Indicator : PIndicator;
  116. constructor Init(var Bounds: TRect; AFileName: string);
  117. procedure SetTitle(ATitle: string); virtual;
  118. procedure UpdateTitle; virtual;
  119. procedure HandleEvent(var Event: TEvent); virtual;
  120. procedure SetState(AState: Word; Enable: Boolean); virtual;
  121. procedure Update; virtual;
  122. procedure UpdateCommands; virtual;
  123. function GetPalette: PPalette; virtual;
  124. constructor Load(var S: TStream);
  125. procedure Store(var S: TStream);
  126. destructor Done; virtual;
  127. end;
  128. PGDBSourceEditor = ^TGDBSourceEditor;
  129. TGDBSourceEditor = object(TSourceEditor)
  130. function InsertLine : Sw_integer;virtual;
  131. function Valid(Command: Word): Boolean; virtual;
  132. procedure AddLine(const S: string); virtual;
  133. procedure AddErrorLine(const S: string); virtual;
  134. private
  135. Silent,
  136. AutoRepeat,
  137. IgnoreStringAtEnd : boolean;
  138. LastCommand : String;
  139. end;
  140. PGDBWindow = ^TGDBWindow;
  141. TGDBWindow = object(TFPWindow)
  142. Editor : PGDBSourceEditor;
  143. Indicator : PIndicator;
  144. constructor Init(var Bounds: TRect);
  145. procedure WriteText(Buf : pchar;IsError : boolean);
  146. procedure WriteString(Const S : string);
  147. procedure WriteErrorString(Const S : string);
  148. procedure WriteOutputText(Buf : pchar);
  149. procedure WriteErrorText(Buf : pchar);
  150. function GetPalette: PPalette;virtual;
  151. constructor Load(var S: TStream);
  152. procedure Store(var S: TStream);
  153. destructor Done; virtual;
  154. end;
  155. PClipboardWindow = ^TClipboardWindow;
  156. TClipboardWindow = object(TSourceWindow)
  157. constructor Init;
  158. procedure Close; virtual;
  159. constructor Load(var S: TStream);
  160. procedure Store(var S: TStream);
  161. destructor Done; virtual;
  162. end;
  163. PMessageItem = ^TMessageItem;
  164. TMessageItem = object(TObject)
  165. TClass : longint;
  166. Text : PString;
  167. Module : PString;
  168. Row,Col : sw_integer;
  169. constructor Init(AClass: longint; const AText: string; AModule: PString; ARow, ACol: sw_integer);
  170. function GetText(MaxLen: Sw_integer): string; virtual;
  171. procedure Selected; virtual;
  172. function GetModuleName: string; virtual;
  173. destructor Done; virtual;
  174. end;
  175. PMessageListBox = ^TMessageListBox;
  176. TMessageListBox = object(THSListBox)
  177. Transparent : boolean;
  178. NoSelection : boolean;
  179. MaxWidth : Sw_integer;
  180. ModuleNames : PStoreCollection;
  181. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  182. procedure AddItem(P: PMessageItem); virtual;
  183. function AddModuleName(const Name: string): PString; virtual;
  184. function GetText(Item,MaxLen: Sw_Integer): String; virtual;
  185. procedure Clear; virtual;
  186. procedure TrackSource; virtual;
  187. procedure GotoSource; virtual;
  188. procedure Draw; virtual;
  189. procedure HandleEvent(var Event: TEvent); virtual;
  190. function GetLocalMenu: PMenu; virtual;
  191. constructor Load(var S: TStream);
  192. procedure Store(var S: TStream);
  193. destructor Done; virtual;
  194. end;
  195. {$ifdef OLDCOMP}
  196. PCompilerMessage = ^TCompilerMessage;
  197. TCompilerMessage = object(TMessageItem)
  198. function GetText(MaxLen: Sw_Integer): String; virtual;
  199. end;
  200. {$endif}
  201. PProgramInfoWindow = ^TProgramInfoWindow;
  202. TProgramInfoWindow = object(TDlgWindow)
  203. InfoST: PColorStaticText;
  204. LogLB : PMessageListBox;
  205. constructor Init;
  206. procedure AddMessage(AClass: longint; Msg, Module: string; Line, Column: longint);
  207. procedure ClearMessages;
  208. procedure SizeLimits(var Min, Max: TPoint); virtual;
  209. procedure Close; virtual;
  210. procedure HandleEvent(var Event: TEvent); virtual;
  211. procedure Update; virtual;
  212. destructor Done; virtual;
  213. end;
  214. PTabItem = ^TTabItem;
  215. TTabItem = record
  216. Next : PTabItem;
  217. View : PView;
  218. Dis : boolean;
  219. end;
  220. PTabDef = ^TTabDef;
  221. TTabDef = record
  222. Next : PTabDef;
  223. Name : PString;
  224. Items : PTabItem;
  225. DefItem : PView;
  226. ShortCut : char;
  227. end;
  228. PTab = ^TTab;
  229. TTab = object(TGroup)
  230. TabDefs : PTabDef;
  231. ActiveDef : integer;
  232. DefCount : word;
  233. constructor Init(var Bounds: TRect; ATabDef: PTabDef);
  234. function AtTab(Index: integer): PTabDef; virtual;
  235. procedure SelectTab(Index: integer); virtual;
  236. function TabCount: integer;
  237. procedure SelectNextTab(Forwards: boolean);
  238. function Valid(Command: Word): Boolean; virtual;
  239. procedure ChangeBounds(var Bounds: TRect); virtual;
  240. procedure HandleEvent(var Event: TEvent); virtual;
  241. function GetPalette: PPalette; virtual;
  242. procedure Draw; virtual;
  243. procedure SetState(AState: Word; Enable: Boolean); virtual;
  244. destructor Done; virtual;
  245. private
  246. InDraw: boolean;
  247. end;
  248. PScreenView = ^TScreenView;
  249. TScreenView = object(TScroller)
  250. Screen: PScreen;
  251. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
  252. AScreen: PScreen);
  253. procedure Draw; virtual;
  254. procedure Update; virtual;
  255. procedure HandleEvent(var Event: TEvent); virtual;
  256. end;
  257. PScreenWindow = ^TScreenWindow;
  258. TScreenWindow = object(TFPWindow)
  259. ScreenView : PScreenView;
  260. constructor Init(AScreen: PScreen; ANumber: integer);
  261. destructor Done; virtual;
  262. end;
  263. PFPAboutDialog = ^TFPAboutDialog;
  264. TFPAboutDialog = object(TCenterDialog)
  265. constructor Init;
  266. procedure ToggleInfo;
  267. procedure HandleEvent(var Event: TEvent); virtual;
  268. private
  269. Scroller: PTextScroller;
  270. TitleST : PStaticText;
  271. end;
  272. PFPASCIIChart = ^TFPASCIIChart;
  273. TFPASCIIChart = object(TASCIIChart)
  274. constructor Init;
  275. procedure HandleEvent(var Event: TEvent); virtual;
  276. destructor Done; virtual;
  277. end;
  278. PVideoModeListBox = ^TVideoModeListBox;
  279. TVideoModeListBox = object(TDropDownListBox)
  280. function GetText(Item: pointer; MaxLen: sw_integer): string; virtual;
  281. end;
  282. PFPDesktop = ^TFPDesktop;
  283. TFPDesktop = object(TDesktop)
  284. constructor Load(var S: TStream);
  285. procedure Store(var S: TStream);
  286. end;
  287. function SearchFreeWindowNo: integer;
  288. function IsThereAnyEditor: boolean;
  289. function IsThereAnyWindow: boolean;
  290. function FirstEditorWindow: PSourceWindow;
  291. function EditorWindowFile(const Name : String): PSourceWindow;
  292. function NewTabItem(AView: PView; ANext: PTabItem): PTabItem;
  293. procedure DisposeTabItem(P: PTabItem);
  294. function NewTabDef(AName: string; ADefItem: PView; AItems: PTabItem; ANext: PTabDef): PTabDef;
  295. procedure DisposeTabDef(P: PTabDef);
  296. function GetEditorCurWord(Editor: PEditor): string;
  297. procedure InitReservedWords;
  298. procedure DoneReservedWords;
  299. procedure TranslateMouseClick(View: PView; var Event: TEvent);
  300. function GetNextEditorBounds(var Bounds: TRect): boolean;
  301. function OpenEditorWindow(Bounds: PRect; FileName: string; CurX,CurY: sw_integer): PSourceWindow;
  302. function TryToOpenFile(Bounds: PRect; FileName: string; CurX,CurY: sw_integer;tryexts:boolean): PSourceWindow;
  303. function StartEditor(Editor: PCodeEditor; FileName: string): boolean;
  304. {$ifdef VESA}
  305. procedure InitVESAScreenModes;
  306. {$endif}
  307. procedure NoDebugger;
  308. const
  309. SourceCmds : TCommandSet =
  310. ([cmSave,cmSaveAs,cmCompile]);
  311. EditorCmds : TCommandSet =
  312. ([cmFind,cmReplace,cmSearchAgain,cmJumpLine,cmHelpTopicSearch]);
  313. CompileCmds : TCommandSet =
  314. ([cmMake,cmBuild,cmRun]);
  315. CalcClipboard : extended = 0;
  316. OpenFileName : string{$ifdef GABOR}[50]{$endif} = '';
  317. OpenFileLastExt : string[12] = '*.pas';
  318. NewEditorOpened : boolean = false;
  319. var MsgParms : array[1..10] of
  320. record
  321. case byte of
  322. 0 : (Ptr : pointer);
  323. 1 : (Long: longint);
  324. end;
  325. procedure RegisterFPViews;
  326. implementation
  327. uses
  328. Video,Strings,Keyboard,Memory,MsgBox,Validate,
  329. Tokens,Version,
  330. {$ifndef NODEBUG}
  331. gdbint,
  332. {$endif NODEBUG}
  333. {$ifdef VESA}Vesa,{$endif}
  334. FPSwitch,FPSymbol,FPDebug,FPVars,FPUtils,FPCompile,FPHelp,
  335. FPTools;
  336. const
  337. RSourceEditor: TStreamRec = (
  338. ObjType: 1500;
  339. VmtLink: Ofs(TypeOf(TSourceEditor)^);
  340. Load: @TSourceEditor.Load;
  341. Store: @TSourceEditor.Store
  342. );
  343. RSourceWindow: TStreamRec = (
  344. ObjType: 1501;
  345. VmtLink: Ofs(TypeOf(TSourceWindow)^);
  346. Load: @TSourceWindow.Load;
  347. Store: @TSourceWindow.Store
  348. );
  349. RFPHelpViewer: TStreamRec = (
  350. ObjType: 1502;
  351. VmtLink: Ofs(TypeOf(TFPHelpViewer)^);
  352. Load: @TFPHelpViewer.Load;
  353. Store: @TFPHelpViewer.Store
  354. );
  355. RFPHelpWindow: TStreamRec = (
  356. ObjType: 1503;
  357. VmtLink: Ofs(TypeOf(TFPHelpWindow)^);
  358. Load: @TFPHelpWindow.Load;
  359. Store: @TFPHelpWindow.Store
  360. );
  361. RClipboardWindow: TStreamRec = (
  362. ObjType: 1504;
  363. VmtLink: Ofs(TypeOf(TClipboardWindow)^);
  364. Load: @TClipboardWindow.Load;
  365. Store: @TClipboardWindow.Store
  366. );
  367. RMessageListBox: TStreamRec = (
  368. ObjType: 1505;
  369. VmtLink: Ofs(TypeOf(TMessageListBox)^);
  370. Load: @TMessageListBox.Load;
  371. Store: @TMessageListBox.Store
  372. );
  373. RFPDesktop: TStreamRec = (
  374. ObjType: 1506;
  375. VmtLink: Ofs(TypeOf(TFPDesktop)^);
  376. Load: @TFPDesktop.Load;
  377. Store: @TFPDesktop.Store
  378. );
  379. RGDBSourceEditor: TStreamRec = (
  380. ObjType: 1507;
  381. VmtLink: Ofs(TypeOf(TGDBSourceEditor)^);
  382. Load: @TGDBSourceEditor.Load;
  383. Store: @TGDBSourceEditor.Store
  384. );
  385. RGDBWindow: TStreamRec = (
  386. ObjType: 1508;
  387. VmtLink: Ofs(TypeOf(TGDBWindow)^);
  388. Load: @TGDBWindow.Load;
  389. Store: @TGDBWindow.Store
  390. );
  391. const
  392. NoNameCount : integer = 0;
  393. var
  394. ReservedWords : array[1..ReservedWordMaxLen] of PStringCollection;
  395. {****************************************************************************
  396. TStoreCollection
  397. ****************************************************************************}
  398. function TStoreCollection.Add(const S: string): PString;
  399. var P: PString;
  400. Index: Sw_integer;
  401. begin
  402. if S='' then P:=nil else
  403. if Search(@S,Index) then P:=At(Index) else
  404. begin
  405. P:=NewStr(S);
  406. Insert(P);
  407. end;
  408. Add:=P;
  409. end;
  410. function IsThereAnyEditor: boolean;
  411. function EditorWindow(P: PView): boolean; {$ifndef FPC}far;{$endif}
  412. begin
  413. EditorWindow:=(P^.HelpCtx=hcSourceWindow);
  414. end;
  415. begin
  416. IsThereAnyEditor:=Desktop^.FirstThat(@EditorWindow)<>nil;
  417. end;
  418. function IsThereAnyHelpWindow: boolean;
  419. begin
  420. IsThereAnyHelpWindow:=(HelpWindow<>nil) and (HelpWindow^.GetState(sfVisible));
  421. end;
  422. function IsThereAnyWindow: boolean;
  423. var _Is: boolean;
  424. begin
  425. _Is:=Message(Desktop,evBroadcast,cmSearchWindow,nil)<>nil;
  426. _Is:=_Is or ( (ClipboardWindow<>nil) and ClipboardWindow^.GetState(sfVisible));
  427. IsThereAnyWindow:=_Is;
  428. end;
  429. function FirstEditorWindow: PSourceWindow;
  430. function EditorWindow(P: PView): boolean; {$ifndef FPC}far;{$endif}
  431. begin
  432. EditorWindow:=(P^.HelpCtx=hcSourceWindow);
  433. end;
  434. begin
  435. FirstEditorWindow:=pointer(Desktop^.FirstThat(@EditorWindow));
  436. end;
  437. function EditorWindowFile(const Name : String): PSourceWindow;
  438. function EditorWindow(P: PView): boolean; {$ifndef FPC}far;{$endif}
  439. begin
  440. EditorWindow:=(TypeOf(P^)=TypeOf(TSourceWindow)) and
  441. {$ifdef linux}
  442. (PSourceWindow(P)^.Editor^.FileName=Name);
  443. {$else}
  444. (UpcaseStr(PSourceWindow(P)^.Editor^.FileName)=UpcaseStr(Name));
  445. {$endif def linux}
  446. end;
  447. begin
  448. EditorWindowFile:=pointer(Desktop^.FirstThat(@EditorWindow));
  449. end;
  450. function GetEditorCurWord(Editor: PEditor): string;
  451. var S: string;
  452. PS,PE: byte;
  453. function Trim(S: string): string;
  454. const TrimChars : set of char = [#0,#9,' ',#255];
  455. begin
  456. while (length(S)>0) and (S[1] in TrimChars) do Delete(S,1,1);
  457. while (length(S)>0) and (S[length(S)] in TrimChars) do Delete(S,length(S),1);
  458. Trim:=S;
  459. end;
  460. const AlphaNum : set of char = ['A'..'Z','0'..'9','_'];
  461. begin
  462. with Editor^ do
  463. begin
  464. {$ifdef EDITORS}
  465. S:='';
  466. {$else}
  467. S:=GetLineText(CurPos.Y);
  468. PS:=CurPos.X; while (PS>0) and (Upcase(S[PS]) in AlphaNum) do Dec(PS);
  469. PE:=CurPos.X; while (PE<length(S)) and (Upcase(S[PE+1]) in AlphaNum) do Inc(PE);
  470. S:=Trim(copy(S,PS+1,PE-PS));
  471. {$endif}
  472. end;
  473. GetEditorCurWord:=S;
  474. end;
  475. {*****************************************************************************
  476. Tab
  477. *****************************************************************************}
  478. function NewTabItem(AView: PView; ANext: PTabItem): PTabItem;
  479. var P: PTabItem;
  480. begin
  481. New(P); FillChar(P^,SizeOf(P^),0);
  482. P^.Next:=ANext; P^.View:=AView;
  483. NewTabItem:=P;
  484. end;
  485. procedure DisposeTabItem(P: PTabItem);
  486. begin
  487. if P<>nil then
  488. begin
  489. if P^.View<>nil then Dispose(P^.View, Done);
  490. Dispose(P);
  491. end;
  492. end;
  493. function NewTabDef(AName: string; ADefItem: PView; AItems: PTabItem; ANext: PTabDef): PTabDef;
  494. var P: PTabDef;
  495. x: byte;
  496. begin
  497. New(P);
  498. P^.Next:=ANext; P^.Name:=NewStr(AName); P^.Items:=AItems;
  499. x:=pos('~',AName);
  500. if (x<>0) and (x<length(AName)) then P^.ShortCut:=Upcase(AName[x+1])
  501. else P^.ShortCut:=#0;
  502. P^.DefItem:=ADefItem;
  503. NewTabDef:=P;
  504. end;
  505. procedure DisposeTabDef(P: PTabDef);
  506. var PI,X: PTabItem;
  507. begin
  508. DisposeStr(P^.Name);
  509. PI:=P^.Items;
  510. while PI<>nil do
  511. begin
  512. X:=PI^.Next;
  513. DisposeTabItem(PI);
  514. PI:=X;
  515. end;
  516. Dispose(P);
  517. end;
  518. {*****************************************************************************
  519. Reserved Words
  520. *****************************************************************************}
  521. function GetReservedWordCount: integer;
  522. var
  523. Count,I: integer;
  524. begin
  525. Count:=0;
  526. for I:=ord(Low(tToken)) to ord(High(tToken)) do
  527. with TokenInfo^[TToken(I)] do
  528. if (str<>'') and (str[1] in['A'..'Z']) then
  529. Inc(Count);
  530. GetReservedWordCount:=Count;
  531. end;
  532. function GetReservedWord(Index: integer): string;
  533. var
  534. Count,Idx,I: integer;
  535. S: string;
  536. begin
  537. Idx:=-1;
  538. Count:=-1;
  539. I:=ord(Low(tToken));
  540. while (I<=ord(High(tToken))) and (Idx=-1) do
  541. with TokenInfo^[TToken(I)] do
  542. begin
  543. if (str<>'') and (str[1] in['A'..'Z']) then
  544. begin
  545. Inc(Count);
  546. if Count=Index then
  547. Idx:=I;
  548. end;
  549. Inc(I);
  550. end;
  551. if Idx=-1 then
  552. S:=''
  553. else
  554. S:=TokenInfo^[TToken(Idx)].str;
  555. GetReservedWord:=S;
  556. end;
  557. procedure InitReservedWords;
  558. var WordS: string;
  559. Idx,I: integer;
  560. begin
  561. InitTokens;
  562. for I:=Low(ReservedWords) to High(ReservedWords) do
  563. New(ReservedWords[I], Init(50,10));
  564. for I:=1 to GetReservedWordCount do
  565. begin
  566. WordS:=GetReservedWord(I-1); Idx:=length(WordS);
  567. ReservedWords[Idx]^.Insert(NewStr(WordS));
  568. end;
  569. end;
  570. procedure DoneReservedWords;
  571. var I: integer;
  572. begin
  573. for I:=Low(ReservedWords) to High(ReservedWords) do
  574. if assigned(ReservedWords[I]) then
  575. begin
  576. dispose(ReservedWords[I],done);
  577. ReservedWords[I]:=nil;
  578. end;
  579. DoneTokens;
  580. end;
  581. function IsFPReservedWord(S: string): boolean;
  582. var _Is: boolean;
  583. Idx,Item: sw_integer;
  584. begin
  585. Idx:=length(S); _Is:=false;
  586. if (Low(ReservedWords)<=Idx) and (Idx<=High(ReservedWords)) and
  587. (ReservedWords[Idx]<>nil) and (ReservedWords[Idx]^.Count<>0) then
  588. begin
  589. S:=UpcaseStr(S);
  590. _Is:=ReservedWords[Idx]^.Search(@S,Item);
  591. end;
  592. IsFPReservedWord:=_Is;
  593. end;
  594. {*****************************************************************************
  595. SearchWindow
  596. *****************************************************************************}
  597. function SearchWindowWithNo(No: integer): PWindow;
  598. var P: PSourceWindow;
  599. begin
  600. P:=Message(Desktop,evBroadcast,cmSearchWindow+No,nil);
  601. if pointer(P)=pointer(Desktop) then P:=nil;
  602. SearchWindowWithNo:=P;
  603. end;
  604. function SearchFreeWindowNo: integer;
  605. var No: integer;
  606. begin
  607. No:=1;
  608. while (No<100) and (SearchWindowWithNo(No)<>nil) do
  609. Inc(No);
  610. if No=100 then No:=0;
  611. SearchFreeWindowNo:=No;
  612. end;
  613. {*****************************************************************************
  614. TIntegerLine
  615. *****************************************************************************}
  616. constructor TIntegerLine.Init(var Bounds: TRect; AMin, AMax: longint);
  617. begin
  618. inherited Init(Bounds, Bounds.B.X-Bounds.A.X-1);
  619. Validator:=New(PRangeValidator, Init(AMin, AMax));
  620. end;
  621. {*****************************************************************************
  622. SourceEditor
  623. *****************************************************************************}
  624. {$ifndef EDITORS}
  625. function TSourceEditor.GetSpecSymbolCount(SpecClass: TSpecSymbolClass): integer;
  626. var Count: integer;
  627. begin
  628. case SpecClass of
  629. ssCommentPrefix : Count:=3;
  630. ssCommentSingleLinePrefix : Count:=1;
  631. ssCommentSuffix : Count:=2;
  632. ssStringPrefix : Count:=1;
  633. ssStringSuffix : Count:=1;
  634. ssAsmPrefix : Count:=1;
  635. ssAsmSuffix : Count:=1;
  636. ssDirectivePrefix : Count:=1;
  637. ssDirectiveSuffix : Count:=1;
  638. end;
  639. GetSpecSymbolCount:=Count;
  640. end;
  641. function TSourceEditor.GetSpecSymbol(SpecClass: TSpecSymbolClass; Index: integer): string;
  642. var S: string[20];
  643. begin
  644. case SpecClass of
  645. ssCommentPrefix :
  646. case Index of
  647. 0 : S:='{';
  648. 1 : S:='(*';
  649. 2 : S:='//';
  650. end;
  651. ssCommentSingleLinePrefix :
  652. case Index of
  653. 0 : S:='//';
  654. end;
  655. ssCommentSuffix :
  656. case Index of
  657. 0 : S:='}';
  658. 1 : S:='*)';
  659. end;
  660. ssStringPrefix :
  661. S:='''';
  662. ssStringSuffix :
  663. S:='''';
  664. ssAsmPrefix :
  665. S:='asm';
  666. ssAsmSuffix :
  667. S:='end';
  668. ssDirectivePrefix :
  669. S:='{$';
  670. ssDirectiveSuffix :
  671. S:='}';
  672. end;
  673. GetSpecSymbol:=S;
  674. end;
  675. constructor TSourceEditor.Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
  676. PScrollBar; AIndicator: PIndicator;const AFileName: string);
  677. begin
  678. inherited Init(Bounds,AHScrollBar,AVScrollBar,AIndicator,AFileName);
  679. StoreUndo:=true;
  680. end;
  681. function TSourceEditor.IsReservedWord(const S: string): boolean;
  682. begin
  683. IsReservedWord:=IsFPReservedWord(S);
  684. end;
  685. {$endif EDITORS}
  686. procedure TSourceEditor.ModifiedChanged;
  687. begin
  688. inherited ModifiedChanged;
  689. if (@Self<>Clipboard) and Modified then
  690. EditorModified:=true;
  691. end;
  692. function TSourceEditor.GetLocalMenu: PMenu;
  693. var M: PMenu;
  694. begin
  695. M:=NewMenu(
  696. NewItem('Cu~t~','Shift+Del',kbShiftDel,cmCut,hcCut,
  697. NewItem('~C~opy','Ctrl+Ins',kbCtrlIns,cmCopy,hcCopy,
  698. NewItem('~P~aste','Shift+Ins',kbShiftIns,cmPaste,hcPaste,
  699. NewItem('C~l~ear','Ctrl+Del',kbCtrlDel,cmClear,hcClear,
  700. NewLine(
  701. NewItem('Open ~f~ile at cursor','',kbNoKey,cmOpenAtCursor,hcOpenAtCursor,
  702. NewItem('~B~rowse symbol at cursor','',kbNoKey,cmBrowseAtCursor,hcBrowseAtCursor,
  703. NewItem('Topic ~s~earch','Ctrl+F1',kbCtrlF1,cmHelpTopicSearch,hcHelpTopicSearch,
  704. NewLine(
  705. NewItem('~O~ptions...','',kbNoKey,cmEditorOptions,hcEditorOptions,
  706. nil)))))))))));
  707. GetLocalMenu:=M;
  708. end;
  709. function TSourceEditor.GetCommandTarget: PView;
  710. begin
  711. GetCommandTarget:=@Self;
  712. end;
  713. function TSourceEditor.CreateLocalMenuView(var Bounds: TRect; M: PMenu): PMenuPopup;
  714. var MV: PAdvancedMenuPopup;
  715. begin
  716. New(MV, Init(Bounds,M));
  717. CreateLocalMenuView:=MV;
  718. end;
  719. {$ifdef DebugUndo}
  720. procedure TSourceEditor.DumpUndo;
  721. var
  722. i : sw_integer;
  723. begin
  724. ClearToolMessages;
  725. AddToolCommand('UndoList Dump');
  726. for i:=0 to UndoList^.count-1 do
  727. with UndoList^.At(i)^ do
  728. begin
  729. if is_grouped_action then
  730. AddToolMessage('','Group '+ActionString[action]+' '+IntToStr(ActionCount)+' elementary actions',0,0)
  731. else
  732. AddToolMessage('',ActionString[action]+' '+IntToStr(StartPos.X)+':'+IntToStr(StartPos.Y)+
  733. ' '+IntToStr(EndPos.X)+':'+IntToStr(EndPos.Y)+' "'+GetStr(Text)+'"',0,0);
  734. end;
  735. if RedoList^.count>0 then
  736. AddToolCommand('RedoList Dump');
  737. for i:=0 to RedoList^.count-1 do
  738. with RedoList^.At(i)^ do
  739. begin
  740. if is_grouped_action then
  741. AddToolMessage('','Group '+ActionString[action]+' '+IntToStr(ActionCount)+' elementary actions',0,0)
  742. else
  743. AddToolMessage('',ActionString[action]+' '+IntToStr(StartPos.X)+':'+IntToStr(StartPos.Y)+
  744. ' '+IntToStr(EndPos.X)+':'+IntToStr(EndPos.Y)+' "'+GetStr(Text)+'"',0,0);
  745. end;
  746. UpdateToolMessages;
  747. if Assigned(MessagesWindow) then
  748. MessagesWindow^.Focus;
  749. end;
  750. procedure TSourceEditor.UndoAll;
  751. begin
  752. While UndoList^.count>0 do
  753. Undo;
  754. end;
  755. procedure TSourceEditor.RedoAll;
  756. begin
  757. While RedoList^.count>0 do
  758. Redo;
  759. end;
  760. {$endif DebugUndo}
  761. procedure TSourceEditor.HandleEvent(var Event: TEvent);
  762. var DontClear: boolean;
  763. S: string;
  764. begin
  765. TranslateMouseClick(@Self,Event);
  766. case Event.What of
  767. evCommand :
  768. begin
  769. DontClear:=false;
  770. case Event.Command of
  771. {$ifdef DebugUndo}
  772. cmDumpUndo : DumpUndo;
  773. cmUndoAll : UndoAll;
  774. cmRedoAll : RedoAll;
  775. {$endif DebugUndo}
  776. cmBrowseAtCursor:
  777. begin
  778. S:=LowerCaseStr(GetEditorCurWord(@Self));
  779. OpenOneSymbolBrowser(S);
  780. end;
  781. cmOpenAtCursor :
  782. begin
  783. S:=LowerCaseStr(GetEditorCurWord(@Self));
  784. OpenFileName:=S+'.pp'+ListSeparator+
  785. S+'.pas'+ListSeparator+
  786. S+'.inc';
  787. Message(Application,evCommand,cmOpen,nil);
  788. end;
  789. cmEditorOptions :
  790. Message(Application,evCommand,cmEditorOptions,@Self);
  791. cmHelp :
  792. Message(@Self,evCommand,cmHelpTopicSearch,@Self);
  793. cmHelpTopicSearch :
  794. HelpTopicSearch(@Self);
  795. else DontClear:=true;
  796. end;
  797. if not DontClear then ClearEvent(Event);
  798. end;
  799. end;
  800. inherited HandleEvent(Event);
  801. end;
  802. constructor TFPHeapView.Init(var Bounds: TRect);
  803. begin
  804. inherited Init(Bounds);
  805. Options:=Options or gfGrowHiX or gfGrowHiY;
  806. EventMask:=EventMask or evIdle;
  807. GrowMode:=gfGrowAll;
  808. end;
  809. constructor TFPHeapView.InitKb(var Bounds: TRect);
  810. begin
  811. inherited InitKb(Bounds);
  812. Options:=Options or gfGrowHiX or gfGrowHiY;
  813. EventMask:=EventMask or evIdle;
  814. GrowMode:=gfGrowAll;
  815. end;
  816. procedure TFPHeapView.HandleEvent(var Event: TEvent);
  817. begin
  818. case Event.What of
  819. evIdle :
  820. Update;
  821. end;
  822. inherited HandleEvent(Event);
  823. end;
  824. constructor TFPClockView.Init(var Bounds: TRect);
  825. begin
  826. inherited Init(Bounds);
  827. EventMask:=EventMask or evIdle;
  828. end;
  829. procedure TFPClockView.HandleEvent(var Event: TEvent);
  830. begin
  831. case Event.What of
  832. evIdle :
  833. Update;
  834. end;
  835. inherited HandleEvent(Event);
  836. end;
  837. function TFPClockView.GetPalette: PPalette;
  838. const P: string[length(CFPClockView)] = CFPClockView;
  839. begin
  840. GetPalette:=@P;
  841. end;
  842. procedure TFPWindow.SetState(AState: Word; Enable: Boolean);
  843. begin
  844. inherited SetState(AState,Enable);
  845. if AutoNumber then
  846. if (AState and (sfVisible+sfExposed))<>0 then
  847. if GetState(sfVisible+sfExposed) then
  848. begin
  849. if Number=0 then
  850. Number:=SearchFreeWindowNo;
  851. ReDraw;
  852. end
  853. else
  854. Number:=0;
  855. end;
  856. procedure TFPWindow.Update;
  857. begin
  858. ReDraw;
  859. end;
  860. procedure TFPWindow.HandleEvent(var Event: TEvent);
  861. begin
  862. case Event.What of
  863. evBroadcast :
  864. case Event.Command of
  865. cmUpdate :
  866. Update;
  867. cmSearchWindow+1..cmSearchWindow+99 :
  868. if (Event.Command-cmSearchWindow=Number) then
  869. ClearEvent(Event);
  870. end;
  871. end;
  872. inherited HandleEvent(Event);
  873. end;
  874. constructor TFPWindow.Load(var S: TStream);
  875. begin
  876. inherited Load(S);
  877. S.Read(AutoNumber,SizeOf(AutoNumber));
  878. end;
  879. procedure TFPWindow.Store(var S: TStream);
  880. begin
  881. inherited Store(S);
  882. S.Write(AutoNumber,SizeOf(AutoNumber));
  883. end;
  884. function TFPHelpViewer.GetLocalMenu: PMenu;
  885. var M: PMenu;
  886. begin
  887. M:=NewMenu(
  888. NewItem('C~o~ntents','',kbNoKey,cmHelpContents,hcHelpContents,
  889. NewItem('~I~ndex','Shift+F1',kbShiftF1,cmHelpIndex,hcHelpIndex,
  890. NewItem('~T~opic search','Ctrl+F1',kbCtrlF1,cmHelpTopicSearch,hcHelpTopicSearch,
  891. NewItem('~P~revious topic','Alt+F1',kbAltF1,cmHelpPrevTopic,hcHelpPrevTopic,
  892. NewLine(
  893. NewItem('~C~opy','Ctrl+Ins',kbCtrlIns,cmCopy,hcCopy,
  894. nil)))))));
  895. GetLocalMenu:=M;
  896. end;
  897. function TFPHelpViewer.GetCommandTarget: PView;
  898. begin
  899. GetCommandTarget:=Application;
  900. end;
  901. constructor TFPHelpWindow.Init(var Bounds: TRect; ATitle: TTitleStr; ASourceFileID: word;
  902. AContext: THelpCtx; ANumber: Integer);
  903. begin
  904. inherited Init(Bounds,ATitle,ASourceFileID,AContext,ANumber);
  905. HelpCtx:=hcHelpWindow;
  906. HideOnClose:=true;
  907. end;
  908. destructor TFPHelpWindow.Done;
  909. begin
  910. if HelpWindow=@Self then
  911. HelpWindow:=nil;
  912. Inherited Done;
  913. end;
  914. procedure TFPHelpWindow.InitHelpView;
  915. var R: TRect;
  916. begin
  917. GetExtent(R); R.Grow(-1,-1);
  918. HelpView:=New(PFPHelpViewer, Init(R, HSB, VSB));
  919. HelpView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  920. end;
  921. procedure TFPHelpWindow.Show;
  922. begin
  923. inherited Show;
  924. if GetState(sfVisible) and (Number=0) then
  925. begin
  926. Number:=SearchFreeWindowNo;
  927. ReDraw;
  928. end;
  929. end;
  930. procedure TFPHelpWindow.Hide;
  931. begin
  932. inherited Hide;
  933. if GetState(sfVisible)=false then
  934. Number:=0;
  935. end;
  936. procedure TFPHelpWindow.HandleEvent(var Event: TEvent);
  937. begin
  938. case Event.What of
  939. evBroadcast :
  940. case Event.Command of
  941. cmUpdate :
  942. ReDraw;
  943. cmSearchWindow+1..cmSearchWindow+99 :
  944. if (Event.Command-cmSearchWindow=Number) then
  945. ClearEvent(Event);
  946. end;
  947. end;
  948. inherited HandleEvent(Event);
  949. end;
  950. function TFPHelpWindow.GetPalette: PPalette;
  951. const P: string[length(CIDEHelpDialog)] = CIDEHelpDialog;
  952. begin
  953. GetPalette:=@P;
  954. end;
  955. constructor TFPHelpWindow.Load(var S: TStream);
  956. begin
  957. Abstract;
  958. end;
  959. procedure TFPHelpWindow.Store(var S: TStream);
  960. begin
  961. Abstract;
  962. end;
  963. constructor TSourceWindow.Init(var Bounds: TRect; AFileName: string);
  964. var HSB,VSB: PScrollBar;
  965. R: TRect;
  966. LoadFile: boolean;
  967. begin
  968. inherited Init(Bounds,AFileName,SearchFreeWindowNo);
  969. Options:=Options or ofTileAble;
  970. GetExtent(R); R.A.Y:=R.B.Y-1; R.Grow(-1,0); R.A.X:=14;
  971. New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
  972. GetExtent(R); R.A.X:=R.B.X-1; R.Grow(0,-1);
  973. New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  974. GetExtent(R); R.A.X:=3; R.B.X:=14; R.A.Y:=R.B.Y-1;
  975. New(Indicator, Init(R));
  976. Indicator^.GrowMode:=gfGrowLoY+gfGrowHiY;
  977. Insert(Indicator);
  978. GetExtent(R); R.Grow(-1,-1);
  979. LoadFile:=AFileName<>'';
  980. if not LoadFile then
  981. begin SetTitle('noname'+IntToStrZ(NonameCount,2)+'.pas'); Inc(NonameCount); end;
  982. New(Editor, Init(R, HSB, VSB, Indicator,AFileName));
  983. Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
  984. if LoadFile then
  985. if Editor^.LoadFile=false then
  986. ErrorBox(#3'Error reading file.',nil);
  987. Insert(Editor);
  988. UpdateTitle;
  989. end;
  990. procedure TSourceWindow.UpdateTitle;
  991. var Name: string;
  992. begin
  993. if Editor^.FileName<>'' then
  994. begin Name:=SmartPath(Editor^.FileName); SetTitle(Name); end;
  995. end;
  996. procedure TSourceWindow.SetTitle(ATitle: string);
  997. begin
  998. if Title<>nil then DisposeStr(Title);
  999. Title:=NewStr(ATitle);
  1000. Frame^.DrawView;
  1001. end;
  1002. procedure TSourceWindow.HandleEvent(var Event: TEvent);
  1003. var DontClear: boolean;
  1004. begin
  1005. case Event.What of
  1006. evBroadcast :
  1007. case Event.Command of
  1008. cmUpdate :
  1009. Update;
  1010. cmUpdateTitle :
  1011. UpdateTitle;
  1012. cmSearchWindow :
  1013. if @Self<>ClipboardWindow then
  1014. ClearEvent(Event);
  1015. end;
  1016. evCommand :
  1017. begin
  1018. DontClear:=false;
  1019. case Event.Command of
  1020. cmSave :
  1021. if Editor^.IsClipboard=false then
  1022. Editor^.Save;
  1023. cmSaveAs :
  1024. if Editor^.IsClipboard=false then
  1025. Editor^.SaveAs;
  1026. else DontClear:=true;
  1027. end;
  1028. if DontClear=false then ClearEvent(Event);
  1029. end;
  1030. end;
  1031. inherited HandleEvent(Event);
  1032. end;
  1033. procedure TSourceWindow.SetState(AState: Word; Enable: Boolean);
  1034. var OldState: word;
  1035. begin
  1036. OldState:=State;
  1037. inherited SetState(AState,Enable);
  1038. if ((AState xor State) and sfActive)<>0 then
  1039. UpdateCommands;
  1040. end;
  1041. procedure TSourceWindow.UpdateCommands;
  1042. var Active: boolean;
  1043. begin
  1044. Active:=GetState(sfActive);
  1045. if Editor^.IsClipboard=false then
  1046. begin
  1047. SetCmdState(SourceCmds+CompileCmds,Active);
  1048. SetCmdState(EditorCmds,Active);
  1049. end;
  1050. if Active=false then
  1051. SetCmdState(ToClipCmds+FromClipCmds+NulClipCmds+UndoCmd+RedoCmd,false);
  1052. Message(Application,evBroadcast,cmCommandSetChanged,nil);
  1053. end;
  1054. procedure TSourceWindow.Update;
  1055. begin
  1056. ReDraw;
  1057. end;
  1058. function TSourceWindow.GetPalette: PPalette;
  1059. const P: string[length(CSourceWindow)] = CSourceWindow;
  1060. begin
  1061. GetPalette:=@P;
  1062. end;
  1063. constructor TSourceWindow.Load(var S: TStream);
  1064. begin
  1065. Title:=S.ReadStr;
  1066. PushStatus('Loading '+GetStr(Title));
  1067. inherited Load(S);
  1068. GetSubViewPtr(S,Indicator);
  1069. GetSubViewPtr(S,Editor);
  1070. PopStatus;
  1071. end;
  1072. procedure TSourceWindow.Store(var S: TStream);
  1073. begin
  1074. S.WriteStr(Title);
  1075. PushStatus('Storing '+GetStr(Title));
  1076. inherited Store(S);
  1077. PutSubViewPtr(S,Indicator);
  1078. PutSubViewPtr(S,Editor);
  1079. PopStatus;
  1080. end;
  1081. destructor TSourceWindow.Done;
  1082. begin
  1083. Message(Application,evBroadcast,cmSourceWndClosing,@Self);
  1084. inherited Done;
  1085. Message(Application,evBroadcast,cmUpdate,@Self);
  1086. end;
  1087. function TGDBSourceEditor.Valid(Command: Word): Boolean;
  1088. var OK: boolean;
  1089. begin
  1090. OK:=TCodeEditor.Valid(Command);
  1091. { do NOT ask for save !!
  1092. if OK and ((Command=cmClose) or (Command=cmQuit)) then
  1093. if IsClipboard=false then
  1094. OK:=SaveAsk; }
  1095. Valid:=OK;
  1096. end;
  1097. procedure TGDBSourceEditor.AddLine(const S: string);
  1098. begin
  1099. if Silent or (IgnoreStringAtEnd and (S=LastCommand)) then exit;
  1100. inherited AddLine(S);
  1101. LimitsChanged;
  1102. end;
  1103. procedure TGDBSourceEditor.AddErrorLine(const S: string);
  1104. begin
  1105. if Silent then exit;
  1106. inherited AddLine(S);
  1107. { display like breakpoints in red }
  1108. Lines^.At(GetLineCount-1)^.IsBreakpoint:=true;
  1109. LimitsChanged;
  1110. end;
  1111. function TGDBSourceEditor.InsertLine: Sw_integer;
  1112. Var
  1113. S : string;
  1114. begin
  1115. if IsReadOnly then begin InsertLine:=-1; Exit; end;
  1116. if CurPos.Y<GetLineCount then S:=GetDisplayText(CurPos.Y) else S:='';
  1117. s:=Copy(S,1,CurPos.X);
  1118. if assigned(Debugger) then
  1119. if S<>'' then
  1120. begin
  1121. LastCommand:=S;
  1122. { should be true only if we are at the end ! }
  1123. IgnoreStringAtEnd:=(CurPos.Y=GetLineCount-1) and
  1124. (CurPos.X=length(GetDisplayText(GetLineCount-1)));
  1125. Debugger^.Command(S);
  1126. IgnoreStringAtEnd:=false;
  1127. end
  1128. else if AutoRepeat then
  1129. Debugger^.Command(LastCommand);
  1130. InsertLine:=inherited InsertLine;
  1131. end;
  1132. constructor TGDBWindow.Init(var Bounds: TRect);
  1133. var HSB,VSB: PScrollBar;
  1134. R: TRect;
  1135. begin
  1136. inherited Init(Bounds,'GDB window',0);
  1137. Options:=Options or ofTileAble;
  1138. AutoNumber:=true;
  1139. HelpCtx:=hcGDBWindow;
  1140. GetExtent(R); R.A.Y:=R.B.Y-1; R.Grow(-1,0); R.A.X:=14;
  1141. New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
  1142. GetExtent(R); R.A.X:=R.B.X-1; R.Grow(0,-1);
  1143. New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  1144. GetExtent(R); R.A.X:=3; R.B.X:=14; R.A.Y:=R.B.Y-1;
  1145. New(Indicator, Init(R));
  1146. Indicator^.GrowMode:=gfGrowLoY+gfGrowHiY;
  1147. Insert(Indicator);
  1148. GetExtent(R); R.Grow(-1,-1);
  1149. New(Editor, Init(R, HSB, VSB, nil, GDBOutputFile));
  1150. Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1151. if ExistsFile(GDBOutputFile) then
  1152. begin
  1153. if Editor^.LoadFile=false then
  1154. ErrorBox(#3'Error reading file.',nil);
  1155. end
  1156. else
  1157. { Empty files are buggy !! }
  1158. Editor^.AddLine('');
  1159. Insert(Editor);
  1160. if assigned(Debugger) then
  1161. Debugger^.Command('set width '+IntToStr(Size.X-1));
  1162. Editor^.silent:=false;
  1163. Editor^.AutoRepeat:=true;
  1164. end;
  1165. destructor TGDBWindow.Done;
  1166. begin
  1167. if @Self=GDBWindow then
  1168. GDBWindow:=nil;
  1169. inherited Done;
  1170. end;
  1171. constructor TGDBWindow.Load(var S: TStream);
  1172. begin
  1173. inherited Load(S);
  1174. GetSubViewPtr(S,Indicator);
  1175. GetSubViewPtr(S,Editor);
  1176. end;
  1177. procedure TGDBWindow.Store(var S: TStream);
  1178. begin
  1179. inherited Store(S);
  1180. PutSubViewPtr(S,Indicator);
  1181. PutSubViewPtr(S,Editor);
  1182. end;
  1183. function TGDBWindow.GetPalette: PPalette;
  1184. const P: string[length(CSourceWindow)] = CSourceWindow;
  1185. begin
  1186. GetPalette:=@P;
  1187. end;
  1188. procedure TGDBWindow.WriteOutputText(Buf : pchar);
  1189. begin
  1190. {selected normal color ?}
  1191. WriteText(Buf,false);
  1192. end;
  1193. procedure TGDBWindow.WriteErrorText(Buf : pchar);
  1194. begin
  1195. {selected normal color ?}
  1196. WriteText(Buf,true);
  1197. end;
  1198. procedure TGDBWindow.WriteString(Const S : string);
  1199. begin
  1200. Editor^.AddLine(S);
  1201. end;
  1202. procedure TGDBWindow.WriteErrorString(Const S : string);
  1203. begin
  1204. Editor^.AddErrorLine(S);
  1205. end;
  1206. procedure TGDBWindow.WriteText(Buf : pchar;IsError : boolean);
  1207. var p,pe : pchar;
  1208. s : string;
  1209. begin
  1210. p:=buf;
  1211. DeskTop^.Lock;
  1212. While assigned(p) do
  1213. begin
  1214. pe:=strscan(p,#10);
  1215. if pe<>nil then
  1216. pe^:=#0;
  1217. s:=strpas(p);
  1218. If IsError then
  1219. Editor^.AddErrorLine(S)
  1220. else
  1221. Editor^.AddLine(S);
  1222. { restore for dispose }
  1223. if pe<>nil then
  1224. pe^:=#10;
  1225. if pe=nil then
  1226. p:=nil
  1227. else
  1228. begin
  1229. p:=pe;
  1230. inc(p);
  1231. end;
  1232. end;
  1233. DeskTop^.Unlock;
  1234. Editor^.Draw;
  1235. end;
  1236. constructor TClipboardWindow.Init;
  1237. var R: TRect;
  1238. HSB,VSB: PScrollBar;
  1239. begin
  1240. Desktop^.GetExtent(R);
  1241. inherited Init(R, '');
  1242. SetTitle('Clipboard');
  1243. HelpCtx:=hcClipboardWindow;
  1244. Number:=wnNoNumber;
  1245. AutoNumber:=true;
  1246. GetExtent(R); R.A.Y:=R.B.Y-1; R.Grow(-1,0); R.A.X:=14;
  1247. New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
  1248. GetExtent(R); R.A.X:=R.B.X-1; R.Grow(0,-1);
  1249. New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  1250. GetExtent(R); R.A.X:=3; R.B.X:=14; R.A.Y:=R.B.Y-1;
  1251. New(Indicator, Init(R));
  1252. Indicator^.GrowMode:=gfGrowLoY+gfGrowHiY;
  1253. Insert(Indicator);
  1254. GetExtent(R); R.Grow(-1,-1);
  1255. New(Editor, Init(R, HSB, VSB, Indicator, ''));
  1256. Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1257. Insert(Editor);
  1258. Hide;
  1259. Clipboard:=Editor;
  1260. end;
  1261. procedure TClipboardWindow.Close;
  1262. begin
  1263. Hide;
  1264. end;
  1265. constructor TClipboardWindow.Load(var S: TStream);
  1266. begin
  1267. inherited Load(S);
  1268. Clipboard:=Editor;
  1269. end;
  1270. procedure TClipboardWindow.Store(var S: TStream);
  1271. begin
  1272. inherited Store(S);
  1273. end;
  1274. destructor TClipboardWindow.Done;
  1275. begin
  1276. inherited Done;
  1277. Clipboard:=nil;
  1278. ClipboardWindow:=nil;
  1279. end;
  1280. constructor TMessageListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  1281. begin
  1282. inherited Init(Bounds,1,AHScrollBar, AVScrollBar);
  1283. GrowMode:=gfGrowHiX+gfGrowHiY;
  1284. New(ModuleNames, Init(50,100));
  1285. NoSelection:=true;
  1286. end;
  1287. function TMessageListBox.GetLocalMenu: PMenu;
  1288. var M: PMenu;
  1289. begin
  1290. if (Owner<>nil) and (Owner^.GetState(sfModal)) then M:=nil else
  1291. M:=NewMenu(
  1292. NewItem('~C~lear','',kbNoKey,cmMsgClear,hcMsgClear,
  1293. NewLine(
  1294. NewItem('~G~oto source','',kbNoKey,cmMsgGotoSource,hcMsgGotoSource,
  1295. NewItem('~T~rack source','',kbNoKey,cmMsgTrackSource,hcMsgTrackSource,
  1296. nil)))));
  1297. GetLocalMenu:=M;
  1298. end;
  1299. procedure TMessageListBox.HandleEvent(var Event: TEvent);
  1300. var DontClear: boolean;
  1301. begin
  1302. case Event.What of
  1303. evKeyDown :
  1304. begin
  1305. DontClear:=false;
  1306. case Event.KeyCode of
  1307. kbEnter :
  1308. Message(@Self,evCommand,cmMsgGotoSource,nil);
  1309. else
  1310. DontClear:=true;
  1311. end;
  1312. if not DontClear then
  1313. ClearEvent(Event);
  1314. end;
  1315. evBroadcast :
  1316. case Event.Command of
  1317. cmListItemSelected :
  1318. if Event.InfoPtr=@Self then
  1319. Message(@Self,evCommand,cmMsgTrackSource,nil);
  1320. end;
  1321. evCommand :
  1322. begin
  1323. DontClear:=false;
  1324. case Event.Command of
  1325. cmMsgGotoSource :
  1326. if Range>0 then
  1327. GotoSource;
  1328. cmMsgTrackSource :
  1329. if Range>0 then
  1330. TrackSource;
  1331. cmMsgClear :
  1332. Clear;
  1333. else
  1334. DontClear:=true;
  1335. end;
  1336. if not DontClear then
  1337. ClearEvent(Event);
  1338. end;
  1339. end;
  1340. inherited HandleEvent(Event);
  1341. end;
  1342. procedure TMessageListBox.AddItem(P: PMessageItem);
  1343. var W : integer;
  1344. begin
  1345. if List=nil then New(List, Init(500,500));
  1346. W:=length(P^.GetText(255));
  1347. if W>MaxWidth then
  1348. begin
  1349. MaxWidth:=W;
  1350. if HScrollBar<>nil then
  1351. HScrollBar^.SetRange(0,MaxWidth);
  1352. end;
  1353. List^.Insert(P);
  1354. SetRange(List^.Count);
  1355. if Focused=List^.Count-1-1 then
  1356. FocusItem(List^.Count-1);
  1357. DrawView;
  1358. end;
  1359. function TMessageListBox.AddModuleName(const Name: string): PString;
  1360. var P: PString;
  1361. begin
  1362. if ModuleNames<>nil then
  1363. P:=ModuleNames^.Add(Name)
  1364. else
  1365. P:=nil;
  1366. AddModuleName:=P;
  1367. end;
  1368. function TMessageListBox.GetText(Item,MaxLen: Sw_Integer): String;
  1369. var P: PMessageItem;
  1370. S: string;
  1371. begin
  1372. P:=List^.At(Item);
  1373. S:=P^.GetText(MaxLen);
  1374. GetText:=copy(S,1,MaxLen);
  1375. end;
  1376. procedure TMessageListBox.Clear;
  1377. begin
  1378. if assigned(List) then
  1379. Dispose(List, Done);
  1380. List:=nil;
  1381. MaxWidth:=0;
  1382. if assigned(ModuleNames) then
  1383. ModuleNames^.FreeAll;
  1384. SetRange(0); DrawView;
  1385. Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  1386. end;
  1387. procedure TMessageListBox.TrackSource;
  1388. var W: PSourceWindow;
  1389. P: PMessageItem;
  1390. R: TRect;
  1391. Row,Col: sw_integer;
  1392. begin
  1393. Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  1394. if Range=0 then Exit;
  1395. P:=List^.At(Focused);
  1396. if P^.Row=0 then Exit;
  1397. Desktop^.Lock;
  1398. GetNextEditorBounds(R);
  1399. {$ifdef OLDCOMP}
  1400. if Assigned(Owner) and (Owner=pointer(ProgramInfoWindow)) then
  1401. {$endif}
  1402. R.B.Y:=Owner^.Origin.Y;
  1403. if P^.Row>0 then Row:=P^.Row-1 else Row:=0;
  1404. if P^.Col>0 then Col:=P^.Col-1 else Col:=0;
  1405. W:=EditorWindowFile(P^.GetModuleName);
  1406. if assigned(W) then
  1407. begin
  1408. W^.GetExtent(R);
  1409. {$ifdef OLDCOMP}
  1410. if Assigned(Owner) and (Owner=pointer(ProgramInfoWindow)) then
  1411. {$endif}
  1412. R.B.Y:=Owner^.Origin.Y;
  1413. W^.ChangeBounds(R);
  1414. W^.Editor^.SetCurPtr(Col,Row);
  1415. end
  1416. else
  1417. W:=TryToOpenFile(@R,P^.GetModuleName,Col,Row,true);
  1418. if W<>nil then
  1419. begin
  1420. W^.Select;
  1421. W^.Editor^.TrackCursor(true);
  1422. W^.Editor^.SetHighlightRow(Row);
  1423. end;
  1424. if Assigned(Owner) then
  1425. Owner^.Select;
  1426. Desktop^.UnLock;
  1427. end;
  1428. procedure TMessageListBox.GotoSource;
  1429. var W: PSourceWindow;
  1430. P: PMessageItem;
  1431. Row,Col: sw_integer;
  1432. begin
  1433. Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  1434. if Range=0 then Exit;
  1435. P:=List^.At(Focused);
  1436. if P^.Row=0 then Exit;
  1437. Desktop^.Lock;
  1438. if P^.Row>0 then Row:=P^.Row-1 else Row:=0;
  1439. if P^.Col>0 then Col:=P^.Col-1 else Col:=0;
  1440. W:=TryToOpenFile(nil,P^.GetModuleName,Col,Row,true);
  1441. Message(Owner,evCommand,cmClose,nil);
  1442. W^.Select;
  1443. Desktop^.UnLock;
  1444. end;
  1445. procedure TMessageListBox.Draw;
  1446. var
  1447. I, J, Item: Sw_Integer;
  1448. NormalColor, SelectedColor, FocusedColor, Color: Word;
  1449. ColWidth, CurCol, Indent: Integer;
  1450. B: TDrawBuffer;
  1451. Text: String;
  1452. SCOff: Byte;
  1453. TC: byte;
  1454. procedure MT(var C: word); begin if TC<>0 then C:=(C and $ff0f) or (TC and $f0); end;
  1455. begin
  1456. if (Owner<>nil) then TC:=ord(Owner^.GetColor(6)) else TC:=0;
  1457. if State and (sfSelected + sfActive) = (sfSelected + sfActive) then
  1458. begin
  1459. NormalColor := GetColor(1);
  1460. FocusedColor := GetColor(3);
  1461. SelectedColor := GetColor(4);
  1462. end else
  1463. begin
  1464. NormalColor := GetColor(2);
  1465. SelectedColor := GetColor(4);
  1466. end;
  1467. if Transparent then
  1468. begin MT(NormalColor); MT(SelectedColor); end;
  1469. if NoSelection then
  1470. SelectedColor:=NormalColor;
  1471. if HScrollBar <> nil then Indent := HScrollBar^.Value
  1472. else Indent := 0;
  1473. ColWidth := Size.X div NumCols + 1;
  1474. for I := 0 to Size.Y - 1 do
  1475. begin
  1476. for J := 0 to NumCols-1 do
  1477. begin
  1478. Item := J*Size.Y + I + TopItem;
  1479. CurCol := J*ColWidth;
  1480. if (State and (sfSelected + sfActive) = (sfSelected + sfActive)) and
  1481. (Focused = Item) and (Range > 0) then
  1482. begin
  1483. Color := FocusedColor;
  1484. SetCursor(CurCol+1,I);
  1485. SCOff := 0;
  1486. end
  1487. else if (Item < Range) and IsSelected(Item) then
  1488. begin
  1489. Color := SelectedColor;
  1490. SCOff := 2;
  1491. end
  1492. else
  1493. begin
  1494. Color := NormalColor;
  1495. SCOff := 4;
  1496. end;
  1497. MoveChar(B[CurCol], ' ', Color, ColWidth);
  1498. if Item < Range then
  1499. begin
  1500. Text := GetText(Item, ColWidth + Indent);
  1501. Text := Copy(Text,Indent,ColWidth);
  1502. MoveStr(B[CurCol+1], Text, Color);
  1503. if ShowMarkers then
  1504. begin
  1505. WordRec(B[CurCol]).Lo := Byte(SpecialChars[SCOff]);
  1506. WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
  1507. end;
  1508. end;
  1509. MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);
  1510. end;
  1511. WriteLine(0, I, Size.X, 1, B);
  1512. end;
  1513. end;
  1514. constructor TMessageListBox.Load(var S: TStream);
  1515. begin
  1516. inherited Load(S);
  1517. New(ModuleNames, Init(50,100));
  1518. NoSelection:=true;
  1519. end;
  1520. procedure TMessageListBox.Store(var S: TStream);
  1521. var OL: PCollection;
  1522. ORV: sw_integer;
  1523. begin
  1524. OL:=List; ORV:=Range;
  1525. New(List, Init(1,1)); Range:=0;
  1526. inherited Store(S);
  1527. Dispose(List, Done);
  1528. List:=OL; Range:=ORV;
  1529. { ^^^ nasty trick - has anyone a better idea how to avoid storing the
  1530. collection? Pasting here a modified version of TListBox.Store+
  1531. TAdvancedListBox.Store isn't a better solution, since by eventually
  1532. changing the obj-hierarchy you'll always have to modify this, too - BG }
  1533. end;
  1534. destructor TMessageListBox.Done;
  1535. begin
  1536. inherited Done;
  1537. if List<>nil then Dispose(List, Done);
  1538. if ModuleNames<>nil then Dispose(ModuleNames, Done);
  1539. end;
  1540. constructor TMessageItem.Init(AClass: longint; const AText: string; AModule: PString; ARow, ACol: sw_integer);
  1541. begin
  1542. inherited Init;
  1543. TClass:=AClass;
  1544. Text:=NewStr(AText);
  1545. Module:=AModule;
  1546. Row:=ARow; Col:=ACol;
  1547. end;
  1548. function TMessageItem.GetText(MaxLen: Sw_integer): string;
  1549. var S: string;
  1550. begin
  1551. if Text=nil then S:='' else S:=Text^;
  1552. if (Module<>nil) then
  1553. S:=NameAndExtOf(Module^)+'('+IntToStr(Row)+') '+S;
  1554. if length(S)>MaxLen then S:=copy(S,1,MaxLen-2)+'..';
  1555. GetText:=S;
  1556. end;
  1557. procedure TMessageItem.Selected;
  1558. begin
  1559. end;
  1560. function TMessageItem.GetModuleName: string;
  1561. begin
  1562. GetModuleName:=GetStr(Module);
  1563. end;
  1564. destructor TMessageItem.Done;
  1565. begin
  1566. inherited Done;
  1567. if Text<>nil then DisposeStr(Text);
  1568. { if Module<>nil then DisposeStr(Module);}
  1569. end;
  1570. {$ifdef OLDCOMP}
  1571. function TCompilerMessage.GetText(MaxLen: Integer): String;
  1572. var ClassS: string[20];
  1573. S: string;
  1574. begin
  1575. if TClass=
  1576. V_Fatal then ClassS:='Fatal' else if TClass =
  1577. V_Error then ClassS:='Error' else if TClass =
  1578. V_Normal then ClassS:='' else if TClass =
  1579. V_Warning then ClassS:='Warning' else if TClass =
  1580. V_Note then ClassS:='Note' else if TClass =
  1581. V_Hint then ClassS:='Hint' else if TClass =
  1582. V_Macro then ClassS:='Macro' else if TClass =
  1583. V_Procedure then ClassS:='Procedure' else if TClass =
  1584. V_Conditional then ClassS:='Conditional' else if TClass =
  1585. V_Info then ClassS:='Info' else if TClass =
  1586. V_Status then ClassS:='Status' else if TClass =
  1587. V_Used then ClassS:='Used' else if TClass =
  1588. V_Tried then ClassS:='Tried' else if TClass =
  1589. V_Debug then ClassS:='Debug'
  1590. else
  1591. ClassS:='???';
  1592. if ClassS<>'' then
  1593. ClassS:=RExpand(ClassS,0)+': ';
  1594. S:=ClassS;
  1595. if (Module<>nil) {and (ID<>0)} then
  1596. S:=S+NameAndExtOf(Module^)+'('+IntToStr(Row)+') ';
  1597. if Text<>nil then S:=S+Text^;
  1598. if length(S)>MaxLen then S:=copy(S,1,MaxLen-2)+'..';
  1599. GetText:=S;
  1600. end;
  1601. {$endif}
  1602. constructor TProgramInfoWindow.Init;
  1603. var R,R2: TRect;
  1604. HSB,VSB: PScrollBar;
  1605. ST: PStaticText;
  1606. C: word;
  1607. const White = 15;
  1608. begin
  1609. Desktop^.GetExtent(R); R.A.Y:=R.B.Y-13;
  1610. inherited Init(R, 'Program Information', wnNoNumber);
  1611. HelpCtx:=hcInfoWindow;
  1612. GetExtent(R); R.Grow(-1,-1); R.B.Y:=R.A.Y+3;
  1613. C:=((Desktop^.GetColor(32+6) and $f0) or White)*256+Desktop^.GetColor(32+6);
  1614. New(InfoST, Init(R,'', C)); InfoST^.GrowMode:=gfGrowHiX;
  1615. InfoST^.DontWrap:=true;
  1616. Insert(InfoST);
  1617. GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,3); R.B.Y:=R.A.Y+1;
  1618. New(ST, Init(R, CharStr('Ä', MaxViewWidth))); ST^.GrowMode:=gfGrowHiX; Insert(ST);
  1619. GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,4);
  1620. R2.Copy(R); Inc(R2.B.Y); R2.A.Y:=R2.B.Y-1;
  1621. New(HSB, Init(R2)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiY+gfGrowHiX; Insert(HSB);
  1622. R2.Copy(R); Inc(R2.B.X); R2.A.X:=R2.B.X-1;
  1623. New(VSB, Init(R2)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  1624. New(LogLB, Init(R,HSB,VSB));
  1625. LogLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1626. LogLB^.Transparent:=true;
  1627. Insert(LogLB);
  1628. Update;
  1629. end;
  1630. procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line, Column: longint);
  1631. begin
  1632. if AClass>=V_Info then Line:=0;
  1633. LogLB^.AddItem(New(PCompilerMessage, Init(AClass, Msg, LogLB^.AddModuleName(Module), Line, Column)));
  1634. end;
  1635. procedure TProgramInfoWindow.ClearMessages;
  1636. begin
  1637. LogLB^.Clear;
  1638. ReDraw;
  1639. end;
  1640. procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
  1641. begin
  1642. inherited SizeLimits(Min,Max);
  1643. Min.X:=30; Min.Y:=9;
  1644. end;
  1645. procedure TProgramInfoWindow.Close;
  1646. begin
  1647. Hide;
  1648. end;
  1649. procedure TProgramInfoWindow.HandleEvent(var Event: TEvent);
  1650. begin
  1651. case Event.What of
  1652. evBroadcast :
  1653. case Event.Command of
  1654. cmUpdate :
  1655. Update;
  1656. end;
  1657. end;
  1658. inherited HandleEvent(Event);
  1659. end;
  1660. procedure TProgramInfoWindow.Update;
  1661. begin
  1662. InfoST^.SetText(
  1663. {#13+ }
  1664. ' Current module : '+MainFile+#13+
  1665. ' Last exit code : '+IntToStr(LastExitCode)+#13+
  1666. ' Available memory : '+IntToStrL(MemAvail div 1024,5)+'K'+#13+
  1667. ''
  1668. );
  1669. end;
  1670. destructor TProgramInfoWindow.Done;
  1671. begin
  1672. inherited Done;
  1673. ProgramInfoWindow:=nil;
  1674. end;
  1675. constructor TTab.Init(var Bounds: TRect; ATabDef: PTabDef);
  1676. begin
  1677. inherited Init(Bounds);
  1678. Options:=Options or ofSelectable or ofFirstClick or ofPreProcess or ofPostProcess;
  1679. GrowMode:=gfGrowHiX+gfGrowHiY+gfGrowRel;
  1680. TabDefs:=ATabDef;
  1681. ActiveDef:=-1;
  1682. SelectTab(0);
  1683. ReDraw;
  1684. end;
  1685. function TTab.TabCount: integer;
  1686. var i: integer;
  1687. P: PTabDef;
  1688. begin
  1689. I:=0; P:=TabDefs;
  1690. while (P<>nil) do
  1691. begin
  1692. Inc(I);
  1693. P:=P^.Next;
  1694. end;
  1695. TabCount:=I;
  1696. end;
  1697. function TTab.AtTab(Index: integer): PTabDef;
  1698. var i: integer;
  1699. P: PTabDef;
  1700. begin
  1701. i:=0; P:=TabDefs;
  1702. while (I<Index) do
  1703. begin
  1704. if P=nil then RunError($AA);
  1705. P:=P^.Next;
  1706. Inc(i);
  1707. end;
  1708. AtTab:=P;
  1709. end;
  1710. procedure TTab.SelectTab(Index: integer);
  1711. var P: PTabItem;
  1712. V: PView;
  1713. begin
  1714. if ActiveDef<>Index then
  1715. begin
  1716. if Owner<>nil then Owner^.Lock;
  1717. Lock;
  1718. { --- Update --- }
  1719. if TabDefs<>nil then
  1720. begin
  1721. DefCount:=1;
  1722. while AtTab(DefCount-1)^.Next<>nil do Inc(DefCount);
  1723. end
  1724. else DefCount:=0;
  1725. if ActiveDef<>-1 then
  1726. begin
  1727. P:=AtTab(ActiveDef)^.Items;
  1728. while P<>nil do
  1729. begin
  1730. if P^.View<>nil then Delete(P^.View);
  1731. P:=P^.Next;
  1732. end;
  1733. end;
  1734. ActiveDef:=Index;
  1735. P:=AtTab(ActiveDef)^.Items;
  1736. while P<>nil do
  1737. begin
  1738. if P^.View<>nil then Insert(P^.View);
  1739. P:=P^.Next;
  1740. end;
  1741. V:=AtTab(ActiveDef)^.DefItem;
  1742. if V<>nil then V^.Select;
  1743. ReDraw;
  1744. { --- Update --- }
  1745. UnLock;
  1746. if Owner<>nil then Owner^.UnLock;
  1747. DrawView;
  1748. end;
  1749. end;
  1750. procedure TTab.ChangeBounds(var Bounds: TRect);
  1751. var D: TPoint;
  1752. procedure DoCalcChange(P: PView); {$ifndef FPC}far;{$endif}
  1753. var
  1754. R: TRect;
  1755. begin
  1756. if P^.Owner=nil then Exit; { it think this is a bug in TV }
  1757. P^.CalcBounds(R, D);
  1758. P^.ChangeBounds(R);
  1759. end;
  1760. var
  1761. P: PTabItem;
  1762. I: integer;
  1763. begin
  1764. D.X := Bounds.B.X - Bounds.A.X - Size.X;
  1765. D.Y := Bounds.B.Y - Bounds.A.Y - Size.Y;
  1766. inherited ChangeBounds(Bounds);
  1767. for I:=0 to TabCount-1 do
  1768. if I<>ActiveDef then
  1769. begin
  1770. P:=AtTab(I)^.Items;
  1771. while P<>nil do
  1772. begin
  1773. if P^.View<>nil then DoCalcChange(P^.View);
  1774. P:=P^.Next;
  1775. end;
  1776. end;
  1777. end;
  1778. procedure TTab.SelectNextTab(Forwards: boolean);
  1779. var Index: integer;
  1780. begin
  1781. Index:=ActiveDef;
  1782. if Index=-1 then Exit;
  1783. if Forwards then Inc(Index) else Dec(Index);
  1784. if Index<0 then Index:=DefCount-1 else
  1785. if Index>DefCount-1 then Index:=0;
  1786. SelectTab(Index);
  1787. end;
  1788. procedure TTab.HandleEvent(var Event: TEvent);
  1789. var Index : integer;
  1790. I : integer;
  1791. X : integer;
  1792. Len : byte;
  1793. P : TPoint;
  1794. V : PView;
  1795. CallOrig: boolean;
  1796. LastV : PView;
  1797. FirstV: PView;
  1798. function FirstSelectable: PView;
  1799. var
  1800. FV : PView;
  1801. begin
  1802. FV := First;
  1803. while (FV<>nil) and ((FV^.Options and ofSelectable)=0) and (FV<>Last) do
  1804. FV:=FV^.Next;
  1805. if FV<>nil then
  1806. if (FV^.Options and ofSelectable)=0 then FV:=nil;
  1807. FirstSelectable:=FV;
  1808. end;
  1809. function LastSelectable: PView;
  1810. var
  1811. LV : PView;
  1812. begin
  1813. LV := Last;
  1814. while (LV<>nil) and ((LV^.Options and ofSelectable)=0) and (LV<>First) do
  1815. LV:=LV^.Prev;
  1816. if LV<>nil then
  1817. if (LV^.Options and ofSelectable)=0 then LV:=nil;
  1818. LastSelectable:=LV;
  1819. end;
  1820. begin
  1821. if (Event.What and evMouseDown)<>0 then
  1822. begin
  1823. MakeLocal(Event.Where,P);
  1824. if P.Y<3 then
  1825. begin
  1826. Index:=-1; X:=1;
  1827. for i:=0 to DefCount-1 do
  1828. begin
  1829. Len:=CStrLen(AtTab(i)^.Name^);
  1830. if (P.X>=X) and (P.X<=X+Len+1) then Index:=i;
  1831. X:=X+Len+3;
  1832. end;
  1833. if Index<>-1 then
  1834. SelectTab(Index);
  1835. end;
  1836. end;
  1837. if Event.What=evKeyDown then
  1838. begin
  1839. Index:=-1;
  1840. case Event.KeyCode of
  1841. kbCtrlTab :
  1842. begin
  1843. SelectNextTab((Event.KeyShift and kbShift)=0);
  1844. ClearEvent(Event);
  1845. end;
  1846. kbTab,kbShiftTab :
  1847. if GetState(sfSelected) then
  1848. begin
  1849. if Current<>nil then
  1850. begin
  1851. LastV:=LastSelectable; FirstV:=FirstSelectable;
  1852. if ((Current=LastV) or (Current=PLabel(LastV)^.Link)) and (Event.KeyCode=kbShiftTab) then
  1853. begin
  1854. if Owner<>nil then Owner^.SelectNext(true);
  1855. end else
  1856. if ((Current=FirstV) or (Current=PLabel(FirstV)^.Link)) and (Event.KeyCode=kbTab) then
  1857. begin
  1858. Lock;
  1859. if Owner<>nil then Owner^.SelectNext(false);
  1860. UnLock;
  1861. end else
  1862. SelectNext(Event.KeyCode=kbShiftTab);
  1863. ClearEvent(Event);
  1864. end;
  1865. end;
  1866. else
  1867. for I:=0 to DefCount-1 do
  1868. begin
  1869. if Upcase(GetAltChar(Event.KeyCode))=AtTab(I)^.ShortCut
  1870. then begin
  1871. Index:=I;
  1872. ClearEvent(Event);
  1873. Break;
  1874. end;
  1875. end;
  1876. end;
  1877. if Index<>-1 then
  1878. begin
  1879. Select;
  1880. SelectTab(Index);
  1881. V:=AtTab(ActiveDef)^.DefItem;
  1882. if V<>nil then V^.Focus;
  1883. end;
  1884. end;
  1885. CallOrig:=true;
  1886. if Event.What=evKeyDown then
  1887. begin
  1888. if ((Owner<>nil) and (Owner^.Phase=phPostProcess) and (GetAltChar(Event.KeyCode)<>#0)) or GetState(sfFocused)
  1889. then
  1890. else CallOrig:=false;
  1891. end;
  1892. if CallOrig then inherited HandleEvent(Event);
  1893. end;
  1894. function TTab.GetPalette: PPalette;
  1895. begin
  1896. GetPalette:=nil;
  1897. end;
  1898. procedure TTab.Draw;
  1899. var B : TDrawBuffer;
  1900. i : integer;
  1901. C1,C2,C3,C : word;
  1902. HeaderLen : integer;
  1903. X,X2 : integer;
  1904. Name : PString;
  1905. ActiveKPos : integer;
  1906. ActiveVPos : integer;
  1907. FC : char;
  1908. ClipR : TRect;
  1909. procedure SWriteBuf(X,Y,W,H: integer; var Buf);
  1910. var i: integer;
  1911. begin
  1912. if Y+H>Size.Y then H:=Size.Y-Y;
  1913. if X+W>Size.X then W:=Size.X-X;
  1914. if Buffer=nil then WriteBuf(X,Y,W,H,Buf)
  1915. else for i:=1 to H do
  1916. Move(Buf,Buffer^[X+(Y+i-1)*Size.X],W*2);
  1917. end;
  1918. procedure ClearBuf;
  1919. begin
  1920. MoveChar(B,' ',C1,Size.X);
  1921. end;
  1922. begin
  1923. if InDraw then Exit;
  1924. InDraw:=true;
  1925. { - Start of TGroup.Draw - }
  1926. if Buffer = nil then
  1927. begin
  1928. GetBuffer;
  1929. end;
  1930. { - Start of TGroup.Draw - }
  1931. C1:=GetColor(1); C2:=(GetColor(7) and $f0 or $08)+GetColor(9)*256; C3:=GetColor(8)+GetColor({9}8)*256;
  1932. HeaderLen:=0; for i:=0 to DefCount-1 do HeaderLen:=HeaderLen+CStrLen(AtTab(i)^.Name^)+3; Dec(HeaderLen);
  1933. if HeaderLen>Size.X-2 then HeaderLen:=Size.X-2;
  1934. { --- 1. sor --- }
  1935. ClearBuf; MoveChar(B[0],'³',C1,1); MoveChar(B[HeaderLen+1],'³',C1,1);
  1936. X:=1;
  1937. for i:=0 to DefCount-1 do
  1938. begin
  1939. Name:=AtTab(i)^.Name; X2:=CStrLen(Name^);
  1940. if i=ActiveDef
  1941. then begin
  1942. ActiveKPos:=X-1;
  1943. ActiveVPos:=X+X2+2;
  1944. if GetState(sfFocused) then C:=C3 else C:=C2;
  1945. end
  1946. else C:=C2;
  1947. MoveCStr(B[X],' '+Name^+' ',C); X:=X+X2+3;
  1948. MoveChar(B[X-1],'³',C1,1);
  1949. end;
  1950. SWriteBuf(0,1,Size.X,1,B);
  1951. { --- 0. sor --- }
  1952. ClearBuf; MoveChar(B[0],'Ú',C1,1);
  1953. X:=1;
  1954. for i:=0 to DefCount-1 do
  1955. begin
  1956. if I<ActiveDef then FC:='Ú'
  1957. else FC:='¿';
  1958. X2:=CStrLen(AtTab(i)^.Name^)+2;
  1959. MoveChar(B[X+X2],{'Â'}FC,C1,1);
  1960. if i=DefCount-1 then X2:=X2+1;
  1961. if X2>0 then
  1962. MoveChar(B[X],'Ä',C1,X2);
  1963. X:=X+X2+1;
  1964. end;
  1965. MoveChar(B[HeaderLen+1],'¿',C1,1);
  1966. MoveChar(B[ActiveKPos],'Ú',C1,1); MoveChar(B[ActiveVPos],'¿',C1,1);
  1967. SWriteBuf(0,0,Size.X,1,B);
  1968. { --- 2. sor --- }
  1969. MoveChar(B[1],'Ä',C1,Max(HeaderLen,0)); MoveChar(B[HeaderLen+2],'Ä',C1,Max(Size.X-HeaderLen-3,0));
  1970. MoveChar(B[Size.X-1],'¿',C1,1);
  1971. MoveChar(B[ActiveKPos],'Ù',C1,1);
  1972. if ActiveDef=0 then MoveChar(B[0],'³',C1,1)
  1973. else MoveChar(B[0],{'Ã'}'Ú',C1,1);
  1974. MoveChar(B[HeaderLen+1],'Ä'{'Á'},C1,1); MoveChar(B[ActiveVPos],'À',C1,1);
  1975. MoveChar(B[ActiveKPos+1],' ',C1,Max(ActiveVPos-ActiveKPos-1,0));
  1976. SWriteBuf(0,2,Size.X,1,B);
  1977. { --- marad‚k sor --- }
  1978. ClearBuf; MoveChar(B[0],'³',C1,1); MoveChar(B[Size.X-1],'³',C1,1);
  1979. SWriteBuf(0,3,Size.X,Size.Y-4,B);
  1980. { --- Size.X . sor --- }
  1981. MoveChar(B[0],'À',C1,1); MoveChar(B[1],'Ä',C1,Max(Size.X-2,0)); MoveChar(B[Size.X-1],'Ù',C1,1);
  1982. SWriteBuf(0,Size.Y-1,Size.X,1,B);
  1983. { - End of TGroup.Draw - }
  1984. if Buffer <> nil then
  1985. begin
  1986. Lock;
  1987. Redraw;
  1988. UnLock;
  1989. end;
  1990. if Buffer <> nil then WriteBuf(0, 0, Size.X, Size.Y, Buffer^) else
  1991. begin
  1992. GetClipRect(ClipR);
  1993. Redraw;
  1994. GetExtent(ClipR);
  1995. end;
  1996. { - End of TGroup.Draw - }
  1997. InDraw:=false;
  1998. end;
  1999. function TTab.Valid(Command: Word): Boolean;
  2000. var PT : PTabDef;
  2001. PI : PTabItem;
  2002. OK : boolean;
  2003. begin
  2004. OK:=true;
  2005. PT:=TabDefs;
  2006. while (PT<>nil) and (OK=true) do
  2007. begin
  2008. PI:=PT^.Items;
  2009. while (PI<>nil) and (OK=true) do
  2010. begin
  2011. if PI^.View<>nil then OK:=OK and PI^.View^.Valid(Command);
  2012. PI:=PI^.Next;
  2013. end;
  2014. PT:=PT^.Next;
  2015. end;
  2016. Valid:=OK;
  2017. end;
  2018. procedure TTab.SetState(AState: Word; Enable: Boolean);
  2019. begin
  2020. inherited SetState(AState,Enable);
  2021. if (AState and sfFocused)<>0 then DrawView;
  2022. end;
  2023. destructor TTab.Done;
  2024. var P,X: PTabDef;
  2025. procedure DeleteViews(P: PView); {$ifndef FPC}far;{$endif}
  2026. begin
  2027. if P<>nil then Delete(P);
  2028. end;
  2029. begin
  2030. ForEach(@DeleteViews);
  2031. inherited Done;
  2032. P:=TabDefs;
  2033. while P<>nil do
  2034. begin
  2035. X:=P^.Next;
  2036. DisposeTabDef(P);
  2037. P:=X;
  2038. end;
  2039. end;
  2040. constructor TScreenView.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
  2041. AScreen: PScreen);
  2042. begin
  2043. inherited Init(Bounds,AHScrollBar,AVScrollBar);
  2044. Screen:=AScreen;
  2045. if Screen=nil then
  2046. Fail;
  2047. SetState(sfCursorVis,true);
  2048. Update;
  2049. end;
  2050. procedure TScreenView.Update;
  2051. begin
  2052. SetLimit(UserScreen^.GetWidth,UserScreen^.GetHeight);
  2053. DrawView;
  2054. end;
  2055. procedure TScreenView.HandleEvent(var Event: TEvent);
  2056. begin
  2057. case Event.What of
  2058. evBroadcast :
  2059. case Event.Command of
  2060. cmUpdate : Update;
  2061. end;
  2062. end;
  2063. inherited HandleEvent(Event);
  2064. end;
  2065. procedure TScreenView.Draw;
  2066. var B: TDrawBuffer;
  2067. X,Y: integer;
  2068. Text,Attr: string;
  2069. P: TPoint;
  2070. begin
  2071. Screen^.GetCursorPos(P);
  2072. for Y:=Delta.Y to Delta.Y+Size.Y-1 do
  2073. begin
  2074. if Y<Screen^.GetHeight then
  2075. Screen^.GetLine(Y,Text,Attr)
  2076. else
  2077. begin Text:=''; Attr:=''; end;
  2078. Text:=copy(Text,Delta.X+1,255); Attr:=copy(Attr,Delta.X+1,255);
  2079. MoveChar(B,' ',0,Size.X);
  2080. for X:=1 to length(Text) do
  2081. MoveChar(B[X-1],Text[X],ord(Attr[X]),1);
  2082. WriteLine(0,Y-Delta.Y,Size.X,1,B);
  2083. end;
  2084. SetCursor(P.X-Delta.X,P.Y-Delta.Y);
  2085. end;
  2086. constructor TScreenWindow.Init(AScreen: PScreen; ANumber: integer);
  2087. var R: TRect;
  2088. VSB,HSB: PScrollBar;
  2089. begin
  2090. Desktop^.GetExtent(R);
  2091. inherited Init(R, 'User screen', ANumber);
  2092. Options:=Options or ofTileAble;
  2093. GetExtent(R); R.Grow(-1,-1); R.Move(1,0); R.A.X:=R.B.X-1;
  2094. New(VSB, Init(R)); VSB^.Options:=VSB^.Options or ofPostProcess;
  2095. VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  2096. GetExtent(R); R.Grow(-1,-1); R.Move(0,1); R.A.Y:=R.B.Y-1;
  2097. New(HSB, Init(R)); HSB^.Options:=HSB^.Options or ofPostProcess;
  2098. HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
  2099. GetExtent(R); R.Grow(-1,-1);
  2100. New(ScreenView, Init(R, HSB, VSB, AScreen));
  2101. ScreenView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  2102. Insert(ScreenView);
  2103. UserScreenWindow:=@Self;
  2104. end;
  2105. destructor TScreenWindow.Done;
  2106. begin
  2107. inherited Done;
  2108. UserScreenWindow:=nil;
  2109. end;
  2110. const InTranslate : boolean = false;
  2111. procedure TranslateMouseClick(View: PView; var Event: TEvent);
  2112. procedure TranslateAction(Action: integer);
  2113. var E: TEvent;
  2114. begin
  2115. if Action<>acNone then
  2116. begin
  2117. E:=Event;
  2118. E.What:=evMouseDown; E.Buttons:=mbLeftButton;
  2119. View^.HandleEvent(E);
  2120. Event.What:=evCommand;
  2121. Event.Command:=ActionCommands[Action];
  2122. end;
  2123. end;
  2124. begin
  2125. if InTranslate then Exit;
  2126. InTranslate:=true;
  2127. case Event.What of
  2128. evMouseDown :
  2129. if (GetShiftState and kbAlt)<>0 then
  2130. TranslateAction(AltMouseAction) else
  2131. if (GetShiftState and kbCtrl)<>0 then
  2132. TranslateAction(CtrlMouseAction);
  2133. end;
  2134. InTranslate:=false;
  2135. end;
  2136. function GetNextEditorBounds(var Bounds: TRect): boolean;
  2137. var P: PView;
  2138. begin
  2139. P:=Desktop^.First;
  2140. while P<>nil do
  2141. begin
  2142. if P^.HelpCtx=hcSourceWindow then Break;
  2143. P:=P^.NextView;
  2144. end;
  2145. if P=nil then Desktop^.GetExtent(Bounds) else
  2146. begin
  2147. P^.GetBounds(Bounds);
  2148. Inc(Bounds.A.X); Inc(Bounds.A.Y);
  2149. end;
  2150. GetNextEditorBounds:=P<>nil;
  2151. end;
  2152. function OpenEditorWindow(Bounds: PRect; FileName: string; CurX,CurY: sw_integer): PSourceWindow;
  2153. var R: TRect;
  2154. W: PSourceWindow;
  2155. begin
  2156. if Assigned(Bounds) then R.Copy(Bounds^) else
  2157. GetNextEditorBounds(R);
  2158. PushStatus('Opening source file... ('+SmartPath(FileName)+')');
  2159. New(W, Init(R, FileName));
  2160. if W<>nil then
  2161. begin
  2162. if (CurX<>0) or (CurY<>0) then
  2163. with W^.Editor^ do
  2164. begin
  2165. SetCurPtr(CurX,CurY);
  2166. TrackCursor(true);
  2167. end;
  2168. W^.HelpCtx:=hcSourceWindow;
  2169. Desktop^.Insert(W);
  2170. If assigned(BreakpointsCollection) then
  2171. BreakpointsCollection^.ShowBreakpoints(W);
  2172. Message(Application,evBroadcast,cmUpdate,nil);
  2173. end;
  2174. PopStatus;
  2175. OpenEditorWindow:=W;
  2176. end;
  2177. function TryToOpenFile(Bounds: PRect; FileName: string; CurX,CurY: sw_integer;tryexts:boolean): PSourceWindow;
  2178. var D : DirStr;
  2179. N : NameStr;
  2180. E : ExtStr;
  2181. DrStr : String;
  2182. function CheckDir(NewDir: DirStr; NewName: NameStr; NewExt: ExtStr): boolean;
  2183. var OK: boolean;
  2184. begin
  2185. NewDir:=CompleteDir(NewDir);
  2186. OK:=ExistsFile(NewDir+NewName+NewExt);
  2187. if OK then begin D:=NewDir; N:=NewName; E:=NewExt; end;
  2188. CheckDir:=OK;
  2189. end;
  2190. function CheckExt(NewExt: ExtStr): boolean;
  2191. var OK: boolean;
  2192. begin
  2193. OK:=false;
  2194. if D<>'' then OK:=CheckDir(D,N,NewExt) else
  2195. if CheckDir('.'+DirSep,N,NewExt) then OK:=true;
  2196. CheckExt:=OK;
  2197. end;
  2198. function TryToOpen(const DD : dirstr): PSourceWindow;
  2199. var Found: boolean;
  2200. W : PSourceWindow;
  2201. begin
  2202. D:=CompleteDir(DD);
  2203. Found:=true;
  2204. if (E<>'') or (not tryexts) then
  2205. Found:=CheckExt(E)
  2206. else
  2207. if CheckExt('.pp') then
  2208. Found:=true
  2209. else
  2210. if CheckExt('.pas') then
  2211. Found:=true
  2212. else
  2213. if CheckExt('.inc') then
  2214. Found:=true
  2215. else
  2216. Found:=false;
  2217. if Found=false then
  2218. W:=nil
  2219. else
  2220. begin
  2221. FileName:=FExpand(D+N+E);
  2222. W:=OpenEditorWindow(Bounds,FileName,CurX,CurY);
  2223. end;
  2224. TryToOpen:=W;
  2225. end;
  2226. function SearchOnDesktop: PSourceWindow;
  2227. var
  2228. V: PView;
  2229. W: PWindow;
  2230. I: integer;
  2231. DS : DirStr;
  2232. NS : NameStr;
  2233. ES : ExtStr;
  2234. Found : boolean;
  2235. SName : string;
  2236. function IsSearchedFile(W : PSourceWindow) : boolean;
  2237. var Found: boolean;
  2238. begin
  2239. Found:=false;
  2240. if (W<>nil) and (W^.HelpCtx=hcSourceWindow) then
  2241. begin
  2242. if (D='') then
  2243. SName:=NameAndExtOf(PSourceWindow(W)^.Editor^.FileName)
  2244. else
  2245. SName:=PSourceWindow(W)^.Editor^.FileName;
  2246. FSplit(SName,DS,NS,ES);
  2247. SName:=UpcaseStr(NS+ES);
  2248. if (E<>'') or (not tryexts) then
  2249. begin
  2250. if D<>'' then
  2251. Found:=UpCaseStr(DS)+SName=UpcaseStr(D+N+E)
  2252. else
  2253. Found:=SName=UpcaseStr(N+E);
  2254. end
  2255. else
  2256. begin
  2257. Found:=SName=UpcaseStr(N+'.pp');
  2258. if Found=false then
  2259. Found:=SName=UpcaseStr(N+'.pas');
  2260. end;
  2261. end;
  2262. IsSearchedFile:=found;
  2263. end;
  2264. function IsSearchedSource(P: PView) : boolean; {$ifndef FPC}far;{$endif}
  2265. begin
  2266. if assigned(P) and
  2267. (TypeOf(P^)=TypeOf(TSourceWindow)) then
  2268. IsSearchedSource:=IsSearchedFile(PSourceWindow(P))
  2269. else
  2270. IsSearchedSource:=false;
  2271. end;
  2272. begin
  2273. SearchOnDesktop:=PSourceWindow(Desktop^.FirstThat(@IsSearchedSource));
  2274. end;
  2275. var
  2276. W : PSourceWindow;
  2277. begin
  2278. FSplit(FileName,D,N,E);
  2279. W:=SearchOnDesktop;
  2280. if W<>nil then
  2281. begin
  2282. NewEditorOpened:=false;
  2283. { if assigned(Bounds) then
  2284. W^.ChangeBounds(Bounds^);}
  2285. W^.Editor^.SetCurPtr(CurX,CurY);
  2286. end
  2287. else
  2288. begin
  2289. DrStr:=GetSourceDirectories;
  2290. While pos(';',DrStr)>0 do
  2291. Begin
  2292. W:=TryToOpen(Copy(DrStr,1,pos(';',DrStr)-1));
  2293. if assigned(W) then
  2294. break;
  2295. DrStr:=Copy(DrStr,pos(';',DrStr)+1,255);
  2296. End;
  2297. if not assigned(W) then
  2298. W:=TryToOpen(DrStr);
  2299. NewEditorOpened:=W<>nil;
  2300. if assigned(W) then
  2301. W^.Editor^.SetCurPtr(CurX,CurY);
  2302. end;
  2303. TryToOpenFile:=W;
  2304. end;
  2305. function StartEditor(Editor: PCodeEditor; FileName: string): boolean;
  2306. var OK: boolean;
  2307. E: PFileEditor;
  2308. R: TRect;
  2309. begin
  2310. R.Assign(0,0,0,0);
  2311. New(E, Init(R,nil,nil,nil,FileName));
  2312. OK:=E<>nil;
  2313. if OK then OK:=E^.LoadFile;
  2314. if OK then
  2315. begin
  2316. E^.SelectAll(true);
  2317. Editor^.InsertFrom(E);
  2318. Editor^.SetCurPtr(0,0);
  2319. Editor^.SelectAll(false);
  2320. Dispose(E, Done);
  2321. end;
  2322. StartEditor:=OK;
  2323. end;
  2324. constructor TTextScroller.Init(var Bounds: TRect; ASpeed: integer; AText: PUnsortedStringCollection);
  2325. begin
  2326. inherited Init(Bounds,'');
  2327. EventMask:=EventMask or evIdle;
  2328. Speed:=ASpeed; Lines:=AText;
  2329. end;
  2330. function TTextScroller.GetLineCount: integer;
  2331. var Count: integer;
  2332. begin
  2333. if Lines=nil then Count:=0 else
  2334. Count:=Lines^.Count;
  2335. GetLineCount:=Count;
  2336. end;
  2337. function TTextScroller.GetLine(I: integer): string;
  2338. var S: string;
  2339. begin
  2340. if I<Lines^.Count then
  2341. S:=GetStr(Lines^.At(I))
  2342. else
  2343. S:='';
  2344. GetLine:=S;
  2345. end;
  2346. procedure TTextScroller.HandleEvent(var Event: TEvent);
  2347. begin
  2348. case Event.What of
  2349. evIdle :
  2350. Update;
  2351. end;
  2352. inherited HandleEvent(Event);
  2353. end;
  2354. procedure TTextScroller.Update;
  2355. begin
  2356. if abs(GetDosTicks-LastTT)<Speed then Exit;
  2357. Scroll;
  2358. LastTT:=GetDosTicks;
  2359. end;
  2360. procedure TTextScroller.Reset;
  2361. begin
  2362. TopLine:=0;
  2363. LastTT:=GetDosTicks;
  2364. DrawView;
  2365. end;
  2366. procedure TTextScroller.Scroll;
  2367. begin
  2368. Inc(TopLine);
  2369. if TopLine>=GetLineCount then
  2370. Reset;
  2371. DrawView;
  2372. end;
  2373. procedure TTextScroller.Draw;
  2374. var B: TDrawBuffer;
  2375. C: word;
  2376. Count,Y: integer;
  2377. S: string;
  2378. begin
  2379. C:=GetColor(1);
  2380. Count:=GetLineCount;
  2381. for Y:=0 to Size.Y-1 do
  2382. begin
  2383. if Count=0 then S:='' else
  2384. S:=GetLine((TopLine+Y) mod Count);
  2385. if copy(S,1,1)=^C then
  2386. S:=CharStr(' ',Max(0,(Size.X-(length(S)-1)) div 2))+copy(S,2,255);
  2387. MoveChar(B,' ',C,Size.X);
  2388. MoveStr(B,S,C);
  2389. WriteLine(0,Y,Size.X,1,B);
  2390. end;
  2391. end;
  2392. destructor TTextScroller.Done;
  2393. begin
  2394. inherited Done;
  2395. if Lines<>nil then Dispose(Lines, Done);
  2396. end;
  2397. constructor TFPAboutDialog.Init;
  2398. var R,R2: TRect;
  2399. C: PUnsortedStringCollection;
  2400. I: integer;
  2401. OSStr: string;
  2402. procedure AddLine(S: string);
  2403. begin
  2404. C^.Insert(NewStr(S));
  2405. end;
  2406. begin
  2407. OSStr:='';
  2408. {$ifdef go32v2}
  2409. OSStr:='Dos';
  2410. {$endif}
  2411. {$ifdef tp}
  2412. OSStr:='Dos';
  2413. {$endif}
  2414. {$ifdef linux}
  2415. OSStr:='Linux';
  2416. {$endif}
  2417. {$ifdef win32}
  2418. OSStr:='Win32';
  2419. {$endif}
  2420. {$ifdef os2}
  2421. OSStr:='OS/2';
  2422. {$endif}
  2423. R.Assign(0,0,38,13);
  2424. inherited Init(R, 'About');
  2425. GetExtent(R); R.Grow(-3,-2);
  2426. R2.Copy(R); R2.B.Y:=R2.A.Y+1;
  2427. Insert(New(PStaticText, Init(R2, ^C'FreePascal IDE for '+OSStr)));
  2428. R2.Move(0,1);
  2429. Insert(New(PStaticText, Init(R2, ^C' Version '+VersionStr)));
  2430. R2.Move(0,1);
  2431. Insert(New(PStaticText, Init(R2, ^C'(Compiler Version '+Version_String+')')));
  2432. {$ifndef NODEBUG}
  2433. if pos('Fake',GDBVersion)=0 then
  2434. begin
  2435. R2.Move(0,1);
  2436. Insert(New(PStaticText, Init(R2, ^C'(Debugger '+GDBVersion+')')));
  2437. R2.Move(0,1);
  2438. end
  2439. else
  2440. R2.Move(0,2);
  2441. {$else NODEBUG}
  2442. R2.Move(0,2);
  2443. {$endif NODEBUG}
  2444. Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
  2445. R2.Move(0,2);
  2446. Insert(New(PStaticText, Init(R2, ^C'B‚rczi G bor')));
  2447. R2.Move(0,1);
  2448. Insert(New(PStaticText, Init(R2, ^C'Pierre Muller')));
  2449. R2.Move(0,1);
  2450. Insert(New(PStaticText, Init(R2, ^C'and')));
  2451. R2.Move(0,1);
  2452. Insert(New(PStaticText, Init(R2, ^C'Peter Vreman')));
  2453. New(C, Init(50,10));
  2454. for I:=1 to 7 do
  2455. AddLine('');
  2456. AddLine(^C'< Original concept >');
  2457. AddLine(^C'Borland International, Inc.');
  2458. AddLine('');
  2459. AddLine(^C'< Compiler development >');
  2460. AddLine(^C'Carl-Eric Codere');
  2461. AddLine(^C'Daniel Mantione');
  2462. AddLine(^C'Florian Kl„mpfl');
  2463. AddLine(^C'Jonas Maebe');
  2464. AddLine(^C'Mich„el Van Canneyt');
  2465. AddLine(^C'Peter Vreman');
  2466. AddLine(^C'Pierre Muller');
  2467. AddLine('');
  2468. AddLine(^C'< IDE development >');
  2469. AddLine(^C'B‚rczi G bor');
  2470. AddLine(^C'Peter Vreman');
  2471. AddLine(^C'Pierre Muller');
  2472. AddLine('');
  2473. GetExtent(R);
  2474. R.Grow(-1,-1); Inc(R.A.Y,3);
  2475. New(Scroller, Init(R, 10, C));
  2476. Scroller^.Hide;
  2477. Insert(Scroller);
  2478. R.Move(0,-1); R.B.Y:=R.A.Y+1;
  2479. New(TitleST, Init(R, ^C'Team'));
  2480. TitleST^.Hide;
  2481. Insert(TitleST);
  2482. InsertOK(@Self);
  2483. end;
  2484. procedure TFPAboutDialog.ToggleInfo;
  2485. begin
  2486. if Scroller=nil then Exit;
  2487. if Scroller^.GetState(sfVisible) then
  2488. begin
  2489. Scroller^.Hide;
  2490. TitleST^.Hide;
  2491. end
  2492. else
  2493. begin
  2494. Scroller^.Reset;
  2495. Scroller^.Show;
  2496. TitleST^.Show;
  2497. end;
  2498. end;
  2499. procedure TFPAboutDialog.HandleEvent(var Event: TEvent);
  2500. begin
  2501. case Event.What of
  2502. evKeyDown :
  2503. case Event.KeyCode of
  2504. kbAltI : { just like in BP }
  2505. begin
  2506. ToggleInfo;
  2507. ClearEvent(Event);
  2508. end;
  2509. end;
  2510. end;
  2511. inherited HandleEvent(Event);
  2512. end;
  2513. constructor TFPASCIIChart.Init;
  2514. begin
  2515. inherited Init;
  2516. HelpCtx:=hcASCIITable;
  2517. Number:=SearchFreeWindowNo;
  2518. ASCIIChart:=@Self;
  2519. end;
  2520. procedure TFPASCIIChart.HandleEvent(var Event: TEvent);
  2521. begin
  2522. case Event.What of
  2523. evKeyDown :
  2524. case Event.KeyCode of
  2525. kbEsc :
  2526. begin
  2527. Close;
  2528. ClearEvent(Event);
  2529. end;
  2530. end;
  2531. end;
  2532. inherited HandleEvent(Event);
  2533. end;
  2534. destructor TFPASCIIChart.Done;
  2535. begin
  2536. ASCIIChart:=nil;
  2537. inherited Done;
  2538. end;
  2539. function TVideoModeListBox.GetText(Item: pointer; MaxLen: sw_integer): string;
  2540. var P: PVideoModeList;
  2541. S: string;
  2542. begin
  2543. P:=Item;
  2544. S:=IntToStr(P^.Col)+'x'+IntToStr(P^.Row)+' ';
  2545. if P^.Color then
  2546. S:=S+'color'
  2547. else
  2548. S:=S+'mono';
  2549. GetText:=copy(S,1,MaxLen);
  2550. end;
  2551. constructor TFPDesktop.Load(var S: TStream);
  2552. begin
  2553. inherited Load(S);
  2554. end;
  2555. procedure TFPDesktop.Store(var S: TStream);
  2556. begin
  2557. inherited Store(S);
  2558. end;
  2559. {$ifdef VESA}
  2560. function VESASetVideoModeProc(const VideoMode: TVideoMode; Params: Longint): Boolean; {$ifndef FPC}far;{$endif}
  2561. begin
  2562. VESASetVideoModeProc:=VESASetMode(Params);
  2563. end;
  2564. procedure InitVESAScreenModes;
  2565. var ML: TVESAModeList;
  2566. MI: TVESAModeInfoBlock;
  2567. I: integer;
  2568. begin
  2569. if VESAInit=false then Exit;
  2570. if VESAGetModeList(ML)=false then Exit;
  2571. for I:=1 to ML.Count do
  2572. begin
  2573. if VESAGetModeInfo(ML.Modes[I],MI) then
  2574. with MI do
  2575. if (Attributes and vesa_vma_GraphicsMode)=0 then
  2576. RegisterVideoMode(XResolution,YResolution,
  2577. (Attributes and vesa_vma_ColorMode)<>0,{$ifdef FPC}@{$endif}VESASetVideoModeProc,ML.Modes[I]);
  2578. end;
  2579. end;
  2580. {$endif}
  2581. procedure NoDebugger;
  2582. begin
  2583. InformationBox('No debugger support available.',nil);
  2584. end;
  2585. procedure RegisterFPViews;
  2586. begin
  2587. RegisterType(RSourceEditor);
  2588. RegisterType(RSourceWindow);
  2589. RegisterType(RFPHelpViewer);
  2590. RegisterType(RFPHelpWindow);
  2591. RegisterType(RClipboardWindow);
  2592. RegisterType(RMessageListBox);
  2593. RegisterType(RFPDesktop);
  2594. RegisterType(RGDBSourceEditor);
  2595. RegisterType(RGDBWindow);
  2596. end;
  2597. END.
  2598. {
  2599. $Log$
  2600. Revision 1.50 1999-12-16 16:55:52 pierre
  2601. * fix of web bug 756
  2602. Revision 1.49 1999/11/25 00:25:43 pierre
  2603. * add Status when loading/saving files
  2604. Revision 1.48 1999/11/22 16:02:12 pierre
  2605. * TryToOpenFile failed tofind a sourcewindow if it has no number
  2606. Revision 1.47 1999/11/18 13:39:24 pierre
  2607. * Better info for Undo debugging
  2608. Revision 1.46 1999/11/10 00:44:12 pierre
  2609. * Grouped Undo action signaled in 'Dump Undo'
  2610. Revision 1.45 1999/10/29 14:50:07 pierre
  2611. * About dialog changes
  2612. Revision 1.44 1999/10/27 12:10:42 pierre
  2613. + With DebugUndo added 3 menu items
  2614. "Dump Undo" "Undo All" and "Redo All"
  2615. for Undo checks
  2616. Revision 1.43 1999/10/25 16:55:13 pierre
  2617. * adapted to a small weditor change
  2618. Revision 1.42 1999/09/16 14:34:59 pierre
  2619. + TBreakpoint and TWatch registering
  2620. + WatchesCollection and BreakpointsCollection stored in desk file
  2621. * Syntax highlighting was broken
  2622. Revision 1.41 1999/09/13 16:24:43 peter
  2623. + clock
  2624. * backspace unident like tp7
  2625. Revision 1.40 1999/09/09 16:30:37 pierre
  2626. * ModuleNames was not created in TMessageListBox.Load
  2627. Revision 1.39 1999/09/03 12:54:07 pierre
  2628. * adapted to modified tokens unit
  2629. * TryToOpen works better
  2630. Revision 1.38 1999/08/31 16:18:33 pierre
  2631. + TGDBWindow.Load and Store + Registration
  2632. Revision 1.37 1999/08/16 18:25:26 peter
  2633. * Adjusting the selection when the editor didn't contain any line.
  2634. * Reserved word recognition redesigned, but this didn't affect the overall
  2635. syntax highlight speed remarkably (at least not on my Amd-K6/350).
  2636. The syntax scanner loop is a bit slow but the main problem is the
  2637. recognition of special symbols. Switching off symbol processing boosts
  2638. the performance up to ca. 200%...
  2639. * The editor didn't allow copying (for ex to clipboard) of a single character
  2640. * 'File|Save as' caused permanently run-time error 3. Not any more now...
  2641. * Compiler Messages window (actually the whole desktop) did not act on any
  2642. keypress when compilation failed and thus the window remained visible
  2643. + Message windows are now closed upon pressing Esc
  2644. + At 'Run' the IDE checks whether any sources are modified, and recompiles
  2645. only when neccessary
  2646. + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
  2647. + LineSelect (Ctrl+K+L) implemented
  2648. * The IDE had problems closing help windows before saving the desktop
  2649. Revision 1.36 1999/08/03 20:22:39 peter
  2650. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  2651. + Desktop saving should work now
  2652. - History saved
  2653. - Clipboard content saved
  2654. - Desktop saved
  2655. - Symbol info saved
  2656. * syntax-highlight bug fixed, which compared special keywords case sensitive
  2657. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  2658. * with 'whole words only' set, the editor didn't found occourences of the
  2659. searched text, if the text appeared previously in the same line, but didn't
  2660. satisfied the 'whole-word' condition
  2661. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  2662. (ie. the beginning of the selection)
  2663. * when started typing in a new line, but not at the start (X=0) of it,
  2664. the editor inserted the text one character more to left as it should...
  2665. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  2666. * Shift shouldn't cause so much trouble in TCodeEditor now...
  2667. * Syntax highlight had problems recognizing a special symbol if it was
  2668. prefixed by another symbol character in the source text
  2669. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  2670. Revision 1.35 1999/07/12 13:14:22 pierre
  2671. * LineEnd bug corrected, now goes end of text even if selected
  2672. + Until Return for debugger
  2673. + Code for Quit inside GDB Window
  2674. Revision 1.34 1999/06/30 23:58:20 pierre
  2675. + BreakpointsList Window implemented
  2676. with Edit/New/Delete functions
  2677. + Individual breakpoint dialog with support for all types
  2678. ignorecount and conditions
  2679. (commands are not yet implemented, don't know if this wolud be useful)
  2680. awatch and rwatch have problems because GDB does not annotate them
  2681. I fixed v4.16 for this
  2682. Revision 1.33 1999/06/28 19:32:28 peter
  2683. * fixes from gabor
  2684. Revision 1.32 1999/06/21 23:37:08 pierre
  2685. * VESASetVideoModeProc return value was not set
  2686. Revision 1.31 1999/06/02 11:19:13 pierre
  2687. * @ is now required for FPC for procedure address passing in functions
  2688. Revision 1.30 1999/05/22 13:44:33 peter
  2689. * fixed couple of bugs
  2690. Revision 1.29 1999/04/15 08:58:08 peter
  2691. * syntax highlight fixes
  2692. * browser updates
  2693. Revision 1.28 1999/04/07 21:55:56 peter
  2694. + object support for browser
  2695. * html help fixes
  2696. * more desktop saving things
  2697. * NODEBUG directive to exclude debugger
  2698. Revision 1.27 1999/04/01 10:27:06 pierre
  2699. + file(line) in start of message added
  2700. Revision 1.26 1999/03/23 16:16:41 peter
  2701. * linux fixes
  2702. Revision 1.25 1999/03/23 15:11:37 peter
  2703. * desktop saving things
  2704. * vesa mode
  2705. * preferences dialog
  2706. Revision 1.24 1999/03/21 22:51:37 florian
  2707. + functional screen mode switching added
  2708. Revision 1.23 1999/03/19 16:04:33 peter
  2709. * new compiler dialog
  2710. Revision 1.22 1999/03/16 00:44:45 peter
  2711. * forgotten in last commit :(
  2712. Revision 1.21 1999/03/08 14:58:16 peter
  2713. + prompt with dialogs for tools
  2714. Revision 1.20 1999/03/01 15:42:08 peter
  2715. + Added dummy entries for functions not yet implemented
  2716. * MenuBar didn't update itself automatically on command-set changes
  2717. * Fixed Debugging/Profiling options dialog
  2718. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is set
  2719. * efBackSpaceUnindents works correctly
  2720. + 'Messages' window implemented
  2721. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  2722. + Added TP message-filter support (for ex. you can call GREP thru
  2723. GREP2MSG and view the result in the messages window - just like in TP)
  2724. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  2725. so topic search didn't work...
  2726. * In FPHELP.PAS there were still context-variables defined as word instead
  2727. of THelpCtx
  2728. * StdStatusKeys() was missing from the statusdef for help windows
  2729. + Topic-title for index-table can be specified when adding a HTML-files
  2730. Revision 1.19 1999/02/22 11:51:39 peter
  2731. * browser updates from gabor
  2732. Revision 1.18 1999/02/22 11:29:38 pierre
  2733. + added col info in MessageItem
  2734. + grep uses HighLightExts and should work for linux
  2735. Revision 1.17 1999/02/22 02:15:22 peter
  2736. + default extension for save in the editor
  2737. + Separate Text to Find for the grep dialog
  2738. * fixed redir crash with tp7
  2739. Revision 1.16 1999/02/19 18:43:49 peter
  2740. + open dialog supports mask list
  2741. Revision 1.15 1999/02/17 15:04:02 pierre
  2742. + file(line) added in TProgramInfo message list
  2743. Revision 1.14 1999/02/16 12:45:18 pierre
  2744. * GDBWindow size and grow corrected
  2745. Revision 1.13 1999/02/15 09:36:06 pierre
  2746. * // comment ends at end of line !
  2747. GDB window changed !
  2748. now all is in a normal text editor, but pressing
  2749. Enter key will send part of line before cursor to GDB !
  2750. Revision 1.12 1999/02/11 19:07:25 pierre
  2751. * GDBWindow redesigned :
  2752. normal editor apart from
  2753. that any kbEnter will send the line (for begin to cursor)
  2754. to GDB command !
  2755. GDBWindow opened in Debugger Menu
  2756. still buggy :
  2757. -echo should not be present if at end of text
  2758. -GDBWindow becomes First after each step (I don't know why !)
  2759. Revision 1.11 1999/02/11 13:08:39 pierre
  2760. + TGDBWindow : direct gdb input/output
  2761. Revision 1.10 1999/02/10 09:42:52 pierre
  2762. + DoneReservedWords to avoid memory leaks
  2763. * TMessageItem Module field was not disposed
  2764. Revision 1.9 1999/02/05 12:12:02 pierre
  2765. + SourceDir that stores directories for sources that the
  2766. compiler should not know about
  2767. Automatically asked for addition when a new file that
  2768. needed filedialog to be found is in an unknown directory
  2769. Stored and retrieved from INIFile
  2770. + Breakpoints conditions added to INIFile
  2771. * Breakpoints insterted and removed at debin and end of debug session
  2772. Revision 1.8 1999/02/04 17:45:23 pierre
  2773. + BrowserAtCursor started
  2774. * bug in TryToOpenFile removed
  2775. Revision 1.7 1999/02/04 13:32:11 pierre
  2776. * Several things added (I cannot commit them independently !)
  2777. + added TBreakpoint and TBreakpointCollection
  2778. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  2779. + Breakpoint list in INIFile
  2780. * Select items now also depend of SwitchMode
  2781. * Reading of option '-g' was not possible !
  2782. + added search for -Fu args pathes in TryToOpen
  2783. + added code for automatic opening of FileDialog
  2784. if source not found
  2785. Revision 1.6 1999/01/21 11:54:27 peter
  2786. + tools menu
  2787. + speedsearch in symbolbrowser
  2788. * working run command
  2789. Revision 1.5 1999/01/14 21:42:25 peter
  2790. * source tracking from Gabor
  2791. Revision 1.4 1999/01/12 14:29:42 peter
  2792. + Implemented still missing 'switch' entries in Options menu
  2793. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  2794. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  2795. ASCII chars and inserted directly in the text.
  2796. + Added symbol browser
  2797. * splitted fp.pas to fpide.pas
  2798. Revision 1.3 1999/01/04 11:49:53 peter
  2799. * 'Use tab characters' now works correctly
  2800. + Syntax highlight now acts on File|Save As...
  2801. + Added a new class to syntax highlight: 'hex numbers'.
  2802. * There was something very wrong with the palette managment. Now fixed.
  2803. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  2804. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  2805. process revised
  2806. Revision 1.2 1998/12/28 15:47:54 peter
  2807. + Added user screen support, display & window
  2808. + Implemented Editor,Mouse Options dialog
  2809. + Added location of .INI and .CFG file
  2810. + Option (INI) file managment implemented (see bottom of Options Menu)
  2811. + Switches updated
  2812. + Run program
  2813. Revision 1.4 1998/12/22 10:39:53 peter
  2814. + options are now written/read
  2815. + find and replace routines
  2816. }