fpviews.pas 83 KB

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