Unit ZoomDisp

********************************************************************** Author: Robert Rossmair Wagelwitz, Rodaer Str. 6 04688 Mutzschen Germany e-mail: Robert.Rossmair@t-online.de http://home.t-online.de/home/Robert.Rossmair/ Module: ZoomDisp Version: 3.0.0, 3-Jun-1998 Compatibility: Delphi 2.0 and Delphi 3 Description: Implements T(Custom)ZoomDisplay and related stuff History: Version 3: Scales! New types: * TDisplayScale * TGetScalePointProc Changes in T(Custom)ZoomDisplay: New properties: * HorzScale * VertScale * MinVertScaleWidth * Viewport * OnGetHorzScalePoint * OnGetVertScalePoint Optimizations in PlotByteArray, PlotSmallintArray Buffered and MonochromeBitmap now True by default 30-Apr-98: Version 2.1.0 Changes in TCustomZoomDisplay: * New property PaintMode * TAmpFunc result type changed; consequential changes in PlotSamples * removed property WorldPoint (superfluous) * renamed Canvas to WaveformCanvas 17-Apr-98: Version 2.0.6: TCustomZoomDisplay.SetWorld enhanced (EqualsW?, EqualsMaxW? stuff) 16-Apr-98: Version 2.0.5: Bug fix in PlotSamples method 13-Apr-98: Version 2.0.4: TMarker: New: SetKind; To uncouple the Visible property from side effects of its internal use, methods SetVisible, SetInheritedVisible have been added; this required changes in T{Horz|Vert}Marker.UpdatePos; TCustomZoomDisplay: Changed BoundWindow so that FXPos/FYPos are updated if necessary Changed SetWindow so that FXPos is updated if necessary Fixed DragOver, CMMouseLeave 10-Apr-98: Version 2.0.3: Changed WorldX/Y result type to TWorldCoord Removed TZoomDisplay.OnEndDrag Added TMarker.OnEndDrag 07-Apr-98: Version 2.0.2: Fixed THorz/VertMarker.UpdatePos so that they take into account changes in Height resp. Width of the marker's Parent... 07-Apr-98: Version 2.0.0: Some measures have been taken to make the off-screen bitmap refresh only when necessary. This requires a means to trigger an off-screen bitmap update manually in situations where TCustomZoomDisplay cannot recognize that the bitmap needs to be updated; that's the task of TCustomZoomDisplay.InvalidateWorldWindow. In the course of revising line-drawing routines DeviceLineTo/ DeviceMoveTo have been removed, the result type of DeviceX/Y changed to Double. Removed OnChange event; use OnWindowChange instead. Minor bug fixes. New features of TCustomZoomDisplay: * properties SelectionStart, SelectionEnd, OnSelectionChange, SelectionColor, DrawSelectionMode, OnMouseLeave * methods SetSelection, Plot24BitSamples, PlotSamples 21-Mar-98: Version 1.4.1 changed visibility of DeviceX/Y methods from protected to public; fixed bug in T{Horz|Vert}Marker.SetAlign (which used to align to Parent.BoundsRect instead of Parent.ClientRect before) 18-Mar-98: Version 1.4.0 TCustomZoomDisplay: replaced property SaveImageAsWMF by ImageFileFormat; minor bug fix: SetBuffered used to create a bitmap too small in size (by 1 Pixel in height and width). 18-Mar-98: Version 1.3.3 Implemented OnWindowChange event. Bug fixes: fixed TCustomZoomDisplay.GetBitmap in respect to MonochromeBitmap. In some cases (e.g. PenChanged) I referenced FBitmap without ensuring FBitmap <> nil; fixed that. TCustomZoomDisplay.EndZoom: BeginZoom sets Brush.Style to bsClear, which has the side effect to change Brush.Color to clWhite; hence I replaced "Brush.Style := bsSolid" by "Brush.Color := Color" with the side effect of changing Brush.Style to bsSolid. 17-Mar-98: Version 1.3.2 fixed TCustomZoomDisplay.Paint in respect to MonochromeBitmap 13-Mar-98: Version 1.3.1 removed some superfluous stuff 12-Mar-98: Version 1.3.0 introduces MonochromeBitmap 11-Mar-98: Version 1.2.1 removed TCustomZoomDisplay.SetMarkerColorOf(), TCustomZoomDisplay.SetMarkerHintOf(); IterateMarkers can be used instead 10-Mar-98: Version 1.2.0 PlotByteArray implemented. Some details changed. 27-Nov-97: Version 1.1.1 changed type to TWorldCoord for: TMarker.Position, TCustomZoomDisplay.DeviceX/Y arguments, TCustomZoomDisplay.MoveTo/LineTo arguments, 26-Nov-97: Version 1.1.0 added TCustomZoomDisplay.Error, TCustomZoomDisplay.PlotSmallintArray, TCustomZoomDisplay.PlotIntArray 21-Nov-97: Version 1.0.12 TCustomZoomDisplay.IterateMarkers 20-Nov-97: Version 1.0.11 added THorzMarker, TVertMarker classes 17-Nov-97: Version 1.0.10 added TMarker.Locked property added TCustomZoomDisplay.SetMarkerColorOf(), 15-Nov-97: Version 1.0.9 added TCustomZoomDisplay.SetMarkerHintOf(), TCustomZoomDisplay.UpdateMarkerPosOf() TMarker.SetOnGetposition() 14-Nov-97: Version 1.0.8 added TCustomZoomDisplay.DeleteMarkersMarking() 10-Nov-97: Version 1.0.7 added TMarker.Marked property published all Events inherited from TControl 09-Nov-97: Version 1.0.6 added TCustomZoomDisplay.FDoDrawMarkerPositions 08-Nov-97: Version 1.0.5 moved resource initialization (cursors) into initialization section 01-Nov-97: Version 1.0.4 added FRestoreColors and related stuff to equalize monochrome bitmap palette problems in Delphi 3. 29-Oct-97: Version 1.0.3 added property TCustomZoomDisplay.Bitmap to make the paint buffer visible to the public. 27-Oct-97: Version 1.0.2 added condition "if FPosition <> Value then" to TMarker.SetPosition 10-Oct-97: Version 1.0.1 added condition "if not (csDestroying in ComponentState)" to TCustomZoomDisplay.WMSize. Without this condition an EAccessViolation is raised on program exit if: 1. Two MDI child windows with TZoomDisplay controls placed on each of them are open, 2. one of these windows is maximized. 17-Sep-97: Version 1.0.0 Copyright © 1993-1998 Robert Rossmair This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (file COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. If you want to use this program in a commercial application, contact me to get informed about the conditions.

