MMMRKLST.INT 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. unit MMMrkLst;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinProcs,
  33. WinTypes,
  34. {$ENDIF}
  35. SysUtils,
  36. Classes,
  37. MMObj,
  38. MMMuldiv,
  39. MMUtils;
  40. type
  41. PMMMarker = ^TMMMarker;
  42. TMMMarker = record
  43. ID : Longint;
  44. NextID : Longint;
  45. Offset : Longint;
  46. Name : string[80];
  47. Comment: string[255];
  48. Fixed : Boolean;
  49. Visible: Boolean;
  50. Color : Longint;
  51. Flags : Longint;
  52. end;
  53. const
  54. { Maximum List size }
  55. {$IFDEF WIN32}
  56. MaxListSize = Maxint div (sizeOf(TMMMarker));
  57. {$ELSE}
  58. MaxListSize = 65520 div sizeOf(TMMMarker);
  59. {$ENDIF}
  60. type
  61. PMMMarkerArray = ^TMMMarkerArray;
  62. TMMMarkerArray = array[0..MaxListSize-1] of TMMMarker;
  63. TMMMarkerList = class(TMMObject)
  64. public
  65. constructor Create; virtual;
  66. destructor Destroy; override;
  67. procedure BeginUpdate;
  68. procedure EndUpdate;
  69. procedure Clear; virtual;
  70. procedure Assign(Source: TPersistent); virtual;
  71. procedure AddMarker(Marker: TMMMarker);
  72. procedure Insert(Index: Integer; Marker: TMMMarker);
  73. procedure Exchange(Index1, Index2: Integer);
  74. procedure Move(CurIndex, NewIndex: Integer);
  75. function Remove(Marker: PMMMarker): Integer;
  76. procedure Delete(Index: Integer);
  77. function IndexOf(Marker: PMMMarker): Integer;
  78. function FindFreeID: Longint;
  79. function LocateMarker(Offset: Longint): integer;
  80. function FindMarker(Offset: Longint): integer;
  81. function FindConnectedMarker(Index: integer): integer;
  82. function QueryMarker(Offset: Longint): Boolean;
  83. procedure Sort;
  84. function First: PMMMarker;
  85. function Last: PMMMarker;
  86. function Expand: TMMMarkerList;
  87. procedure SetOffset(Index: integer; Offset: Longint);
  88. procedure SetColor(Index: integer; Color: Longint);
  89. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  90. property OnChanging: TNotifyEvent read FOnChanging write FOnChanging;
  91. property Capacity: Integer read FCapacity write SetCapacity;
  92. property Count: Integer read FCount write SetCount;
  93. property Markers[Index: Integer]: PMMMarker read Get write Put; default;
  94. property List: PMMMarkerArray read FList;
  95. end;
  96. function CompareMarkers(Marker1,Marker2: PMMMarker): Boolean;
  97. implementation