dialogs.pas 139 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771
  1. { $Id$ }
  2. {********[ SOURCE FILE OF GRAPHICAL FREE VISION ]**********}
  3. { }
  4. { System independent GRAPHICAL clone of DIALOGS.PAS }
  5. { }
  6. { Interface Copyright (c) 1992 Borland International }
  7. { }
  8. { Copyright (c) 1996, 1997, 1998, 1999 by Leon de Boer }
  9. { [email protected] - primary e-mail addr }
  10. { [email protected] - backup e-mail addr }
  11. { }
  12. {****************[ THIS CODE IS FREEWARE ]*****************}
  13. { }
  14. { This sourcecode is released for the purpose to }
  15. { promote the pascal language on all platforms. You may }
  16. { redistribute it and/or modify with the following }
  17. { DISCLAIMER. }
  18. { }
  19. { This SOURCE CODE is distributed "AS IS" WITHOUT }
  20. { WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR }
  21. { ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. }
  22. { }
  23. {*****************[ SUPPORTED PLATFORMS ]******************}
  24. { }
  25. { Only Free Pascal Compiler supported }
  26. { }
  27. {**********************************************************}
  28. UNIT Dialogs;
  29. {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
  30. INTERFACE
  31. {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
  32. {====Include file to sort compiler platform out =====================}
  33. {$I Platform.inc}
  34. {====================================================================}
  35. {==== Compiler directives ===========================================}
  36. {$X+} { Extended syntax is ok }
  37. {$R-} { Disable range checking }
  38. {$S-} { Disable Stack Checking }
  39. {$I-} { Disable IO Checking }
  40. {$Q-} { Disable Overflow Checking }
  41. {$V-} { Turn off strict VAR strings }
  42. {====================================================================}
  43. USES
  44. {$IFDEF OS_WINDOWS} { WIN/NT CODE }
  45. Windows, { Standard units }
  46. {$ENDIF}
  47. {$IFDEF OS_OS2} { OS2 CODE }
  48. OS2Def, OS2Base, OS2PMAPI, { Standard units }
  49. {$ENDIF}
  50. GFVGraph, { GFV standard unit }
  51. Common, Objects, Drivers, Views, Validate; { Standard GFV units }
  52. {***************************************************************************}
  53. { PUBLIC CONSTANTS }
  54. {***************************************************************************}
  55. {---------------------------------------------------------------------------}
  56. { COLOUR PALETTE DEFINITIONS }
  57. {---------------------------------------------------------------------------}
  58. CONST
  59. CGrayDialog = #32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47 +
  60. #48#49#50#51#52#53#54#55#56#57#58#59#60#61#62#63;
  61. CBlueDialog = #64#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79 +
  62. #80#81#82#83#84#85#86#87#88#89#90#91#92#92#94#95;
  63. CCyanDialog = #96#97#98#99#100#101#102#103#104#105#106#107#108 +
  64. #109#110#111#112#113#114#115#116#117#118#119#120 +
  65. #121#122#123#124#125#126#127;
  66. CStaticText = #6#7#8#9;
  67. CLabel = #7#8#9#9;
  68. CButton = #10#11#12#13#14#14#14#15;
  69. CCluster = #16#17#18#18#31#6;
  70. CInputLine = #19#19#20#21#14;
  71. CHistory = #22#23;
  72. CHistoryWindow = #19#19#21#24#25#19#20;
  73. CHistoryViewer = #6#6#7#6#6;
  74. CDialog = CGrayDialog; { Default palette }
  75. {---------------------------------------------------------------------------}
  76. { TDialog PALETTE COLOUR CONSTANTS }
  77. {---------------------------------------------------------------------------}
  78. CONST
  79. dpBlueDialog = 0; { Blue dialog colour }
  80. dpCyanDialog = 1; { Cyan dialog colour }
  81. dpGrayDialog = 2; { Gray dialog colour }
  82. {---------------------------------------------------------------------------}
  83. { TButton FLAGS MASKS }
  84. {---------------------------------------------------------------------------}
  85. CONST
  86. bfNormal = $00; { Normal displayed }
  87. bfDefault = $01; { Default command }
  88. bfLeftJust = $02; { Left just text }
  89. bfBroadcast = $04; { Broadcast command }
  90. bfGrabFocus = $08; { Grab focus }
  91. {---------------------------------------------------------------------------}
  92. { TMultiCheckBoxes FLAGS - (HiByte = Bits LoByte = Mask) }
  93. {---------------------------------------------------------------------------}
  94. CONST
  95. cfOneBit = $0101; { One bit masks }
  96. cfTwoBits = $0203; { Two bit masks }
  97. cfFourBits = $040F; { Four bit masks }
  98. cfEightBits = $08FF; { Eight bit masks }
  99. {---------------------------------------------------------------------------}
  100. { DIALOG BROADCAST COMMANDS }
  101. {---------------------------------------------------------------------------}
  102. CONST
  103. cmRecordHistory = 60; { Record history cmd }
  104. {***************************************************************************}
  105. { RECORD DEFINITIONS }
  106. {***************************************************************************}
  107. {---------------------------------------------------------------------------}
  108. { ITEM RECORD DEFINITION }
  109. {---------------------------------------------------------------------------}
  110. TYPE
  111. PSItem = ^TSItem;
  112. TSItem = RECORD
  113. Value: PString; { Item string }
  114. Next: PSItem; { Next item }
  115. END;
  116. {***************************************************************************}
  117. { OBJECT DEFINITIONS }
  118. {***************************************************************************}
  119. {---------------------------------------------------------------------------}
  120. { TDialog OBJECT - DIALOG OBJECT }
  121. {---------------------------------------------------------------------------}
  122. TYPE
  123. TDialog = OBJECT (TWindow)
  124. CONSTRUCTOR Init (Var Bounds: TRect; ATitle: TTitleStr);
  125. CONSTRUCTOR Load (Var S: TStream);
  126. FUNCTION GetPalette: PPalette; Virtual;
  127. FUNCTION Valid (Command: Word): Boolean; Virtual;
  128. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  129. END;
  130. PDialog = ^TDialog;
  131. {---------------------------------------------------------------------------}
  132. { TInputLine OBJECT - INPUT LINE OBJECT }
  133. {---------------------------------------------------------------------------}
  134. TYPE
  135. TInputLine = OBJECT (TView)
  136. MaxLen: Integer; { Max input length }
  137. CurPos: Integer; { Cursor position }
  138. FirstPos: Integer; { First position }
  139. SelStart: Integer; { Selected start }
  140. SelEnd: Integer; { Selected end }
  141. Data: PString; { Input line data }
  142. Validator: PValidator; { Validator of view }
  143. CONSTRUCTOR Init (Var Bounds: TRect; AMaxLen: Integer);
  144. CONSTRUCTOR Load (Var S: TStream);
  145. DESTRUCTOR Done; Virtual;
  146. FUNCTION DataSize: Word; Virtual;
  147. FUNCTION GetPalette: PPalette; Virtual;
  148. FUNCTION Valid (Command: Word): Boolean; Virtual;
  149. PROCEDURE Draw; Virtual;
  150. PROCEDURE DrawCursor; Virtual;
  151. PROCEDURE DrawbackGround; Virtual;
  152. PROCEDURE SelectAll (Enable: Boolean);
  153. PROCEDURE SetValidator (AValid: PValidator);
  154. PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
  155. PROCEDURE GetData (Var Rec); Virtual;
  156. PROCEDURE SetData (Var Rec); Virtual;
  157. PROCEDURE Store (Var S: TStream);
  158. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  159. PRIVATE
  160. FUNCTION CanScroll (Delta: Integer): Boolean;
  161. END;
  162. PInputLine = ^TInputLine;
  163. {---------------------------------------------------------------------------}
  164. { TButton OBJECT - BUTTON ANCESTOR OBJECT }
  165. {---------------------------------------------------------------------------}
  166. TYPE
  167. TButton = OBJECT (TView)
  168. AmDefault: Boolean; { If default button }
  169. Flags : Byte; { Button flags }
  170. Command : Word; { Button command }
  171. Title : PString; { Button title }
  172. CONSTRUCTOR Init (Var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;
  173. AFlags: Word);
  174. CONSTRUCTOR Load (Var S: TStream);
  175. DESTRUCTOR Done; Virtual;
  176. FUNCTION GetPalette: PPalette; Virtual;
  177. PROCEDURE Press; Virtual;
  178. PROCEDURE DrawFocus; Virtual;
  179. PROCEDURE DrawState (Down: Boolean);
  180. PROCEDURE MakeDefault (Enable: Boolean);
  181. PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
  182. PROCEDURE Store (Var S: TStream);
  183. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  184. PRIVATE
  185. DownFlag: Boolean;
  186. END;
  187. PButton = ^TButton;
  188. {---------------------------------------------------------------------------}
  189. { TCluster OBJECT - CLUSTER ANCESTOR OBJECT }
  190. {---------------------------------------------------------------------------}
  191. TYPE
  192. TCluster = OBJECT (TView)
  193. Id : Integer; { New communicate id }
  194. Sel : Integer; { Selected item }
  195. Value : LongInt; { Bit value }
  196. EnableMask: LongInt; { Mask enable bits }
  197. Strings : TStringCollection; { String collection }
  198. CONSTRUCTOR Init (Var Bounds: TRect; AStrings: PSItem);
  199. CONSTRUCTOR Load (Var S: TStream);
  200. DESTRUCTOR Done; Virtual;
  201. FUNCTION DataSize: Word; Virtual;
  202. FUNCTION GetHelpCtx: Word; Virtual;
  203. FUNCTION GetPalette: PPalette; Virtual;
  204. FUNCTION Mark (Item: Integer): Boolean; Virtual;
  205. FUNCTION MultiMark (Item: Integer): Byte; Virtual;
  206. FUNCTION ButtonState (Item: Integer): Boolean;
  207. PROCEDURE DrawFocus; Virtual;
  208. PROCEDURE Press (Item: Integer); Virtual;
  209. PROCEDURE MovedTo (Item: Integer); Virtual;
  210. PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
  211. PROCEDURE DrawMultiBox (Const Icon, Marker: String);
  212. PROCEDURE DrawBox (Const Icon: String; Marker: Char);
  213. PROCEDURE SetButtonState (AMask: Longint; Enable: Boolean);
  214. PROCEDURE GetData (Var Rec); Virtual;
  215. PROCEDURE SetData (Var Rec); Virtual;
  216. PROCEDURE Store (Var S: TStream);
  217. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  218. PRIVATE
  219. FUNCTION FindSel (P: TPoint): Integer;
  220. FUNCTION Row (Item: Integer): Integer;
  221. FUNCTION Column (Item: Integer): Integer;
  222. END;
  223. PCluster = ^TCluster;
  224. {---------------------------------------------------------------------------}
  225. { TRadioButtons OBJECT - RADIO BUTTON OBJECT }
  226. {---------------------------------------------------------------------------}
  227. TYPE
  228. TRadioButtons = OBJECT (TCluster)
  229. FUNCTION Mark (Item: Integer): Boolean; Virtual;
  230. PROCEDURE DrawFocus; Virtual;
  231. PROCEDURE Press (Item: Integer); Virtual;
  232. PROCEDURE MovedTo(Item: Integer); Virtual;
  233. PROCEDURE SetData (Var Rec); Virtual;
  234. END;
  235. PRadioButtons = ^TRadioButtons;
  236. {---------------------------------------------------------------------------}
  237. { TCheckBoxes OBJECT - CHECK BOXES OBJECT }
  238. {---------------------------------------------------------------------------}
  239. TYPE
  240. TCheckBoxes = OBJECT (TCluster)
  241. FUNCTION Mark (Item: Integer): Boolean; Virtual;
  242. PROCEDURE DrawFocus; Virtual;
  243. PROCEDURE Press (Item: Integer); Virtual;
  244. END;
  245. PCheckBoxes = ^TCheckBoxes;
  246. {---------------------------------------------------------------------------}
  247. { TMultiCheckBoxes OBJECT - CHECK BOXES OBJECT }
  248. {---------------------------------------------------------------------------}
  249. TYPE
  250. TMultiCheckBoxes = OBJECT (TCluster)
  251. SelRange: Byte; { Select item range }
  252. Flags : Word; { Select flags }
  253. States : PString; { Strings }
  254. CONSTRUCTOR Init (Var Bounds: TRect; AStrings: PSItem;
  255. ASelRange: Byte; AFlags: Word; Const AStates: String);
  256. CONSTRUCTOR Load (Var S: TStream);
  257. DESTRUCTOR Done; Virtual;
  258. FUNCTION DataSize: Word; Virtual;
  259. FUNCTION MultiMark (Item: Integer): Byte; Virtual;
  260. PROCEDURE DrawFocus; Virtual;
  261. PROCEDURE Press (Item: Integer); Virtual;
  262. PROCEDURE GetData (Var Rec); Virtual;
  263. PROCEDURE SetData (Var Rec); Virtual;
  264. PROCEDURE Store (Var S: TStream);
  265. END;
  266. PMultiCheckBoxes = ^TMultiCheckBoxes;
  267. {---------------------------------------------------------------------------}
  268. { TListBox OBJECT - LIST BOX OBJECT }
  269. {---------------------------------------------------------------------------}
  270. TYPE
  271. TListBox = OBJECT (TListViewer)
  272. List: PCollection; { List of strings }
  273. CONSTRUCTOR Init (Var Bounds: TRect; ANumCols: Word;
  274. AScrollBar: PScrollBar);
  275. CONSTRUCTOR Load (Var S: TStream);
  276. FUNCTION DataSize: Word; Virtual;
  277. FUNCTION GetText (Item: Integer; MaxLen: Integer): String; Virtual;
  278. PROCEDURE NewList(AList: PCollection); Virtual;
  279. PROCEDURE GetData (Var Rec); Virtual;
  280. PROCEDURE SetData (Var Rec); Virtual;
  281. PROCEDURE Store (Var S: TStream);
  282. END;
  283. PListBox = ^TListBox;
  284. {---------------------------------------------------------------------------}
  285. { TStaticText OBJECT - STATIC TEXT OBJECT }
  286. {---------------------------------------------------------------------------}
  287. TYPE
  288. TStaticText = OBJECT (TView)
  289. Text: PString; { Text string ptr }
  290. CONSTRUCTOR Init (Var Bounds: TRect; Const AText: String);
  291. CONSTRUCTOR Load (Var S: TStream);
  292. DESTRUCTOR Done; Virtual;
  293. FUNCTION GetPalette: PPalette; Virtual;
  294. PROCEDURE DrawBackGround; Virtual;
  295. PROCEDURE Store (Var S: TStream);
  296. PROCEDURE GetText (Var S: String); Virtual;
  297. END;
  298. PStaticText = ^TStaticText;
  299. {---------------------------------------------------------------------------}
  300. { TParamText OBJECT - PARMETER STATIC TEXT OBJECT }
  301. {---------------------------------------------------------------------------}
  302. TYPE
  303. TParamText = OBJECT (TStaticText)
  304. ParamCount: Integer; { Parameter count }
  305. ParamList : Pointer; { Parameter list }
  306. CONSTRUCTOR Init (Var Bounds: TRect; Const AText: String;
  307. AParamCount: Integer);
  308. CONSTRUCTOR Load (Var S: TStream);
  309. FUNCTION DataSize: Word; Virtual;
  310. PROCEDURE GetData (Var Rec); Virtual;
  311. PROCEDURE SetData (Var Rec); Virtual;
  312. PROCEDURE Store (Var S: TStream);
  313. PROCEDURE GetText (Var S: String); Virtual;
  314. END;
  315. PParamText = ^TParamText;
  316. {---------------------------------------------------------------------------}
  317. { TLabel OBJECT - LABEL OBJECT }
  318. {---------------------------------------------------------------------------}
  319. TYPE
  320. TLabel = OBJECT (TStaticText)
  321. Light: Boolean;
  322. Link: PView; { Linked view }
  323. CONSTRUCTOR Init (Var Bounds: TRect; CONST AText: String; ALink: PView);
  324. CONSTRUCTOR Load (Var S: TStream);
  325. FUNCTION GetPalette: PPalette; Virtual;
  326. PROCEDURE DrawBackGround; Virtual;
  327. PROCEDURE Store (Var S: TStream);
  328. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  329. END;
  330. PLabel = ^TLabel;
  331. {---------------------------------------------------------------------------}
  332. { THistoryViewer OBJECT - HISTORY VIEWER OBJECT }
  333. {---------------------------------------------------------------------------}
  334. TYPE
  335. THistoryViewer = OBJECT (TListViewer)
  336. HistoryId: Word; { History id }
  337. CONSTRUCTOR Init(Var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
  338. AHistoryId: Word);
  339. FUNCTION HistoryWidth: Integer;
  340. FUNCTION GetPalette: PPalette; Virtual;
  341. FUNCTION GetText (Item: Integer; MaxLen: Integer): String; Virtual;
  342. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  343. END;
  344. PHistoryViewer = ^THistoryViewer;
  345. {---------------------------------------------------------------------------}
  346. { THistoryWindow OBJECT - HISTORY WINDOW OBJECT }
  347. {---------------------------------------------------------------------------}
  348. TYPE
  349. THistoryWindow = OBJECT (TWindow)
  350. Viewer: PListViewer; { List viewer object }
  351. CONSTRUCTOR Init (Var Bounds: TRect; HistoryId: Word);
  352. FUNCTION GetSelection: String; Virtual;
  353. FUNCTION GetPalette: PPalette; Virtual;
  354. PROCEDURE InitViewer (HistoryId: Word); Virtual;
  355. END;
  356. PHistoryWindow = ^THistoryWindow;
  357. {---------------------------------------------------------------------------}
  358. { THistory OBJECT - HISTORY OBJECT }
  359. {---------------------------------------------------------------------------}
  360. TYPE
  361. THistory = OBJECT (TView)
  362. HistoryId: Word;
  363. Link: PInputLine;
  364. CONSTRUCTOR Init (Var Bounds: TRect; ALink: PInputLine; AHistoryId: Word);
  365. CONSTRUCTOR Load (Var S: TStream);
  366. FUNCTION GetPalette: PPalette; Virtual;
  367. FUNCTION InitHistoryWindow (Var Bounds: TRect): PHistoryWindow; Virtual;
  368. PROCEDURE Draw; Virtual;
  369. PROCEDURE RecordHistory (CONST S: String); Virtual;
  370. PROCEDURE Store (Var S: TStream);
  371. PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
  372. END;
  373. PHistory = ^THistory;
  374. {***************************************************************************}
  375. { INTERFACE ROUTINES }
  376. {***************************************************************************}
  377. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  378. { ITEM STRING ROUTINES }
  379. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  380. {-NewSItem-----------------------------------------------------------
  381. Allocates memory for a new TSItem record and sets the text field
  382. and chains to the next TSItem. This allows easy construction of
  383. singly-linked lists of strings, to end a chain the next TSItem
  384. should be nil.
  385. 28Apr98 LdB
  386. ---------------------------------------------------------------------}
  387. FUNCTION NewSItem (Const Str: String; ANext: PSItem): PSItem;
  388. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  389. { DIALOG OBJECT REGISTRATION PROCEDURE }
  390. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  391. {-RegisterDialogs----------------------------------------------------
  392. This registers all the view type objects used in this unit.
  393. 30Sep99 LdB
  394. ---------------------------------------------------------------------}
  395. PROCEDURE RegisterDialogs;
  396. {***************************************************************************}
  397. { STREAM REGISTRATION RECORDS }
  398. {***************************************************************************}
  399. {---------------------------------------------------------------------------}
  400. { TDialog STREAM REGISTRATION }
  401. {---------------------------------------------------------------------------}
  402. CONST
  403. RDialog: TStreamRec = (
  404. ObjType: 10; { Register id = 10 }
  405. VmtLink: TypeOf(TDialog);
  406. Load: @TDialog.Load; { Object load method }
  407. Store: @TDialog.Store { Object store method }
  408. );
  409. {---------------------------------------------------------------------------}
  410. { TInputLine STREAM REGISTRATION }
  411. {---------------------------------------------------------------------------}
  412. CONST
  413. RInputLine: TStreamRec = (
  414. ObjType: 11; { Register id = 11 }
  415. VmtLink: TypeOf(TInputLine);
  416. Load: @TInputLine.Load; { Object load method }
  417. Store: @TInputLine.Store { Object store method }
  418. );
  419. {---------------------------------------------------------------------------}
  420. { TButton STREAM REGISTRATION }
  421. {---------------------------------------------------------------------------}
  422. CONST
  423. RButton: TStreamRec = (
  424. ObjType: 12; { Register id = 12 }
  425. VmtLink: TypeOf(TButton);
  426. Load: @TButton.Load; { Object load method }
  427. Store: @TButton.Store { Object store method }
  428. );
  429. {---------------------------------------------------------------------------}
  430. { TCluster STREAM REGISTRATION }
  431. {---------------------------------------------------------------------------}
  432. CONST
  433. RCluster: TStreamRec = (
  434. ObjType: 13; { Register id = 13 }
  435. VmtLink: TypeOf(TCluster);
  436. Load: @TCluster.Load; { Object load method }
  437. Store: @TCluster.Store { Objects store method }
  438. );
  439. {---------------------------------------------------------------------------}
  440. { TRadioButtons STREAM REGISTRATION }
  441. {---------------------------------------------------------------------------}
  442. CONST
  443. RRadioButtons: TStreamRec = (
  444. ObjType: 14; { Register id = 14 }
  445. VmtLink: TypeOf(TRadioButtons);
  446. Load: @TRadioButtons.Load; { Object load method }
  447. Store: @TRadioButtons.Store { Object store method }
  448. );
  449. {---------------------------------------------------------------------------}
  450. { TCheckBoxes STREAM REGISTRATION }
  451. {---------------------------------------------------------------------------}
  452. CONST
  453. RCheckBoxes: TStreamRec = (
  454. ObjType: 15; { Register id = 15 }
  455. VmtLink: TypeOf(TCheckBoxes);
  456. Load: @TCheckBoxes.Load; { Object load method }
  457. Store: @TCheckBoxes.Store { Object store method }
  458. );
  459. {---------------------------------------------------------------------------}
  460. { TMultiCheckBoxes STREAM REGISTRATION }
  461. {---------------------------------------------------------------------------}
  462. CONST
  463. RMultiCheckBoxes: TStreamRec = (
  464. ObjType: 27; { Register id = 27 }
  465. VmtLink: TypeOf(TMultiCheckBoxes);
  466. Load: @TMultiCheckBoxes.Load; { Object load method }
  467. Store: @TMultiCheckBoxes.Store { Object store method }
  468. );
  469. {---------------------------------------------------------------------------}
  470. { TListBox STREAM REGISTRATION }
  471. {---------------------------------------------------------------------------}
  472. CONST
  473. RListBox: TStreamRec = (
  474. ObjType: 16; { Register id = 16 }
  475. VmtLink: TypeOf(TListBox);
  476. Load: @TListBox.Load; { Object load method }
  477. Store: @TListBox.Store { Object store method }
  478. );
  479. {---------------------------------------------------------------------------}
  480. { TStaticText STREAM REGISTRATION }
  481. {---------------------------------------------------------------------------}
  482. CONST
  483. RStaticText: TStreamRec = (
  484. ObjType: 17; { Register id = 17 }
  485. VmtLink: TypeOf(TStaticText);
  486. Load: @TStaticText.Load; { Object load method }
  487. Store: @TStaticText.Store { Object store method }
  488. );
  489. {---------------------------------------------------------------------------}
  490. { TLabel STREAM REGISTRATION }
  491. {---------------------------------------------------------------------------}
  492. CONST
  493. RLabel: TStreamRec = (
  494. ObjType: 18; { Register id = 18 }
  495. VmtLink: TypeOf(TLabel);
  496. Load: @TLabel.Load; { Object load method }
  497. Store: @TLabel.Store { Object store method }
  498. );
  499. {---------------------------------------------------------------------------}
  500. { THistory STREAM REGISTRATION }
  501. {---------------------------------------------------------------------------}
  502. CONST
  503. RHistory: TStreamRec = (
  504. ObjType: 19; { Register id = 19 }
  505. VmtLink: TypeOf(THistory);
  506. Load: @THistory.Load; { Object load method }
  507. Store: @THistory.Store { Object store method }
  508. );
  509. {---------------------------------------------------------------------------}
  510. { TParamText STREAM REGISTRATION }
  511. {---------------------------------------------------------------------------}
  512. CONST
  513. RParamText: TStreamRec = (
  514. ObjType: 20; { Register id = 20 }
  515. VmtLink: TypeOf(TParamText);
  516. Load: @TParamText.Load; { Object load method }
  517. Store: @TParamText.Store { Object store method }
  518. );
  519. {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
  520. IMPLEMENTATION
  521. {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
  522. USES HistList; { Standard GFV unit }
  523. {***************************************************************************}
  524. { PRIVATE DEFINED CONSTANTS }
  525. {***************************************************************************}
  526. {---------------------------------------------------------------------------}
  527. { LEFT AND RIGHT ARROW CHARACTER CONSTANTS }
  528. {---------------------------------------------------------------------------}
  529. CONST LeftArr = #17; RightArr = #16;
  530. {---------------------------------------------------------------------------}
  531. { TButton MESSAGES }
  532. {---------------------------------------------------------------------------}
  533. CONST
  534. cmGrabDefault = 61; { Grab default }
  535. cmReleaseDefault = 62; { Release default }
  536. {---------------------------------------------------------------------------}
  537. { IsBlank -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 08Jun98 LdB }
  538. {---------------------------------------------------------------------------}
  539. FUNCTION IsBlank (Ch: Char): Boolean;
  540. BEGIN
  541. IsBlank := (Ch = ' ') OR (Ch = #13) OR (Ch = #10); { Check for characters }
  542. END;
  543. {---------------------------------------------------------------------------}
  544. { HotKey -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 08Jun98 LdB }
  545. {---------------------------------------------------------------------------}
  546. FUNCTION HotKey (Const S: String): Char;
  547. VAR I: Word;
  548. BEGIN
  549. HotKey := #0; { Preset fail }
  550. If (S <> '') Then Begin { Valid string }
  551. I := Pos('~', S); { Search for tilde }
  552. If (I <> 0) Then HotKey := UpCase(S[I+1]); { Return hotkey }
  553. End;
  554. END;
  555. {***************************************************************************}
  556. { OBJECT METHODS }
  557. {***************************************************************************}
  558. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  559. { TDialog OBJECT METHODS }
  560. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  561. {--TDialog------------------------------------------------------------------}
  562. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  563. {---------------------------------------------------------------------------}
  564. CONSTRUCTOR TDialog.Init (Var Bounds: TRect; ATitle: TTitleStr);
  565. BEGIN
  566. Inherited Init(Bounds, ATitle, wnNoNumber); { Call ancestor }
  567. Options := Options OR ofVersion20; { Version two dialog }
  568. GrowMode := 0; { Clear grow mode }
  569. Flags := wfMove + wfClose; { Close/moveable flags }
  570. Palette := dpGrayDialog; { Default gray colours }
  571. END;
  572. {--TDialog------------------------------------------------------------------}
  573. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  574. {---------------------------------------------------------------------------}
  575. CONSTRUCTOR TDialog.Load (Var S: TStream);
  576. BEGIN
  577. Inherited Load(S); { Call ancestor }
  578. If (Options AND ofVersion = ofVersion10) Then Begin
  579. Palette := dpGrayDialog; { Set gray palette }
  580. Options := Options OR ofVersion20; { Update version flag }
  581. End;
  582. END;
  583. {--TDialog------------------------------------------------------------------}
  584. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  585. {---------------------------------------------------------------------------}
  586. FUNCTION TDialog.GetPalette: PPalette;
  587. CONST P: Array[dpBlueDialog..dpGrayDialog] Of String[Length(CBlueDialog)] =
  588. (CBlueDialog, CCyanDialog, CGrayDialog); { Always normal string }
  589. BEGIN
  590. GetPalette := @P[Palette]; { Return palette }
  591. END;
  592. {--TDialog------------------------------------------------------------------}
  593. { Valid -> Platforms DOS/DPMI/WIN/NT/Os2 - Updated 25Apr98 LdB }
  594. {---------------------------------------------------------------------------}
  595. FUNCTION TDialog.Valid (Command: Word): Boolean;
  596. BEGIN
  597. If (Command = cmCancel) Then Valid := True { Cancel returns true }
  598. Else Valid := TGroup.Valid(Command); { Call group ancestor }
  599. END;
  600. {--TDialog------------------------------------------------------------------}
  601. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  602. {---------------------------------------------------------------------------}
  603. PROCEDURE TDialog.HandleEvent (Var Event: TEvent);
  604. BEGIN
  605. Inherited HandleEvent(Event); { Call ancestor }
  606. Case Event.What Of
  607. evNothing: Exit; { Speed up exit }
  608. evKeyDown: { Key down event }
  609. Case Event.KeyCode Of
  610. kbEsc: Begin { Escape key press }
  611. Event.What := evCommand; { Command event }
  612. Event.Command := cmCancel; { cancel command }
  613. Event.InfoPtr := Nil; { Clear info ptr }
  614. PutEvent(Event); { Put event on queue }
  615. ClearEvent(Event); { Clear the event }
  616. End;
  617. kbEnter: Begin { Enter key press }
  618. Event.What := evBroadcast; { Broadcast event }
  619. Event.Command := cmDefault; { Default command }
  620. Event.InfoPtr := Nil; { Clear info ptr }
  621. PutEvent(Event); { Put event on queue }
  622. ClearEvent(Event); { Clear the event }
  623. End;
  624. End;
  625. evCommand: { Command event }
  626. Case Event.Command Of
  627. cmOk, cmCancel, cmYes, cmNo: { End dialog cmds }
  628. If (State AND sfModal <> 0) Then Begin { View is modal }
  629. EndModal(Event.Command); { End modal state }
  630. ClearEvent(Event); { Clear the event }
  631. End;
  632. End;
  633. End;
  634. END;
  635. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  636. { TInputLine OBJECT METHODS }
  637. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  638. {--TInputLine---------------------------------------------------------------}
  639. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  640. {---------------------------------------------------------------------------}
  641. CONSTRUCTOR TInputLine.Init (Var Bounds: TRect; AMaxLen: Integer);
  642. BEGIN
  643. Inherited Init(Bounds); { Call ancestor }
  644. State := State OR sfCursorVis; { Cursor visible }
  645. Options := Options OR (ofSelectable + ofFirstClick
  646. + ofVersion20); { Set options }
  647. If (MaxAvail > AMaxLen + 1) Then Begin { Check enough memory }
  648. GetMem(Data, AMaxLen + 1); { Allocate memory }
  649. Data^ := ''; { Data = empty string }
  650. End;
  651. MaxLen := AMaxLen; { Hold maximum length }
  652. END;
  653. {--TInputLine---------------------------------------------------------------}
  654. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  655. {---------------------------------------------------------------------------}
  656. CONSTRUCTOR TInputLine.Load (Var S: TStream);
  657. VAR B: Byte;
  658. BEGIN
  659. Inherited Load(S); { Call ancestor }
  660. S.Read(MaxLen, 2); { Read max length }
  661. S.Read(CurPos, 2); { Read cursor position }
  662. S.Read(FirstPos, 2); { Read first position }
  663. S.Read(SelStart, 2); { Read selected start }
  664. S.Read(SelEnd, 2); { Read selected end }
  665. S.Read(B, 1); { Read string length }
  666. If (MaxAvail > MaxLen+1) Then Begin { Check enough memory }
  667. GetMem(Data, MaxLen + 1); { Allocate memory }
  668. S.Read(Data^[1], Length(Data^)); { Read string data }
  669. SetLength(Data^, B); { Xfer string length }
  670. End Else S.Seek(S.GetPos + B); { Move to position }
  671. If (Options AND ofVersion >= ofVersion20) Then { Version 2 or above }
  672. Validator := PValidator(S.Get); { Get any validator }
  673. Options := Options OR ofVersion20; { Set version 2 flag }
  674. END;
  675. {--TInputLine---------------------------------------------------------------}
  676. { Done -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  677. {---------------------------------------------------------------------------}
  678. DESTRUCTOR TInputLine.Done;
  679. BEGIN
  680. If (Data <> Nil) Then FreeMem(Data, MaxLen + 1); { Release any memory }
  681. SetValidator(Nil); { Clear any validator }
  682. Inherited Done; { Call ancestor }
  683. END;
  684. {--TInputLine---------------------------------------------------------------}
  685. { DataSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  686. {---------------------------------------------------------------------------}
  687. FUNCTION TInputLine.DataSize: Word;
  688. VAR DSize: Word;
  689. BEGIN
  690. DSize := 0; { Preset zero datasize }
  691. If (Validator <> Nil) AND (Data <> Nil) Then
  692. DSize := Validator^.Transfer(Data^, Nil,
  693. vtDataSize); { Add validator size }
  694. If (DSize <> 0) Then DataSize := DSize { Use validtor size }
  695. Else DataSize := MaxLen + 1; { No validator use size }
  696. END;
  697. {--TInputLine---------------------------------------------------------------}
  698. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  699. {---------------------------------------------------------------------------}
  700. FUNCTION TInputLine.GetPalette: PPalette;
  701. CONST P: String[Length(CInputLine)] = CInputLine; { Always normal string }
  702. BEGIN
  703. GetPalette := @P; { Return palette }
  704. END;
  705. {--TInputLine---------------------------------------------------------------}
  706. { Valid -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  707. {---------------------------------------------------------------------------}
  708. FUNCTION TInputLine.Valid (Command: Word): Boolean;
  709. FUNCTION AppendError (Validator: PValidator): Boolean;
  710. BEGIN
  711. AppendError := False; { Preset false }
  712. If (Data <> Nil) Then
  713. With Validator^ Do
  714. If (Options AND voOnAppend <> 0) AND { Check options }
  715. (CurPos <> Length(Data^)) AND { Exceeds max length }
  716. NOT IsValidInput(Data^, True) Then Begin { Check data valid }
  717. Error; { Call error }
  718. AppendError := True; { Return true }
  719. End;
  720. END;
  721. BEGIN
  722. Valid := Inherited Valid(Command); { Call ancestor }
  723. If (Validator <> Nil) AND (Data <> Nil) AND { Validator present }
  724. (State AND sfDisabled = 0) Then { Not disabled }
  725. If (Command = cmValid) Then { Valid command }
  726. Valid := Validator^.Status = vsOk { Validator result }
  727. Else If (Command <> cmCancel) Then { Not cancel command }
  728. If AppendError(Validator) OR { Append any error }
  729. NOT Validator^.Valid(Data^) Then Begin { Check validator }
  730. Select; { Reselect view }
  731. Valid := False; { Return false }
  732. End;
  733. END;
  734. {--TInputLine---------------------------------------------------------------}
  735. { Draw -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  736. {---------------------------------------------------------------------------}
  737. PROCEDURE TInputLine.Draw;
  738. VAR Color: Byte; X, L, R: Integer; S, T: String;
  739. BEGIN
  740. If (State AND sfFocused = 0) Then Color := 1 { Not focused colour }
  741. Else Color := 2; { Focused colour }
  742. If CanScroll(-1) Then WriteStr(0, 0, LeftArr, 4); { Set left scroll mark }
  743. If CanScroll(1) Then WriteStr(-(RawSize.X + 1 -
  744. TextWidth(RightArr)), 0, RightArr, 4); { Set right scroll mark }
  745. If (Data <> Nil) Then S := Copy(Data^, FirstPos+1,
  746. Length(Data^)-FirstPos) Else S := ''; { Fetch data string }
  747. X := TextWidth(LeftArr); { left arrow width }
  748. While (TextWidth(S) > ((RawSize.X+1)-X-TextWidth(
  749. RightArr))) Do Delete(S, Length(S), 1); { Cut to right length }
  750. If (State AND sfFocused <> 0) Then Begin
  751. L := SelStart - FirstPos; { Selected left end }
  752. R := SelEnd - FirstPos; { Selected right end }
  753. If (L < 0) Then L := 0; { Fix any negative }
  754. If (R > Length(S)) Then R := Length(S); { Fix to long case }
  755. If (L > 0) Then Begin
  756. T := Copy(S, 1, L); { Unhighlight bit }
  757. WriteStr(-X, 0, T, Color); { Write string to screen }
  758. X := X + TextWidth(T); { New x position }
  759. Delete(S, 1, L); { Reduce string }
  760. End;
  761. If (L < R) Then Begin
  762. T := Copy(S, 1, R-L); { Highlight bit }
  763. WriteStr(-X, 0, T, 3); { Write string to screen }
  764. X := X + TextWidth(T); { New x position }
  765. Delete(S, 1, R-L); { Reduce string }
  766. End;
  767. If (Length(S) > 0) Then
  768. WriteStr(-X, 0, S, Color); { Write string to screen }
  769. End Else WriteStr(-X, 0, S, Color); { Write string to screen }
  770. Cursor.X := CurPos - FirstPos + 1; { Update cursor position }
  771. END;
  772. {--TInputLine---------------------------------------------------------------}
  773. { DrawbackGround -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  774. {---------------------------------------------------------------------------}
  775. PROCEDURE TInputLine.DrawBackGround;
  776. BEGIN
  777. Inherited DrawBackGround; { Call ancestor }
  778. END;
  779. {--TInputLine---------------------------------------------------------------}
  780. { DrawCursor -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 05Oct99 LdB }
  781. {---------------------------------------------------------------------------}
  782. PROCEDURE TInputLine.DrawCursor;
  783. VAR I, X: Integer; S: String;
  784. BEGIN
  785. If (State AND sfFocused <> 0) Then Begin { Focused window }
  786. X := TextWidth(LeftArr); { Preset x position }
  787. I := 0; { Preset cursor width }
  788. If (Data <> Nil) Then Begin { Data pointer valid }
  789. S := Copy(Data^, FirstPos+1, CurPos-FirstPos); { Copy the string }
  790. X := X + TextWidth(S); { Calculate position }
  791. If (State AND sfCursorIns <> 0) Then { Check insert mode }
  792. If ((CurPos+1) <= Length(Data^)) Then
  793. I := TextWidth(Data^[CurPos+1]) { Insert caret width }
  794. Else I := FontWidth; { At end use fontwidth }
  795. End;
  796. If (State AND sfCursorIns <> 0) Then Begin { Insert mode }
  797. If ((CurPos+1) <= Length(Data^)) Then { Not beyond end }
  798. WriteStr(-X, 0, Data^[CurPos+1], 5) { Create block cursor }
  799. Else ClearArea(X, 0, X+I, FontHeight, Green);{ Line cursor }
  800. End Else ClearArea(X, 0, X+I, FontHeight, Green);{ Line cursor }
  801. End;
  802. END;
  803. {--TInputLine---------------------------------------------------------------}
  804. { SelectAll -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  805. {---------------------------------------------------------------------------}
  806. PROCEDURE TInputLine.SelectAll (Enable: Boolean);
  807. BEGIN
  808. CurPos := 0; { Cursor to start }
  809. FirstPos := 0; { First pos to start }
  810. SelStart := 0; { Selected at start }
  811. If Enable AND (Data <> Nil) Then
  812. SelEnd := Length(Data^) Else SelEnd := 0; { Selected which end }
  813. DrawView; { Now redraw the view }
  814. END;
  815. {--TInputLine---------------------------------------------------------------}
  816. { SetValidator -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  817. {---------------------------------------------------------------------------}
  818. PROCEDURE TInputLine.SetValidator (AValid: PValidator);
  819. BEGIN
  820. If (Validator <> Nil) Then Validator^.Free; { Release validator }
  821. Validator := AValid; { Set new validator }
  822. END;
  823. {--TInputLine---------------------------------------------------------------}
  824. { SetState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  825. {---------------------------------------------------------------------------}
  826. PROCEDURE TInputLine.SetState (AState: Word; Enable: Boolean);
  827. BEGIN
  828. Inherited SetState(AState, Enable); { Call ancestor }
  829. If (AState = sfSelected) OR ((AState = sfActive)
  830. AND (State and sfSelected <> 0)) Then
  831. SelectAll(Enable) Else { Call select all }
  832. If (AState = sfFocused) Then DrawView; { Redraw for focus }
  833. END;
  834. {--TInputLine---------------------------------------------------------------}
  835. { GetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  836. {---------------------------------------------------------------------------}
  837. PROCEDURE TInputLine.GetData (Var Rec);
  838. BEGIN
  839. If (Data <> Nil) Then Begin { Data ptr valid }
  840. If (Validator = Nil) OR (Validator^.Transfer(Data^,
  841. @Rec, vtGetData) = 0) Then Begin { No validator/data }
  842. FillChar(Rec, DataSize, #0); { Clear the data area }
  843. Move(Data^, Rec, Length(Data^) + 1); { Transfer our data }
  844. End;
  845. End Else FillChar(Rec, DataSize, #0); { Clear the data area }
  846. END;
  847. {--TInputLine---------------------------------------------------------------}
  848. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  849. {---------------------------------------------------------------------------}
  850. PROCEDURE TInputLine.SetData (Var Rec);
  851. BEGIN
  852. If (Data <> Nil) Then Begin { Data ptr valid }
  853. If (Validator = Nil) OR (Validator^.Transfer(
  854. Data^, @Rec, vtSetData) = 0) Then { No validator/data }
  855. Move(Rec, Data^[0], DataSize); { Set our data }
  856. End;
  857. SelectAll(True); { Now select all }
  858. END;
  859. {--TInputLine---------------------------------------------------------------}
  860. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  861. {---------------------------------------------------------------------------}
  862. PROCEDURE TInputLine.Store (Var S: TStream);
  863. BEGIN
  864. TView.Store(S); { Implict TView.Store }
  865. S.Write(MaxLen, 2); { Read max length }
  866. S.Write(CurPos, 2); { Read cursor position }
  867. S.Write(FirstPos, 2); { Read first position }
  868. S.Write(SelStart, 2); { Read selected start }
  869. S.Write(SelEnd, 2); { Read selected end }
  870. S.WriteStr(Data); { Write the data }
  871. S.Put(Validator); { Write any validator }
  872. END;
  873. {--TInputLine---------------------------------------------------------------}
  874. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  875. {---------------------------------------------------------------------------}
  876. PROCEDURE TInputLine.HandleEvent (Var Event: TEvent);
  877. CONST PadKeys = [$47, $4B, $4D, $4F, $73, $74];
  878. VAR WasAppending: Boolean; ExtendBlock: Boolean; OldData: String;
  879. Delta, Anchor, OldCurPos, OldFirstPos, OldSelStart, OldSelEnd: Integer;
  880. FUNCTION MouseDelta: Integer;
  881. BEGIN
  882. If (Event.Where.X <= RawOrigin.X+TextWidth(LeftArr))
  883. Then MouseDelta := -1 Else { To left of text area }
  884. If ((Event.Where.X-RawOrigin.X) >= RawSize.X -
  885. TextWidth(RightArr)) Then MouseDelta := 1 { To right of text area }
  886. Else MouseDelta := 0; { In area return 0 }
  887. END;
  888. FUNCTION MousePos: Integer;
  889. VAR Mp, Tw, Pos: Integer; S: String;
  890. BEGIN
  891. Mp := Event.Where.X - RawOrigin.X; { Mouse position }
  892. If (Data <> Nil) Then S := Copy(Data^, FirstPos+1,
  893. Length(Data^)-FirstPos) Else S := ''; { Text area string }
  894. Tw := TextWidth(LeftArr); { Text width }
  895. Pos := 0; { Zero position }
  896. While (Mp > Tw) AND (Pos <= Length(S)) Do Begin { Still text to right }
  897. Tw := Tw + TextWidth(S[Pos+1]); { Add next character }
  898. Inc(Pos); { Next character }
  899. End;
  900. If (Pos > 0) Then Dec(Pos);
  901. MousePos := FirstPos + Pos; { Return mouse position }
  902. END;
  903. PROCEDURE DeleteSelect;
  904. BEGIN
  905. If (SelStart <> SelEnd) Then Begin { An area selected }
  906. If (Data <> Nil) Then
  907. Delete(Data^, SelStart+1, SelEnd-SelStart); { Delete the text }
  908. CurPos := SelStart; { Set cursor position }
  909. End;
  910. END;
  911. PROCEDURE AdjustSelectBlock;
  912. BEGIN
  913. If (CurPos < Anchor) Then Begin { Selection backwards }
  914. SelStart := CurPos; { Start of select }
  915. SelEnd := Anchor; { End of select }
  916. End Else Begin
  917. SelStart := Anchor; { Start of select }
  918. SelEnd := CurPos; { End of select }
  919. End;
  920. END;
  921. PROCEDURE SaveState;
  922. BEGIN
  923. If (Validator <> Nil) Then Begin { Check for validator }
  924. If (Data <> Nil) Then OldData := Data^; { Hold data }
  925. OldCurPos := CurPos; { Hold cursor position }
  926. OldFirstPos := FirstPos; { Hold first position }
  927. OldSelStart := SelStart; { Hold select start }
  928. OldSelEnd := SelEnd; { Hold select end }
  929. If (Data = Nil) Then WasAppending := True { Invalid data ptr }
  930. Else WasAppending := Length(Data^) = CurPos; { Hold appending state }
  931. End;
  932. END;
  933. PROCEDURE RestoreState;
  934. BEGIN
  935. If (Validator <> Nil) Then Begin { Validator valid }
  936. If (Data <> Nil) Then Data^ := OldData; { Restore data }
  937. CurPos := OldCurPos; { Restore cursor pos }
  938. FirstPos := OldFirstPos; { Restore first pos }
  939. SelStart := OldSelStart; { Restore select start }
  940. SelEnd := OldSelEnd; { Restore select end }
  941. End;
  942. END;
  943. FUNCTION CheckValid (NoAutoFill: Boolean): Boolean;
  944. VAR OldLen: Integer; NewData: String;
  945. BEGIN
  946. If (Validator <> Nil) Then Begin { Validator valid }
  947. CheckValid := False; { Preset false return }
  948. If (Data <> Nil) Then OldLen := Length(Data^); { Hold old length }
  949. If (Validator^.Options AND voOnAppend = 0) OR
  950. (WasAppending AND (CurPos = OldLen)) Then Begin
  951. If (Data <> Nil) Then NewData := Data^ { Hold current data }
  952. Else NewData := ''; { Set empty string }
  953. If NOT Validator^.IsValidInput(NewData,
  954. NoAutoFill) Then RestoreState Else Begin
  955. If (Length(NewData) > MaxLen) Then { Exceeds maximum }
  956. SetLength(NewData, MaxLen); { Set string length }
  957. If (Data <> Nil) Then Data^ := NewData; { Set data value }
  958. If (Data <> Nil) AND (CurPos >= OldLen) { Cursor beyond end }
  959. AND (Length(Data^) > OldLen) Then { Cursor beyond string }
  960. CurPos := Length(Data^); { Set cursor position }
  961. CheckValid := True; { Return true result }
  962. End;
  963. End Else Begin
  964. CheckValid := True; { Preset true return }
  965. If (CurPos = OldLen) AND (Data <> Nil) Then { Lengths match }
  966. If NOT Validator^.IsValidInput(Data^,
  967. False) Then Begin { Check validator }
  968. Validator^.Error; { Call error }
  969. CheckValid := False; { Return false result }
  970. End;
  971. End;
  972. End Else CheckValid := True; { No validator }
  973. END;
  974. BEGIN
  975. Inherited HandleEvent(Event); { Call ancestor }
  976. If (State AND sfSelected <> 0) Then Begin { View is selected }
  977. Case Event.What Of
  978. evNothing: Exit; { Speed up exit }
  979. evMouseDown: Begin { Mouse down event }
  980. Delta := MouseDelta; { Calc scroll value }
  981. If CanScroll(Delta) Then Begin { Can scroll }
  982. Repeat
  983. If CanScroll(Delta) Then Begin { Still can scroll }
  984. Inc(FirstPos, Delta); { Move start position }
  985. DrawView; { Redraw the view }
  986. End;
  987. Until NOT MouseEvent(Event, evMouseAuto); { Until no mouse auto }
  988. End Else If Event.Double Then { Double click }
  989. SelectAll(True) Else Begin { Select whole text }
  990. Anchor := MousePos; { Start of selection }
  991. Repeat
  992. If (Event.What = evMouseAuto) { Mouse auto event }
  993. Then Begin
  994. Delta := MouseDelta; { New position }
  995. If CanScroll(Delta) Then { If can scroll }
  996. Inc(FirstPos, Delta);
  997. End;
  998. CurPos := MousePos; { Set cursor position }
  999. AdjustSelectBlock; { Adjust selected }
  1000. DrawView; { Redraw the view }
  1001. Until NOT MouseEvent(Event, evMouseMove
  1002. + evMouseAuto); { Until mouse released }
  1003. End;
  1004. ClearEvent(Event); { Clear the event }
  1005. End;
  1006. evKeyDown: Begin
  1007. SaveState; { Save state of view }
  1008. Event.KeyCode := CtrlToArrow(Event.KeyCode); { Convert keycode }
  1009. If (Event.ScanCode IN PadKeys) AND
  1010. (GetShiftState AND $03 <> 0) Then Begin { Mark selection active }
  1011. Event.CharCode := #0; { Clear char code }
  1012. If (CurPos = SelEnd) Then { Find if at end }
  1013. Anchor := SelStart Else { Anchor from start }
  1014. Anchor := SelEnd; { Anchor from end }
  1015. ExtendBlock := True; { Extended block true }
  1016. End Else ExtendBlock := False; { No extended block }
  1017. Case Event.KeyCode Of
  1018. kbLeft: If (CurPos > 0) Then Dec(CurPos); { Move cursor left }
  1019. kbRight: If (Data <> Nil) AND { Move right cursor }
  1020. (CurPos < Length(Data^)) Then Begin { Check not at end }
  1021. Inc(CurPos); { Move cursor }
  1022. CheckValid(True); { Check if valid }
  1023. End;
  1024. kbHome: CurPos := 0; { Move to line start }
  1025. kbEnd: Begin { Move to line end }
  1026. If (Data = Nil) Then CurPos := 0 { Invalid data ptr }
  1027. Else CurPos := Length(Data^); { Set cursor position }
  1028. CheckValid(True); { Check if valid }
  1029. End;
  1030. kbBack: If (Data <> Nil) AND (CurPos > 0) { Not at line start }
  1031. Then Begin
  1032. Delete(Data^, CurPos, 1); { Backspace over char }
  1033. Dec(CurPos); { Move cursor back one }
  1034. If (FirstPos > 0) Then Dec(FirstPos); { Move first position }
  1035. CheckValid(True); { Check if valid }
  1036. End;
  1037. kbDel: If (Data <> Nil) Then Begin { Delete character }
  1038. If (SelStart = SelEnd) Then { Select all on }
  1039. If (CurPos < Length(Data^)) Then Begin { Cursor not at end }
  1040. SelStart := CurPos; { Set select start }
  1041. SelEnd := CurPos + 1; { Set select end }
  1042. End;
  1043. DeleteSelect; { Deselect selection }
  1044. CheckValid(True); { Check if valid }
  1045. End;
  1046. kbIns: SetState(sfCursorIns, State AND
  1047. sfCursorIns = 0); { Flip insert state }
  1048. Else Case Event.CharCode Of
  1049. ' '..#255: If (Data <> Nil) Then Begin { Character key }
  1050. If (State AND sfCursorIns <> 0) Then
  1051. Delete(Data^, CurPos + 1, 1) Else { Overwrite character }
  1052. DeleteSelect; { Deselect selected }
  1053. If CheckValid(True) Then Begin { Check data valid }
  1054. If (Length(Data^) < MaxLen) Then { Must not exceed maxlen }
  1055. Begin
  1056. If (FirstPos > CurPos) Then
  1057. FirstPos := CurPos; { Advance first position }
  1058. Inc(CurPos); { Increment cursor }
  1059. Insert(Event.CharCode, Data^,
  1060. CurPos); { Insert the character }
  1061. End;
  1062. CheckValid(False); { Check data valid }
  1063. End;
  1064. End;
  1065. ^Y: If (Data <> Nil) Then Begin { Clear all data }
  1066. Data^ := ''; { Set empty string }
  1067. CurPos := 0; { Cursor to start }
  1068. End;
  1069. Else Exit; { Unused key }
  1070. End
  1071. End;
  1072. If ExtendBlock Then AdjustSelectBlock { Extended block }
  1073. Else Begin
  1074. SelStart := CurPos; { Set select start }
  1075. SelEnd := CurPos; { Set select end }
  1076. End;
  1077. If (FirstPos > CurPos) Then
  1078. FirstPos := CurPos; { Advance first pos }
  1079. If (Data <> Nil) Then OldData := Copy(Data^,
  1080. FirstPos+1, CurPos-FirstPos) { Text area string }
  1081. Else OldData := ''; { Empty string }
  1082. Delta := FontWidth; { Safety = 1 char }
  1083. While (TextWidth(OldData) > ((RawSize.X+1)-Delta)
  1084. - TextWidth(LeftArr) - TextWidth(RightArr)) { Check text fits }
  1085. Do Begin
  1086. Inc(FirstPos); { Advance first pos }
  1087. OldData := Copy(Data^, FirstPos+1,
  1088. CurPos-FirstPos) { Text area string }
  1089. End;
  1090. DrawView; { Redraw the view }
  1091. ClearEvent(Event); { Clear the event }
  1092. End;
  1093. End;
  1094. End;
  1095. END;
  1096. {***************************************************************************}
  1097. { TInputLine OBJECT PRIVATE METHODS }
  1098. {***************************************************************************}
  1099. {--TInputLine---------------------------------------------------------------}
  1100. { CanScroll -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  1101. {---------------------------------------------------------------------------}
  1102. FUNCTION TInputLine.CanScroll (Delta: Integer): Boolean;
  1103. VAR S: String;
  1104. BEGIN
  1105. If (Delta < 0) Then CanScroll := FirstPos > 0 { Check scroll left }
  1106. Else If (Delta > 0) Then Begin
  1107. If (Data = Nil) Then S := '' Else { Data ptr invalid }
  1108. S := Copy(Data^, FirstPos+1, Length(Data^)
  1109. - FirstPos); { Fetch max string }
  1110. CanScroll := (TextWidth(S)) > (RawSize.X -
  1111. TextWidth(LeftArr) - TextWidth(RightArr)); { Check scroll right }
  1112. End Else CanScroll := False; { Zero so no scroll }
  1113. END;
  1114. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1115. { TButton OBJECT METHODS }
  1116. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1117. {--TButton------------------------------------------------------------------}
  1118. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  1119. {---------------------------------------------------------------------------}
  1120. CONSTRUCTOR TButton.Init (Var Bounds: TRect; ATitle: TTitleStr;
  1121. ACommand: Word; AFlags: Word);
  1122. BEGIN
  1123. Inherited Init(Bounds); { Call ancestor }
  1124. EventMask := EventMask OR evBroadcast; { Handle broadcasts }
  1125. GOptions := GOptions OR goDrawFocus; { Set new option mask }
  1126. Options := Options OR (ofSelectable + ofFirstClick
  1127. + ofPreProcess + ofPostProcess); { Set option flags }
  1128. If NOT CommandEnabled(ACommand) Then
  1129. State := State OR sfDisabled; { Check command state }
  1130. Flags := AFlags; { Hold flags }
  1131. If (AFlags AND bfDefault <> 0) Then AmDefault := True
  1132. Else AmDefault := False; { Check if default }
  1133. Title := NewStr(ATitle); { Hold title string }
  1134. Command := ACommand; { Hold button command }
  1135. TabMask := TabMask OR (tmLeft + tmRight +
  1136. tmTab + tmShiftTab + tmUp + tmDown); { Set tab masks }
  1137. END;
  1138. {--TButton------------------------------------------------------------------}
  1139. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  1140. {---------------------------------------------------------------------------}
  1141. CONSTRUCTOR TButton.Load (Var S: TStream);
  1142. BEGIN
  1143. Inherited Load(S); { Call ancestor }
  1144. Title := S.ReadStr; { Read title }
  1145. S.Read(Command, 2); { Read command }
  1146. S.Read(Flags, 1); { Read flags }
  1147. S.Read(AmDefault, 1); { Read if default }
  1148. If NOT CommandEnabled(Command) Then { Check command state }
  1149. State := State OR sfDisabled Else { Command disabled }
  1150. State := State AND NOT sfDisabled; { Command enabled }
  1151. END;
  1152. {--TButton------------------------------------------------------------------}
  1153. { Done -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  1154. {---------------------------------------------------------------------------}
  1155. DESTRUCTOR TButton.Done;
  1156. BEGIN
  1157. If (Title <> Nil) Then DisposeStr(Title); { Dispose title }
  1158. Inherited Done; { Call ancestor }
  1159. END;
  1160. {--TButton------------------------------------------------------------------}
  1161. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Apr98 LdB }
  1162. {---------------------------------------------------------------------------}
  1163. FUNCTION TButton.GetPalette: PPalette;
  1164. CONST P: String[Length(CButton)] = CButton; { Always normal string }
  1165. BEGIN
  1166. GetPalette := @P; { Get button palette }
  1167. END;
  1168. {--TButton------------------------------------------------------------------}
  1169. { Press -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 29Apr98 LdB }
  1170. {---------------------------------------------------------------------------}
  1171. PROCEDURE TButton.Press;
  1172. VAR E: TEvent;
  1173. BEGIN
  1174. Message(Owner, evBroadcast, cmRecordHistory, Nil); { Message for history }
  1175. If (Flags AND bfBroadcast <> 0) Then { Broadcasting button }
  1176. Message(Owner, evBroadcast, Command, @Self) { Send message }
  1177. Else Begin
  1178. E.What := evCommand; { Command event }
  1179. E.Command := Command; { Set command value }
  1180. E.InfoPtr := @Self; { Pointer to self }
  1181. PutEvent(E); { Put event on queue }
  1182. End;
  1183. END;
  1184. {--TButton------------------------------------------------------------------}
  1185. { DrawFocus -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1186. {---------------------------------------------------------------------------}
  1187. PROCEDURE TButton.DrawFocus;
  1188. VAR B: Byte; I, Pos: Integer;
  1189. Bc: Word; Db: TDrawBuffer;
  1190. C : char;
  1191. BEGIN
  1192. If not TextModeGFV then Begin
  1193. If DownFlag Then B := 7 Else B := 0; { Shadow colour }
  1194. GraphRectangle(0, 0, RawSize.X, RawSize.Y, B); { Draw backing shadow }
  1195. GraphRectangle(1, 1, RawSize.X-1, RawSize.Y-1, B); { Draw backing shadow }
  1196. If DownFlag Then B := 0 Else B := 15; { Highlight colour }
  1197. GraphLine(0, RawSize.Y, 0, 0, B);
  1198. GraphLine(1, RawSize.Y-1, 1, 1, B); { Left highlights }
  1199. GraphLine(0, 0, RawSize.X, 0, B);
  1200. GraphLine(1, 1, RawSize.X-1, 1, B); { Top highlights }
  1201. If DownFlag Then B := 8 Else B := 7; { Select backing }
  1202. If (State AND sfFocused <> 0) AND
  1203. (DownFlag = False) Then B := 14; { Show as focused }
  1204. GraphRectangle(2, 2, RawSize.X-2, RawSize.Y-2, B); { Draw first border }
  1205. GraphRectangle(3, 3, RawSize.X-3, RawSize.Y-3, B); { Draw next border }
  1206. End;
  1207. If (State AND sfDisabled <> 0) Then { Button disabled }
  1208. Bc := GetColor($0404) Else Begin { Disabled colour }
  1209. Bc := GetColor($0501); { Set normal colour }
  1210. If (State AND sfActive <> 0) Then { Button is active }
  1211. If (State AND sfSelected <> 0) Then
  1212. Bc := GetColor($0703) Else { Set selected colour }
  1213. If AmDefault Then Bc := GetColor($0602); { Set is default colour }
  1214. End;
  1215. If (Title <> Nil) Then Begin { We have a title }
  1216. If (Flags AND bfLeftJust = 0) Then Begin { Not left set title }
  1217. I := TextWidth(Title^); { Fetch title width }
  1218. I := (RawSize.X - I) DIV 2; { Centre in button }
  1219. End Else I := FontWidth; { Left edge of button }
  1220. If TextModeGFV and DownFlag then Begin
  1221. MoveChar(Db,' ',Bc,1);
  1222. Pos:=1;
  1223. end else Pos:=0;
  1224. MoveCStr(Db[Pos], Title^, Bc); { Move title to buffer }
  1225. If not TextModeGFV then Begin
  1226. GOptions := GOptions OR goGraphView; { Graphics co-ords mode }
  1227. WriteLine(I, FontHeight DIV 2, CStrLen(Title^)+Pos,
  1228. 1, Db); { Write the title }
  1229. GOptions := GOptions AND NOT goGraphView; { Return to normal mode }
  1230. End Else Begin
  1231. WriteLine(I div SysFontWidth, 0, CStrLen(Title^),
  1232. 1, Db); { Write the title }
  1233. If Size.Y>1 then Begin
  1234. Bc:={GetColor($0707)}$70;
  1235. if DownFlag then c:=' '
  1236. else c:='Ü';
  1237. MoveChar(Db,c,Bc,1);
  1238. WriteLine(Size.X-1, 0, 1, 1, Db); { Write the title }
  1239. MoveChar(Db,' ',Bc,1);
  1240. if DownFlag then c:=' '
  1241. else c:='ß';
  1242. MoveChar(Db[1],c,Bc,Size.X-1);
  1243. WriteLine(0, 1, Size.X, 1, Db);
  1244. End;
  1245. End;
  1246. End;
  1247. END;
  1248. {--TButton------------------------------------------------------------------}
  1249. { DrawState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1250. {---------------------------------------------------------------------------}
  1251. PROCEDURE TButton.DrawState (Down: Boolean);
  1252. BEGIN
  1253. DownFlag := Down; { Set down flag }
  1254. SetDrawMask(vdFocus); { Set focus mask }
  1255. DrawView; { Redraw the view }
  1256. END;
  1257. {--TButton------------------------------------------------------------------}
  1258. { MakeDefault -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  1259. {---------------------------------------------------------------------------}
  1260. PROCEDURE TButton.MakeDefault (Enable: Boolean);
  1261. VAR C: Word;
  1262. BEGIN
  1263. If (Flags AND bfDefault=0) Then Begin { Not default }
  1264. If Enable Then C := cmGrabDefault
  1265. Else C := cmReleaseDefault; { Change default }
  1266. Message(Owner, evBroadcast, C, @Self); { Message to owner }
  1267. AmDefault := Enable; { Set default flag }
  1268. DrawView; { Now redraw button }
  1269. End;
  1270. END;
  1271. {--TButton------------------------------------------------------------------}
  1272. { SetState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB }
  1273. {---------------------------------------------------------------------------}
  1274. PROCEDURE TButton.SetState (AState: Word; Enable: Boolean);
  1275. BEGIN
  1276. Inherited SetState(AState, Enable); { Call ancestor }
  1277. If (AState AND (sfSelected + sfActive) <> 0) { Changing select }
  1278. Then DrawView; { Redraw required }
  1279. If (AState AND sfFocused <> 0) Then
  1280. MakeDefault(Enable); { Check for default }
  1281. END;
  1282. {--TButton------------------------------------------------------------------}
  1283. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  1284. {---------------------------------------------------------------------------}
  1285. PROCEDURE TButton.Store (Var S: TStream);
  1286. BEGIN
  1287. TView.Store(S); { Implict TView.Store }
  1288. S.WriteStr(Title); { Store title string }
  1289. S.Write(Command, 2); { Store command }
  1290. S.Write(Flags, 1); { Store flags }
  1291. S.Write(AmDefault, 1); { Store default flag }
  1292. END;
  1293. {--TButton------------------------------------------------------------------}
  1294. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 05Sep99 LdB }
  1295. {---------------------------------------------------------------------------}
  1296. PROCEDURE TButton.HandleEvent (Var Event: TEvent);
  1297. VAR Down: Boolean; C: Char; ButRect: TRect;
  1298. BEGIN
  1299. ButRect.A := RawOrigin; { Get origin point }
  1300. ButRect.B.X := RawOrigin.X + RawSize.X; { Calc right side }
  1301. ButRect.B.Y := RawOrigin.Y + RawSize.Y; { Calc bottom }
  1302. If (Event.What = evMouseDown) Then Begin { Mouse down event }
  1303. If NOT MouseInView(Event.Where) Then Begin { If point not in view }
  1304. ClearEvent(Event); { Clear the event }
  1305. Exit; { Speed up exit }
  1306. End;
  1307. End;
  1308. If (Flags AND bfGrabFocus <> 0) Then { Check focus grab }
  1309. Inherited HandleEvent(Event); { Call ancestor }
  1310. Case Event.What Of
  1311. evNothing: Exit; { Speed up exit }
  1312. evMouseDown: Begin
  1313. If (State AND sfDisabled = 0) Then Begin { Button not disabled }
  1314. Down := False; { Clear down flag }
  1315. Repeat
  1316. If (Down <> ButRect.Contains(Event.Where)) { State has changed }
  1317. Then Begin
  1318. Down := NOT Down; { Invert down flag }
  1319. DrawState(Down); { Redraw button }
  1320. End;
  1321. Until NOT MouseEvent(Event, evMouseMove); { Wait for mouse move }
  1322. If Down Then Begin { Button is down }
  1323. Press; { Send out command }
  1324. DrawState(False); { Draw button up }
  1325. End;
  1326. End;
  1327. ClearEvent(Event); { Event was handled }
  1328. End;
  1329. evKeyDown: Begin
  1330. If (Title <> Nil) Then C := HotKey(Title^) { Key title hotkey }
  1331. Else C := #0; { Invalid title }
  1332. If (Event.KeyCode = GetAltCode(C)) OR { Alt char }
  1333. (Owner^.Phase = phPostProcess) AND (C <> #0)
  1334. AND (Upcase(Event.CharCode) = C) OR { Matches hotkey }
  1335. (State AND sfFocused <> 0) AND { View focused }
  1336. ((Event.CharCode = ' ') OR { Space bar }
  1337. (Event.KeyCode=kbEnter)) Then Begin { Enter key }
  1338. DrawState(True); { Draw button down }
  1339. Press; { Send out command }
  1340. ClearEvent(Event); { Clear the event }
  1341. DrawState(False); { Draw button up }
  1342. End;
  1343. End;
  1344. evBroadcast:
  1345. Case Event.Command of
  1346. cmDefault: If AmDefault AND { Default command }
  1347. (State AND sfDisabled = 0) Then Begin { Button enabled }
  1348. Press; { Send out command }
  1349. ClearEvent(Event); { Clear the event }
  1350. End;
  1351. cmGrabDefault, cmReleaseDefault: { Grab and release cmd }
  1352. If (Flags AND bfDefault <> 0) Then Begin { Change button state }
  1353. AmDefault := Event.Command = cmReleaseDefault;
  1354. DrawView; { Redraw the view }
  1355. End;
  1356. cmCommandSetChanged: Begin { Command set changed }
  1357. SetState(sfDisabled, NOT
  1358. CommandEnabled(Command)); { Set button state }
  1359. DrawView; { Redraw the view }
  1360. End;
  1361. End;
  1362. End;
  1363. END;
  1364. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1365. { TCluster OBJECT METHODS }
  1366. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1367. CONST TvClusterClassName = 'TVCLUSTER';
  1368. {--TCluster-----------------------------------------------------------------}
  1369. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28May98 LdB }
  1370. {---------------------------------------------------------------------------}
  1371. CONSTRUCTOR TCluster.Init (Var Bounds: TRect; AStrings: PSItem);
  1372. VAR I: Integer; P: PSItem;
  1373. BEGIN
  1374. Inherited Init(Bounds); { Call ancestor }
  1375. GOptions := GOptions OR goDrawFocus; { Draw focus view }
  1376. Options := Options OR (ofSelectable + ofFirstClick
  1377. + ofPreProcess + ofPostProcess + ofVersion20); { Set option masks }
  1378. I := 0; { Zero string count }
  1379. P := AStrings; { First item }
  1380. While (P <> Nil) Do Begin
  1381. Inc(I); { Count 1 item }
  1382. P := P^.Next; { Move to next item }
  1383. End;
  1384. Strings.Init(I, 0); { Create collection }
  1385. While (AStrings <> Nil) Do Begin
  1386. P := AStrings; { Transfer item ptr }
  1387. Strings.AtInsert(Strings.Count, AStrings^.Value);{ Insert string }
  1388. AStrings := AStrings^.Next; { Move to next item }
  1389. Dispose(P); { Dispose prior item }
  1390. End;
  1391. EnableMask := $FFFFFFFF; { Enable bit masks }
  1392. END;
  1393. {--TCluster-----------------------------------------------------------------}
  1394. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Oct99 LdB }
  1395. {---------------------------------------------------------------------------}
  1396. CONSTRUCTOR TCluster.Load (Var S: TStream);
  1397. BEGIN
  1398. Inherited Load(S); { Call ancestor }
  1399. S.Read(Value, 4); { Read value }
  1400. S.Read(Sel, 2); { Read select item }
  1401. If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view }
  1402. Then S.Read(EnableMask, 4) Else Begin { Read enable masks }
  1403. EnableMask := $FFFFFFFF; { Enable all masks }
  1404. Options := Options OR ofVersion20; { Set version 2 mask }
  1405. End;
  1406. If (Options AND ofGFVModeView <> 0) Then { GFV mode view check }
  1407. S.Read(Id, 2); { Read view id }
  1408. Strings.Load(S); { Load string data }
  1409. SetButtonState(0, True); { Set button state }
  1410. END;
  1411. {--TCluster-----------------------------------------------------------------}
  1412. { Done -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Jul99 LdB }
  1413. {---------------------------------------------------------------------------}
  1414. DESTRUCTOR TCluster.Done;
  1415. VAR I: Integer;
  1416. BEGIN
  1417. Strings.Done; { Dispose of strings }
  1418. Inherited Done; { Call ancestor }
  1419. END;
  1420. {--TCluster-----------------------------------------------------------------}
  1421. { DataSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1422. {---------------------------------------------------------------------------}
  1423. FUNCTION TCluster.DataSize: Word;
  1424. BEGIN
  1425. DataSize := SizeOf(Word); { Exchanges a word }
  1426. END;
  1427. {--TCluster-----------------------------------------------------------------}
  1428. { GetHelpCtx -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1429. {---------------------------------------------------------------------------}
  1430. FUNCTION TCluster.GetHelpCtx: Word;
  1431. BEGIN
  1432. If (HelpCtx = hcNoContext) Then { View has no help }
  1433. GetHelpCtx := hcNoContext Else { No help context }
  1434. GetHelpCtx := HelpCtx + Sel; { Help of selected }
  1435. END;
  1436. {--TCluster-----------------------------------------------------------------}
  1437. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1438. {---------------------------------------------------------------------------}
  1439. FUNCTION TCluster.GetPalette: PPalette;
  1440. CONST P: String[Length(CCluster)] = CCluster; { Always normal string }
  1441. BEGIN
  1442. GetPalette := @P; { Cluster palette }
  1443. END;
  1444. {--TCluster-----------------------------------------------------------------}
  1445. { Mark -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1446. {---------------------------------------------------------------------------}
  1447. FUNCTION TCluster.Mark (Item: Integer): Boolean;
  1448. BEGIN
  1449. Mark := False; { Default false }
  1450. END;
  1451. {--TCluster-----------------------------------------------------------------}
  1452. { MultiMark -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1453. {---------------------------------------------------------------------------}
  1454. FUNCTION TCluster.MultiMark (Item: Integer): Byte;
  1455. BEGIN
  1456. MultiMark := Byte(Mark(Item) = True); { Return multi mark }
  1457. END;
  1458. {--TCluster-----------------------------------------------------------------}
  1459. { ButtonState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1460. {---------------------------------------------------------------------------}
  1461. FUNCTION TCluster.ButtonState (Item: Integer): Boolean;
  1462. BEGIN
  1463. If (Item > 31) Then ButtonState := False Else { Impossible item }
  1464. ButtonState := ((1 SHL Item) AND EnableMask)<>0; { Return true/false }
  1465. END;
  1466. {--TCluster-----------------------------------------------------------------}
  1467. { DrawFocus -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Jul99 LdB }
  1468. {---------------------------------------------------------------------------}
  1469. PROCEDURE TCluster.DrawFocus;
  1470. BEGIN
  1471. END;
  1472. {--TCluster-----------------------------------------------------------------}
  1473. { Press -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1474. {---------------------------------------------------------------------------}
  1475. PROCEDURE TCluster.Press (Item: Integer);
  1476. VAR P: PView;
  1477. BEGIN
  1478. P := TopView;
  1479. If (Id <> 0) AND (P <> Nil) Then NewMessage(P,
  1480. evCommand, cmIdCommunicate, Id, Value, @Self); { Send new message }
  1481. END;
  1482. {--TCluster-----------------------------------------------------------------}
  1483. { MovedTo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1484. {---------------------------------------------------------------------------}
  1485. PROCEDURE TCluster.MovedTo (Item: Integer);
  1486. BEGIN { Abstract method }
  1487. END;
  1488. {--TCluster-----------------------------------------------------------------}
  1489. { SetState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1490. {---------------------------------------------------------------------------}
  1491. PROCEDURE TCluster.SetState (AState: Word; Enable: Boolean);
  1492. BEGIN
  1493. Inherited SetState(AState, Enable); { Call ancestor }
  1494. If (AState AND sfFocused <> 0) Then Begin
  1495. SetDrawMask(vdFocus OR vdInner); { Set redraw masks }
  1496. DrawView; { Redraw masked areas }
  1497. End;
  1498. END;
  1499. {--TCluster-----------------------------------------------------------------}
  1500. { DrawMultiBox -> Platforms DOS/DPMI/WIN/NT - Updated 05Jun98 LdB }
  1501. {---------------------------------------------------------------------------}
  1502. PROCEDURE TCluster.DrawMultiBox (Const Icon, Marker: String);
  1503. VAR I, J, K, Cur, Col: Integer; CNorm, CSel, CDis, Color: Word; B: TDrawBuffer;
  1504. Tb, SCOff: Byte;
  1505. BEGIN
  1506. CNorm := GetColor($0301); { Normal colour }
  1507. CSel := GetColor($0402); { Selected colour }
  1508. CDis := GetColor($0505); { Disabled colour }
  1509. If (Options AND ofFramed <>0) OR { Normal frame }
  1510. (GOptions AND goThickFramed <>0) Then { Thick frame }
  1511. K := 1 Else K := 0; { Select offset }
  1512. For I := 0 To Size.Y-K-K-1 Do Begin { For each line }
  1513. MoveChar(B, ' ', Byte(CNorm), Size.X-K-K); { Fill buffer }
  1514. For J := 0 To (Strings.Count - 1) DIV Size.Y + 1
  1515. Do Begin
  1516. Cur := J*Size.Y + I; { Current line }
  1517. If (Cur < Strings.Count) Then Begin
  1518. Col := Column(Cur); { Calc column }
  1519. If (Col + CStrLen(PString(Strings.At(Cur))^)+
  1520. 5 < Sizeof(TDrawBuffer) DIV SizeOf(Word))
  1521. AND (Col < Size.X-K-K) Then Begin { Text fits in column }
  1522. If NOT ButtonState(Cur) Then
  1523. Color := CDis Else If (Cur = Sel) AND { Disabled colour }
  1524. (State and sfFocused <> 0) Then
  1525. Color := CSel Else { Selected colour }
  1526. Color := CNorm; { Normal colour }
  1527. MoveChar(B[Col], ' ', Byte(Color),
  1528. Size.X-K-K-Col); { Set this colour }
  1529. MoveStr(B[Col], Icon, Byte(Color)); { Transfer icon string }
  1530. WordRec(B[Col+2]).Lo := Byte(Marker[
  1531. MultiMark(Cur) + 1]); { Transfer marker }
  1532. MoveCStr(B[Col+5], PString(Strings.At(
  1533. Cur))^, Color); { Transfer item string }
  1534. If ShowMarkers AND (State AND sfFocused <> 0)
  1535. AND (Cur = Sel) Then Begin { Current is selected }
  1536. WordRec(B[Col]).Lo := Byte(SpecialChars[0]);
  1537. WordRec(B[Column(Cur+Size.Y)-1]).Lo
  1538. := Byte(SpecialChars[1]); { Set special character }
  1539. End;
  1540. End;
  1541. End;
  1542. End;
  1543. WriteBuf(K, K+I, Size.X-K-K, 1, B); { Write buffer }
  1544. End;
  1545. END;
  1546. {--TCluster-----------------------------------------------------------------}
  1547. { DrawBox -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1548. {---------------------------------------------------------------------------}
  1549. PROCEDURE TCluster.DrawBox (Const Icon: String; Marker: Char);
  1550. BEGIN
  1551. DrawMultiBox(Icon, ' '+Marker); { Call draw routine }
  1552. END;
  1553. {--TCluster-----------------------------------------------------------------}
  1554. { SetButtonState -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1555. {---------------------------------------------------------------------------}
  1556. PROCEDURE TCluster.SetButtonState (AMask: Longint; Enable: Boolean);
  1557. VAR I: Integer; M: Longint;
  1558. BEGIN
  1559. If Enable Then EnableMask := EnableMask OR AMask { Set enable bit mask }
  1560. Else EnableMask := EnableMask AND NOT AMask; { Disable bit mask }
  1561. If (Strings.Count <= 32) Then Begin { Valid string number }
  1562. M := 1; { Preset bit masks }
  1563. For I := 1 To Strings.Count Do Begin { For each item string }
  1564. If ((M AND EnableMask) <> 0) Then Begin { Bit enabled }
  1565. Options := Options OR ofSelectable; { Set selectable option }
  1566. Exit; { Now exit }
  1567. End;
  1568. M := M SHL 1; { Create newbit mask }
  1569. End;
  1570. Options := Options AND NOT ofSelectable; { Make not selectable }
  1571. End;
  1572. END;
  1573. {--TCluster-----------------------------------------------------------------}
  1574. { GetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1575. {---------------------------------------------------------------------------}
  1576. PROCEDURE TCluster.GetData (Var Rec);
  1577. BEGIN
  1578. Word(Rec) := Value; { Return current value }
  1579. END;
  1580. {--TCluster-----------------------------------------------------------------}
  1581. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1582. {---------------------------------------------------------------------------}
  1583. PROCEDURE TCluster.SetData (Var Rec);
  1584. BEGIN
  1585. Value := Word(Rec); { Set current value }
  1586. SetDrawMask(vdFocus OR vdInner); { Set redraw mask }
  1587. DrawView; { Redraw masked areas }
  1588. END;
  1589. {--TCluster-----------------------------------------------------------------}
  1590. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1591. {---------------------------------------------------------------------------}
  1592. PROCEDURE TCluster.Store (Var S: TStream);
  1593. BEGIN
  1594. TView.Store(S); { TView.Store called }
  1595. If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view }
  1596. Then Begin
  1597. S.Write(Value, SizeOf(LongInt)); { Write value }
  1598. S.Write(Sel, SizeOf(Sel)); { Write select item }
  1599. S.Write(EnableMask, SizeOf(EnableMask)); { Write enable masks }
  1600. End Else Begin
  1601. S.Write(Value, SizeOf(Word)); { Write value }
  1602. S.Write(Sel, SizeOf(Sel)); { Write select item }
  1603. End;
  1604. If (Options AND ofGFVModeView <> 0) Then { GFV mode view check }
  1605. S.Write(Id, SizeOf(Id)); { Write new id value }
  1606. Strings.Store(S); { Store strings }
  1607. END;
  1608. {--TCluster-----------------------------------------------------------------}
  1609. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Jun98 LdB }
  1610. {---------------------------------------------------------------------------}
  1611. PROCEDURE TCluster.HandleEvent (Var Event: TEvent);
  1612. VAR C: Char; I, J, S, Vh: Integer; Key: Word; Mouse: TPoint; Ts: PString;
  1613. PROCEDURE MoveSel;
  1614. BEGIN
  1615. If (I <= Strings.Count) Then Begin
  1616. Sel := S; { Set selected item }
  1617. MovedTo(Sel); { Move to selected }
  1618. SetDrawMask(vdInner OR vdFocus); { Set draw masks }
  1619. DrawView; { Now draw changes }
  1620. End;
  1621. END;
  1622. BEGIN
  1623. Inherited HandleEvent(Event); { Call ancestor }
  1624. If ((Options AND ofSelectable) = 0) Then Exit; { Check selectable }
  1625. If (Event.What = evMouseDown) Then Begin { MOUSE EVENT }
  1626. MakeLocal(Event.Where, Mouse); { Make point local }
  1627. I := FindSel(Mouse); { Find selected item }
  1628. If (I <> -1) Then { Check in view }
  1629. If ButtonState(I) Then Sel := I; { If enabled select }
  1630. SetDrawMask(vdFocus OR vdInner); { Set draw mask }
  1631. DrawView; { Now draw changes }
  1632. Repeat
  1633. MakeLocal(Event.Where, Mouse); { Make point local }
  1634. Until NOT MouseEvent(Event, evMouseMove); { Wait for mouse up }
  1635. MakeLocal(Event.Where, Mouse); { Make point local }
  1636. If (FindSel(Mouse) = Sel) AND ButtonState(Sel) { If valid/selected }
  1637. Then Begin
  1638. Press(Sel); { Call pressed }
  1639. SetDrawMask(vdFocus OR vdInner); { Set draw mask }
  1640. DrawView; { Now draw changes }
  1641. End;
  1642. ClearEvent(Event); { Event was handled }
  1643. End Else If (Event.What = evKeyDown) Then Begin { KEY EVENT }
  1644. If (Options AND ofFramed <> 0) OR { Normal frame }
  1645. (GOptions AND goThickFramed <> 0) Then { Thick frame }
  1646. J := 1 Else J := 0; { Adjust value }
  1647. Vh := Size.Y - J - J; { View height }
  1648. S := Sel; { Hold current item }
  1649. Key := CtrlToArrow(Event.KeyCode); { Convert keystroke }
  1650. Case Key Of
  1651. kbUp, kbDown, kbRight, kbLeft:
  1652. If (State AND sfFocused <> 0) Then Begin { Focused key event }
  1653. I := 0; { Zero process count }
  1654. Repeat
  1655. Inc(I); { Inc process count }
  1656. Case Key Of
  1657. kbUp: Dec(S); { Next item up }
  1658. kbDown: Inc(S); { Next item down }
  1659. kbRight: Begin { Next column across }
  1660. Inc(S, Vh); { Move to next column }
  1661. If (S >= Strings.Count) Then { No next column check }
  1662. S := (S+1) MOD Vh; { Move to last column }
  1663. End;
  1664. kbLeft: Begin { Prior column across }
  1665. Dec(S, Vh); { Move to prior column }
  1666. If (S < 0) Then S := ((Strings.Count +
  1667. Vh - 1) DIV Vh) * Vh + S - 1; { No prior column check }
  1668. End;
  1669. End;
  1670. If (S >= Strings.Count) Then S := 0; { Roll up to top }
  1671. If (S < 0) Then S := Strings.Count - 1; { Roll down to bottom }
  1672. Until ButtonState(S) OR (I > Strings.Count); { Repeat until select }
  1673. MoveSel; { Move to selected }
  1674. ClearEvent(Event); { Event was handled }
  1675. End;
  1676. Else Begin { Not an arrow key }
  1677. For I := 0 To Strings.Count-1 Do Begin { Scan each item }
  1678. Ts := Strings.At(I); { Fetch string pointer }
  1679. If (Ts <> Nil) Then C := HotKey(Ts^) { Check for hotkey }
  1680. Else C := #0; { No valid string }
  1681. If (GetAltCode(C) = Event.KeyCode) OR { Hot key for item }
  1682. (((Owner^.Phase = phPostProcess) OR { Owner in post process }
  1683. (State AND sfFocused <> 0)) AND (C <> #0) { Non zero hotkey }
  1684. AND (UpCase(Event.CharCode) = C)) { Matches current key }
  1685. Then Begin
  1686. If ButtonState(I) Then Begin { Check mask enabled }
  1687. If Focus Then Begin { Check view focus }
  1688. Sel := I; { Set selected }
  1689. MovedTo(Sel); { Move to selected }
  1690. Press(Sel); { Call pressed }
  1691. SetDrawMask(vdFocus OR vdInner); { Set draw mask }
  1692. DrawView; { Now draw changes }
  1693. End;
  1694. ClearEvent(Event); { Event was handled }
  1695. End;
  1696. Exit; { Now exit }
  1697. End;
  1698. End;
  1699. If (Event.CharCode = ' ') AND { Spacebar key }
  1700. (State AND sfFocused <> 0) AND { Check focused view }
  1701. ButtonState(Sel) Then Begin { Check item enabled }
  1702. Press(Sel); { Call pressed }
  1703. SetDrawMask(vdFocus OR vdInner); { Set draw mask }
  1704. DrawView; { Now draw changes }
  1705. ClearEvent(Event); { Event was handled }
  1706. End;
  1707. End;
  1708. End;
  1709. End;
  1710. END;
  1711. {***************************************************************************}
  1712. { TCluster OBJECT PRIVATE METHODS }
  1713. {***************************************************************************}
  1714. {--TCluster-----------------------------------------------------------------}
  1715. { FindSel -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1716. {---------------------------------------------------------------------------}
  1717. FUNCTION TCluster.FindSel (P: TPoint): Integer;
  1718. VAR I, J, S, Vh: Integer; R: TRect;
  1719. BEGIN
  1720. GetExtent(R); { Get view extents }
  1721. If R.Contains(P) Then Begin { Point in view }
  1722. If (Options AND ofFramed <> 0) OR { Normal frame }
  1723. (GOptions AND goThickFramed <> 0) Then { Thick frame }
  1724. J := 1 Else J := 0; { Adjust value }
  1725. Vh := Size.Y - J - J; { View height }
  1726. I := 0; { Preset zero value }
  1727. While (P.X >= Column(I+Vh)) Do Inc(I, Vh); { Inc view size }
  1728. S := I + P.Y - J; { Line to select }
  1729. If ((S >= 0) AND (S < Strings.Count)) { Valid selection }
  1730. Then FindSel := S Else FindSel := -1; { Return selected item }
  1731. End Else FindSel := -1; { Point outside view }
  1732. END;
  1733. {--TCluster-----------------------------------------------------------------}
  1734. { Row -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1735. {---------------------------------------------------------------------------}
  1736. FUNCTION TCluster.Row (Item: Integer): Integer;
  1737. BEGIN
  1738. If (Options AND ofFramed <> 0) OR { Normal frame }
  1739. (GOptions AND goThickFramed <> 0) Then { Thick frame }
  1740. Row := Item MOD (Size.Y - 2) Else { Allow for frames }
  1741. Row := Item MOD Size.Y; { Normal mod value }
  1742. END;
  1743. {--TCluster-----------------------------------------------------------------}
  1744. { Column -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB }
  1745. {---------------------------------------------------------------------------}
  1746. FUNCTION TCluster.Column (Item: Integer): Integer;
  1747. VAR I, J, Col, Width, L, Vh: Integer; Ts: PString;
  1748. BEGIN
  1749. If (Options AND ofFramed <> 0) OR { Normal frame }
  1750. (GOptions AND goThickFramed <> 0) Then { Thick frame }
  1751. J := 1 Else J := 0; { Adjust value }
  1752. Vh := Size.Y - J - J; { Vertical size }
  1753. If (Item >= Vh) Then Begin { Valid selection }
  1754. Width := 0; { Zero width }
  1755. Col := -6; { Start column at -6 }
  1756. For I := 0 To Item Do Begin { For each item }
  1757. If (I MOD Vh = 0) Then Begin { Start next column }
  1758. Inc(Col, Width + 6); { Add column width }
  1759. Width := 0; { Zero width }
  1760. End;
  1761. If (I < Strings.Count) Then Begin { Valid string }
  1762. Ts := Strings.At(I); { Transfer string }
  1763. If (Ts <> Nil) Then L := CStrLen(Ts^) { Length of string }
  1764. Else L := 0; { No string }
  1765. End;
  1766. If (L > Width) Then Width := L; { Hold longest string }
  1767. End;
  1768. Column := Col; { Return column }
  1769. End Else Column := 0; { Outside select area }
  1770. END;
  1771. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1772. { TRadioButtons OBJECT METHODS }
  1773. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1774. {--TRadioButtons------------------------------------------------------------}
  1775. { Mark -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1776. {---------------------------------------------------------------------------}
  1777. FUNCTION TRadioButtons.Mark (Item: Integer): Boolean;
  1778. BEGIN
  1779. Mark := Item = Value; { True if item = value }
  1780. END;
  1781. {--TRadioButtons------------------------------------------------------------}
  1782. { Draw -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1783. {---------------------------------------------------------------------------}
  1784. PROCEDURE TRadioButtons.DrawFocus;
  1785. CONST Button = ' ( ) ';
  1786. BEGIN
  1787. Inherited DrawFocus;
  1788. DrawMultiBox(Button, #32#7); { Redraw the text }
  1789. END;
  1790. {--TRadioButtons------------------------------------------------------------}
  1791. { Press -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1792. {---------------------------------------------------------------------------}
  1793. PROCEDURE TRadioButtons.Press (Item: Integer);
  1794. BEGIN
  1795. Value := Item; { Set value field }
  1796. Inherited Press(Item); { Call ancestor }
  1797. END;
  1798. {--TRadioButtons------------------------------------------------------------}
  1799. { MovedTo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1800. {---------------------------------------------------------------------------}
  1801. PROCEDURE TRadioButtons.MovedTo (Item: Integer);
  1802. BEGIN
  1803. Value := Item; { Set value to item }
  1804. If (Id <> 0) Then NewMessage(Owner, evCommand,
  1805. cmIdCommunicate, Id, Value, @Self); { Send new message }
  1806. END;
  1807. {--TRadioButtons------------------------------------------------------------}
  1808. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1809. {---------------------------------------------------------------------------}
  1810. PROCEDURE TRadioButtons.SetData (Var Rec);
  1811. BEGIN
  1812. Sel := Integer(Rec); { Set selection }
  1813. Inherited SetData(Rec); { Call ancestor }
  1814. END;
  1815. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1816. { TCheckBoxes OBJECT METHODS }
  1817. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1818. {--TCheckBoxes--------------------------------------------------------------}
  1819. { Mark -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1820. {---------------------------------------------------------------------------}
  1821. FUNCTION TCheckBoxes.Mark(Item: Integer): Boolean;
  1822. BEGIN
  1823. If (Value AND (1 SHL Item) <> 0) Then { Check if item ticked }
  1824. Mark := True Else Mark := False; { Return result }
  1825. END;
  1826. {--TCheckBoxes--------------------------------------------------------------}
  1827. { Draw -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04May98 LdB }
  1828. {---------------------------------------------------------------------------}
  1829. PROCEDURE TCheckBoxes.DrawFocus;
  1830. CONST Button = ' [ ] ';
  1831. BEGIN
  1832. Inherited DrawFocus;
  1833. DrawMultiBox(Button, ' X'); { Redraw the text }
  1834. END;
  1835. {--TCheckBoxes--------------------------------------------------------------}
  1836. { Press -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Apr98 LdB }
  1837. {---------------------------------------------------------------------------}
  1838. PROCEDURE TCheckBoxes.Press (Item: Integer);
  1839. BEGIN
  1840. Value := Value XOR (1 SHL Item); { Flip the item mask }
  1841. Inherited Press(Item); { Call ancestor }
  1842. END;
  1843. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1844. { TMultiCheckBoxes OBJECT METHODS }
  1845. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1846. {--TMultiCheckBoxes---------------------------------------------------------}
  1847. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 05Jun98 LdB }
  1848. {---------------------------------------------------------------------------}
  1849. CONSTRUCTOR TMultiCheckBoxes.Init (Var Bounds: TRect; AStrings: PSItem;
  1850. ASelRange: Byte; AFlags: Word; Const AStates: String);
  1851. BEGIN
  1852. Inherited Init(Bounds, AStrings); { Call ancestor }
  1853. SelRange := ASelRange; { Hold select range }
  1854. Flags := AFlags; { Hold flags }
  1855. States := NewStr(AStates); { Hold string }
  1856. END;
  1857. {--TMultiCheckBoxes---------------------------------------------------------}
  1858. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1859. {---------------------------------------------------------------------------}
  1860. CONSTRUCTOR TMultiCheckBoxes.Load (Var S: TStream);
  1861. BEGIN
  1862. Inherited Load(S); { Call ancestor }
  1863. S.Read(SelRange, SizeOf(SelRange)); { Read select range }
  1864. S.Read(Flags, SizeOf(Flags)); { Read flags }
  1865. States := S.ReadStr; { Read strings }
  1866. END;
  1867. {--TMultiCheckBoxes---------------------------------------------------------}
  1868. { Done -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1869. {---------------------------------------------------------------------------}
  1870. DESTRUCTOR TMultiCheckBoxes.Done;
  1871. BEGIN
  1872. If (States <> Nil) Then DisposeStr(States); { Dispose strings }
  1873. Inherited Done; { Call ancestor }
  1874. END;
  1875. {--TMultiCheckBoxes---------------------------------------------------------}
  1876. { DataSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1877. {---------------------------------------------------------------------------}
  1878. FUNCTION TMultiCheckBoxes.DataSize: Word;
  1879. BEGIN
  1880. DataSize := SizeOf(LongInt); { Size to exchange }
  1881. END;
  1882. {--TMultiCheckBoxes---------------------------------------------------------}
  1883. { MultiMark -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1884. {---------------------------------------------------------------------------}
  1885. FUNCTION TMultiCheckBoxes.MultiMark (Item: Integer): Byte;
  1886. BEGIN
  1887. MultiMark := (Value SHR (Word(Item) *
  1888. WordRec(Flags).Hi)) AND WordRec(Flags).Lo; { Return mark state }
  1889. END;
  1890. {--TMultiCheckBoxes---------------------------------------------------------}
  1891. { Draw -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1892. {---------------------------------------------------------------------------}
  1893. PROCEDURE TMultiCheckBoxes.DrawFocus;
  1894. CONST Button = ' [ ] ';
  1895. BEGIN
  1896. Inherited DrawFocus;
  1897. DrawMultiBox(Button, States^); { Draw the items }
  1898. END;
  1899. {--TMultiCheckBoxes---------------------------------------------------------}
  1900. { Press -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1901. {---------------------------------------------------------------------------}
  1902. PROCEDURE TMultiCheckBoxes.Press (Item: Integer);
  1903. VAR CurState: ShortInt;
  1904. BEGIN
  1905. CurState := (Value SHR (Word(Item) *
  1906. WordRec(Flags).Hi)) AND WordRec(Flags).Lo; { Hold current state }
  1907. Dec(CurState); { One down }
  1908. If (CurState >= SelRange) OR (CurState < 0) Then
  1909. CurState := SelRange - 1; { Roll if needed }
  1910. Value := (Value AND NOT (LongInt(WordRec(Flags).Lo)
  1911. SHL (Word(Item) * WordRec(Flags).Hi))) OR
  1912. (LongInt(CurState) SHL (Word(Item) *
  1913. WordRec(Flags).Hi)); { Calculate value }
  1914. Inherited Press(Item); { Call ancestor }
  1915. END;
  1916. {--TMultiCheckBoxes---------------------------------------------------------}
  1917. { GetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1918. {---------------------------------------------------------------------------}
  1919. PROCEDURE TMultiCheckBoxes.GetData (Var Rec);
  1920. BEGIN
  1921. Longint(Rec) := Value; { Return value }
  1922. END;
  1923. {--TMultiCheckBoxes---------------------------------------------------------}
  1924. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1925. {---------------------------------------------------------------------------}
  1926. PROCEDURE TMultiCheckBoxes.SetData (Var Rec);
  1927. BEGIN
  1928. Value := Longint(Rec); { Set value }
  1929. SetDrawMask(vdFocus OR vdInner); { Set redraw mask }
  1930. DrawView; { Redraw masked areas }
  1931. END;
  1932. {--TMultiCheckBoxes---------------------------------------------------------}
  1933. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1934. {---------------------------------------------------------------------------}
  1935. PROCEDURE TMultiCheckBoxes.Store (Var S: TStream);
  1936. BEGIN
  1937. TCluster.Store(S); { TCluster store called }
  1938. S.Write(SelRange, SizeOf(SelRange)); { Write select range }
  1939. S.Write(Flags, SizeOf(Flags)); { Write select flags }
  1940. S.WriteStr(States); { Write strings }
  1941. END;
  1942. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1943. { TListBox OBJECT METHODS }
  1944. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  1945. TYPE
  1946. TListBoxRec = PACKED RECORD
  1947. List: PCollection; { List collection ptr }
  1948. Selection: Word; { Selected item }
  1949. END;
  1950. {--TListBox-----------------------------------------------------------------}
  1951. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1952. {---------------------------------------------------------------------------}
  1953. CONSTRUCTOR TListBox.Init (Var Bounds: TRect; ANumCols: Word;
  1954. AScrollBar: PScrollBar);
  1955. BEGIN
  1956. Inherited Init(Bounds, ANumCols, Nil, AScrollBar); { Call ancestor }
  1957. SetRange(0); { Set range to zero }
  1958. END;
  1959. {--TListBox-----------------------------------------------------------------}
  1960. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1961. {---------------------------------------------------------------------------}
  1962. CONSTRUCTOR TListBox.Load (Var S: TStream);
  1963. BEGIN
  1964. Inherited Load(S); { Call ancestor }
  1965. List := PCollection(S.Get); { Fetch collection }
  1966. END;
  1967. {--TListBox-----------------------------------------------------------------}
  1968. { DataSize -> Platforms DOS/DPMI/WIN/NT/Os2 - Updated 06Jun98 LdB }
  1969. {---------------------------------------------------------------------------}
  1970. FUNCTION TListBox.DataSize: Word;
  1971. BEGIN
  1972. DataSize := SizeOf(TListBoxRec); { Xchg data size }
  1973. END;
  1974. {--TListBox-----------------------------------------------------------------}
  1975. { GetText -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1976. {---------------------------------------------------------------------------}
  1977. FUNCTION TListBox.GetText (Item: Integer; MaxLen: Integer): String;
  1978. VAR P: PString;
  1979. BEGIN
  1980. GetText := ''; { Preset return }
  1981. If (List <> Nil) Then Begin { A list exists }
  1982. P := PString(List^.At(Item)); { Get string ptr }
  1983. If (P <> Nil) Then GetText := P^; { Return string }
  1984. End;
  1985. END;
  1986. {--TListBox-----------------------------------------------------------------}
  1987. { NewList -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  1988. {---------------------------------------------------------------------------}
  1989. PROCEDURE TListBox.NewList (AList: PCollection);
  1990. BEGIN
  1991. If (List <> Nil) Then Dispose(List, Done); { Dispose old list }
  1992. List := AList; { Hold new list }
  1993. If (AList <> Nil) Then SetRange(AList^.Count) { Set new item range }
  1994. Else SetRange(0); { Set zero range }
  1995. If (Range > 0) Then FocusItem(0); { Focus first item }
  1996. DrawView; { Redraw all view }
  1997. END;
  1998. {--TListBox-----------------------------------------------------------------}
  1999. { GetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2000. {---------------------------------------------------------------------------}
  2001. PROCEDURE TListBox.GetData (Var Rec);
  2002. BEGIN
  2003. TListBoxRec(Rec).List := List; { Return current list }
  2004. TListBoxRec(Rec).Selection := Focused; { Return focused item }
  2005. END;
  2006. {--TListBox-----------------------------------------------------------------}
  2007. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2008. {---------------------------------------------------------------------------}
  2009. PROCEDURE TListBox.SetData (Var Rec);
  2010. BEGIN
  2011. NewList(TListBoxRec(Rec).List); { Hold new list }
  2012. FocusItem(TListBoxRec(Rec).Selection); { Focus selected item }
  2013. DrawView; { Redraw all view }
  2014. END;
  2015. {--TListBox-----------------------------------------------------------------}
  2016. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2017. {---------------------------------------------------------------------------}
  2018. PROCEDURE TListBox.Store (Var S: TStream);
  2019. BEGIN
  2020. TListViewer.Store(S); { TListViewer store }
  2021. S.Put(List); { Store list to stream }
  2022. END;
  2023. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2024. { TStaticText OBJECT METHODS }
  2025. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2026. {--TStaticText--------------------------------------------------------------}
  2027. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2028. {---------------------------------------------------------------------------}
  2029. CONSTRUCTOR TStaticText.Init (Var Bounds: TRect; Const AText: String);
  2030. BEGIN
  2031. Inherited Init(Bounds); { Call ancestor }
  2032. Text := NewStr(AText); { Create string ptr }
  2033. END;
  2034. {--TStaticText--------------------------------------------------------------}
  2035. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2036. {---------------------------------------------------------------------------}
  2037. CONSTRUCTOR TStaticText.Load (Var S: TStream);
  2038. BEGIN
  2039. Inherited Load(S); { Call ancestor }
  2040. Text := S.ReadStr; { Read text string }
  2041. END;
  2042. {--TStaticText--------------------------------------------------------------}
  2043. { Done -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2044. {---------------------------------------------------------------------------}
  2045. DESTRUCTOR TStaticText.Done;
  2046. BEGIN
  2047. If (Text <> Nil) Then DisposeStr(Text); { Dispose string }
  2048. Inherited Done; { Call ancestor }
  2049. END;
  2050. {--TStaticText--------------------------------------------------------------}
  2051. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2052. {---------------------------------------------------------------------------}
  2053. FUNCTION TStaticText.GetPalette: PPalette;
  2054. CONST P: String[Length(CStaticText)] = CStaticText; { Always normal string }
  2055. BEGIN
  2056. GetPalette := @P; { Return palette }
  2057. END;
  2058. {--TStaticText--------------------------------------------------------------}
  2059. { DrawBackGround -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2060. {---------------------------------------------------------------------------}
  2061. PROCEDURE TStaticText.DrawBackGround;
  2062. VAR Just: Byte; I, J, P, Y, L: Integer; S, T: String;
  2063. BEGIN
  2064. Inherited DrawBackGround; { Call ancestor }
  2065. GetText(S); { Fetch text to write }
  2066. P := 1; { X start position }
  2067. Y := 0; { Y start position }
  2068. L := Length(S); { Length of text }
  2069. While (Y < Size.Y) AND (P <= L) Do Begin
  2070. Just := 0; { Default left justify }
  2071. If (S[P] = #2) Then Begin { Right justify char }
  2072. Just := 2; { Set right justify }
  2073. Inc(P); { Next character }
  2074. End;
  2075. If (S[P] = #3) Then Begin { Centre justify char }
  2076. Just := 1; { Set centre justify }
  2077. Inc(P); { Next character }
  2078. End;
  2079. I := P; { Start position }
  2080. While (P <= L) AND (S[P] <> #13) Do Inc(P); { Scan for end }
  2081. T := Copy(S, I, P-I); { String to write }
  2082. Case Just Of
  2083. 0: J := 0; { Left justify }
  2084. 1: J := (RawSize.X - TextWidth(T)) DIV 2; { Centre justify }
  2085. 2: J := RawSize.X - TextWidth(T); { Right justify }
  2086. End;
  2087. While (J < 0) Do Begin { Text to long }
  2088. J := J + TextWidth(T[1]); { Add width to J }
  2089. Delete(T, 1, 1); { Delete the char }
  2090. End;
  2091. WriteStr(-J, -(Y*FontHeight), T, 1); { Write the text }
  2092. While (P <= L) AND ((S[P] = #13) OR (S[P] = #10))
  2093. Do Inc(P); { Remove CR/LF }
  2094. Inc(Y); { Next line }
  2095. End;
  2096. END;
  2097. {--TStaticText--------------------------------------------------------------}
  2098. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2099. {---------------------------------------------------------------------------}
  2100. PROCEDURE TStaticText.Store (Var S: TStream);
  2101. BEGIN
  2102. TView.Store(S); { Call TView store }
  2103. S.WriteStr(Text); { Write text string }
  2104. END;
  2105. {--TStaticText--------------------------------------------------------------}
  2106. { GetText -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2107. {---------------------------------------------------------------------------}
  2108. PROCEDURE TStaticText.GetText (Var S: String);
  2109. BEGIN
  2110. If (Text <> Nil) Then S := Text^ { Copy text string }
  2111. Else S := ''; { Return empty string }
  2112. END;
  2113. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2114. { TParamText OBJECT METHODS }
  2115. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2116. {--TParamText---------------------------------------------------------------}
  2117. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2118. {---------------------------------------------------------------------------}
  2119. CONSTRUCTOR TParamText.Init (Var Bounds: TRect; Const AText: String;
  2120. AParamCount: Integer);
  2121. BEGIN
  2122. Inherited Init(Bounds, AText); { Call ancestor }
  2123. ParamCount := AParamCount; { Hold param count }
  2124. END;
  2125. {--TParamText---------------------------------------------------------------}
  2126. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2127. {---------------------------------------------------------------------------}
  2128. CONSTRUCTOR TParamText.Load (Var S: TStream);
  2129. BEGIN
  2130. Inherited Load(S); { Call ancestor }
  2131. S.Read(ParamCount, 2); { Read parameter count }
  2132. END;
  2133. {--TParamText---------------------------------------------------------------}
  2134. { DataSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2135. {---------------------------------------------------------------------------}
  2136. FUNCTION TParamText.DataSize: Word;
  2137. BEGIN
  2138. DataSize := ParamCount * SizeOf(Pointer); { Return data size }
  2139. END;
  2140. {--TParamText---------------------------------------------------------------}
  2141. { GetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2142. {---------------------------------------------------------------------------}
  2143. PROCEDURE TParamText.GetData (Var Rec);
  2144. BEGIN
  2145. Pointer(Rec) := @ParamList; { Return parm ptr }
  2146. END;
  2147. {--TParamText---------------------------------------------------------------}
  2148. { SetData -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Jun98 LdB }
  2149. {---------------------------------------------------------------------------}
  2150. PROCEDURE TParamText.SetData (Var Rec);
  2151. BEGIN
  2152. ParamList := @Rec; { Fetch parameter list }
  2153. DrawView; { Redraw all the view }
  2154. END;
  2155. {--TParamText---------------------------------------------------------------}
  2156. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2157. {---------------------------------------------------------------------------}
  2158. PROCEDURE TParamText.Store (Var S: TStream);
  2159. BEGIN
  2160. TStaticText.Store(S); { Statictext store }
  2161. S.Write(ParamCount, 2); { Store param count }
  2162. END;
  2163. {--TParamText---------------------------------------------------------------}
  2164. { GetText -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2165. {---------------------------------------------------------------------------}
  2166. PROCEDURE TParamText.GetText (Var S: String);
  2167. BEGIN
  2168. If (Text = Nil) Then S := '' Else { Return empty string }
  2169. FormatStr(S, Text^, ParamList^); { Return text string }
  2170. END;
  2171. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2172. { TLabel OBJECT METHODS }
  2173. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2174. {--TLabel-------------------------------------------------------------------}
  2175. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2176. {---------------------------------------------------------------------------}
  2177. CONSTRUCTOR TLabel.Init (Var Bounds: TRect; CONST AText: String; ALink: PView);
  2178. BEGIN
  2179. Inherited Init(Bounds, AText); { Call ancestor }
  2180. Link := ALink; { Hold link }
  2181. Options := Options OR (ofPreProcess+ofPostProcess);{ Set pre/post process }
  2182. EventMask := EventMask OR evBroadcast; { Sees broadcast events }
  2183. END;
  2184. {--TLabel-------------------------------------------------------------------}
  2185. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2186. {---------------------------------------------------------------------------}
  2187. CONSTRUCTOR TLabel.Load (Var S: TStream);
  2188. BEGIN
  2189. Inherited Load(S); { Call ancestor }
  2190. GetPeerViewPtr(S, Link); { Load link view }
  2191. END;
  2192. {--TLabel-------------------------------------------------------------------}
  2193. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2194. {---------------------------------------------------------------------------}
  2195. FUNCTION TLabel.GetPalette: PPalette;
  2196. CONST P: String[Length(CLabel)] = CLabel; { Always normal string }
  2197. BEGIN
  2198. GetPalette := @P; { Return palette }
  2199. END;
  2200. {--TLabel-------------------------------------------------------------------}
  2201. { DrawBackGround -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2202. {---------------------------------------------------------------------------}
  2203. PROCEDURE TLabel.DrawBackGround;
  2204. VAR SCOff: Byte; Color: Word; B: TDrawBuffer;
  2205. BEGIN
  2206. TView.DrawBackGround; { Explict call to TView }
  2207. If Light Then Begin { Light colour select }
  2208. Color := GetColor($0402); { Choose light colour }
  2209. SCOff := 0; { Zero offset }
  2210. End Else Begin
  2211. Color := GetColor($0301); { Darker colour }
  2212. SCOff := 4; { Set offset }
  2213. End;
  2214. MoveChar(B[0], ' ', Byte(Color), Size.X); { Clear the buffer }
  2215. If (Text <> Nil) Then MoveCStr(B[1], Text^, Color);{ Transfer label text }
  2216. If ShowMarkers Then WordRec(B[0]).Lo := Byte(
  2217. SpecialChars[SCOff]); { Show marker if req }
  2218. WriteLine(0, 0, Size.X, 1, B); { Write the text }
  2219. END;
  2220. {--TLabel-------------------------------------------------------------------}
  2221. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2222. {---------------------------------------------------------------------------}
  2223. PROCEDURE TLabel.Store (Var S: TStream);
  2224. BEGIN
  2225. TStaticText.Store(S); { TStaticText.Store }
  2226. PutPeerViewPtr(S, Link); { Store link view }
  2227. END;
  2228. {--TLabel-------------------------------------------------------------------}
  2229. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2230. {---------------------------------------------------------------------------}
  2231. PROCEDURE TLabel.HandleEvent (Var Event: TEvent);
  2232. VAR C: Char;
  2233. PROCEDURE FocusLink;
  2234. BEGIN
  2235. If (Link <> Nil) AND (Link^.Options AND
  2236. ofSelectable <> 0) Then Link^.Focus; { Focus link view }
  2237. ClearEvent(Event); { Clear the event }
  2238. END;
  2239. BEGIN
  2240. Inherited HandleEvent(Event); { Call ancestor }
  2241. Case Event.What Of
  2242. evNothing: Exit; { Speed up exit }
  2243. evMouseDown: FocusLink; { Focus link view }
  2244. evKeyDown: Begin
  2245. C := HotKey(Text^); { Check for hotkey }
  2246. If (GetAltCode(C) = Event.KeyCode) OR { Alt plus char }
  2247. ((C <> #0) AND (Owner^.Phase = phPostProcess) { Post process phase }
  2248. AND (UpCase(Event.CharCode) = C)) Then { Upper case match }
  2249. FocusLink; { Focus link view }
  2250. End;
  2251. evBroadcast: If ((Event.Command = cmReceivedFocus)
  2252. OR (Event.Command = cmReleasedFocus)) AND { Focus state change }
  2253. (Link <> Nil) Then Begin
  2254. Light := Link^.State AND sfFocused <> 0; { Change light state }
  2255. DrawView; { Now redraw change }
  2256. End;
  2257. End;
  2258. END;
  2259. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2260. { THistoryViewer OBJECT METHODS }
  2261. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2262. {--THistoryViewer-----------------------------------------------------------}
  2263. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2264. {---------------------------------------------------------------------------}
  2265. CONSTRUCTOR THistoryViewer.Init (Var Bounds: TRect; AHScrollBar,
  2266. AVScrollBar: PScrollBar; AHistoryId: Word);
  2267. BEGIN
  2268. Inherited Init(Bounds, 1, AHScrollBar,
  2269. AVScrollBar); { Call ancestor }
  2270. HistoryId := AHistoryId; { Hold history id }
  2271. SetRange(HistoryCount(AHistoryId)); { Set history range }
  2272. If (Range > 1) Then FocusItem(1); { Set to item 1 }
  2273. If (HScrollBar <> Nil) Then
  2274. HScrollBar^.SetRange(1, HistoryWidth-Size.X + 3);{ Set scrollbar range }
  2275. END;
  2276. {--THistoryViewer-----------------------------------------------------------}
  2277. { HistoryWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2278. {---------------------------------------------------------------------------}
  2279. FUNCTION THistoryViewer.HistoryWidth: Integer;
  2280. VAR Width, T, Count, I: Integer;
  2281. BEGIN
  2282. Width := 0; { Zero width variable }
  2283. Count := HistoryCount(HistoryId); { Hold count value }
  2284. For I := 0 To Count-1 Do Begin { For each item }
  2285. T := Length(HistoryStr(HistoryId, I)); { Get width of item }
  2286. If (T > Width) Then Width := T; { Set width to max }
  2287. End;
  2288. HistoryWidth := Width; { Return max item width }
  2289. END;
  2290. {--THistoryViewer-----------------------------------------------------------}
  2291. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2292. {---------------------------------------------------------------------------}
  2293. FUNCTION THistoryViewer.GetPalette: PPalette;
  2294. CONST P: String[Length(CHistoryViewer)] = CHistoryViewer;{ Always normal string }
  2295. BEGIN
  2296. GetPalette := @P; { Return palette }
  2297. END;
  2298. {--THistoryViewer-----------------------------------------------------------}
  2299. { GetText -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2300. {---------------------------------------------------------------------------}
  2301. FUNCTION THistoryViewer.GetText (Item: Integer; MaxLen: Integer): String;
  2302. BEGIN
  2303. GetText := HistoryStr(HistoryId, Item); { Return history string }
  2304. END;
  2305. {--THistoryViewer-----------------------------------------------------------}
  2306. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2307. {---------------------------------------------------------------------------}
  2308. PROCEDURE THistoryViewer.HandleEvent (Var Event: TEvent);
  2309. BEGIN
  2310. If ((Event.What = evMouseDown) AND (Event.Double)) { Double click mouse }
  2311. OR ((Event.What = evKeyDown) AND
  2312. (Event.KeyCode = kbEnter)) Then Begin { Enter key press }
  2313. EndModal(cmOk); { End with cmOk }
  2314. ClearEvent(Event); { Event was handled }
  2315. End Else If ((Event.What = evKeyDown) AND
  2316. (Event.KeyCode = kbEsc)) OR { Esc key press }
  2317. ((Event.What = evCommand) AND
  2318. (Event.Command = cmCancel)) Then Begin { Cancel command }
  2319. EndModal(cmCancel); { End with cmCancel }
  2320. ClearEvent(Event); { Event was handled }
  2321. End Else Inherited HandleEvent(Event); { Call ancestor }
  2322. END;
  2323. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2324. { THistoryWindow OBJECT METHODS }
  2325. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2326. {--THistoryWindow-----------------------------------------------------------}
  2327. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2328. {---------------------------------------------------------------------------}
  2329. CONSTRUCTOR THistoryWindow.Init (Var Bounds: TRect; HistoryId: Word);
  2330. BEGIN
  2331. Inherited Init(Bounds, '', wnNoNumber); { Call ancestor }
  2332. Flags := wfClose; { Close flag only }
  2333. InitViewer(HistoryId); { Create list view }
  2334. END;
  2335. {--THistoryWindow-----------------------------------------------------------}
  2336. { GetSelection -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2337. {---------------------------------------------------------------------------}
  2338. FUNCTION THistoryWindow.GetSelection: String;
  2339. BEGIN
  2340. If (Viewer = Nil) Then GetSelection := '' Else { Return empty string }
  2341. GetSelection := Viewer^.GetText(Viewer^.Focused,
  2342. 255); { Get focused string }
  2343. END;
  2344. {--THistoryWindow-----------------------------------------------------------}
  2345. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2346. {---------------------------------------------------------------------------}
  2347. FUNCTION THistoryWindow.GetPalette: PPalette;
  2348. CONST P: String[Length(CHistoryWindow)] = CHistoryWindow;{ Always normal string }
  2349. BEGIN
  2350. GetPalette := @P; { Return the palette }
  2351. END;
  2352. {--THistoryWindow-----------------------------------------------------------}
  2353. { InitViewer -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2354. {---------------------------------------------------------------------------}
  2355. PROCEDURE THistoryWindow.InitViewer(HistoryId: Word);
  2356. VAR R: TRect;
  2357. BEGIN
  2358. GetExtent(R); { Get extents }
  2359. R.Grow(-1,-1); { Grow inside }
  2360. Viewer := New(PHistoryViewer, Init(R,
  2361. StandardScrollBar(sbHorizontal + sbHandleKeyboard),
  2362. StandardScrollBar(sbVertical + sbHandleKeyboard),
  2363. HistoryId)); { Create the viewer }
  2364. If (Viewer <> Nil) Then Insert(Viewer); { Insert viewer }
  2365. END;
  2366. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2367. { THistory OBJECT METHODS }
  2368. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2369. {--THistory-----------------------------------------------------------------}
  2370. { Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2371. {---------------------------------------------------------------------------}
  2372. CONSTRUCTOR THistory.Init (Var Bounds: TRect; ALink: PInputLine;
  2373. AHistoryId: Word);
  2374. BEGIN
  2375. Inherited Init(Bounds); { Call ancestor }
  2376. Options := Options OR ofPostProcess; { Set post process }
  2377. EventMask := EventMask OR evBroadcast; { See broadcast events }
  2378. Link := ALink; { Hold link view }
  2379. HistoryId := AHistoryId; { Hold history id }
  2380. END;
  2381. {--THistory-----------------------------------------------------------------}
  2382. { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2383. {---------------------------------------------------------------------------}
  2384. CONSTRUCTOR THistory.Load (Var S: TStream);
  2385. BEGIN
  2386. Inherited Load(S); { Call ancestor }
  2387. GetPeerViewPtr(S, Link); { Load link view }
  2388. S.Read(HistoryId, 2); { Read history id }
  2389. END;
  2390. {--THistory-----------------------------------------------------------------}
  2391. { GetPalette -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2392. {---------------------------------------------------------------------------}
  2393. FUNCTION THistory.GetPalette: PPalette;
  2394. CONST P: String[Length(CHistory)] = CHistory; { Always normal string }
  2395. BEGIN
  2396. GetPalette := @P; { Return the palette }
  2397. END;
  2398. {--THistory-----------------------------------------------------------------}
  2399. { InitHistoryWindow -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2400. {---------------------------------------------------------------------------}
  2401. FUNCTION THistory.InitHistoryWindow (Var Bounds: TRect): PHistoryWindow;
  2402. VAR P: PHistoryWindow;
  2403. BEGIN
  2404. P := New(PHistoryWindow, Init(Bounds, HistoryId)); { Create history window }
  2405. If (Link <> Nil) Then
  2406. P^.HelpCtx := Link^.HelpCtx; { Set help context }
  2407. InitHistoryWindow := P; { Return history window }
  2408. END;
  2409. PROCEDURE THistory.Draw;
  2410. VAR B: TDrawBuffer;
  2411. BEGIN
  2412. MoveCStr(B, #222'~'#25'~'#221, GetColor($0102)); { Set buffer data }
  2413. WriteLine(0, 0, Size.X, Size.Y, B); { Write buffer }
  2414. END;
  2415. {--THistory-----------------------------------------------------------------}
  2416. { RecordHistory -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2417. {---------------------------------------------------------------------------}
  2418. PROCEDURE THistory.RecordHistory (CONST S: String);
  2419. BEGIN
  2420. HistoryAdd(HistoryId, S); { Add to history }
  2421. END;
  2422. {--THistory-----------------------------------------------------------------}
  2423. { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2424. {---------------------------------------------------------------------------}
  2425. PROCEDURE THistory.Store (Var S: TStream);
  2426. BEGIN
  2427. TView.Store(S); { TView.Store called }
  2428. PutPeerViewPtr(S, Link); { Store link view }
  2429. S.Write(HistoryId, 2); { Store history id }
  2430. END;
  2431. {--THistory-----------------------------------------------------------------}
  2432. { HandleEvent -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Oct99 LdB }
  2433. {---------------------------------------------------------------------------}
  2434. PROCEDURE THistory.HandleEvent (Var Event: TEvent);
  2435. VAR C: Word; Rslt: String; R, P: TRect; HistoryWindow: PHistoryWindow;
  2436. BEGIN
  2437. Inherited HandleEvent(Event); { Call ancestor }
  2438. If (Link = Nil) Then Exit; { No link view exits }
  2439. If (Event.What = evMouseDown) OR { Mouse down event }
  2440. ((Event.What = evKeyDown) AND
  2441. (CtrlToArrow(Event.KeyCode) = kbDown) AND { Down arrow key }
  2442. (Link^.State AND sfFocused <> 0)) Then Begin { Link view selected }
  2443. If NOT Link^.Focus Then Begin
  2444. ClearEvent(Event); { Event was handled }
  2445. Exit; { Now exit }
  2446. End;
  2447. RecordHistory(Link^.Data^); { Record current data }
  2448. Link^.GetBounds(R); { Get view bounds }
  2449. Dec(R.A.X); { One char in from us }
  2450. Inc(R.B.X); { One char short of us }
  2451. Inc(R.B.Y, 7); { Seven lines down }
  2452. Dec(R.A.Y,1); { One line below us }
  2453. Owner^.GetExtent(P); { Get owner extents }
  2454. R.Intersect(P); { Intersect views }
  2455. Dec(R.B.Y,1); { Shorten length by one }
  2456. HistoryWindow := InitHistoryWindow(R); { Create history window }
  2457. If (HistoryWindow <> Nil) Then Begin { Window crested okay }
  2458. C := Owner^.ExecView(HistoryWindow); { Execute this window }
  2459. If (C = cmOk) Then Begin { Result was okay }
  2460. Rslt := HistoryWindow^.GetSelection; { Get history selection }
  2461. If Length(Rslt) > Link^.MaxLen Then
  2462. SetLength(Rslt, Link^.MaxLen); { Hold new length }
  2463. Link^.Data^ := Rslt; { Hold new selection }
  2464. Link^.SelectAll(True); { Select all string }
  2465. Link^.DrawView; { Redraw link view }
  2466. End;
  2467. Dispose(HistoryWindow, Done); { Dispose of window }
  2468. End;
  2469. ClearEvent(Event); { Event was handled }
  2470. End Else If (Event.What = evBroadcast) Then { Broadcast event }
  2471. If ((Event.Command = cmReleasedFocus) AND
  2472. (Event.InfoPtr = Link)) OR
  2473. (Event.Command = cmRecordHistory) Then { Record command }
  2474. RecordHistory(Link^.Data^); { Record the history }
  2475. END;
  2476. {***************************************************************************}
  2477. { INTERFACE ROUTINES }
  2478. {***************************************************************************}
  2479. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2480. { ITEM STRING ROUTINES }
  2481. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2482. {---------------------------------------------------------------------------}
  2483. { NewSItem -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB }
  2484. {---------------------------------------------------------------------------}
  2485. FUNCTION NewSItem (Const Str: String; ANext: PSItem): PSItem;
  2486. VAR Item: PSItem;
  2487. BEGIN
  2488. New(Item); { Allocate item }
  2489. Item^.Value := NewStr(Str); { Hold item string }
  2490. Item^.Next := ANext; { Chain the ptr }
  2491. NewSItem := Item; { Return item }
  2492. END;
  2493. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2494. { DIALOG OBJECT REGISTRATION ROUTINES }
  2495. {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
  2496. {---------------------------------------------------------------------------}
  2497. { RegisterDialogs -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Sep99 LdB }
  2498. {---------------------------------------------------------------------------}
  2499. PROCEDURE RegisterDialogs;
  2500. BEGIN
  2501. RegisterType(RDialog); { Register dialog }
  2502. RegisterType(RInputLine); { Register inputline }
  2503. RegisterType(RButton); { Register button }
  2504. RegisterType(RCluster); { Register cluster }
  2505. RegisterType(RRadioButtons); { Register radiobutton }
  2506. RegisterType(RCheckBoxes); { Register check boxes }
  2507. RegisterType(RMultiCheckBoxes); { Register multi boxes }
  2508. RegisterType(RListBox); { Register list box }
  2509. RegisterType(RStaticText); { Register static text }
  2510. RegisterType(RLabel); { Register label }
  2511. RegisterType(RHistory); { Register history }
  2512. RegisterType(RParamText); { Register parm text }
  2513. END;
  2514. END.
  2515. {
  2516. $Log$
  2517. Revision 1.10 2001-06-01 16:00:00 pierre
  2518. * small changes for tbutton.draw
  2519. Revision 1.9 2001/05/31 12:14:50 pierre
  2520. Better button draw
  2521. Revision 1.8 2001/05/10 16:46:27 pierre
  2522. + some improovements made
  2523. Revision 1.7 2001/05/07 22:22:03 pierre
  2524. * removed NO_WINDOW cond, added GRAPH_API
  2525. Revision 1.6 2001/05/04 10:46:01 pierre
  2526. * various fixes for win32 api mode
  2527. Revision 1.5 2001/05/04 08:42:54 pierre
  2528. * some corrections for linux
  2529. Revision 1.4 2001/05/03 22:32:52 pierre
  2530. new bunch of changes, displays something for dos at least
  2531. Revision 1.3 2001/04/10 21:29:55 pierre
  2532. * import of Leon de Boer's files
  2533. Revision 1.2 2000/08/24 12:00:20 marco
  2534. * CVS log and ID tags
  2535. }
  2536. {******************[ REVISION HISTORY ]********************}
  2537. { Version Date Fix }
  2538. { ------- --------- --------------------------------- }
  2539. { 1.00 11 Nov 96 First DOS/DPMI platform release. }
  2540. { 1.10 13 Jul 97 Windows platform code added. }
  2541. { 1.20 29 Aug 97 Platform.inc sort added. }
  2542. { 1.30 13 Oct 97 Delphi 2 32 bit code added. }
  2543. { 1.40 05 May 98 Virtual pascal 2.0 code added. }
  2544. { 1.50 27 Oct 99 All objects completed and checked }
  2545. { 1.51 03 Nov 99 FPC windows support added }
  2546. { 1.60 26 Nov 99 Graphics stuff moved to GFVGraph }
  2547. {**********************************************************}