fpviews.pas 96 KB

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