wviews.pas 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$I globdir.inc}
  12. unit WViews;
  13. interface
  14. uses Objects,Drivers,Views,Menus,Dialogs;
  15. const
  16. evIdle = $8000;
  17. cmLocalMenu = 54100;
  18. cmUpdate = 54101;
  19. cmListFocusChanged = 54102;
  20. mfUserBtn1 = $00010000;
  21. mfUserBtn2 = $00020000;
  22. mfUserBtn3 = $00040000;
  23. mfUserBtn4 = $00080000;
  24. mfCantCancel = $00100000;
  25. cmUserBtn1 = $fee0;
  26. cmUserBtn2 = $fee1;
  27. cmUserBtn3 = $fee2;
  28. cmUserBtn4 = $fee3;
  29. CPlainCluster = #7#8#9#9;
  30. type
  31. longstring = {$ifdef TP}string{$else}ansistring{$endif};
  32. PCenterDialog = ^TCenterDialog;
  33. TCenterDialog = object(TDialog)
  34. constructor Init(var Bounds: TRect; ATitle: TTitleStr);
  35. end;
  36. PAdvancedMenuBox = ^TAdvancedMenuBox;
  37. TAdvancedMenuBox = object(TMenuBox)
  38. function NewSubView(var Bounds: TRect; AMenu: PMenu;
  39. AParentMenu: PMenuView): PMenuView; virtual;
  40. function Execute: Word; virtual;
  41. end;
  42. PAdvancedMenuPopUp = ^TAdvancedMenuPopup;
  43. TAdvancedMenuPopUp = object(TMenuPopup)
  44. function NewSubView(var Bounds: TRect; AMenu: PMenu;
  45. AParentMenu: PMenuView): PMenuView; virtual;
  46. function Execute: Word; virtual;
  47. end;
  48. PAdvancedMenuBar = ^TAdvancedMenuBar;
  49. TAdvancedMenuBar = object(TMenuBar)
  50. constructor Init(var Bounds: TRect; AMenu: PMenu);
  51. function NewSubView(var Bounds: TRect; AMenu: PMenu;
  52. AParentMenu: PMenuView): PMenuView; virtual;
  53. procedure Update; virtual;
  54. function GetMenuItem(cm : word) : PMenuItem;
  55. procedure HandleEvent(var Event: TEvent); virtual;
  56. function Execute: Word; virtual;
  57. end;
  58. PAdvancedStaticText = ^TAdvancedStaticText;
  59. TAdvancedStaticText = object(TStaticText)
  60. procedure SetText(S: string); virtual;
  61. end;
  62. PAdvancedListBox = ^TAdvancedListBox;
  63. TAdvancedListBox = object(TListBox)
  64. Default: boolean;
  65. procedure FocusItem(Item: sw_integer); virtual;
  66. procedure HandleEvent(var Event: TEvent); virtual;
  67. constructor Load(var S: TStream);
  68. procedure Store(var S: TStream);
  69. end;
  70. PNoUpdateButton = ^TNoUpdateButton;
  71. TNoUpdateButton = object(TButton)
  72. procedure HandleEvent(var Event: TEvent); virtual;
  73. end;
  74. TLocalMenuListBox = object(TAdvancedListBox)
  75. procedure HandleEvent(var Event: TEvent); virtual;
  76. procedure LocalMenu(P: TPoint); virtual;
  77. function GetLocalMenu: PMenu; virtual;
  78. function GetCommandTarget: PView; virtual;
  79. private
  80. LastLocalCmd: word;
  81. end;
  82. PColorStaticText = ^TColorStaticText;
  83. TColorStaticText = object(TAdvancedStaticText)
  84. Color: word;
  85. DontWrap: boolean;
  86. Delta: TPoint;
  87. constructor Init(var Bounds: TRect; AText: String; AColor: word; AWrap: boolean);
  88. function GetPalette: PPalette; virtual;
  89. procedure Draw; virtual;
  90. constructor Load(var S: TStream);
  91. procedure Store(var S: TStream);
  92. end;
  93. PHSListBox = ^THSListBox;
  94. THSListBox = object(TLocalMenuListBox)
  95. constructor Init(var Bounds: TRect; ANumCols: Word; AHScrollBar, AVScrollBar: PScrollBar);
  96. end;
  97. PDlgWindow = ^TDlgWindow;
  98. TDlgWindow = object(TDialog)
  99. constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Sw_Integer);
  100. end;
  101. PAdvancedStatusLine = ^TAdvancedStatusLine;
  102. TAdvancedStatusLine = object(TStatusLine)
  103. StatusText: PString;
  104. function GetStatusText: string; virtual;
  105. procedure SetStatusText(const S: string); virtual;
  106. procedure ClearStatusText; virtual;
  107. procedure Draw; virtual;
  108. end;
  109. PDropDownListBox = ^TDropDownListBox;
  110. PDDHelperLB = ^TDDHelperLB;
  111. TDDHelperLB = object(TLocalMenuListBox)
  112. constructor Init(ALink: PDropDownListBox; var Bounds: TRect; ANumCols: Word; AScrollBar: PScrollBar);
  113. procedure HandleEvent(var Event: TEvent); virtual;
  114. procedure SetState(AState: Word; Enable: Boolean); virtual;
  115. procedure SelectItem(Item: Sw_Integer); virtual;
  116. function GetText(Item,MaxLen: Sw_Integer): String; virtual;
  117. function GetLocalMenu: PMenu; virtual;
  118. function GetCommandTarget: PView; virtual;
  119. private
  120. Link : PDropDownListBox;
  121. LastTT: longint;
  122. InClose: boolean;
  123. end;
  124. TDropDownListBox = object(TView)
  125. Text: string;
  126. Focused: sw_integer;
  127. List: PCollection;
  128. constructor Init(var Bounds: TRect; ADropLineCount: Sw_integer; AList: PCollection);
  129. procedure HandleEvent(var Event: TEvent); virtual;
  130. function GetText(Item: pointer; MaxLen: sw_integer): string; virtual;
  131. procedure NewList(AList: PCollection); virtual;
  132. procedure CreateListBox(var R: TRect);
  133. procedure DropList(Drop: boolean); virtual;
  134. function GetItemCount: sw_integer; virtual;
  135. procedure FocusItem(Item: sw_integer); virtual;
  136. function LBGetLocalMenu: PMenu; virtual;
  137. function LBGetCommandTarget: PView; virtual;
  138. procedure SetState(AState: Word; Enable: Boolean); virtual;
  139. procedure Draw; virtual;
  140. function GetPalette: PPalette; virtual;
  141. destructor Done; virtual;
  142. private
  143. DropLineCount: Sw_integer;
  144. ListDropped : boolean;
  145. ListBox : PDDHelperLB;
  146. SB : PScrollBar;
  147. end;
  148. PGroupView = ^TGroupView;
  149. TGroupView = object(TLabel)
  150. constructor Init(var Bounds: TRect; AText: String; ALink: PView);
  151. procedure Draw; virtual;
  152. end;
  153. PPlainCheckBoxes = ^TPlainCheckBoxes;
  154. TPlainCheckBoxes = object(TCheckBoxes)
  155. function GetPalette: PPalette; virtual;
  156. end;
  157. PPlainRadioButtons = ^TPlainRadioButtons;
  158. TPlainRadioButtons = object(TRadioButtons)
  159. function GetPalette: PPalette; virtual;
  160. end;
  161. PPanel = ^TPanel;
  162. TPanel = object(TGroup)
  163. constructor Init(var Bounds: TRect);
  164. end;
  165. PAdvMessageBox = ^TAdvMessageBox;
  166. TAdvMessageBox = object(TDialog)
  167. CanCancel: boolean;
  168. procedure HandleEvent(var Event: TEvent); virtual;
  169. end;
  170. procedure InsertOK(ADialog: PDialog);
  171. procedure InsertButtons(ADialog: PDialog);
  172. procedure Bug(const S: string; Params: pointer);
  173. procedure ErrorBox(const S: string; Params: pointer);
  174. procedure WarningBox(const S: string; Params: pointer);
  175. procedure InformationBox(const S: string; Params: pointer);
  176. function ConfirmBox(const S: string; Params: pointer; CanCancel: boolean): word;
  177. function ChoiceBox(const S: string; Params: pointer; Buttons: array of longstring; CanCancel: boolean): word;
  178. procedure ShowMessage(Msg: string);
  179. procedure HideMessage;
  180. function SearchMenuItem(Menu: PMenu; Cmd: word): PMenuItem;
  181. procedure SetMenuItemParam(Menu: PMenuItem; Param: string);
  182. function IsSubMenu(P: PMenuItem): boolean;
  183. function IsSeparator(P: PMenuItem): boolean;
  184. function UpdateMenu(M: PMenu): boolean;
  185. function SearchSubMenu(M: PMenu; Index: Sw_integer): PMenuItem;
  186. procedure AppendMenuItem(M: PMenu; I: PMenuItem);
  187. procedure RemoveMenuItem(Menu: PMenu; I: PMenuItem);
  188. function GetMenuItemBefore(Menu:PMenu; BeforeOf: PMenuItem): PMenuItem;
  189. procedure NotImplemented;
  190. function ColorIndex(Color: byte): word;
  191. var FormatParams : array[1..20] of longint;
  192. FormatParamCount : integer;
  193. FormatParamStrs : array[1..10] of string;
  194. FormatParamStrCount: integer;
  195. procedure ClearFormatParams;
  196. procedure AddFormatParam(P: pointer);
  197. procedure AddFormatParamInt(L: longint);
  198. procedure AddFormatParamChar(C: char);
  199. procedure AddFormatParamStr(const S: string);
  200. function FormatStrF(const Format: string; var Params): string;
  201. function FormatStrStr(const Format, Param: string): string;
  202. function FormatStrStr2(const Format, Param1,Param2: string): string;
  203. function FormatStrStr3(const Format, Param1,Param2,Param3: string): string;
  204. function FormatStrInt(const Format: string; L: longint): string;
  205. const UserButtonName : array[1..4] of string[40] = ('User~1~','User~2~','User~3~','User~4~');
  206. procedure InitAdvMsgBox;
  207. function AdvMessageBox(const Msg: String; Params: Pointer; AOptions: longint): Word;
  208. function AdvMessageBoxRect(var R: TRect; const Msg: String; Params: Pointer; AOptions: longint): Word;
  209. procedure DoneAdvMsgBox;
  210. procedure RegisterWViews;
  211. implementation
  212. uses Mouse,
  213. Resource,Commands,App,MsgBox,
  214. WConsts,WUtils;
  215. {$ifndef NOOBJREG}
  216. const
  217. RAdvancedListBox: TStreamRec = (
  218. ObjType: 1120;
  219. VmtLink: Ofs(TypeOf(TAdvancedListBox)^);
  220. Load: @TAdvancedListBox.Load;
  221. Store: @TAdvancedListBox.Store
  222. );
  223. RColorStaticText: TStreamRec = (
  224. ObjType: 1121;
  225. VmtLink: Ofs(TypeOf(TColorStaticText)^);
  226. Load: @TColorStaticText.Load;
  227. Store: @TColorStaticText.Store
  228. );
  229. RHSListBox: TStreamRec = (
  230. ObjType: 1122;
  231. VmtLink: Ofs(TypeOf(THSListBox)^);
  232. Load: @THSListBox.Load;
  233. Store: @THSListBox.Store
  234. );
  235. RDlgWindow: TStreamRec = (
  236. ObjType: 1123;
  237. VmtLink: Ofs(TypeOf(TDlgWindow)^);
  238. Load: @TDlgWindow.Load;
  239. Store: @TDlgWindow.Store
  240. );
  241. {$endif}
  242. const
  243. MessageDialog : PCenterDialog = nil;
  244. UserButtonCmd : array[Low(UserButtonName)..High(UserButtonName)] of word = (cmUserBtn1,cmUserBtn2,cmUserBtn3,cmUserBtn4);
  245. function ColorIndex(Color: byte): word;
  246. begin
  247. ColorIndex:=(Color and $0f)+(Color and $0f) shl 4;
  248. end;
  249. {*****************************************************************************
  250. TCenterDialog
  251. *****************************************************************************}
  252. constructor TCenterDialog.Init(var Bounds: TRect; ATitle: TTitleStr);
  253. begin
  254. inherited Init(Bounds,ATitle);
  255. Options:=Options or ofCentered;
  256. end;
  257. function TAdvancedMenuBox.NewSubView(var Bounds: TRect; AMenu: PMenu;
  258. AParentMenu: PMenuView): PMenuView;
  259. begin
  260. NewSubView := New(PAdvancedMenuBox, Init(Bounds, AMenu, AParentMenu));
  261. end;
  262. function TAdvancedMenuBox.Execute: word;
  263. type
  264. MenuAction = (DoNothing, DoSelect, DoReturn);
  265. var
  266. AutoSelect: Boolean;
  267. Action: MenuAction;
  268. Ch: Char;
  269. Result: Word;
  270. ItemShown, P: PMenuItem;
  271. Target: PMenuView;
  272. R: TRect;
  273. E: TEvent;
  274. MouseActive: Boolean;
  275. function IsDisabled(Item: PMenuItem): boolean;
  276. var Found: boolean;
  277. begin
  278. Found:=Item^.Disabled or IsSeparator(Item);
  279. if (Found=false) and (IsSubMenu(Item)=false) then
  280. Found:=CommandEnabled(Item^.Command)=false;
  281. IsDisabled:=Found;
  282. end;
  283. procedure TrackMouse;
  284. var
  285. Mouse: TPoint;
  286. R: TRect;
  287. begin
  288. MakeLocal(E.Where, Mouse);
  289. Current := Menu^.Items;
  290. while Current <> nil do
  291. begin
  292. GetItemRect(Current, R);
  293. if R.Contains(Mouse) then
  294. begin
  295. MouseActive := True;
  296. Break;
  297. end;
  298. Current := Current^.Next;
  299. end;
  300. if (Current<>nil) and IsDisabled(Current) then
  301. begin
  302. Current:=nil;
  303. MouseActive:=false;
  304. end;
  305. end;
  306. procedure TrackKey(FindNext: Boolean);
  307. procedure NextItem;
  308. begin
  309. Current := Current^.Next;
  310. if Current = nil then Current := Menu^.Items;
  311. end;
  312. procedure PrevItem;
  313. var
  314. P: PMenuItem;
  315. begin
  316. P := Current;
  317. if P = Menu^.Items then P := nil;
  318. repeat NextItem until Current^.Next = P;
  319. end;
  320. begin
  321. if Current <> nil then
  322. repeat
  323. if FindNext then NextItem else PrevItem;
  324. until (Current^.Name <> nil) and (IsDisabled(Current)=false);
  325. end;
  326. function MouseInOwner: Boolean;
  327. var
  328. Mouse: TPoint;
  329. R: TRect;
  330. begin
  331. MouseInOwner := False;
  332. if (ParentMenu <> nil) and (ParentMenu^.Size.Y = 1) then
  333. begin
  334. ParentMenu^.MakeLocal(E.Where, Mouse);
  335. ParentMenu^.GetItemRect(ParentMenu^.Current, R);
  336. MouseInOwner := R.Contains(Mouse);
  337. end;
  338. end;
  339. function MouseInMenus: Boolean;
  340. var
  341. P: PMenuView;
  342. begin
  343. P := ParentMenu;
  344. while (P <> nil) and (P^.MouseInView(E.Where)=false) do
  345. P := P^.ParentMenu;
  346. MouseInMenus := P <> nil;
  347. end;
  348. function TopMenu: PMenuView;
  349. var
  350. P: PMenuView;
  351. begin
  352. P := @Self;
  353. while P^.ParentMenu <> nil do P := P^.ParentMenu;
  354. TopMenu := P;
  355. end;
  356. begin
  357. AutoSelect := False; E.What:=evNothing;
  358. Result := 0;
  359. ItemShown := nil;
  360. Current := Menu^.Default;
  361. MouseActive := False;
  362. if UpdateMenu(Menu) then
  363. begin
  364. if Current<>nil then
  365. if Current^.Disabled then
  366. TrackKey(true);
  367. repeat
  368. Action := DoNothing;
  369. GetEvent(E);
  370. case E.What of
  371. evMouseDown:
  372. if MouseInView(E.Where) or MouseInOwner then
  373. begin
  374. TrackMouse;
  375. if Size.Y = 1 then AutoSelect := True;
  376. end else Action := DoReturn;
  377. evMouseUp:
  378. begin
  379. TrackMouse;
  380. if MouseInOwner then
  381. Current := Menu^.Default
  382. else
  383. if (Current <> nil) and (Current^.Name <> nil) then
  384. Action := DoSelect
  385. else
  386. if MouseActive or MouseInView(E.Where) then Action := DoReturn
  387. else
  388. begin
  389. Current := Menu^.Default;
  390. if Current = nil then Current := Menu^.Items;
  391. Action := DoNothing;
  392. end;
  393. end;
  394. evMouseMove:
  395. if E.Buttons <> 0 then
  396. begin
  397. TrackMouse;
  398. if not (MouseInView(E.Where) or MouseInOwner) and
  399. MouseInMenus then Action := DoReturn;
  400. end;
  401. evKeyDown:
  402. case CtrlToArrow(E.KeyCode) of
  403. kbUp, kbDown:
  404. if Size.Y <> 1 then
  405. TrackKey(CtrlToArrow(E.KeyCode) = kbDown) else
  406. if E.KeyCode = kbDown then AutoSelect := True;
  407. kbLeft, kbRight:
  408. if ParentMenu = nil then
  409. TrackKey(CtrlToArrow(E.KeyCode) = kbRight) else
  410. Action := DoReturn;
  411. kbHome, kbEnd:
  412. if Size.Y <> 1 then
  413. begin
  414. Current := Menu^.Items;
  415. if E.KeyCode = kbEnd then TrackKey(False);
  416. end;
  417. kbEnter:
  418. begin
  419. if Size.Y = 1 then AutoSelect := True;
  420. Action := DoSelect;
  421. end;
  422. kbEsc:
  423. begin
  424. Action := DoReturn;
  425. if (ParentMenu = nil) or (ParentMenu^.Size.Y <> 1) then
  426. ClearEvent(E);
  427. end;
  428. else
  429. Target := @Self;
  430. Ch := GetAltChar(E.KeyCode);
  431. if Ch = #0 then Ch := E.CharCode else Target := TopMenu;
  432. P := Target^.FindItem(Ch);
  433. if P = nil then
  434. begin
  435. P := TopMenu^.HotKey(E.KeyCode);
  436. if (P <> nil) and CommandEnabled(P^.Command) then
  437. begin
  438. Result := P^.Command;
  439. Action := DoReturn;
  440. end
  441. end else
  442. if Target = @Self then
  443. begin
  444. if Size.Y = 1 then AutoSelect := True;
  445. Action := DoSelect;
  446. Current := P;
  447. end else
  448. if (ParentMenu <> Target) or (ParentMenu^.Current <> P) then
  449. Action := DoReturn;
  450. end;
  451. evCommand:
  452. if E.Command = cmMenu then
  453. begin
  454. AutoSelect := False;
  455. if ParentMenu <> nil then Action := DoReturn;
  456. end else Action := DoReturn;
  457. end;
  458. if ItemShown <> Current then
  459. begin
  460. ItemShown := Current;
  461. DrawView;
  462. end;
  463. if (Action = DoSelect) or ((Action = DoNothing) and AutoSelect) then
  464. if Current <> nil then with Current^ do if Name <> nil then
  465. if Command = 0 then
  466. begin
  467. if E.What and (evMouseDown + evMouseMove) <> 0 then PutEvent(E);
  468. GetItemRect(Current, R);
  469. R.A.X := R.A.X + Origin.X;
  470. R.A.Y := R.B.Y + Origin.Y;
  471. R.B := Owner^.Size;
  472. if Size.Y = 1 then Dec(R.A.X);
  473. Target := TopMenu^.NewSubView(R, SubMenu, @Self);
  474. Result := Owner^.ExecView(Target);
  475. Dispose(Target, Done);
  476. end else if Action = DoSelect then Result := Command;
  477. if (Result <> 0) and CommandEnabled(Result) then
  478. begin
  479. Action := DoReturn;
  480. ClearEvent(E);
  481. end
  482. else
  483. Result := 0;
  484. until Action = DoReturn;
  485. end;
  486. if E.What <> evNothing then
  487. if (ParentMenu <> nil) or (E.What = evCommand) then PutEvent(E);
  488. if Current <> nil then
  489. begin
  490. Menu^.Default := Current;
  491. Current := nil;
  492. DrawView;
  493. end;
  494. Execute := Result;
  495. end;
  496. function TAdvancedMenuPopup.NewSubView(var Bounds: TRect; AMenu: PMenu;
  497. AParentMenu: PMenuView): PMenuView;
  498. begin
  499. NewSubView := New(PAdvancedMenuBox, Init(Bounds, AMenu, AParentMenu));
  500. end;
  501. function TAdvancedMenuPopup.Execute: word;
  502. type
  503. MenuAction = (DoNothing, DoSelect, DoReturn);
  504. var
  505. AutoSelect: Boolean;
  506. Action: MenuAction;
  507. Ch: Char;
  508. Result: Word;
  509. ItemShown, P: PMenuItem;
  510. Target: PMenuView;
  511. R: TRect;
  512. E: TEvent;
  513. MouseActive: Boolean;
  514. function IsDisabled(Item: PMenuItem): boolean;
  515. var Found: boolean;
  516. begin
  517. Found:=Item^.Disabled or IsSeparator(Item);
  518. if (Found=false) and (IsSubMenu(Item)=false) then
  519. Found:=CommandEnabled(Item^.Command)=false;
  520. IsDisabled:=Found;
  521. end;
  522. procedure TrackMouse;
  523. var
  524. Mouse: TPoint;
  525. R: TRect;
  526. { OldC: PMenuItem;}
  527. begin
  528. MakeLocal(E.Where, Mouse);
  529. { OldC:=Current;}
  530. Current := Menu^.Items;
  531. while Current <> nil do
  532. begin
  533. GetItemRect(Current, R);
  534. if R.Contains(Mouse) then
  535. begin
  536. MouseActive := True;
  537. Break;
  538. end;
  539. Current := Current^.Next;
  540. end;
  541. if (Current<>nil) and IsDisabled(Current) then
  542. begin
  543. Current:={OldC}nil;
  544. MouseActive:=false;
  545. end;
  546. end;
  547. procedure TrackKey(FindNext: Boolean);
  548. procedure NextItem;
  549. begin
  550. Current := Current^.Next;
  551. if Current = nil then Current := Menu^.Items;
  552. end;
  553. procedure PrevItem;
  554. var
  555. P: PMenuItem;
  556. begin
  557. P := Current;
  558. if P = Menu^.Items then P := nil;
  559. repeat NextItem until Current^.Next = P;
  560. end;
  561. begin
  562. if Current <> nil then
  563. repeat
  564. if FindNext then NextItem else PrevItem;
  565. until (Current^.Name <> nil) and (IsDisabled(Current)=false);
  566. end;
  567. function MouseInOwner: Boolean;
  568. var
  569. Mouse: TPoint;
  570. R: TRect;
  571. begin
  572. MouseInOwner := False;
  573. if (ParentMenu <> nil) and (ParentMenu^.Size.Y = 1) then
  574. begin
  575. ParentMenu^.MakeLocal(E.Where, Mouse);
  576. ParentMenu^.GetItemRect(ParentMenu^.Current, R);
  577. MouseInOwner := R.Contains(Mouse);
  578. end;
  579. end;
  580. function MouseInMenus: Boolean;
  581. var
  582. P: PMenuView;
  583. begin
  584. P := ParentMenu;
  585. while (P <> nil) and (P^.MouseInView(E.Where)=false) do
  586. P := P^.ParentMenu;
  587. MouseInMenus := P <> nil;
  588. end;
  589. function TopMenu: PMenuView;
  590. var
  591. P: PMenuView;
  592. begin
  593. P := @Self;
  594. while P^.ParentMenu <> nil do P := P^.ParentMenu;
  595. TopMenu := P;
  596. end;
  597. begin
  598. AutoSelect := False; E.What:=evNothing;
  599. Result := 0;
  600. ItemShown := nil;
  601. Current := Menu^.Default;
  602. MouseActive := False;
  603. if UpdateMenu(Menu) then
  604. begin
  605. if Current<>nil then
  606. if Current^.Disabled then
  607. TrackKey(true);
  608. repeat
  609. Action := DoNothing;
  610. GetEvent(E);
  611. case E.What of
  612. evMouseDown:
  613. if MouseInView(E.Where) or MouseInOwner then
  614. begin
  615. TrackMouse;
  616. if Size.Y = 1 then AutoSelect := True;
  617. end else Action := DoReturn;
  618. evMouseUp:
  619. begin
  620. TrackMouse;
  621. if MouseInOwner then
  622. Current := Menu^.Default
  623. else
  624. if (Current <> nil) and (Current^.Name <> nil) then
  625. Action := DoSelect
  626. else
  627. if MouseActive or MouseInView(E.Where) then Action := DoReturn
  628. else
  629. begin
  630. Current := Menu^.Default;
  631. if Current = nil then Current := Menu^.Items;
  632. Action := DoNothing;
  633. end;
  634. end;
  635. evMouseMove:
  636. if E.Buttons <> 0 then
  637. begin
  638. TrackMouse;
  639. if not (MouseInView(E.Where) or MouseInOwner) and
  640. MouseInMenus then Action := DoReturn;
  641. end;
  642. evKeyDown:
  643. case CtrlToArrow(E.KeyCode) of
  644. kbUp, kbDown:
  645. if Size.Y <> 1 then
  646. TrackKey(CtrlToArrow(E.KeyCode) = kbDown) else
  647. if E.KeyCode = kbDown then AutoSelect := True;
  648. kbLeft, kbRight:
  649. if ParentMenu = nil then
  650. TrackKey(CtrlToArrow(E.KeyCode) = kbRight) else
  651. Action := DoReturn;
  652. kbHome, kbEnd:
  653. if Size.Y <> 1 then
  654. begin
  655. Current := Menu^.Items;
  656. if E.KeyCode = kbEnd then TrackKey(False);
  657. end;
  658. kbEnter:
  659. begin
  660. if Size.Y = 1 then AutoSelect := True;
  661. Action := DoSelect;
  662. end;
  663. kbEsc:
  664. begin
  665. Action := DoReturn;
  666. if (ParentMenu = nil) or (ParentMenu^.Size.Y <> 1) then
  667. ClearEvent(E);
  668. end;
  669. else
  670. Target := @Self;
  671. Ch := GetAltChar(E.KeyCode);
  672. if Ch = #0 then Ch := E.CharCode else Target := TopMenu;
  673. P := Target^.FindItem(Ch);
  674. if P = nil then
  675. begin
  676. P := TopMenu^.HotKey(E.KeyCode);
  677. if (P <> nil) and CommandEnabled(P^.Command) then
  678. begin
  679. Result := P^.Command;
  680. Action := DoReturn;
  681. end
  682. end else
  683. if Target = @Self then
  684. begin
  685. if Size.Y = 1 then AutoSelect := True;
  686. Action := DoSelect;
  687. Current := P;
  688. end else
  689. if (ParentMenu <> Target) or (ParentMenu^.Current <> P) then
  690. Action := DoReturn;
  691. end;
  692. evCommand:
  693. if E.Command = cmMenu then
  694. begin
  695. AutoSelect := False;
  696. if ParentMenu <> nil then Action := DoReturn;
  697. end else Action := DoReturn;
  698. end;
  699. if ItemShown <> Current then
  700. begin
  701. ItemShown := Current;
  702. DrawView;
  703. end;
  704. if (Action = DoSelect) or ((Action = DoNothing) and AutoSelect) then
  705. if Current <> nil then with Current^ do if Name <> nil then
  706. if Command = 0 then
  707. begin
  708. if E.What and (evMouseDown + evMouseMove) <> 0 then PutEvent(E);
  709. GetItemRect(Current, R);
  710. R.A.X := R.A.X + Origin.X;
  711. R.A.Y := R.B.Y + Origin.Y;
  712. R.B := Owner^.Size;
  713. if Size.Y = 1 then Dec(R.A.X);
  714. Target := TopMenu^.NewSubView(R, SubMenu, @Self);
  715. Result := Owner^.ExecView(Target);
  716. Dispose(Target, Done);
  717. end else if Action = DoSelect then Result := Command;
  718. if (Result <> 0) and CommandEnabled(Result) then
  719. begin
  720. Action := DoReturn;
  721. ClearEvent(E);
  722. end
  723. else
  724. Result := 0;
  725. until Action = DoReturn;
  726. end;
  727. if E.What <> evNothing then
  728. if (ParentMenu <> nil) or (E.What = evCommand) then PutEvent(E);
  729. if Current <> nil then
  730. begin
  731. Menu^.Default := Current;
  732. Current := nil;
  733. DrawView;
  734. end;
  735. Execute := Result;
  736. end;
  737. constructor TAdvancedMenuBar.Init(var Bounds: TRect; AMenu: PMenu);
  738. begin
  739. inherited Init(Bounds, AMenu);
  740. EventMask:=EventMask or evBroadcast;
  741. GrowMode:=gfGrowHiX;
  742. end;
  743. function TAdvancedMenuBar.NewSubView(var Bounds: TRect; AMenu: PMenu;
  744. AParentMenu: PMenuView): PMenuView;
  745. begin
  746. NewSubView := New(PAdvancedMenuBox, Init(Bounds, AMenu, AParentMenu));
  747. end;
  748. procedure TAdvancedMenuBar.Update;
  749. begin
  750. UpdateMenu(Menu);
  751. DrawView;
  752. end;
  753. function TAdvancedMenuBar.GetMenuItem(cm : word) : PMenuItem;
  754. type
  755. PItemChain = ^TItemChain;
  756. TItemChain = record
  757. Next : PMenuItem;
  758. Up : PItemChain;
  759. end;
  760. var Cur : PMenuItem;
  761. Up,NUp : PItemChain;
  762. begin
  763. Cur:=Menu^.Items;
  764. Up:=nil;
  765. if cm=0 then
  766. begin
  767. GetMenuItem:=nil;
  768. exit;
  769. end;
  770. while assigned(Cur) and (Cur^.Command<>cm) do
  771. begin
  772. if (Cur^.Command=0) and assigned(Cur^.SubMenu) and
  773. assigned(Cur^.Name) and
  774. assigned(Cur^.SubMenu^.Items) then
  775. {subMenu}
  776. begin
  777. If assigned(Cur^.Next) then
  778. begin
  779. New(Nup);
  780. Nup^.Up:=Up;
  781. Nup^.next:=Cur^.Next;
  782. Up:=Nup;
  783. end;
  784. Cur:=Cur^.SubMenu^.Items;
  785. end
  786. else
  787. { normal item }
  788. begin
  789. if assigned(Cur^.Next) then
  790. Cur:=Cur^.Next
  791. else if assigned(Up) then
  792. begin
  793. Cur:=Up^.next;
  794. NUp:=Up;
  795. Up:=Up^.Up;
  796. Dispose(NUp);
  797. end
  798. else
  799. Cur:=Nil;
  800. end;
  801. end;
  802. GetMenuItem:=Cur;
  803. While assigned(Up) do
  804. begin
  805. NUp:=Up;
  806. Up:=Up^.up;
  807. Dispose(NUp);
  808. end;
  809. end;
  810. procedure TAdvancedMenuBar.HandleEvent(var Event: TEvent);
  811. begin
  812. case Event.What of
  813. evBroadcast :
  814. case Event.Command of
  815. cmCommandSetChanged : Update;
  816. cmUpdate : Update;
  817. end;
  818. end;
  819. inherited HandleEvent(Event);
  820. end;
  821. function TAdvancedMenuBar.Execute: word;
  822. type
  823. MenuAction = (DoNothing, DoSelect, DoReturn);
  824. var
  825. AutoSelect: Boolean;
  826. Action: MenuAction;
  827. Ch: Char;
  828. Result: Word;
  829. ItemShown, P: PMenuItem;
  830. Target: PMenuView;
  831. R: TRect;
  832. E: TEvent;
  833. MouseActive: Boolean;
  834. function IsDisabled(Item: PMenuItem): boolean;
  835. var Dis : boolean;
  836. begin
  837. Dis:=Item^.Disabled or IsSeparator(Item);
  838. if (Dis=false) and (IsSubMenu(Item)=false) then
  839. Dis:=CommandEnabled(Item^.Command)=false;
  840. IsDisabled:=Dis;
  841. end;
  842. procedure TrackMouse;
  843. var
  844. Mouse: TPoint;
  845. R: TRect;
  846. OldC: PMenuItem;
  847. begin
  848. MakeLocal(E.Where, Mouse);
  849. OldC:=Current;
  850. Current := Menu^.Items;
  851. while Current <> nil do
  852. begin
  853. GetItemRect(Current, R);
  854. if R.Contains(Mouse) then
  855. begin
  856. MouseActive := True;
  857. Break;
  858. end;
  859. Current := Current^.Next;
  860. end;
  861. if (Current<>nil) and IsDisabled(Current) then
  862. Current:=nil;
  863. end;
  864. procedure TrackKey(FindNext: Boolean);
  865. procedure NextItem;
  866. begin
  867. Current := Current^.Next;
  868. if Current = nil then Current := Menu^.Items;
  869. end;
  870. procedure PrevItem;
  871. var
  872. P: PMenuItem;
  873. begin
  874. P := Current;
  875. if P = Menu^.Items then P := nil;
  876. repeat NextItem until Current^.Next = P;
  877. end;
  878. begin
  879. if Current <> nil then
  880. repeat
  881. if FindNext then NextItem else PrevItem;
  882. until (Current^.Name <> nil) and (IsDisabled(Current)=false);
  883. end;
  884. function MouseInOwner: Boolean;
  885. var
  886. Mouse: TPoint;
  887. R: TRect;
  888. begin
  889. MouseInOwner := False;
  890. if (ParentMenu <> nil) and (ParentMenu^.Size.Y = 1) then
  891. begin
  892. ParentMenu^.MakeLocal(E.Where, Mouse);
  893. ParentMenu^.GetItemRect(ParentMenu^.Current, R);
  894. MouseInOwner := R.Contains(Mouse);
  895. end;
  896. end;
  897. function MouseInMenus: Boolean;
  898. var
  899. P: PMenuView;
  900. begin
  901. P := ParentMenu;
  902. while (P <> nil) and not P^.MouseInView(E.Where) do P := P^.ParentMenu;
  903. MouseInMenus := P <> nil;
  904. end;
  905. function TopMenu: PMenuView;
  906. var
  907. P: PMenuView;
  908. begin
  909. P := @Self;
  910. while P^.ParentMenu <> nil do P := P^.ParentMenu;
  911. TopMenu := P;
  912. end;
  913. begin
  914. AutoSelect := False; E.What:=evNothing;
  915. Result := 0;
  916. ItemShown := nil;
  917. Current := Menu^.Default;
  918. MouseActive := False;
  919. if UpdateMenu(Menu) then
  920. begin
  921. if Current<>nil then
  922. if Current^.Disabled then
  923. TrackKey(true);
  924. repeat
  925. Action := DoNothing;
  926. GetEvent(E);
  927. case E.What of
  928. evMouseDown:
  929. if MouseInView(E.Where) or MouseInOwner then
  930. begin
  931. TrackMouse;
  932. if Size.Y = 1 then AutoSelect := True;
  933. end else Action := DoReturn;
  934. evMouseUp:
  935. begin
  936. TrackMouse;
  937. if MouseInOwner then
  938. Current := Menu^.Default
  939. else
  940. if (Current <> nil) and (Current^.Name <> nil) then
  941. Action := DoSelect
  942. else
  943. if MouseActive or MouseInView(E.Where) then Action := DoReturn
  944. else
  945. begin
  946. Current := Menu^.Default;
  947. if Current = nil then Current := Menu^.Items;
  948. Action := DoNothing;
  949. end;
  950. end;
  951. evMouseMove:
  952. if E.Buttons <> 0 then
  953. begin
  954. TrackMouse;
  955. if not (MouseInView(E.Where) or MouseInOwner) and
  956. MouseInMenus then Action := DoReturn;
  957. end;
  958. evKeyDown:
  959. case CtrlToArrow(E.KeyCode) of
  960. kbUp, kbDown:
  961. if Size.Y <> 1 then
  962. TrackKey(CtrlToArrow(E.KeyCode) = kbDown) else
  963. if E.KeyCode = kbDown then AutoSelect := True;
  964. kbLeft, kbRight:
  965. if ParentMenu = nil then
  966. TrackKey(CtrlToArrow(E.KeyCode) = kbRight) else
  967. Action := DoReturn;
  968. kbHome, kbEnd:
  969. if Size.Y <> 1 then
  970. begin
  971. Current := Menu^.Items;
  972. if E.KeyCode = kbEnd then TrackKey(False);
  973. end;
  974. kbEnter:
  975. begin
  976. if Size.Y = 1 then AutoSelect := True;
  977. Action := DoSelect;
  978. end;
  979. kbEsc:
  980. begin
  981. Action := DoReturn;
  982. if (ParentMenu = nil) or (ParentMenu^.Size.Y <> 1) then
  983. ClearEvent(E);
  984. end;
  985. else
  986. Target := @Self;
  987. Ch := GetAltChar(E.KeyCode);
  988. if Ch = #0 then Ch := E.CharCode else Target := TopMenu;
  989. P := Target^.FindItem(Ch);
  990. if P = nil then
  991. begin
  992. P := TopMenu^.HotKey(E.KeyCode);
  993. if (P <> nil) and CommandEnabled(P^.Command) then
  994. begin
  995. Result := P^.Command;
  996. Action := DoReturn;
  997. end
  998. end else
  999. if Target = @Self then
  1000. begin
  1001. if Size.Y = 1 then AutoSelect := True;
  1002. Action := DoSelect;
  1003. Current := P;
  1004. end else
  1005. if (ParentMenu <> Target) or (ParentMenu^.Current <> P) then
  1006. Action := DoReturn;
  1007. end;
  1008. evCommand:
  1009. if E.Command = cmMenu then
  1010. begin
  1011. AutoSelect := False;
  1012. if ParentMenu <> nil then Action := DoReturn;
  1013. end else Action := DoReturn;
  1014. end;
  1015. if ItemShown <> Current then
  1016. begin
  1017. ItemShown := Current;
  1018. DrawView;
  1019. end;
  1020. if (Action = DoSelect) or ((Action = DoNothing) and AutoSelect) then
  1021. if Current <> nil then with Current^ do if Name <> nil then
  1022. if Command = 0 then
  1023. begin
  1024. if E.What and (evMouseDown + evMouseMove) <> 0 then PutEvent(E);
  1025. GetItemRect(Current, R);
  1026. R.A.X := R.A.X + Origin.X;
  1027. R.A.Y := R.B.Y + Origin.Y;
  1028. R.B := Owner^.Size;
  1029. if Size.Y = 1 then Dec(R.A.X);
  1030. Target := TopMenu^.NewSubView(R, SubMenu, @Self);
  1031. Result := Owner^.ExecView(Target);
  1032. Dispose(Target, Done);
  1033. end else if Action = DoSelect then Result := Command;
  1034. if (Result <> 0) and CommandEnabled(Result) then
  1035. begin
  1036. Action := DoReturn;
  1037. ClearEvent(E);
  1038. end
  1039. else
  1040. Result := 0;
  1041. until Action = DoReturn;
  1042. end;
  1043. if E.What <> evNothing then
  1044. if (ParentMenu <> nil) or (E.What = evCommand) then PutEvent(E);
  1045. if Current <> nil then
  1046. begin
  1047. Menu^.Default := Current;
  1048. Current := nil;
  1049. DrawView;
  1050. end;
  1051. Execute := Result;
  1052. end;
  1053. procedure TAdvancedStaticText.SetText(S: string);
  1054. begin
  1055. if Text<>nil then DisposeStr(Text);
  1056. Text:=NewStr(S);
  1057. DrawView;
  1058. end;
  1059. procedure TAdvancedListBox.FocusItem(Item: sw_integer);
  1060. var OFocused: sw_integer;
  1061. begin
  1062. OFocused:=Focused;
  1063. inherited FocusItem(Item);
  1064. if Focused<>OFocused then
  1065. Message(Owner,evBroadcast,cmListFocusChanged,@Self);
  1066. end;
  1067. procedure TAdvancedListBox.HandleEvent(var Event: TEvent);
  1068. begin
  1069. case Event.What of
  1070. evMouseDown :
  1071. if MouseInView(Event.Where) and (Event.Double) then
  1072. begin
  1073. inherited HandleEvent(Event);
  1074. if Range>Focused then SelectItem(Focused);
  1075. end;
  1076. evBroadcast :
  1077. case Event.Command of
  1078. cmListItemSelected :
  1079. Message(Owner,evBroadcast,cmDefault,nil);
  1080. end;
  1081. end;
  1082. inherited HandleEvent(Event);
  1083. end;
  1084. constructor TColorStaticText.Init(var Bounds: TRect; AText: String; AColor: word; AWrap: boolean);
  1085. begin
  1086. inherited Init(Bounds,AText);
  1087. DontWrap:=not AWrap;
  1088. Color:=AColor;
  1089. end;
  1090. function TColorStaticText.GetPalette: PPalette;
  1091. begin
  1092. GetPalette:=nil;
  1093. end;
  1094. procedure TColorStaticText.Draw;
  1095. procedure MoveColorTxt(var b;const curs:string;c:word);
  1096. var
  1097. p : ^word;
  1098. i : sw_integer;
  1099. col : byte;
  1100. tilde : boolean;
  1101. begin
  1102. tilde:=false;
  1103. col:=lo(c);
  1104. p:=@b;
  1105. i:=0;
  1106. while (i<length(Curs)) do
  1107. begin
  1108. Inc(i);
  1109. case CurS[i] of
  1110. #1 :
  1111. begin
  1112. Inc(i);
  1113. Col:=ord(curS[i]);
  1114. end;
  1115. #2 :
  1116. begin
  1117. if tilde then
  1118. col:=hi(Color)
  1119. else
  1120. col:=lo(Color)
  1121. end;
  1122. '~' :
  1123. begin
  1124. tilde:=not tilde;
  1125. if tilde then
  1126. col:=hi(Color)
  1127. else
  1128. col:=lo(Color)
  1129. end;
  1130. else
  1131. begin
  1132. p^:=(col shl 8) or ord(curs[i]);
  1133. inc(p);
  1134. end;
  1135. end;
  1136. end;
  1137. end;
  1138. var
  1139. C: word;
  1140. Center: Boolean;
  1141. I, J, L, P, Y: Sw_Integer;
  1142. B: TDrawBuffer;
  1143. S: String;
  1144. T: string;
  1145. CurS: string;
  1146. TildeCount,Po: Sw_integer;
  1147. TempS: string;
  1148. begin
  1149. if Size.X=0 then Exit;
  1150. C:=Color;
  1151. if (C and $0f)=((C and $f0) shr 4) then
  1152. C:=GetColor(C and $0f);
  1153. if DontWrap=false then
  1154. begin
  1155. GetText(S);
  1156. L := Length(S);
  1157. P := 1;
  1158. Y := 0;
  1159. Center := False;
  1160. while Y < Size.Y do
  1161. begin
  1162. MoveChar(B, ' ', Lo(C), Size.X);
  1163. if P <= L then
  1164. begin
  1165. if S[P] = #3 then
  1166. begin
  1167. Center := True;
  1168. Inc(P);
  1169. end;
  1170. I := P;
  1171. repeat
  1172. J := P;
  1173. while (P <= L) and (S[P] = ' ') do Inc(P);
  1174. while (P <= L) and (S[P] <> ' ') and (S[P] <> #13) do Inc(P);
  1175. until (P > L) or (P >= I + Size.X) or (S[P] = #13);
  1176. TildeCount:=0; TempS:=copy(S,I,P-I);
  1177. repeat
  1178. Po:=Pos('~',TempS);
  1179. if Po>0 then begin Inc(TildeCount); Delete(TempS,1,Po); end;
  1180. until Po=0;
  1181. if P > I + Size.X + TildeCount then
  1182. if J > I then P := J else P := I + Size.X;
  1183. T:=copy(S,I,P-I);
  1184. if Center then J := (Size.X - {P + I}CStrLen(T)) div 2 else J := 0;
  1185. MoveColorTxt(B[J],T,C);
  1186. while (P <= L) and (S[P] = ' ') do Inc(P);
  1187. if (P <= L) and (S[P] = #13) then
  1188. begin
  1189. Center := False;
  1190. Inc(P);
  1191. if (P <= L) and (S[P] = #10) then Inc(P);
  1192. end;
  1193. end;
  1194. WriteLine(0, Y, Size.X, 1, B);
  1195. Inc(Y);
  1196. end;
  1197. end { Wrap=false } else
  1198. begin
  1199. GetText(S);
  1200. I:=1;
  1201. for Y:=0 to Size.Y-1 do
  1202. begin
  1203. MoveChar(B, ' ', Lo(C), Size.X);
  1204. CurS:='';
  1205. if S<>'' then
  1206. begin
  1207. P:=Pos(#13,S);
  1208. if P=0 then P:=length(S)+1;
  1209. CurS:=copy(S,1,P-1);
  1210. CurS:=copy(CurS,Delta.X+1,High(CurS));
  1211. CurS:=copy(CurS,1,MaxViewWidth);
  1212. Delete(S,1,P);
  1213. end;
  1214. if CurS<>'' then
  1215. MoveColorTxt(B,CurS,C);
  1216. WriteLine(0,Y,Size.X,1,B);
  1217. end;
  1218. end;
  1219. end;
  1220. constructor TColorStaticText.Load(var S: TStream);
  1221. begin
  1222. inherited Load(S);
  1223. S.Read(Color,SizeOf(Color));
  1224. S.Read(DontWrap,SizeOf(DontWrap));
  1225. S.Read(Delta,SizeOf(Delta));
  1226. end;
  1227. procedure TColorStaticText.Store(var S: TStream);
  1228. begin
  1229. inherited Store(S);
  1230. S.Write(Color,SizeOf(Color));
  1231. S.Write(DontWrap,SizeOf(DontWrap));
  1232. S.Write(Delta,SizeOf(Delta));
  1233. end;
  1234. constructor THSListBox.Init(var Bounds: TRect; ANumCols: Word; AHScrollBar, AVScrollBar: PScrollBar);
  1235. begin
  1236. inherited Init(Bounds,ANumCols,AVScrollBar);
  1237. HScrollBar:=AHScrollBar;
  1238. end;
  1239. constructor TDlgWindow.Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Sw_Integer);
  1240. begin
  1241. inherited Init(Bounds,ATitle);
  1242. Number:=ANumber;
  1243. Flags:=Flags or (wfMove + wfGrow + wfClose + wfZoom);
  1244. end;
  1245. procedure TLocalMenuListBox.LocalMenu(P: TPoint);
  1246. var M: PMenu;
  1247. MV: PAdvancedMenuPopUp;
  1248. R: TRect;
  1249. Re: word;
  1250. begin
  1251. M:=GetLocalMenu;
  1252. if M=nil then Exit;
  1253. if LastLocalCmd<>0 then
  1254. M^.Default:=SearchMenuItem(M,LastLocalCmd);
  1255. Desktop^.GetExtent(R);
  1256. MakeGlobal(P,R.A); {Desktop^.MakeLocal(R.A,R.A);}
  1257. New(MV, Init(R, M));
  1258. Re:=Application^.ExecView(MV);
  1259. if M^.Default=nil then LastLocalCmd:=0
  1260. else LastLocalCmd:=M^.Default^.Command;
  1261. Dispose(MV, Done);
  1262. if Re<>0 then
  1263. Message(GetCommandTarget,evCommand,Re,@Self);
  1264. end;
  1265. function TLocalMenuListBox.GetLocalMenu: PMenu;
  1266. begin
  1267. GetLocalMenu:=nil;
  1268. { Abstract;}
  1269. end;
  1270. function TLocalMenuListBox.GetCommandTarget: PView;
  1271. begin
  1272. GetCommandTarget:=@Self;
  1273. end;
  1274. procedure TLocalMenuListBox.HandleEvent(var Event: TEvent);
  1275. var DontClear: boolean;
  1276. P: TPoint;
  1277. begin
  1278. case Event.What of
  1279. evMouseDown :
  1280. if MouseInView(Event.Where) and (Event.Buttons=mbRightButton) then
  1281. begin
  1282. MakeLocal(Event.Where,P); Inc(P.X); Inc(P.Y);
  1283. LocalMenu(P);
  1284. ClearEvent(Event);
  1285. end;
  1286. evKeyDown :
  1287. begin
  1288. DontClear:=false;
  1289. case Event.KeyCode of
  1290. kbAltF10 : Message(@Self,evCommand,cmLocalMenu,@Self);
  1291. else DontClear:=true;
  1292. end;
  1293. if DontClear=false then ClearEvent(Event);
  1294. end;
  1295. evCommand :
  1296. begin
  1297. DontClear:=false;
  1298. case Event.Command of
  1299. cmLocalMenu :
  1300. begin
  1301. P:=Cursor; Inc(P.X); Inc(P.Y);
  1302. LocalMenu(P);
  1303. end;
  1304. else DontClear:=true;
  1305. end;
  1306. if not DontClear then ClearEvent(Event);
  1307. end;
  1308. end;
  1309. inherited HandleEvent(Event);
  1310. end;
  1311. function TAdvancedStatusLine.GetStatusText: string;
  1312. var S: string;
  1313. begin
  1314. if StatusText=nil then S:='' else S:=StatusText^;
  1315. GetStatusText:=S;
  1316. end;
  1317. procedure TAdvancedStatusLine.SetStatusText(const S: string);
  1318. begin
  1319. if StatusText<>nil then DisposeStr(StatusText);
  1320. StatusText:=NewStr(S);
  1321. DrawView;
  1322. end;
  1323. procedure TAdvancedStatusLine.ClearStatusText;
  1324. begin
  1325. SetStatusText('');
  1326. end;
  1327. procedure TAdvancedStatusLine.Draw;
  1328. var B: TDrawBuffer;
  1329. C: word;
  1330. S: string;
  1331. begin
  1332. S:=GetStatusText;
  1333. if S='' then inherited Draw else
  1334. begin
  1335. C:=GetColor(1);
  1336. MoveChar(B,' ',C,Size.X);
  1337. MoveStr(B[1],S,C);
  1338. WriteLine(0,0,Size.X,Size.Y,B);
  1339. end;
  1340. end;
  1341. procedure Bug(const S: string; Params: pointer);
  1342. begin
  1343. ErrorBox(FormatStrStr(msg_bugcheckfailed,S),Params);
  1344. end;
  1345. procedure ErrorBox(const S: string; Params: pointer);
  1346. begin
  1347. AdvMessageBox(S,Params,mfError+mfInsertInApp+mfOKButton);
  1348. end;
  1349. procedure WarningBox(const S: string; Params: pointer);
  1350. begin
  1351. AdvMessageBox(S,Params,mfWarning+mfInsertInApp+mfOKButton);
  1352. end;
  1353. procedure InformationBox(const S: string; Params: pointer);
  1354. begin
  1355. AdvMessageBox(S,Params,mfInformation+mfInsertInApp+mfOKButton);
  1356. end;
  1357. function b2i(B: boolean): longint;
  1358. begin
  1359. if b then b2i:=1 else b2i:=0;
  1360. end;
  1361. function ConfirmBox(const S: string; Params: pointer; CanCancel: boolean): word;
  1362. begin
  1363. ConfirmBox:=AdvMessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+
  1364. b2i(CanCancel)*mfCancelButton+b2i(not CanCancel)*mfCantCancel);
  1365. end;
  1366. function ChoiceBox(const S: string; Params: pointer; Buttons: array of longstring; CanCancel: boolean): word;
  1367. var BtnMask,M: longint;
  1368. I,BtnCount: integer;
  1369. begin
  1370. BtnCount:=Min(High(Buttons)-Low(Buttons)+1,High(UserButtonName)-Low(UserButtonName)+1);
  1371. BtnMask:=0; M:=mfUserBtn1;
  1372. for I:=Low(Buttons) to Low(Buttons)+BtnCount-1 do
  1373. begin
  1374. UserButtonName[Low(UserButtonName)+I-Low(Buttons)]:=Buttons[I];
  1375. BtnMask:=BtnMask or M; M:=M shl 1;
  1376. end;
  1377. ChoiceBox:=AdvMessageBox(S,Params,mfConfirmation+BtnMask+
  1378. b2i(CanCancel)*mfCancelButton+b2i(not CanCancel)*mfCantCancel);
  1379. end;
  1380. function IsSeparator(P: PMenuItem): boolean;
  1381. begin
  1382. IsSeparator:=(P<>nil) and (P^.Name=nil) and (P^.HelpCtx=hcNoContext);
  1383. end;
  1384. function IsSubMenu(P: PMenuItem): boolean;
  1385. begin
  1386. IsSubMenu:=(P<>nil) and (P^.Name<>nil) and (P^.Command=0) and (P^.SubMenu<>nil);
  1387. end;
  1388. function SearchMenuItem(Menu: PMenu; Cmd: word): PMenuItem;
  1389. var P,I: PMenuItem;
  1390. begin
  1391. I:=nil;
  1392. if Menu=nil then P:=nil else P:=Menu^.Items;
  1393. while (P<>nil) and (I=nil) do
  1394. begin
  1395. if IsSubMenu(P) then
  1396. I:=SearchMenuItem(P^.SubMenu,Cmd);
  1397. if I=nil then
  1398. if P^.Command=Cmd then I:=P else
  1399. P:=P^.Next;
  1400. end;
  1401. SearchMenuItem:=I;
  1402. end;
  1403. procedure SetMenuItemParam(Menu: PMenuItem; Param: string);
  1404. begin
  1405. if Menu=nil then Exit;
  1406. if Menu^.Param<>nil then DisposeStr(Menu^.Param);
  1407. Menu^.Param:=NewStr(Param);
  1408. end;
  1409. function UpdateMenu(M: PMenu): boolean;
  1410. var P: PMenuItem;
  1411. IsEnabled: boolean;
  1412. begin
  1413. if M=nil then begin UpdateMenu:=false; Exit; end;
  1414. P:=M^.Items; IsEnabled:=false;
  1415. while (P<>nil) do
  1416. begin
  1417. if IsSubMenu(P) then
  1418. P^.Disabled:=not UpdateMenu(P^.SubMenu);
  1419. if (IsSeparator(P)=false) and (P^.Disabled=false) and (Application^.CommandEnabled(P^.Command)=true) then
  1420. IsEnabled:=true;
  1421. P:=P^.Next;
  1422. end;
  1423. UpdateMenu:=IsEnabled;
  1424. end;
  1425. function SearchSubMenu(M: PMenu; Index: Sw_integer): PMenuItem;
  1426. var P,C: PMenuItem;
  1427. Count: Sw_integer;
  1428. begin
  1429. P:=nil; Count:=-1;
  1430. if M<>nil then C:=M^.Items else C:=nil;
  1431. while (C<>nil) and (P=nil) do
  1432. begin
  1433. if IsSubMenu(C) then
  1434. begin
  1435. Inc(Count);
  1436. if Count=Index then P:=C;
  1437. end;
  1438. C:=C^.Next;
  1439. end;
  1440. SearchSubMenu:=P;
  1441. end;
  1442. procedure AppendMenuItem(M: PMenu; I: PMenuItem);
  1443. var P: PMenuItem;
  1444. begin
  1445. if (M=nil) or (I=nil) then Exit;
  1446. I^.Next:=nil;
  1447. if M^.Items=nil then M^.Items:=I else
  1448. begin
  1449. P:=M^.Items;
  1450. while (P^.Next<>nil) do P:=P^.Next;
  1451. P^.Next:=I;
  1452. end;
  1453. end;
  1454. procedure DisposeMenuItem(P: PMenuItem);
  1455. begin
  1456. if P<>nil then
  1457. begin
  1458. if IsSubMenu(P) then DisposeMenu(P^.SubMenu) else
  1459. if IsSeparator(P)=false then
  1460. if P^.Param<>nil then DisposeStr(P^.Param);
  1461. if P^.Name<>nil then DisposeStr(P^.Name);
  1462. Dispose(P);
  1463. end;
  1464. end;
  1465. procedure RemoveMenuItem(Menu: PMenu; I: PMenuItem);
  1466. var P,PrevP: PMenuItem;
  1467. begin
  1468. if (Menu=nil) or (I=nil) then Exit;
  1469. P:=Menu^.Items; PrevP:=nil;
  1470. while (P<>nil) do
  1471. begin
  1472. if P=I then
  1473. begin
  1474. if Menu^.Items<>I then PrevP^.Next:=P^.Next
  1475. else Menu^.Items:=P^.Next;
  1476. DisposeMenuItem(P);
  1477. Break;
  1478. end;
  1479. PrevP:=P; P:=P^.Next;
  1480. end;
  1481. end;
  1482. function GetMenuItemBefore(Menu: PMenu; BeforeOf: PMenuItem): PMenuItem;
  1483. var P,C: PMenuItem;
  1484. begin
  1485. P:=nil;
  1486. if Menu<>nil then C:=Menu^.Items else C:=nil;
  1487. while (C<>nil) do
  1488. begin
  1489. if C^.Next=BeforeOf then begin P:=C; Break; end;
  1490. C:=C^.Next;
  1491. end;
  1492. GetMenuItemBefore:=P;
  1493. end;
  1494. procedure NotImplemented;
  1495. begin
  1496. InformationBox(msg_functionnotimplemented,nil);
  1497. end;
  1498. procedure InsertButtons(ADialog: PDialog);
  1499. var R : TRect;
  1500. W,H : Sw_integer;
  1501. X : Sw_integer;
  1502. X1,X2: Sw_integer;
  1503. begin
  1504. with ADialog^ do
  1505. begin
  1506. GetExtent(R);
  1507. W:=R.B.X-R.A.X; H:=(R.B.Y-R.A.Y);
  1508. R.Assign(0,0,W,H+3); ChangeBounds(R);
  1509. X:=W div 2; X1:=X div 2+1; X2:=X+X1-1;
  1510. R.Assign(X1-3,H,X1+7,H+2);
  1511. Insert(New(PButton, Init(R, btn_OK, cmOK, bfDefault)));
  1512. R.Assign(X2-7,H,X2+3,H+2);
  1513. Insert(New(PButton, Init(R, btn_Cancel, cmCancel, bfNormal)));
  1514. SelectNext(true);
  1515. end;
  1516. end;
  1517. procedure InsertOK(ADialog: PDialog);
  1518. var BW: Sw_integer;
  1519. R: TRect;
  1520. begin
  1521. with ADialog^ do
  1522. begin
  1523. GetBounds(R); R.Grow(0,1); Inc(R.B.Y);
  1524. ChangeBounds(R);
  1525. BW:=10;
  1526. R.A.Y:=R.B.Y-2; R.B.Y:=R.A.Y+2;
  1527. R.A.X:=R.A.X+(R.B.X-R.A.X-BW) div 2; R.B.X:=R.A.X+BW;
  1528. Insert(New(PButton, Init(R, btn_OK, cmOK, bfDefault)));
  1529. SelectNext(true);
  1530. end;
  1531. end;
  1532. procedure ShowMessage(Msg: string);
  1533. var R: TRect;
  1534. Width: Sw_integer;
  1535. begin
  1536. Width:=length(Msg)+4*2;
  1537. if Width<(Desktop^.Size.X div 2) then Width:=(Desktop^.Size.X div 2);
  1538. R.Assign(0,0,Width,5);
  1539. New(MessageDialog, Init(R, ''));
  1540. with MessageDialog^ do
  1541. begin
  1542. Flags:=0;
  1543. GetExtent(R); R.Grow(-4,-2);
  1544. if copy(Msg,1,1)<>^C then Msg:=^C+Msg;
  1545. Insert(New(PStaticText, Init(R, Msg)));
  1546. end;
  1547. Application^.Insert(MessageDialog);
  1548. end;
  1549. procedure HideMessage;
  1550. begin
  1551. if MessageDialog<>nil then
  1552. begin
  1553. Application^.Delete(MessageDialog);
  1554. Dispose(MessageDialog, Done);
  1555. MessageDialog:=nil;
  1556. end;
  1557. end;
  1558. constructor TDDHelperLB.Init(ALink: PDropDownListBox; var Bounds: TRect; ANumCols: Word; AScrollBar: PScrollBar);
  1559. begin
  1560. inherited Init(Bounds,ANumCols,AScrollBar);
  1561. EventMask:=EventMask or (evMouseMove+evIdle);
  1562. { Options:=Options or ofPreProcess;}
  1563. Link:=ALink;
  1564. end;
  1565. procedure TDDHelperLB.SetState(AState: Word; Enable: Boolean);
  1566. {var OState: longint;}
  1567. begin
  1568. { OState:=State;}
  1569. inherited SetState(AState,Enable);
  1570. { if (((State xor OState) and sfFocused)<>0) and (GetState(sfFocused)=false) then
  1571. Link^.DropList(false);}
  1572. end;
  1573. function TDDHelperLB.GetText(Item,MaxLen: Sw_Integer): String;
  1574. var P: pointer;
  1575. S: string;
  1576. begin
  1577. P:=List^.At(Item);
  1578. if Link=nil then S:='' else
  1579. S:=Link^.GetText(P,MaxLen);
  1580. GetText:=S;
  1581. end;
  1582. function TDDHelperLB.GetLocalMenu: PMenu;
  1583. begin
  1584. GetLocalMenu:=Link^.LBGetLocalMenu;
  1585. end;
  1586. function TDDHelperLB.GetCommandTarget: PView;
  1587. begin
  1588. GetCommandTarget:=Link^.LBGetCommandTarget;
  1589. end;
  1590. procedure TDDHelperLB.HandleEvent(var Event: TEvent);
  1591. const
  1592. MouseAutosToSkip = 4;
  1593. var
  1594. Mouse : TPoint;
  1595. OldItem, NewItem : Sw_Integer;
  1596. ColWidth,Count : Sw_Word;
  1597. GoSelectItem: sw_integer;
  1598. MouseWhere: TPoint;
  1599. begin
  1600. GoSelectItem:=-1;
  1601. TView.HandleEvent(Event);
  1602. case Event.What of
  1603. evMouseDown :
  1604. if MouseInView(Event.Where)=false then
  1605. GoSelectItem:=-2
  1606. else
  1607. begin
  1608. ColWidth := Size.X div NumCols + 1;
  1609. OldItem := Focused;
  1610. MakeLocal(Event.Where, Mouse);
  1611. if MouseInView(Event.Where) then
  1612. NewItem := Mouse.Y + (Size.Y * (Mouse.X div ColWidth)) + TopItem
  1613. else
  1614. NewItem := OldItem;
  1615. Count := 0;
  1616. repeat
  1617. if NewItem <> OldItem then
  1618. begin
  1619. FocusItemNum(NewItem);
  1620. DrawView;
  1621. end;
  1622. OldItem := NewItem;
  1623. MakeLocal(Event.Where, Mouse);
  1624. if MouseInView(Event.Where) then
  1625. NewItem := Mouse.Y + (Size.Y * (Mouse.X div ColWidth)) + TopItem
  1626. else
  1627. begin
  1628. if NumCols = 1 then
  1629. begin
  1630. if Event.What = evMouseAuto then Inc(Count);
  1631. if Count = MouseAutosToSkip then
  1632. begin
  1633. Count := 0;
  1634. if Mouse.Y < 0 then NewItem := Focused-1
  1635. else if Mouse.Y >= Size.Y then NewItem := Focused+1;
  1636. end;
  1637. end
  1638. else
  1639. begin
  1640. if Event.What = evMouseAuto then Inc(Count);
  1641. if Count = MouseAutosToSkip then
  1642. begin
  1643. Count := 0;
  1644. if Mouse.X < 0 then NewItem := Focused-Size.Y
  1645. else if Mouse.X >= Size.X then NewItem := Focused+Size.Y
  1646. else if Mouse.Y < 0 then
  1647. NewItem := Focused - Focused mod Size.Y
  1648. else if Mouse.Y > Size.Y then
  1649. NewItem := Focused - Focused mod Size.Y + Size.Y - 1;
  1650. end
  1651. end;
  1652. end;
  1653. until not MouseEvent(Event, evMouseMove + evMouseAuto);
  1654. FocusItemNum(NewItem);
  1655. DrawView;
  1656. if Event.Double and (Range > Focused) then SelectItem(Focused);
  1657. ClearEvent(Event);
  1658. GoSelectItem:=Focused;
  1659. end;
  1660. evMouseMove,evMouseAuto:
  1661. if GetState(sfFocused) then
  1662. if MouseInView(Event.Where) then
  1663. begin
  1664. MakeLocal(Event.Where,Mouse);
  1665. FocusItemNum(TopItem+Mouse.Y);
  1666. ClearEvent(Event);
  1667. end;
  1668. evKeyDown :
  1669. begin
  1670. if (Event.KeyCode=kbEsc) then
  1671. begin
  1672. GoSelectItem:=-2;
  1673. ClearEvent(Event);
  1674. end else
  1675. if (Event.CharCode = ' ') and (Focused < Range) then
  1676. begin
  1677. GoSelectItem:=Focused;
  1678. NewItem := Focused;
  1679. end
  1680. else
  1681. case CtrlToArrow(Event.KeyCode) of
  1682. kbUp : NewItem := Focused - 1;
  1683. kbDown : NewItem := Focused + 1;
  1684. kbRight: if NumCols > 1 then NewItem := Focused + Size.Y else Exit;
  1685. kbLeft : if NumCols > 1 then NewItem := Focused - Size.Y else Exit;
  1686. kbPgDn : NewItem := Focused + Size.Y * NumCols;
  1687. kbPgUp : NewItem := Focused - Size.Y * NumCols;
  1688. kbHome : NewItem := TopItem;
  1689. kbEnd : NewItem := TopItem + (Size.Y * NumCols) - 1;
  1690. kbCtrlPgDn: NewItem := Range - 1;
  1691. kbCtrlPgUp: NewItem := 0;
  1692. else
  1693. Exit;
  1694. end;
  1695. FocusItemNum(NewItem);
  1696. DrawView;
  1697. ClearEvent(Event);
  1698. end;
  1699. evBroadcast :
  1700. case Event.Command of
  1701. cmReceivedFocus :
  1702. if (Event.InfoPtr<>@Self) and (InClose=false) then
  1703. begin
  1704. GoSelectItem:=-2;
  1705. end;
  1706. else
  1707. if Options and ofSelectable <> 0 then
  1708. if (Event.Command = cmScrollBarClicked) and
  1709. ((Event.InfoPtr = HScrollBar) or (Event.InfoPtr = VScrollBar)) then
  1710. Select
  1711. else
  1712. if (Event.Command = cmScrollBarChanged) then
  1713. begin
  1714. if (VScrollBar = Event.InfoPtr) then
  1715. begin
  1716. FocusItemNum(VScrollBar^.Value);
  1717. DrawView;
  1718. end
  1719. else
  1720. if (HScrollBar = Event.InfoPtr) then
  1721. DrawView;
  1722. end;
  1723. end;
  1724. evIdle :
  1725. begin
  1726. MouseWhere.X:=MouseWhereX shr 3; MouseWhere.Y:=MouseWhereY shr 3;
  1727. if MouseInView(MouseWhere)=false then
  1728. if abs(GetDosTicks-LastTT)>=1 then
  1729. begin
  1730. LastTT:=GetDosTicks;
  1731. MakeLocal(MouseWhere,Mouse);
  1732. if ((Mouse.Y<-1) or (Mouse.Y>=Size.Y)) and
  1733. ((0<=Mouse.X) and (Mouse.X<Size.X)) then
  1734. if Range>0 then
  1735. if Mouse.Y<0 then
  1736. FocusItemNum(Focused-(0-Mouse.Y))
  1737. else
  1738. FocusItemNum(Focused+(Mouse.Y-(Size.Y-1)));
  1739. end;
  1740. end;
  1741. end;
  1742. if (Range>0) and (GoSelectItem<>-1) then
  1743. begin
  1744. InClose:=true;
  1745. if GoSelectItem=-2 then
  1746. Link^.DropList(false)
  1747. else
  1748. SelectItem(GoSelectItem);
  1749. end;
  1750. end;
  1751. procedure TDDHelperLB.SelectItem(Item: Sw_Integer);
  1752. begin
  1753. inherited SelectItem(Item);
  1754. Link^.FocusItem(Focused);
  1755. Link^.DropList(false);
  1756. end;
  1757. constructor TDropDownListBox.Init(var Bounds: TRect; ADropLineCount: Sw_integer; AList: PCollection);
  1758. begin
  1759. inherited Init(Bounds);
  1760. Options:=Options or (ofSelectable);
  1761. EventMask:=EventMask or (evBroadcast);
  1762. DropLineCount:=ADropLineCount;
  1763. NewList(AList);
  1764. end;
  1765. procedure TDropDownListBox.HandleEvent(var Event: TEvent);
  1766. var DontClear: boolean;
  1767. Count: sw_integer;
  1768. begin
  1769. case Event.What of
  1770. evKeyDown :
  1771. if GetState(sfFocused) then
  1772. begin
  1773. DontClear:=false;
  1774. Count:=GetItemCount;
  1775. if Count>0 then
  1776. case Event.KeyCode of
  1777. kbUp :
  1778. if Focused>0 then
  1779. FocusItem(Focused-1);
  1780. kbDown :
  1781. if Focused<Count-1 then
  1782. FocusItem(Focused+1);
  1783. kbHome :
  1784. FocusItem(0);
  1785. kbEnd :
  1786. FocusItem(Count-1);
  1787. kbPgDn :
  1788. DropList(true);
  1789. else DontClear:=true;
  1790. end;
  1791. if DontClear=false then ClearEvent(Event);
  1792. end;
  1793. evBroadcast :
  1794. case Event.Command of
  1795. { cmReleasedFocus :
  1796. if (ListBox<>nil) and (Event.InfoPtr=ListBox) then
  1797. DropList(false);}
  1798. cmListItemSelected :
  1799. if (ListBox<>nil) and (Event.InfoPtr=ListBox) then
  1800. begin
  1801. FocusItem(ListBox^.Focused);
  1802. Text:=GetText(List^.At(Focused),High(Text));
  1803. DrawView;
  1804. DropList(false);
  1805. end;
  1806. end;
  1807. evMouseDown :
  1808. if MouseInView(Event.Where) then
  1809. begin
  1810. DropList(not ListDropped);
  1811. ClearEvent(Event);
  1812. end;
  1813. end;
  1814. inherited HandleEvent(Event);
  1815. end;
  1816. function TDropDownListBox.GetText(Item: pointer; MaxLen: Sw_integer): string;
  1817. var S: string;
  1818. begin
  1819. S:=GetStr(Item);
  1820. GetText:=copy(S,1,MaxLen);
  1821. end;
  1822. procedure TDropDownListBox.NewList(AList: PCollection);
  1823. begin
  1824. if List<>nil then Dispose(List, Done); List:=nil;
  1825. List:=AList; FocusItem(0);
  1826. end;
  1827. procedure TDropDownListBox.CreateListBox(var R: TRect);
  1828. var R2: TRect;
  1829. begin
  1830. R2.Copy(R); R2.A.X:=R2.B.X-1;
  1831. New(SB, Init(R2));
  1832. Dec(R.B.X);
  1833. New(ListBox, Init(@Self,R,1,SB));
  1834. end;
  1835. procedure TDropDownListBox.DropList(Drop: boolean);
  1836. var R: TRect;
  1837. LB: PListBox;
  1838. begin
  1839. if (ListDropped=Drop) then Exit;
  1840. if Drop then
  1841. begin
  1842. R.Assign(Origin.X+1,Origin.Y+Size.Y,Origin.X+Size.X,Origin.Y+Size.Y+DropLineCount);
  1843. if Owner<>nil then Owner^.Lock;
  1844. CreateListBox(R);
  1845. if SB<>nil then
  1846. Owner^.Insert(SB);
  1847. if ListBox<>nil then
  1848. begin
  1849. ListBox^.NewList(List);
  1850. ListBox^.FocusItem(Focused);
  1851. Owner^.Insert(ListBox);
  1852. end;
  1853. if Owner<>nil then Owner^.UnLock;
  1854. end
  1855. else
  1856. begin
  1857. if Owner<>nil then Owner^.Lock;
  1858. if ListBox<>nil then
  1859. begin
  1860. { ListBox^.List:=nil;}
  1861. LB:=ListBox; ListBox:=nil; { this prevents GPFs while deleting }
  1862. Dispose(LB, Done);
  1863. end;
  1864. if SB<>nil then
  1865. begin
  1866. Dispose(SB, Done);
  1867. SB:=nil;
  1868. end;
  1869. Select;
  1870. if Owner<>nil then Owner^.UnLock;
  1871. end;
  1872. ListDropped:=Drop;
  1873. DrawView;
  1874. end;
  1875. function TDropDownListBox.GetItemCount: sw_integer;
  1876. var Count: sw_integer;
  1877. begin
  1878. if assigned(List)=false then Count:=0 else
  1879. Count:=List^.Count;
  1880. GetItemCount:=Count;
  1881. end;
  1882. procedure TDropDownListBox.FocusItem(Item: sw_integer);
  1883. var P: pointer;
  1884. begin
  1885. Focused:=Item;
  1886. if assigned(ListBox) and (Item>=0) then
  1887. ListBox^.FocusItem(Item);
  1888. if (GetItemCount>0) and (Focused>=0) then
  1889. begin
  1890. P:=List^.At(Focused);
  1891. Text:=GetText(P,Size.X-4);
  1892. end;
  1893. DrawView;
  1894. end;
  1895. function TDropDownListBox.LBGetLocalMenu: PMenu;
  1896. begin
  1897. LBGetLocalMenu:=nil;
  1898. end;
  1899. function TDropDownListBox.LBGetCommandTarget: PView;
  1900. begin
  1901. LBGetCommandTarget:=@Self;
  1902. end;
  1903. procedure TDropDownListBox.SetState(AState: Word; Enable: Boolean);
  1904. begin
  1905. inherited SetState(AState,Enable);
  1906. if (AState and (sfSelected + sfActive + sfFocused)) <> 0 then DrawView;
  1907. end;
  1908. procedure TDropDownListBox.Draw;
  1909. var B: TDrawBuffer;
  1910. C,TextC: word;
  1911. LC: char;
  1912. begin
  1913. if GetState(sfFocused)=false then
  1914. begin
  1915. C:=GetColor(2);
  1916. TextC:=GetColor(2);
  1917. end
  1918. else
  1919. begin
  1920. C:=GetColor(3);
  1921. TextC:=GetColor(3);
  1922. end;
  1923. MoveChar(B,' ',C,Size.X);
  1924. MoveStr(B[1],copy(Text,1,Size.X-2),TextC);
  1925. if ListDropped then LC:=#30 else LC:=#31;
  1926. MoveChar(B[Size.X-2],LC,C,1);
  1927. WriteLine(0,0,Size.X,Size.Y,B);
  1928. end;
  1929. function TDropDownListBox.GetPalette: PPalette;
  1930. const P: string[length(CListViewer)] = CListViewer;
  1931. begin
  1932. GetPalette:=@P;
  1933. end;
  1934. destructor TDropDownListBox.Done;
  1935. begin
  1936. if ListDropped then DropList(false);
  1937. inherited Done;
  1938. end;
  1939. constructor TGroupView.Init(var Bounds: TRect; AText: String; ALink: PView);
  1940. begin
  1941. inherited Init(Bounds,AText,ALink);
  1942. end;
  1943. procedure TGroupView.Draw;
  1944. var B: TDrawBuffer;
  1945. FrameC,LabelC: word;
  1946. begin
  1947. FrameC:=GetColor(1);
  1948. if Light then
  1949. LabelC:=GetColor(2)+GetColor(4) shl 8
  1950. else
  1951. LabelC:=GetColor(1)+GetColor(3) shl 8;
  1952. { First Line }
  1953. MoveChar(B[0],'Ú',FrameC,1);
  1954. MoveChar(B[1],'Ä',FrameC,Size.X-2);
  1955. MoveChar(B[Size.X-1],'¿',FrameC,1);
  1956. if Text<>nil then
  1957. begin
  1958. MoveCStr(B[1],' '+Text^+' ',LabelC);
  1959. end;
  1960. WriteLine(0,0,Size.X,1,B);
  1961. { Mid Lines }
  1962. MoveChar(B[0],'³',FrameC,1);
  1963. MoveChar(B[1],' ',FrameC,Size.X-2);
  1964. MoveChar(B[Size.X-1],'³',FrameC,1);
  1965. WriteLine(0,1,Size.X,Size.Y-2,B);
  1966. { Last Line }
  1967. MoveChar(B[0],'À',FrameC,1);
  1968. MoveChar(B[1],'Ä',FrameC,Size.X-2);
  1969. MoveChar(B[Size.X-1],'Ù',FrameC,1);
  1970. WriteLine(0,Size.Y-1,Size.X,1,B);
  1971. end;
  1972. function TPlainCheckBoxes.GetPalette: PPalette;
  1973. const P: string[length(CPlainCluster)] = CPlainCluster;
  1974. begin
  1975. GetPalette:=@P;
  1976. end;
  1977. function TPlainRadioButtons.GetPalette: PPalette;
  1978. const P: string[length(CPlainCluster)] = CPlainCluster;
  1979. begin
  1980. GetPalette:=@P;
  1981. end;
  1982. constructor TAdvancedListBox.Load(var S: TStream);
  1983. begin
  1984. inherited Load(S);
  1985. S.Read(Default,SizeOf(Default));
  1986. end;
  1987. procedure TAdvancedListBox.Store(var S: TStream);
  1988. begin
  1989. inherited Store(S);
  1990. S.Write(Default,SizeOf(Default));
  1991. end;
  1992. procedure TNoUpdateButton.HandleEvent(var Event: TEvent);
  1993. begin
  1994. if (Event.What<>evBroadcast) or (Event.Command<>cmCommandSetChanged) then
  1995. inherited HandleEvent(Event);
  1996. end;
  1997. constructor TPanel.Init(var Bounds: TRect);
  1998. begin
  1999. inherited Init(Bounds);
  2000. Options:=Options or (ofSelectable+ofTopSelect);
  2001. GrowMode:=gfGrowHiX+gfGrowHiY;
  2002. end;
  2003. procedure TAdvMessageBox.HandleEvent(var Event: TEvent);
  2004. var I: integer;
  2005. begin
  2006. if (not CanCancel) and (Event.What=evCommand) and (Event.Command=cmCancel) then
  2007. ClearEvent(Event);
  2008. inherited HandleEvent(Event);
  2009. case Event.What of
  2010. evCommand:
  2011. begin
  2012. for I:=Low(UserButtonCmd) to High(UserButtonCmd) do
  2013. if Event.Command=UserButtonCmd[I] then
  2014. if State and sfModal <> 0 then
  2015. begin
  2016. EndModal(Event.Command);
  2017. ClearEvent(Event);
  2018. end;
  2019. end;
  2020. end;
  2021. end;
  2022. procedure ClearFormatParams;
  2023. begin
  2024. FormatParamCount:=0; FillChar(FormatParams,sizeof(FormatParams),0);
  2025. FormatParamStrCount:=0;
  2026. end;
  2027. procedure AddFormatParam(P: pointer);
  2028. begin
  2029. AddFormatParamInt(longint(P));
  2030. end;
  2031. procedure AddFormatParamInt(L: longint);
  2032. begin
  2033. Inc(FormatParamCount);
  2034. FormatParams[FormatParamCount]:=L;
  2035. end;
  2036. procedure AddFormatParamChar(C: char);
  2037. begin
  2038. AddFormatParamInt(ord(C));
  2039. end;
  2040. procedure AddFormatParamStr(const S: string);
  2041. begin
  2042. Inc(FormatParamStrCount); FormatParamStrs[FormatParamStrCount]:=S;
  2043. AddFormatParam(@FormatParamStrs[FormatParamStrCount]);
  2044. end;
  2045. function FormatStrF(const Format: string; var Params): string;
  2046. var S: string;
  2047. begin
  2048. S:='';
  2049. FormatStr(S,Format,Params);
  2050. FormatStrF:=S;
  2051. end;
  2052. function FormatStrStr(const Format, Param: string): string;
  2053. var S: string;
  2054. P: pointer;
  2055. begin
  2056. P:=@Param;
  2057. FormatStr(S,Format,P);
  2058. FormatStrStr:=S;
  2059. end;
  2060. function FormatStrStr2(const Format, Param1,Param2: string): string;
  2061. var S: string;
  2062. P: array[1..2] of pointer;
  2063. begin
  2064. P[1]:=@Param1; P[2]:=@Param2;
  2065. FormatStr(S,Format,P);
  2066. FormatStrStr2:=S;
  2067. end;
  2068. function FormatStrStr3(const Format, Param1,Param2,Param3: string): string;
  2069. var S: string;
  2070. P: array[1..3] of pointer;
  2071. begin
  2072. P[1]:=@Param1; P[2]:=@Param2; P[3]:=@Param3;
  2073. FormatStr(S,Format,P);
  2074. FormatStrStr3:=S;
  2075. end;
  2076. function FormatStrInt(const Format: string; L: longint): string;
  2077. var S: string;
  2078. begin
  2079. FormatStr(S,Format,L);
  2080. FormatStrInt:=S;
  2081. end;
  2082. const
  2083. Cmds: array[0..3] of word =
  2084. (cmYes, cmNo, cmOK, cmCancel);
  2085. var
  2086. ButtonName: array[0..3] of string;
  2087. Titles: array[0..3] of string;
  2088. function AdvMessageBox(const Msg: String; Params: Pointer; AOptions: longint): Word;
  2089. var
  2090. R: TRect;
  2091. begin
  2092. R.Assign(0, 0, 0, 0);
  2093. AdvMessageBox := AdvMessageBoxRect(R, Msg, Params, AOptions);
  2094. end;
  2095. procedure GetStaticTextDimensions(const S: string; ViewWidth: integer; var MaxCols, Rows: integer);
  2096. var
  2097. Color: Byte;
  2098. Center: Boolean;
  2099. I, J, L, P, Y: Sw_Integer;
  2100. CurLine: string;
  2101. begin
  2102. MaxCols:=0;
  2103. L := Length(S);
  2104. P := 1;
  2105. Y := 0;
  2106. Center := False;
  2107. while (Y < 32767) and (P<=length(S)) do
  2108. begin
  2109. CurLine:='';
  2110. if P <= L then
  2111. begin
  2112. if S[P] = #3 then
  2113. begin
  2114. Center := True;
  2115. Inc(P);
  2116. end;
  2117. I := P;
  2118. repeat
  2119. J := P;
  2120. while (P <= L) and (S[P] = ' ') do Inc(P);
  2121. while (P <= L) and (S[P] <> ' ') and (S[P] <> #13) do Inc(P);
  2122. until (P > L) or (P >= I + ViewWidth) or (S[P] = #13);
  2123. if P > I + ViewWidth then
  2124. if J > I then P := J else P := I + ViewWidth;
  2125. if Center then J := (ViewWidth - P + I) div 2 else J := 0;
  2126. CurLine:=CurLine+copy(S,I,P-I);
  2127. { MoveBuf(B[J], S[I], Color, P - I);}
  2128. while (P <= L) and (S[P] = ' ') do Inc(P);
  2129. if (P <= L) and (S[P] = #13) then
  2130. begin
  2131. Center := False;
  2132. Inc(P);
  2133. if (P <= L) and (S[P] = #10) then Inc(P);
  2134. end;
  2135. end;
  2136. if length(CurLine)>MaxCols then
  2137. MaxCols:=length(CurLine);
  2138. { WriteLine(0, Y, Size.X, 1, B);}
  2139. Inc(Y);
  2140. end;
  2141. Rows:=Y;
  2142. end;
  2143. function AdvMessageBoxRect(var R: TRect; const Msg: String; Params: Pointer; AOptions: longint): Word;
  2144. var
  2145. I, X, ButtonCount: Sw_Integer;
  2146. Dialog: PAdvMessageBox;
  2147. Control: PView;
  2148. ButtonList: array[0..4] of PView;
  2149. S,BtnName: String;
  2150. Cols,Rows: integer;
  2151. begin
  2152. FormatStr(S, Msg, Params^);
  2153. if R.Empty then
  2154. begin
  2155. GetStaticTextDimensions(S,40,Cols,Rows);
  2156. if Cols<30 then Cols:=30; if Rows=0 then Rows:=1;
  2157. R.Assign(0,0,3+Cols+3,Rows+6);
  2158. if (AOptions and mfInsertInApp)= 0 then
  2159. R.Move((Desktop^.Size.X-(R.B.X-R.A.X)) div 2,(Desktop^.Size.Y-(R.B.Y-R.A.Y)) div 2)
  2160. else
  2161. R.Move((Application^.Size.X-(R.B.X-R.A.X)) div 2,(Application^.Size.Y-(R.B.Y-R.A.Y)) div 2);
  2162. end;
  2163. New(Dialog,Init(R, Titles[AOptions and $3]));
  2164. with Dialog^ do
  2165. begin
  2166. CanCancel:=(Options and mfCantCancel)=0;
  2167. R.Assign(3,2, Size.X-2,Size.Y-3);
  2168. Control := New(PStaticText, Init(R, S));
  2169. Insert(Control);
  2170. X := -2;
  2171. ButtonCount := 0;
  2172. for I := 0 to 3 do
  2173. if AOptions and ($10000 shl I) <> 0 then
  2174. begin
  2175. BtnName:=UserButtonName[I+1];
  2176. R.Assign(0, 0, Max(10,length(BtnName)+2), 2);
  2177. Control := New(PButton, Init(R, BtnName, UserButtonCmd[I+1], bfNormal));
  2178. Inc(X, Control^.Size.X + 2);
  2179. ButtonList[ButtonCount] := Control;
  2180. Inc(ButtonCount);
  2181. end;
  2182. for I := 0 to 3 do
  2183. if AOptions and ($0100 shl I) <> 0 then
  2184. begin
  2185. R.Assign(0, 0, 10, 2);
  2186. Control := New(PButton, Init(R, ButtonName[I], Cmds[i], bfNormal));
  2187. Inc(X, Control^.Size.X + 2);
  2188. ButtonList[ButtonCount] := Control;
  2189. Inc(ButtonCount);
  2190. end;
  2191. X := (Size.X - X) div 2;
  2192. for I := 0 to ButtonCount - 1 do
  2193. begin
  2194. Control := ButtonList[I];
  2195. Insert(Control);
  2196. Control^.MoveTo(X, Size.Y - 3);
  2197. Inc(X, Control^.Size.X + 2);
  2198. end;
  2199. SelectNext(False);
  2200. end;
  2201. if AOptions and mfInsertInApp = 0 then
  2202. AdvMessageBoxRect := DeskTop^.ExecView(Dialog)
  2203. else
  2204. AdvMessageBoxRect := Application^.ExecView(Dialog);
  2205. Dispose(Dialog, Done);
  2206. end;
  2207. procedure InitAdvMsgBox;
  2208. begin
  2209. ButtonName[0] := Labels^.Get(slYes);
  2210. ButtonName[1] := Labels^.Get(slNo);
  2211. ButtonName[2] := Labels^.Get(slOk);
  2212. ButtonName[3] := Labels^.Get(slCancel);
  2213. Titles[0] := Labels^.Get(sWarning);
  2214. Titles[1] := Labels^.Get(sError);
  2215. Titles[2] := Labels^.Get(sInformation);
  2216. Titles[3] := Labels^.Get(sConfirm);
  2217. end;
  2218. procedure DoneAdvMsgBox;
  2219. begin
  2220. end;
  2221. procedure RegisterWViews;
  2222. begin
  2223. {$ifndef NOOBJREG}
  2224. RegisterType(RAdvancedListBox);
  2225. RegisterType(RColorStaticText);
  2226. RegisterType(RHSListBox);
  2227. RegisterType(RDlgWindow);
  2228. {$endif}
  2229. end;
  2230. END.
  2231. {
  2232. $Log$
  2233. Revision 1.2 2000-08-22 09:41:42 pierre
  2234. * first big merge from fixes branch
  2235. Revision 1.1.2.2 2000/08/16 18:46:15 peter
  2236. [*] double clicking on a droplistbox caused GPF (due to invalid recurson)
  2237. [*] Make, Build now possible even in Compiler Messages Window
  2238. [+] when started in a new dir the IDE now ask whether to create a local
  2239. config, or to use the one located in the IDE dir
  2240. Revision 1.1.2.1 2000/08/04 14:05:20 michael
  2241. * Fixes from Gabor:
  2242. [*] the IDE now doesn't disable Compile|Make & Build when all windows
  2243. are closed, but there's still a primary file set
  2244. (set bug 1059 to fixed!)
  2245. [*] the IDE didn't read some compiler options correctly back from the
  2246. FP.CFG file, for ex. the linker options. Now it read everything
  2247. correctly, and also automatically handles smartlinking option synch-
  2248. ronization.
  2249. (set bug 1048 to fixed!)
  2250. Revision 1.1 2000/07/13 09:48:37 michael
  2251. + Initial import
  2252. Revision 1.15 2000/06/22 09:07:15 pierre
  2253. * Gabor changes: see fixes.txt
  2254. Revision 1.14 2000/06/16 08:50:45 pierre
  2255. + new bunch of Gabor's changes
  2256. Revision 1.13 2000/05/02 08:42:29 pierre
  2257. * new set of Gabor changes: see fixes.txt
  2258. Revision 1.12 2000/04/18 11:42:39 pierre
  2259. lot of Gabor changes : see fixes.txt
  2260. Revision 1.11 2000/01/10 15:53:37 pierre
  2261. * WViews objects were not registered
  2262. Revision 1.10 1999/08/03 20:22:46 peter
  2263. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  2264. + Desktop saving should work now
  2265. - History saved
  2266. - Clipboard content saved
  2267. - Desktop saved
  2268. - Symbol info saved
  2269. * syntax-highlight bug fixed, which compared special keywords case sensitive
  2270. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  2271. * with 'whole words only' set, the editor didn't found occourences of the
  2272. searched text, if the text appeared previously in the same line, but didn't
  2273. satisfied the 'whole-word' condition
  2274. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  2275. (ie. the beginning of the selection)
  2276. * when started typing in a new line, but not at the start (X=0) of it,
  2277. the editor inserted the text one character more to left as it should...
  2278. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  2279. * Shift shouldn't cause so much trouble in TCodeEditor now...
  2280. * Syntax highlight had problems recognizing a special symbol if it was
  2281. prefixed by another symbol character in the source text
  2282. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  2283. Revision 1.9 1999/06/28 19:32:37 peter
  2284. * fixes from gabor
  2285. Revision 1.8 1999/06/28 12:29:56 pierre
  2286. *GetMenuItem fixed
  2287. Revision 1.7 1999/06/25 00:30:34 pierre
  2288. + TAdvancedMenuBar.GetMenuItem(by command number)
  2289. Revision 1.6 1999/04/07 21:56:07 peter
  2290. + object support for browser
  2291. * html help fixes
  2292. * more desktop saving things
  2293. * NODEBUG directive to exclude debugger
  2294. Revision 1.5 1999/03/23 16:16:44 peter
  2295. * linux fixes
  2296. Revision 1.4 1999/03/23 15:11:42 peter
  2297. * desktop saving things
  2298. * vesa mode
  2299. * preferences dialog
  2300. Revision 1.3 1999/03/19 16:04:35 peter
  2301. * new compiler dialog
  2302. Revision 1.2 1999/03/08 14:58:23 peter
  2303. + prompt with dialogs for tools
  2304. Revision 1.1 1999/03/01 15:51:43 peter
  2305. + Log
  2306. }