wviews.pas 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527
  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. begin
  1419. P^.Disabled:=not UpdateMenu(P^.SubMenu);
  1420. if not P^.Disabled then
  1421. IsEnabled:=true;
  1422. end
  1423. else if (IsSeparator(P)=false) {and (P^.Disabled=false)} and
  1424. (Application^.CommandEnabled(P^.Command)=true) then
  1425. begin
  1426. p^.disabled:=not Application^.CommandEnabled(P^.Command);
  1427. if not p^.disabled then
  1428. IsEnabled:=true;
  1429. end;
  1430. P:=P^.Next;
  1431. end;
  1432. UpdateMenu:=IsEnabled;
  1433. end;
  1434. function SearchSubMenu(M: PMenu; Index: Sw_integer): PMenuItem;
  1435. var P,C: PMenuItem;
  1436. Count: Sw_integer;
  1437. begin
  1438. P:=nil; Count:=-1;
  1439. if M<>nil then C:=M^.Items else C:=nil;
  1440. while (C<>nil) and (P=nil) do
  1441. begin
  1442. if IsSubMenu(C) then
  1443. begin
  1444. Inc(Count);
  1445. if Count=Index then P:=C;
  1446. end;
  1447. C:=C^.Next;
  1448. end;
  1449. SearchSubMenu:=P;
  1450. end;
  1451. procedure AppendMenuItem(M: PMenu; I: PMenuItem);
  1452. var P: PMenuItem;
  1453. begin
  1454. if (M=nil) or (I=nil) then Exit;
  1455. I^.Next:=nil;
  1456. if M^.Items=nil then M^.Items:=I else
  1457. begin
  1458. P:=M^.Items;
  1459. while (P^.Next<>nil) do P:=P^.Next;
  1460. P^.Next:=I;
  1461. end;
  1462. end;
  1463. procedure DisposeMenuItem(P: PMenuItem);
  1464. begin
  1465. if P<>nil then
  1466. begin
  1467. if IsSubMenu(P) then DisposeMenu(P^.SubMenu) else
  1468. if IsSeparator(P)=false then
  1469. if P^.Param<>nil then DisposeStr(P^.Param);
  1470. if P^.Name<>nil then DisposeStr(P^.Name);
  1471. Dispose(P);
  1472. end;
  1473. end;
  1474. procedure RemoveMenuItem(Menu: PMenu; I: PMenuItem);
  1475. var P,PrevP: PMenuItem;
  1476. begin
  1477. if (Menu=nil) or (I=nil) then Exit;
  1478. P:=Menu^.Items; PrevP:=nil;
  1479. while (P<>nil) do
  1480. begin
  1481. if P=I then
  1482. begin
  1483. if Menu^.Items<>I then PrevP^.Next:=P^.Next
  1484. else Menu^.Items:=P^.Next;
  1485. DisposeMenuItem(P);
  1486. Break;
  1487. end;
  1488. PrevP:=P; P:=P^.Next;
  1489. end;
  1490. end;
  1491. function GetMenuItemBefore(Menu: PMenu; BeforeOf: PMenuItem): PMenuItem;
  1492. var P,C: PMenuItem;
  1493. begin
  1494. P:=nil;
  1495. if Menu<>nil then C:=Menu^.Items else C:=nil;
  1496. while (C<>nil) do
  1497. begin
  1498. if C^.Next=BeforeOf then begin P:=C; Break; end;
  1499. C:=C^.Next;
  1500. end;
  1501. GetMenuItemBefore:=P;
  1502. end;
  1503. procedure NotImplemented;
  1504. begin
  1505. InformationBox(msg_functionnotimplemented,nil);
  1506. end;
  1507. procedure InsertButtons(ADialog: PDialog);
  1508. var R : TRect;
  1509. W,H : Sw_integer;
  1510. X : Sw_integer;
  1511. X1,X2: Sw_integer;
  1512. begin
  1513. with ADialog^ do
  1514. begin
  1515. GetExtent(R);
  1516. W:=R.B.X-R.A.X; H:=(R.B.Y-R.A.Y);
  1517. R.Assign(0,0,W,H+3); ChangeBounds(R);
  1518. X:=W div 2; X1:=X div 2+1; X2:=X+X1-1;
  1519. R.Assign(X1-3,H,X1+7,H+2);
  1520. Insert(New(PButton, Init(R, btn_OK, cmOK, bfDefault)));
  1521. R.Assign(X2-7,H,X2+3,H+2);
  1522. Insert(New(PButton, Init(R, btn_Cancel, cmCancel, bfNormal)));
  1523. SelectNext(true);
  1524. end;
  1525. end;
  1526. procedure InsertOK(ADialog: PDialog);
  1527. var BW: Sw_integer;
  1528. R: TRect;
  1529. begin
  1530. with ADialog^ do
  1531. begin
  1532. GetBounds(R); R.Grow(0,1); Inc(R.B.Y);
  1533. ChangeBounds(R);
  1534. BW:=10;
  1535. R.A.Y:=R.B.Y-2; R.B.Y:=R.A.Y+2;
  1536. R.A.X:=R.A.X+(R.B.X-R.A.X-BW) div 2; R.B.X:=R.A.X+BW;
  1537. Insert(New(PButton, Init(R, btn_OK, cmOK, bfDefault)));
  1538. SelectNext(true);
  1539. end;
  1540. end;
  1541. procedure ShowMessage(Msg: string);
  1542. var R: TRect;
  1543. Width: Sw_integer;
  1544. begin
  1545. Width:=length(Msg)+4*2;
  1546. if Width<(Desktop^.Size.X div 2) then Width:=(Desktop^.Size.X div 2);
  1547. R.Assign(0,0,Width,5);
  1548. New(MessageDialog, Init(R, ''));
  1549. with MessageDialog^ do
  1550. begin
  1551. Flags:=0;
  1552. GetExtent(R); R.Grow(-4,-2);
  1553. if copy(Msg,1,1)<>^C then Msg:=^C+Msg;
  1554. Insert(New(PStaticText, Init(R, Msg)));
  1555. end;
  1556. Application^.Insert(MessageDialog);
  1557. end;
  1558. procedure HideMessage;
  1559. begin
  1560. if MessageDialog<>nil then
  1561. begin
  1562. Application^.Delete(MessageDialog);
  1563. Dispose(MessageDialog, Done);
  1564. MessageDialog:=nil;
  1565. end;
  1566. end;
  1567. constructor TDDHelperLB.Init(ALink: PDropDownListBox; var Bounds: TRect; ANumCols: Word; AScrollBar: PScrollBar);
  1568. begin
  1569. inherited Init(Bounds,ANumCols,AScrollBar);
  1570. EventMask:=EventMask or (evMouseMove+evIdle);
  1571. { Options:=Options or ofPreProcess;}
  1572. Link:=ALink;
  1573. end;
  1574. procedure TDDHelperLB.SetState(AState: Word; Enable: Boolean);
  1575. {var OState: longint;}
  1576. begin
  1577. { OState:=State;}
  1578. inherited SetState(AState,Enable);
  1579. { if (((State xor OState) and sfFocused)<>0) and (GetState(sfFocused)=false) then
  1580. Link^.DropList(false);}
  1581. end;
  1582. function TDDHelperLB.GetText(Item,MaxLen: Sw_Integer): String;
  1583. var P: pointer;
  1584. S: string;
  1585. begin
  1586. P:=List^.At(Item);
  1587. if Link=nil then S:='' else
  1588. S:=Link^.GetText(P,MaxLen);
  1589. GetText:=S;
  1590. end;
  1591. function TDDHelperLB.GetLocalMenu: PMenu;
  1592. begin
  1593. GetLocalMenu:=Link^.LBGetLocalMenu;
  1594. end;
  1595. function TDDHelperLB.GetCommandTarget: PView;
  1596. begin
  1597. GetCommandTarget:=Link^.LBGetCommandTarget;
  1598. end;
  1599. procedure TDDHelperLB.HandleEvent(var Event: TEvent);
  1600. const
  1601. MouseAutosToSkip = 4;
  1602. var
  1603. Mouse : TPoint;
  1604. OldItem, NewItem : Sw_Integer;
  1605. ColWidth,Count : Sw_Word;
  1606. GoSelectItem: sw_integer;
  1607. MouseWhere: TPoint;
  1608. begin
  1609. GoSelectItem:=-1;
  1610. TView.HandleEvent(Event);
  1611. case Event.What of
  1612. evMouseDown :
  1613. if MouseInView(Event.Where)=false then
  1614. GoSelectItem:=-2
  1615. else
  1616. begin
  1617. ColWidth := Size.X div NumCols + 1;
  1618. OldItem := Focused;
  1619. MakeLocal(Event.Where, Mouse);
  1620. if MouseInView(Event.Where) then
  1621. NewItem := Mouse.Y + (Size.Y * (Mouse.X div ColWidth)) + TopItem
  1622. else
  1623. NewItem := OldItem;
  1624. Count := 0;
  1625. repeat
  1626. if NewItem <> OldItem then
  1627. begin
  1628. FocusItemNum(NewItem);
  1629. DrawView;
  1630. end;
  1631. OldItem := NewItem;
  1632. MakeLocal(Event.Where, Mouse);
  1633. if MouseInView(Event.Where) then
  1634. NewItem := Mouse.Y + (Size.Y * (Mouse.X div ColWidth)) + TopItem
  1635. else
  1636. begin
  1637. if NumCols = 1 then
  1638. begin
  1639. if Event.What = evMouseAuto then Inc(Count);
  1640. if Count = MouseAutosToSkip then
  1641. begin
  1642. Count := 0;
  1643. if Mouse.Y < 0 then NewItem := Focused-1
  1644. else if Mouse.Y >= Size.Y then NewItem := Focused+1;
  1645. end;
  1646. end
  1647. else
  1648. begin
  1649. if Event.What = evMouseAuto then Inc(Count);
  1650. if Count = MouseAutosToSkip then
  1651. begin
  1652. Count := 0;
  1653. if Mouse.X < 0 then NewItem := Focused-Size.Y
  1654. else if Mouse.X >= Size.X then NewItem := Focused+Size.Y
  1655. else if Mouse.Y < 0 then
  1656. NewItem := Focused - Focused mod Size.Y
  1657. else if Mouse.Y > Size.Y then
  1658. NewItem := Focused - Focused mod Size.Y + Size.Y - 1;
  1659. end
  1660. end;
  1661. end;
  1662. until not MouseEvent(Event, evMouseMove + evMouseAuto);
  1663. FocusItemNum(NewItem);
  1664. DrawView;
  1665. if Event.Double and (Range > Focused) then SelectItem(Focused);
  1666. ClearEvent(Event);
  1667. GoSelectItem:=Focused;
  1668. end;
  1669. evMouseMove,evMouseAuto:
  1670. if GetState(sfFocused) then
  1671. if MouseInView(Event.Where) then
  1672. begin
  1673. MakeLocal(Event.Where,Mouse);
  1674. FocusItemNum(TopItem+Mouse.Y);
  1675. ClearEvent(Event);
  1676. end;
  1677. evKeyDown :
  1678. begin
  1679. if (Event.KeyCode=kbEsc) then
  1680. begin
  1681. GoSelectItem:=-2;
  1682. ClearEvent(Event);
  1683. end else
  1684. if (Event.CharCode = ' ') and (Focused < Range) then
  1685. begin
  1686. GoSelectItem:=Focused;
  1687. NewItem := Focused;
  1688. end
  1689. else
  1690. case CtrlToArrow(Event.KeyCode) of
  1691. kbUp : NewItem := Focused - 1;
  1692. kbDown : NewItem := Focused + 1;
  1693. kbRight: if NumCols > 1 then NewItem := Focused + Size.Y else Exit;
  1694. kbLeft : if NumCols > 1 then NewItem := Focused - Size.Y else Exit;
  1695. kbPgDn : NewItem := Focused + Size.Y * NumCols;
  1696. kbPgUp : NewItem := Focused - Size.Y * NumCols;
  1697. kbHome : NewItem := TopItem;
  1698. kbEnd : NewItem := TopItem + (Size.Y * NumCols) - 1;
  1699. kbCtrlPgDn: NewItem := Range - 1;
  1700. kbCtrlPgUp: NewItem := 0;
  1701. else
  1702. Exit;
  1703. end;
  1704. FocusItemNum(NewItem);
  1705. DrawView;
  1706. ClearEvent(Event);
  1707. end;
  1708. evBroadcast :
  1709. case Event.Command of
  1710. cmReceivedFocus :
  1711. if (Event.InfoPtr<>@Self) and (InClose=false) then
  1712. begin
  1713. GoSelectItem:=-2;
  1714. end;
  1715. else
  1716. if Options and ofSelectable <> 0 then
  1717. if (Event.Command = cmScrollBarClicked) and
  1718. ((Event.InfoPtr = HScrollBar) or (Event.InfoPtr = VScrollBar)) then
  1719. Select
  1720. else
  1721. if (Event.Command = cmScrollBarChanged) then
  1722. begin
  1723. if (VScrollBar = Event.InfoPtr) then
  1724. begin
  1725. FocusItemNum(VScrollBar^.Value);
  1726. DrawView;
  1727. end
  1728. else
  1729. if (HScrollBar = Event.InfoPtr) then
  1730. DrawView;
  1731. end;
  1732. end;
  1733. evIdle :
  1734. begin
  1735. MouseWhere.X:=MouseWhereX shr 3; MouseWhere.Y:=MouseWhereY shr 3;
  1736. if MouseInView(MouseWhere)=false then
  1737. if abs(GetDosTicks-LastTT)>=1 then
  1738. begin
  1739. LastTT:=GetDosTicks;
  1740. MakeLocal(MouseWhere,Mouse);
  1741. if ((Mouse.Y<-1) or (Mouse.Y>=Size.Y)) and
  1742. ((0<=Mouse.X) and (Mouse.X<Size.X)) then
  1743. if Range>0 then
  1744. if Mouse.Y<0 then
  1745. FocusItemNum(Focused-(0-Mouse.Y))
  1746. else
  1747. FocusItemNum(Focused+(Mouse.Y-(Size.Y-1)));
  1748. end;
  1749. end;
  1750. end;
  1751. if (Range>0) and (GoSelectItem<>-1) then
  1752. begin
  1753. InClose:=true;
  1754. if GoSelectItem=-2 then
  1755. Link^.DropList(false)
  1756. else
  1757. SelectItem(GoSelectItem);
  1758. end;
  1759. end;
  1760. procedure TDDHelperLB.SelectItem(Item: Sw_Integer);
  1761. begin
  1762. inherited SelectItem(Item);
  1763. Link^.FocusItem(Focused);
  1764. Link^.DropList(false);
  1765. end;
  1766. constructor TDropDownListBox.Init(var Bounds: TRect; ADropLineCount: Sw_integer; AList: PCollection);
  1767. begin
  1768. inherited Init(Bounds);
  1769. Options:=Options or (ofSelectable);
  1770. EventMask:=EventMask or (evBroadcast);
  1771. DropLineCount:=ADropLineCount;
  1772. NewList(AList);
  1773. end;
  1774. procedure TDropDownListBox.HandleEvent(var Event: TEvent);
  1775. var DontClear: boolean;
  1776. Count: sw_integer;
  1777. begin
  1778. case Event.What of
  1779. evKeyDown :
  1780. if GetState(sfFocused) then
  1781. begin
  1782. DontClear:=false;
  1783. Count:=GetItemCount;
  1784. if Count>0 then
  1785. case Event.KeyCode of
  1786. kbUp :
  1787. if Focused>0 then
  1788. FocusItem(Focused-1);
  1789. kbDown :
  1790. if Focused<Count-1 then
  1791. FocusItem(Focused+1);
  1792. kbHome :
  1793. FocusItem(0);
  1794. kbEnd :
  1795. FocusItem(Count-1);
  1796. kbPgDn :
  1797. DropList(true);
  1798. else DontClear:=true;
  1799. end;
  1800. if DontClear=false then ClearEvent(Event);
  1801. end;
  1802. evBroadcast :
  1803. case Event.Command of
  1804. { cmReleasedFocus :
  1805. if (ListBox<>nil) and (Event.InfoPtr=ListBox) then
  1806. DropList(false);}
  1807. cmListItemSelected :
  1808. if (ListBox<>nil) and (Event.InfoPtr=ListBox) then
  1809. begin
  1810. FocusItem(ListBox^.Focused);
  1811. Text:=GetText(List^.At(Focused),High(Text));
  1812. DrawView;
  1813. DropList(false);
  1814. end;
  1815. end;
  1816. evMouseDown :
  1817. if MouseInView(Event.Where) then
  1818. begin
  1819. DropList(not ListDropped);
  1820. ClearEvent(Event);
  1821. end;
  1822. end;
  1823. inherited HandleEvent(Event);
  1824. end;
  1825. function TDropDownListBox.GetText(Item: pointer; MaxLen: Sw_integer): string;
  1826. var S: string;
  1827. begin
  1828. S:=GetStr(Item);
  1829. GetText:=copy(S,1,MaxLen);
  1830. end;
  1831. procedure TDropDownListBox.NewList(AList: PCollection);
  1832. begin
  1833. if List<>nil then Dispose(List, Done); List:=nil;
  1834. List:=AList; FocusItem(0);
  1835. end;
  1836. procedure TDropDownListBox.CreateListBox(var R: TRect);
  1837. var R2: TRect;
  1838. begin
  1839. R2.Copy(R); R2.A.X:=R2.B.X-1;
  1840. New(SB, Init(R2));
  1841. Dec(R.B.X);
  1842. New(ListBox, Init(@Self,R,1,SB));
  1843. end;
  1844. procedure TDropDownListBox.DropList(Drop: boolean);
  1845. var R: TRect;
  1846. LB: PListBox;
  1847. begin
  1848. if (ListDropped=Drop) then Exit;
  1849. if Drop then
  1850. begin
  1851. R.Assign(Origin.X+1,Origin.Y+Size.Y,Origin.X+Size.X,Origin.Y+Size.Y+DropLineCount);
  1852. if Owner<>nil then Owner^.Lock;
  1853. CreateListBox(R);
  1854. if SB<>nil then
  1855. Owner^.Insert(SB);
  1856. if ListBox<>nil then
  1857. begin
  1858. ListBox^.NewList(List);
  1859. ListBox^.FocusItem(Focused);
  1860. Owner^.Insert(ListBox);
  1861. end;
  1862. if Owner<>nil then Owner^.UnLock;
  1863. end
  1864. else
  1865. begin
  1866. if Owner<>nil then Owner^.Lock;
  1867. if ListBox<>nil then
  1868. begin
  1869. { ListBox^.List:=nil;}
  1870. LB:=ListBox; ListBox:=nil; { this prevents GPFs while deleting }
  1871. Dispose(LB, Done);
  1872. end;
  1873. if SB<>nil then
  1874. begin
  1875. Dispose(SB, Done);
  1876. SB:=nil;
  1877. end;
  1878. Select;
  1879. if Owner<>nil then Owner^.UnLock;
  1880. end;
  1881. ListDropped:=Drop;
  1882. DrawView;
  1883. end;
  1884. function TDropDownListBox.GetItemCount: sw_integer;
  1885. var Count: sw_integer;
  1886. begin
  1887. if assigned(List)=false then Count:=0 else
  1888. Count:=List^.Count;
  1889. GetItemCount:=Count;
  1890. end;
  1891. procedure TDropDownListBox.FocusItem(Item: sw_integer);
  1892. var P: pointer;
  1893. begin
  1894. Focused:=Item;
  1895. if assigned(ListBox) and (Item>=0) then
  1896. ListBox^.FocusItem(Item);
  1897. if (GetItemCount>0) and (Focused>=0) then
  1898. begin
  1899. P:=List^.At(Focused);
  1900. Text:=GetText(P,Size.X-4);
  1901. end;
  1902. DrawView;
  1903. end;
  1904. function TDropDownListBox.LBGetLocalMenu: PMenu;
  1905. begin
  1906. LBGetLocalMenu:=nil;
  1907. end;
  1908. function TDropDownListBox.LBGetCommandTarget: PView;
  1909. begin
  1910. LBGetCommandTarget:=@Self;
  1911. end;
  1912. procedure TDropDownListBox.SetState(AState: Word; Enable: Boolean);
  1913. begin
  1914. inherited SetState(AState,Enable);
  1915. if (AState and (sfSelected + sfActive + sfFocused)) <> 0 then DrawView;
  1916. end;
  1917. procedure TDropDownListBox.Draw;
  1918. var B: TDrawBuffer;
  1919. C,TextC: word;
  1920. LC: char;
  1921. begin
  1922. if GetState(sfFocused)=false then
  1923. begin
  1924. C:=GetColor(2);
  1925. TextC:=GetColor(2);
  1926. end
  1927. else
  1928. begin
  1929. C:=GetColor(3);
  1930. TextC:=GetColor(3);
  1931. end;
  1932. MoveChar(B,' ',C,Size.X);
  1933. MoveStr(B[1],copy(Text,1,Size.X-2),TextC);
  1934. if ListDropped then LC:=#30 else LC:=#31;
  1935. MoveChar(B[Size.X-2],LC,C,1);
  1936. WriteLine(0,0,Size.X,Size.Y,B);
  1937. end;
  1938. function TDropDownListBox.GetPalette: PPalette;
  1939. const P: string[length(CListViewer)] = CListViewer;
  1940. begin
  1941. GetPalette:=@P;
  1942. end;
  1943. destructor TDropDownListBox.Done;
  1944. begin
  1945. if ListDropped then DropList(false);
  1946. inherited Done;
  1947. end;
  1948. constructor TGroupView.Init(var Bounds: TRect; AText: String; ALink: PView);
  1949. begin
  1950. inherited Init(Bounds,AText,ALink);
  1951. end;
  1952. procedure TGroupView.Draw;
  1953. var B: TDrawBuffer;
  1954. FrameC,LabelC: word;
  1955. begin
  1956. FrameC:=GetColor(1);
  1957. if Light then
  1958. LabelC:=GetColor(2)+GetColor(4) shl 8
  1959. else
  1960. LabelC:=GetColor(1)+GetColor(3) shl 8;
  1961. { First Line }
  1962. MoveChar(B[0],'Ú',FrameC,1);
  1963. MoveChar(B[1],'Ä',FrameC,Size.X-2);
  1964. MoveChar(B[Size.X-1],'¿',FrameC,1);
  1965. if Text<>nil then
  1966. begin
  1967. MoveCStr(B[1],' '+Text^+' ',LabelC);
  1968. end;
  1969. WriteLine(0,0,Size.X,1,B);
  1970. { Mid Lines }
  1971. MoveChar(B[0],'³',FrameC,1);
  1972. MoveChar(B[1],' ',FrameC,Size.X-2);
  1973. MoveChar(B[Size.X-1],'³',FrameC,1);
  1974. WriteLine(0,1,Size.X,Size.Y-2,B);
  1975. { Last Line }
  1976. MoveChar(B[0],'À',FrameC,1);
  1977. MoveChar(B[1],'Ä',FrameC,Size.X-2);
  1978. MoveChar(B[Size.X-1],'Ù',FrameC,1);
  1979. WriteLine(0,Size.Y-1,Size.X,1,B);
  1980. end;
  1981. function TPlainCheckBoxes.GetPalette: PPalette;
  1982. const P: string[length(CPlainCluster)] = CPlainCluster;
  1983. begin
  1984. GetPalette:=@P;
  1985. end;
  1986. function TPlainRadioButtons.GetPalette: PPalette;
  1987. const P: string[length(CPlainCluster)] = CPlainCluster;
  1988. begin
  1989. GetPalette:=@P;
  1990. end;
  1991. constructor TAdvancedListBox.Load(var S: TStream);
  1992. begin
  1993. inherited Load(S);
  1994. S.Read(Default,SizeOf(Default));
  1995. end;
  1996. procedure TAdvancedListBox.Store(var S: TStream);
  1997. begin
  1998. inherited Store(S);
  1999. S.Write(Default,SizeOf(Default));
  2000. end;
  2001. procedure TNoUpdateButton.HandleEvent(var Event: TEvent);
  2002. begin
  2003. if (Event.What<>evBroadcast) or (Event.Command<>cmCommandSetChanged) then
  2004. inherited HandleEvent(Event);
  2005. end;
  2006. constructor TPanel.Init(var Bounds: TRect);
  2007. begin
  2008. inherited Init(Bounds);
  2009. Options:=Options or (ofSelectable+ofTopSelect);
  2010. GrowMode:=gfGrowHiX+gfGrowHiY;
  2011. end;
  2012. procedure TAdvMessageBox.HandleEvent(var Event: TEvent);
  2013. var I: integer;
  2014. begin
  2015. if (not CanCancel) and (Event.What=evCommand) and (Event.Command=cmCancel) then
  2016. ClearEvent(Event);
  2017. inherited HandleEvent(Event);
  2018. case Event.What of
  2019. evCommand:
  2020. begin
  2021. for I:=Low(UserButtonCmd) to High(UserButtonCmd) do
  2022. if Event.Command=UserButtonCmd[I] then
  2023. if State and sfModal <> 0 then
  2024. begin
  2025. EndModal(Event.Command);
  2026. ClearEvent(Event);
  2027. end;
  2028. end;
  2029. end;
  2030. end;
  2031. procedure ClearFormatParams;
  2032. begin
  2033. FormatParamCount:=0; FillChar(FormatParams,sizeof(FormatParams),0);
  2034. FormatParamStrCount:=0;
  2035. end;
  2036. procedure AddFormatParam(P: pointer);
  2037. begin
  2038. AddFormatParamInt(longint(P));
  2039. end;
  2040. procedure AddFormatParamInt(L: longint);
  2041. begin
  2042. Inc(FormatParamCount);
  2043. FormatParams[FormatParamCount]:=L;
  2044. end;
  2045. procedure AddFormatParamChar(C: char);
  2046. begin
  2047. AddFormatParamInt(ord(C));
  2048. end;
  2049. procedure AddFormatParamStr(const S: string);
  2050. begin
  2051. Inc(FormatParamStrCount); FormatParamStrs[FormatParamStrCount]:=S;
  2052. AddFormatParam(@FormatParamStrs[FormatParamStrCount]);
  2053. end;
  2054. function FormatStrF(const Format: string; var Params): string;
  2055. var S: string;
  2056. begin
  2057. S:='';
  2058. FormatStr(S,Format,Params);
  2059. FormatStrF:=S;
  2060. end;
  2061. function FormatStrStr(const Format, Param: string): string;
  2062. var S: string;
  2063. P: pointer;
  2064. begin
  2065. P:=@Param;
  2066. FormatStr(S,Format,P);
  2067. FormatStrStr:=S;
  2068. end;
  2069. function FormatStrStr2(const Format, Param1,Param2: string): string;
  2070. var S: string;
  2071. P: array[1..2] of pointer;
  2072. begin
  2073. P[1]:=@Param1; P[2]:=@Param2;
  2074. FormatStr(S,Format,P);
  2075. FormatStrStr2:=S;
  2076. end;
  2077. function FormatStrStr3(const Format, Param1,Param2,Param3: string): string;
  2078. var S: string;
  2079. P: array[1..3] of pointer;
  2080. begin
  2081. P[1]:=@Param1; P[2]:=@Param2; P[3]:=@Param3;
  2082. FormatStr(S,Format,P);
  2083. FormatStrStr3:=S;
  2084. end;
  2085. function FormatStrInt(const Format: string; L: longint): string;
  2086. var S: string;
  2087. begin
  2088. FormatStr(S,Format,L);
  2089. FormatStrInt:=S;
  2090. end;
  2091. const
  2092. Cmds: array[0..3] of word =
  2093. (cmYes, cmNo, cmOK, cmCancel);
  2094. var
  2095. ButtonName: array[0..3] of string;
  2096. Titles: array[0..3] of string;
  2097. function AdvMessageBox(const Msg: String; Params: Pointer; AOptions: longint): Word;
  2098. var
  2099. R: TRect;
  2100. begin
  2101. R.Assign(0, 0, 0, 0);
  2102. AdvMessageBox := AdvMessageBoxRect(R, Msg, Params, AOptions);
  2103. end;
  2104. procedure GetStaticTextDimensions(const S: string; ViewWidth: integer; var MaxCols, Rows: integer);
  2105. var
  2106. Color: Byte;
  2107. Center: Boolean;
  2108. I, J, L, P, Y: Sw_Integer;
  2109. CurLine: string;
  2110. begin
  2111. MaxCols:=0;
  2112. L := Length(S);
  2113. P := 1;
  2114. Y := 0;
  2115. Center := False;
  2116. while (Y < 32767) and (P<=length(S)) do
  2117. begin
  2118. CurLine:='';
  2119. if P <= L then
  2120. begin
  2121. if S[P] = #3 then
  2122. begin
  2123. Center := True;
  2124. Inc(P);
  2125. end;
  2126. I := P;
  2127. repeat
  2128. J := P;
  2129. while (P <= L) and (S[P] = ' ') do Inc(P);
  2130. while (P <= L) and (S[P] <> ' ') and (S[P] <> #13) do Inc(P);
  2131. until (P > L) or (P >= I + ViewWidth) or (S[P] = #13);
  2132. if P > I + ViewWidth then
  2133. if J > I then P := J else P := I + ViewWidth;
  2134. if Center then J := (ViewWidth - P + I) div 2 else J := 0;
  2135. CurLine:=CurLine+copy(S,I,P-I);
  2136. { MoveBuf(B[J], S[I], Color, P - I);}
  2137. while (P <= L) and (S[P] = ' ') do Inc(P);
  2138. if (P <= L) and (S[P] = #13) then
  2139. begin
  2140. Center := False;
  2141. Inc(P);
  2142. if (P <= L) and (S[P] = #10) then Inc(P);
  2143. end;
  2144. end;
  2145. if length(CurLine)>MaxCols then
  2146. MaxCols:=length(CurLine);
  2147. { WriteLine(0, Y, Size.X, 1, B);}
  2148. Inc(Y);
  2149. end;
  2150. Rows:=Y;
  2151. end;
  2152. function AdvMessageBoxRect(var R: TRect; const Msg: String; Params: Pointer; AOptions: longint): Word;
  2153. var
  2154. I, X, ButtonCount: Sw_Integer;
  2155. Dialog: PAdvMessageBox;
  2156. Control: PView;
  2157. ButtonList: array[0..4] of PView;
  2158. S,BtnName: String;
  2159. Cols,Rows: integer;
  2160. begin
  2161. FormatStr(S, Msg, Params^);
  2162. if R.Empty then
  2163. begin
  2164. GetStaticTextDimensions(S,40,Cols,Rows);
  2165. if Cols<30 then Cols:=30; if Rows=0 then Rows:=1;
  2166. R.Assign(0,0,3+Cols+3,Rows+6);
  2167. if (AOptions and mfInsertInApp)= 0 then
  2168. R.Move((Desktop^.Size.X-(R.B.X-R.A.X)) div 2,(Desktop^.Size.Y-(R.B.Y-R.A.Y)) div 2)
  2169. else
  2170. R.Move((Application^.Size.X-(R.B.X-R.A.X)) div 2,(Application^.Size.Y-(R.B.Y-R.A.Y)) div 2);
  2171. end;
  2172. New(Dialog,Init(R, Titles[AOptions and $3]));
  2173. with Dialog^ do
  2174. begin
  2175. CanCancel:=(Options and mfCantCancel)=0;
  2176. R.Assign(3,2, Size.X-2,Size.Y-3);
  2177. Control := New(PStaticText, Init(R, S));
  2178. Insert(Control);
  2179. X := -2;
  2180. ButtonCount := 0;
  2181. for I := 0 to 3 do
  2182. if AOptions and ($10000 shl I) <> 0 then
  2183. begin
  2184. BtnName:=UserButtonName[I+1];
  2185. R.Assign(0, 0, Max(10,length(BtnName)+2), 2);
  2186. Control := New(PButton, Init(R, BtnName, UserButtonCmd[I+1], bfNormal));
  2187. Inc(X, Control^.Size.X + 2);
  2188. ButtonList[ButtonCount] := Control;
  2189. Inc(ButtonCount);
  2190. end;
  2191. for I := 0 to 3 do
  2192. if AOptions and ($0100 shl I) <> 0 then
  2193. begin
  2194. R.Assign(0, 0, 10, 2);
  2195. Control := New(PButton, Init(R, ButtonName[I], Cmds[i], bfNormal));
  2196. Inc(X, Control^.Size.X + 2);
  2197. ButtonList[ButtonCount] := Control;
  2198. Inc(ButtonCount);
  2199. end;
  2200. X := (Size.X - X) div 2;
  2201. for I := 0 to ButtonCount - 1 do
  2202. begin
  2203. Control := ButtonList[I];
  2204. Insert(Control);
  2205. Control^.MoveTo(X, Size.Y - 3);
  2206. Inc(X, Control^.Size.X + 2);
  2207. end;
  2208. SelectNext(False);
  2209. end;
  2210. if AOptions and mfInsertInApp = 0 then
  2211. AdvMessageBoxRect := DeskTop^.ExecView(Dialog)
  2212. else
  2213. AdvMessageBoxRect := Application^.ExecView(Dialog);
  2214. Dispose(Dialog, Done);
  2215. end;
  2216. procedure InitAdvMsgBox;
  2217. begin
  2218. ButtonName[0] := Labels^.Get(slYes);
  2219. ButtonName[1] := Labels^.Get(slNo);
  2220. ButtonName[2] := Labels^.Get(slOk);
  2221. ButtonName[3] := Labels^.Get(slCancel);
  2222. Titles[0] := Labels^.Get(sWarning);
  2223. Titles[1] := Labels^.Get(sError);
  2224. Titles[2] := Labels^.Get(sInformation);
  2225. Titles[3] := Labels^.Get(sConfirm);
  2226. end;
  2227. procedure DoneAdvMsgBox;
  2228. begin
  2229. end;
  2230. procedure RegisterWViews;
  2231. begin
  2232. {$ifndef NOOBJREG}
  2233. RegisterType(RAdvancedListBox);
  2234. RegisterType(RColorStaticText);
  2235. RegisterType(RHSListBox);
  2236. RegisterType(RDlgWindow);
  2237. {$endif}
  2238. end;
  2239. END.
  2240. {
  2241. $Log$
  2242. Revision 1.3 2000-10-31 22:35:56 pierre
  2243. * New big merge from fixes branch
  2244. Revision 1.1.2.3 2000/10/24 00:21:59 pierre
  2245. * fix the greyed save after window list box
  2246. Revision 1.2 2000/08/22 09:41:42 pierre
  2247. * first big merge from fixes branch
  2248. Revision 1.1.2.2 2000/08/16 18:46:15 peter
  2249. [*] double clicking on a droplistbox caused GPF (due to invalid recurson)
  2250. [*] Make, Build now possible even in Compiler Messages Window
  2251. [+] when started in a new dir the IDE now ask whether to create a local
  2252. config, or to use the one located in the IDE dir
  2253. Revision 1.1.2.1 2000/08/04 14:05:20 michael
  2254. * Fixes from Gabor:
  2255. [*] the IDE now doesn't disable Compile|Make & Build when all windows
  2256. are closed, but there's still a primary file set
  2257. (set bug 1059 to fixed!)
  2258. [*] the IDE didn't read some compiler options correctly back from the
  2259. FP.CFG file, for ex. the linker options. Now it read everything
  2260. correctly, and also automatically handles smartlinking option synch-
  2261. ronization.
  2262. (set bug 1048 to fixed!)
  2263. Revision 1.1 2000/07/13 09:48:37 michael
  2264. + Initial import
  2265. Revision 1.15 2000/06/22 09:07:15 pierre
  2266. * Gabor changes: see fixes.txt
  2267. Revision 1.14 2000/06/16 08:50:45 pierre
  2268. + new bunch of Gabor's changes
  2269. Revision 1.13 2000/05/02 08:42:29 pierre
  2270. * new set of Gabor changes: see fixes.txt
  2271. Revision 1.12 2000/04/18 11:42:39 pierre
  2272. lot of Gabor changes : see fixes.txt
  2273. Revision 1.11 2000/01/10 15:53:37 pierre
  2274. * WViews objects were not registered
  2275. Revision 1.10 1999/08/03 20:22:46 peter
  2276. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  2277. + Desktop saving should work now
  2278. - History saved
  2279. - Clipboard content saved
  2280. - Desktop saved
  2281. - Symbol info saved
  2282. * syntax-highlight bug fixed, which compared special keywords case sensitive
  2283. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  2284. * with 'whole words only' set, the editor didn't found occourences of the
  2285. searched text, if the text appeared previously in the same line, but didn't
  2286. satisfied the 'whole-word' condition
  2287. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  2288. (ie. the beginning of the selection)
  2289. * when started typing in a new line, but not at the start (X=0) of it,
  2290. the editor inserted the text one character more to left as it should...
  2291. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  2292. * Shift shouldn't cause so much trouble in TCodeEditor now...
  2293. * Syntax highlight had problems recognizing a special symbol if it was
  2294. prefixed by another symbol character in the source text
  2295. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  2296. Revision 1.9 1999/06/28 19:32:37 peter
  2297. * fixes from gabor
  2298. Revision 1.8 1999/06/28 12:29:56 pierre
  2299. *GetMenuItem fixed
  2300. Revision 1.7 1999/06/25 00:30:34 pierre
  2301. + TAdvancedMenuBar.GetMenuItem(by command number)
  2302. Revision 1.6 1999/04/07 21:56:07 peter
  2303. + object support for browser
  2304. * html help fixes
  2305. * more desktop saving things
  2306. * NODEBUG directive to exclude debugger
  2307. Revision 1.5 1999/03/23 16:16:44 peter
  2308. * linux fixes
  2309. Revision 1.4 1999/03/23 15:11:42 peter
  2310. * desktop saving things
  2311. * vesa mode
  2312. * preferences dialog
  2313. Revision 1.3 1999/03/19 16:04:35 peter
  2314. * new compiler dialog
  2315. Revision 1.2 1999/03/08 14:58:23 peter
  2316. + prompt with dialogs for tools
  2317. Revision 1.1 1999/03/01 15:51:43 peter
  2318. + Log
  2319. }