Classes

TCustomZoomDisplay -
TDisplayScale -
TDisplayScrollBar -
THorzMarker -
TMarker -
TVertMarker -
TZoomDisplay -

Functions

Register -

Types

P16BitSampleArray
P24BitSampleArray
T16BitSampleArray
T24BitSample
T24BitSampleArray
TAmpFunc
TClipCode
TClipCodes
TDoublePoint
TDrawSelectionMode
TGetScalePointProc
THMarkerAlign
TImageFileFormat
TMarkerKind
TMarkerPosEvent
TMarkerProc
TPageFraction
TPosEvent
TSignalPaintMode
TVMarkerAlign
TWorldCoord
TWorldPoint
TZoomMode
TZoomStartMode

Constants

crBase
crCrossHairs
crGrip
crHand
crZoomIn
crZoomOut
High24BitSample
Low24BitSample

Variables


Functions


procedure Register;


Types


P16BitSampleArray = ^T16BitSampleArray

P24BitSampleArray = ^T24BitSampleArray

T16BitSampleArray = array[0..(High(Cardinal)div 2) div SizeOf(Smallint)] of Smallint;

T24BitSample = record
end;

T24BitSampleArray = array[0..(High(Cardinal)div 2) div SizeOf(T24BitSample)] of T24BitSample;

TAmpFunc = function(var P: Pointer): TWorldCoord of object

TClipCode = set of TClipCodes

TClipCodes = (ccCenter, ccLeft, ccRight, ccTop, ccBottom);

TDoublePoint = record
X : TWorldCoord;
Y : TWorldCoord;
end;

TDrawSelectionMode = (smNop, smInvert, smPatInvert);

TGetScalePointProc = procedure(Sender: TObject; var Value: Extended) of object

THMarkerAlign = (alTop, alBottom);

TImageFileFormat = (imBMP, imEMF, imWMF);

TMarkerKind = (mkMark, mkRangeStart, mkRangeEnd);

TMarkerPosEvent = procedure(Sender: TObject; var Pos: TWorldCoord) of object

TMarkerProc = procedure(Marker: TMarker; Param: DWord)

TPageFraction = 1..High(Smallint)

TPosEvent = procedure(Sender: TObject; X, Y: Single) of object

TSignalPaintMode = (spHollow, spSolid);

TVMarkerAlign = (alLeft, alRight);

TWorldCoord = Double

TWorldPoint = TDoublePoint

TZoomMode = (zmZoomOff, zmZoomIn, zmZoomOut);

TZoomStartMode = (zmAutomatic, zmManual);

Constants

crBase = 10260

.$DEFINE Profile

crCrossHairs = crBase

crGrip = crBase+2

crHand = crBase+1

crZoomIn = crBase+3

crZoomOut = crBase+4

High24BitSample = 1 shl 23-1

Low24BitSample = -1 shl 23


Variables