📄 hyieutils.pas
字号:
(*
Copyright (c) 1998-2007 by HiComponents. All rights reserved.
This software comes without express or implied warranty.
In no case shall the author be liable for any damage or unwanted behavior of any
computer hardware and/or software.
HiComponents grants you the right to include the compiled component
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE,
BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM.
ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial,
shareware or freeware libraries or components.
email: support@hicomponents.com
http://www.hicomponents.com
*)
unit hyieutils;
{$R-}
{$Q-}
{$I ie.inc}
interface
uses Windows, Messages, Forms, Classes, StdCtrls, Graphics, Controls, SysUtils, hyiedefs, iewords, dialogs;
{$IFDEF FPC}
uses Classes, SysUtils, hyiedefs, iewords;
{$ENDIF}
type
{!!
<FS>TIECompareFunction
<FM>Declaration<FC>
}
TIECompareFunction=function(Index1,Index2:integer):integer of object;
{!!}
{!!
<FS>TIESwapFunction
<FM>Declaration<FC>
}
TIESwapFunction=procedure(Index1,Index2:integer) of object;
{!!}
{!!
<FS>TIEDialogCenter
<FM>Declaration<FC>
}
TIEDialogCenter = procedure(Wnd: HWnd);
{!!}
TTIFFHeader = packed record
Id: word;
Ver: word;
PosIFD: integer;
end;
TTIFFTAG = packed record
IdTag: word; // tag identified
DataType: word; // data type
DataNum: integer; // data count
DataPos: integer; // data position
end;
PTIFFTAG = ^TTIFFTAG;
TIFD = array[0..MaxInt div 16] of TTIFFTag;
PIFD = ^TIFD;
TTIFFEnv = record
Intel: boolean; // true:Intel - false:Motorola
Stream: TStream;
IFD: PIFD;
NumTags: word;
StreamBase: int64;
end;
// handles hash code for numeric values
THash1Item = class
key: integer;
nextitem: THash1Item; // nil=end of list
value: integer;
end;
THash1 = class
private
fMainKeys: TList; // main key array
fMainKeysUse: TList; // main key array - state [0=free; 1=busy; 2=more keys]
fMainKeysValue: TList; // array of values
fHbits: integer; // has table size in bits
fHdim: integer; // items count of fMainKeys and fMainKeyUse
fIteratePtr1: integer;
fIteratePtr2: THash1Item;
function HashFunc(kk: integer): integer;
public
nkeys: integer; // inserted key count
constructor Create(Hbits: integer);
destructor Destroy; override;
function Insert(kk: integer): boolean;
function KeyPresent(kk: integer): boolean;
function Insert2(kk: integer; var ptr1: integer; var ptr2: Thash1Item): boolean;
procedure SetValue(ptr1: integer; ptr2: Thash1Item; Value: integer);
function GetValue(ptr1: integer; ptr2: Thash1Item): integer;
function IterateBegin: boolean;
function IterateNext: boolean;
function IterateGetValue: integer;
end;
{!!
<FS>TImageEnPaletteDialog
<FM>Description<FN>
TImageEnPaletteDialog is a dialog useful to show a palette and select a color from it.
See also <A TImageEnProc.CalcImagePalette>
<FM>Methods<FN>
<A TImageEnPaletteDialog.Execute>
<A TImageEnPaletteDialog.SetPalette>
!!}
TImageEnPaletteDialog = class(TForm)
private
MouseCol: integer;
fPalette: PRGBROW;
fNumCol: integer;
procedure FormPaint(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; x, y: integer);
procedure FormClick(Sender: TObject);
public
ButtonCancel: TButton;
SelCol: TColor;
property NumCol: integer read MouseCol;
constructor Create(AOwner: TComponent); override;
procedure SetPalette(var Palette: array of TRGB; NumCol: integer);
function Execute: boolean;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TIEScrollBarParams
{!!
<FS>TIEScrollBarParams
<FM>Description<FN>
Allows an application to customize the scroll bars behavior like tracking (display refresh on mouse dragging), up/down buttons pixel scroll, pagedown/up pixel scroll.
<FM>Properties<FN>
<A TIEScrollBarParams.LineStep>
<A TIEScrollBarParams.PageStep>
<A TIEScrollBarParams.Tracking>
!!}
TIEScrollBarParams = class
private
fLineStep: integer; // click on up/down/left/right (-1=default size)
fPageStep: integer; // page step (-1=default size)
fTracking: boolean; // scroll-bar updates display in real-time (true=default)
public
constructor Create;
destructor Destroy; override;
{!!
<FS>TIEScrollBarParams.LineStep
<FM>Declaration<FC>
property LineStep: integer;
<FM>Description<FN>
LineStep is the number of pixels to scroll when the user clicks on UP or DOWN arrows.
Setting this property to -1, the component scrolls by one thumbnail at a time. Default value is -1.
!!}
property LineStep: integer read fLineStep write fLineStep;
{!!
<FS>TIEScrollBarParams.PageStep
<FM>Declaration<FC>
property PageStep: integer;
<FM>Description<FN>
PageStep is the number of pixels to scroll when the user clicks near the cursor (PAGEUP or PAGEDOWN).
Setting this property to -1, the component scrolls by one page (client height). Default value is -1.
!!}
property PageStep: integer read fPageStep write fPageStep;
{!!
<FS>TIEScrollBarParams.Tracking
<FM>Declaration<FC>
property Tracking: boolean
<FM>Description<FN>
Set Tracking to False to disable display refreshing during mouse dragging. Default value is True.
!!}
property Tracking: boolean read fTracking write fTracking;
end;
// TIEScrollBarParams
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TIEMouseWheelParams
{!!
<FS>TIEMouseWheelParamsAction
<FM>Declaration<FC>
}
TIEMouseWheelParamsAction = (iemwNone, iemwVScroll, iemwZoom);
{!!}
{!!
<FS>TIEMouseWheelParamsVariation
<FM>Declaration<FC>
}
TIEMouseWheelParamsVariation = (iemwAbsolute, iemwPercentage);
{!!}
{!!
<FS>TIEMouseWheelParamsZoomPosition
<FM>Declaration<FC>
}
TIEMouseWheelParamsZoomPosition = (iemwCenter, iemwMouse);
{!!}
{!!
<FS>TIEMouseWheelParams
<FM>Description<FN>
The TIEMouseWheelParams allows applications to customize the mouse wheel抯 behavior.
<FM>Properties<FN>
<A TIEMouseWheelParams.InvertDirection>
<A TIEMouseWheelParams.Action>
<A TIEMouseWheelParams.Variation>
<A TIEMouseWheelParams.Value>
<A TIEMouseWheelParams.ZoomPosition>
!!}
TIEMouseWheelParams = class
public
{!!
<FS>TIEMouseWheelParams.InvertDirection
<FM>Declaration<FC>
InvertDirection: boolean;
<FM>Description<FN>
If True inverts wheel direction (default False).
!!}
InvertDirection: boolean; // invert wheel direction
{!!
<FS>TIEMouseWheelParams.Action
<FM>Declaration<FC>
Action: <A TIEMouseWheelParamsAction>;
<FM>Description<FN>
Action specifies the task to perform on mouse wheel events.
Specify iemwNone for no operation, iemwVScroll for vertical image scroll or iemwZoom for zoom-in/out (default iemwZoom).
!!}
Action: TIEMouseWheelParamsAction; // action
{!!
<FS>TIEMouseWheelParams.Variation
<FM>Declaration<FC>
Variation: <A TIEMouseWheelParamsVariation>;
<FM>Description<FN>
Variation specifies how much scrolling or zooming occurs in response to mouse wheel rotation.
If Variation is iemwAbsolute, Value contains the absolute value to add or subtract from the current value.
If Variation is iemwPercentage, Value contains the percentage of variation from the current value (default is iemwPercentage).
!!}
Variation: TIEMouseWheelParamsVariation; // variation mode
{!!
<FS>TIEMouseWheelParams.Value
<FM>Declaration<FC>
Value: integer;
<FM>Description<FN>
Value or percentage of variation (default 8).
!!}
Value: integer; // value o percentage of variation
{!!
<FS>TIEMouseWheelParams.ZoomPosition
<FM>Declaration<FC>
ZoomPosition: <A TIEMouseWheelParamsZoomPosition>;
<FM>Description<FN>
If Action is iemwZoom, ZoomPosition specifies where the zoom acts. The default is the center of the control, otherwise (iemwMouse) zooms from the mouse抯 position.
!!}
ZoomPosition: TIEMouseWheelParamsZoomPosition;
constructor Create;
destructor Destroy; override;
end;
// TIEMouseWheelParams
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TIEHint = class(TCustomControl)
private
fText: string;
fFont: TFont;
procedure SetText(s: string);
procedure SetFont(f: TFont);
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT;
public
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
procedure Paint; override;
property Text: string read fText write SetText;
//property Color:TColor read fColor write SetColor;
property Font: TFont read fFont write SetFont;
end;
TIEByteArray = class
private
fSize: integer; // size of datas
fRSize: integer; // size of allocated buffer
fBlockSize: integer; // allocation block size
procedure SetSize(v: integer);
public
Data: pbytearray;
constructor Create;
destructor Destroy; override;
procedure AddByte(v: byte);
property Size: integer read fSize write SetSize;
property BlockSize: integer read fBlockSize write fBlockSize;
procedure Clear;
function AppendFromStream(Stream: TStream; Count: integer): integer;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -