const
vaNormal = $00;
vaBold = $01;
vaInvert = $02;
vaItalic = $04;
{$IFDEF PAIDVERS}
SDLVersionInfo = 'chemgrph_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'chemgrph_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
TDirection = (diLeft, diTop, diRight, diBottom);
TCGDispMode = (dmSkeleton, dmHeteroOnly, dmAllAtoms, dmNumbers);
{ event for mouse pos. in chart coords }
TMoveOverStructEvent = procedure (Sender: TObject; ClosestAtom: integer;
Dist: double; Shift: TShiftState;
rMousePosX, rMousePosY: double) of object;
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TChemGraph = class (TGraphicControl)
private
FColorBakG : TColor;
FMolColor : TColor; { color of structure }
FColBlackLine : TColor; { colors to draw the frame }
FColGrayLine : TColor; { -"- }
FColWhiteLine : TColor; { -"- }
FColorScheme : TColorScheme; { color scheme of frames }
FTransForm : array[0..2] of double; { 0 = k, 1 = dx, 2 = dy }
FMaxBondLeng : integer; {max. bond length on screen (in pixel)}
FOnMMvInChart : TMoveOverStructEvent;
FFrameStyle : TFrameStyle;
FClipBounds : array[diLeft..diBottom] of integer;
FDispMode : TCGDispMode;
FSuppressPaint: boolean;
FDrawAsIs : boolean;
function ConstructElemSymb (AtIx: integer;
var ESymb: string): integer;
procedure DrawMolRaw (DispMode: TCGDispMode; TrafoK, TrafoDx,
TrafoDy: double; Clip: boolean; CV: TCanvas);
procedure DrawConnections (AtIx: integer; HighOnly: boolean;
DisplayMode: TCGDispMode; TrafoK, TrafoDx,
TrafoDy: double; Clip: boolean; CV: TCanvas);
procedure DispElemSymb (AtIx: integer; DispMode: TCGDispMode;
TrafoK, TrafoDx, TrafoDy: double;
Clip: boolean; CV: TCanvas);
function GetClipBoundary (ix: TDirection): integer;
function GetAtColor(AtIx: integer): TColor;
function GetVisAttrib (AtIx: integer): byte;
procedure SetClipBoundary (ix: TDirection; ClipVal: integer);
procedure SetColorBakG (Value: TColor);
procedure SetColorScheme (Value: TColorScheme);
procedure SetAtColor (AtIx: integer; value: TColor);
procedure SetDispMode (value: TCGDispMode);
procedure SetFrameStyle (value: TFrameStyle);
procedure SetMaxbondleng (value: integer);
procedure SetMolColor (value: TColor);
procedure SetSuppressPaint (supp: boolean);
procedure SetDrawAsIs (x: boolean);
procedure SetVisAttrib (AtIx: integer; value: byte);
procedure StructureHasChanged (Sender: TObject);
{$IFNDEF ISCLX}
procedure WMMoveOverStruct(var Message: TWMMouse);
message WM_MOUSEMOVE;
{$ENDIF}
protected
procedure Paint; override;
procedure MoveOverStruct (ClosestAtom: integer; Dist: double;
Shift: TShiftState; RMousePosX, RMousePosY: double);
public
Structure : TCtab; { connection table }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property AtColor[AtIx: integer]: TColor
read GetAtColor write SetAtColor;
property AtVisAttrib[AtIx: integer]: byte
read GetVisAttrib write SetVisAttrib;
property ClipBoundary [ix: TDirection]: integer
read GetClipBoundary write SetClipBoundary;
property DrawUnscaled: boolean read FDrawAsIs write SetDrawAsIs;
function FindChainNexttoCursor (x,y: single;
var ChainAtoms: AtListType): integer;
procedure FindRingNextToCursor (x,y: single;
var Ring: RingType);
procedure OptimizeMolShape (IdealDist: integer);
procedure ShowMoleculeInABox (Canvas: TCanvas; DispMode: TCGDispMode;
llx,lly,urx,ury: integer; MaxBondLeng: integer);
property SuppressPaint: boolean
read FSuppressPaint write SetSuppressPaint;
published
property Align;
property ColorBkg: TColor read FColorBakg write SetColorBakG;
property ColorScheme: TColorScheme
read FColorScheme write SetColorScheme;
property ColorStructure: TColor read FMolColor write SetMolColor;
property DisplayMode: TCGDispMode read FDispMode write SetDispMode;
property Font;
property FrameStyle: TFrameStyle
read FFrameStyle write SetFrameStyle;
property MaxBondLeng: integer
read FMaxBondLeng write SetMaxBondleng;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
{$IFDEF GE_LEV17}
(**) property StyleElements;
{$ENDIF}
property Visible;
property OnClick;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnMoveOverStruct: TMoveOverStructEvent
read FOnMMvInChart write FOnMMvInChart;
end;
|