// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'SGDrawingNavigator.pas' rev: 5.00

#ifndef SGDrawingNavigatorHPP
#define SGDrawingNavigatorHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <sgRectangle.hpp>	// Pascal unit
#include <sgOrbit3D.hpp>	// Pascal unit
#include <sgTools.hpp>	// Pascal unit
#include <DXFConv.hpp>	// Pascal unit
#include <DXFImage.hpp>	// Pascal unit
#include <sgConsts.hpp>	// Pascal unit
#include <ExtCtrls.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Menus.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <StdCtrls.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Sgdrawingnavigator
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TsgCustomControl;
class PASCALIMPLEMENTATION TsgCustomControl : public Controls::TWinControl 
{
	typedef Controls::TWinControl inherited;
	
public:
	#pragma option push -w-inl
	/* TWinControl.Create */ inline __fastcall virtual TsgCustomControl(Classes::TComponent* AOwner) : 
		Controls::TWinControl(AOwner) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TsgCustomControl(HWND ParentWindow) : Controls::TWinControl(
		ParentWindow) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TWinControl.Destroy */ inline __fastcall virtual ~TsgCustomControl(void) { }
	#pragma option pop
	
};


#pragma option push -b-
enum TsgDrawingNavigatorStates { dnsLoading, dnsZooming, dnsMoving, dnsDrawing, dnsBufferDrawing, dnsSclollChanging, 
	dnsSetView };
#pragma option pop

typedef Set<TsgDrawingNavigatorStates, dnsLoading, dnsSetView>  TsgDrawingNavigatorStateSet;

struct TsgNavigatorView;
typedef TsgNavigatorView *PsgNavigatorView;

struct TsgNavigatorView
{
	TsgNavigatorView *Prev;
	Windows::TRect ViewRect;
	Windows::TRect PictureRect;
} ;

class DELPHICLASS TNavigatingScrollBar;
class PASCALIMPLEMENTATION TNavigatingScrollBar : public Stdctrls::TScrollBar 
{
	typedef Stdctrls::TScrollBar inherited;
	
public:
	#pragma option push -w-inl
	/* TScrollBar.Create */ inline __fastcall virtual TNavigatingScrollBar(Classes::TComponent* AOwner)
		 : Stdctrls::TScrollBar(AOwner) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TNavigatingScrollBar(HWND ParentWindow) : Stdctrls::TScrollBar(
		ParentWindow) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TWinControl.Destroy */ inline __fastcall virtual ~TNavigatingScrollBar(void) { }
	#pragma option pop
	
};


class DELPHICLASS TSGDrawingNavigator;
class PASCALIMPLEMENTATION TSGDrawingNavigator : public TsgCustomControl 
{
	typedef TsgCustomControl inherited;
	
private:
	Graphics::TGraphic* FActualGraphic;
	HBITMAP FBufferBMP;
	bool FBufferIsCreated;
	bool FCenterAlignment;
	Menus::TPopupMenu* FClipRectPopupMenu;
	Windows::TRect FStoredClipRect;
	Graphics::TCanvas* FCanvas;
	double FCommonUnitsWidth;
	Controls::TCursor FCursorStore;
	TsgDrawingNavigatorStateSet FState;
	double FGivenScale;
	TNavigatingScrollBar* FHorzScrollBar;
	Sgconsts::TsgDistUnitsMode FLinearDimensionsMode;
	double FLinearDimensionsScaleFactor;
	double FmmPerPixelX;
	int FMaxDim;
	Windows::TPoint FMouseDownPt;
	bool FMouseDragging;
	bool FMouseMoveZoomingProcess;
	Windows::TPoint FMouseMovePrevPoint;
	bool FMouseScaling;
	bool FMoveByMouse;
	HGDIOBJ FOldGDIObj;
	Classes::TNotifyEvent FOnChangeScale;
	Classes::TNotifyEvent FOnPaint;
	Graphics::TProgressEvent FOnProgress;
	Sgorbit3d::TsgOrbit3D* FOrbit3D;
	Graphics::TPicture* FPicture;
	bool FPictureBuffer;
	Windows::TRect FPictureRect;
	bool FRectZooming;
	bool FRectZoomingProcess;
	bool FScalingOnMouseWheel;
	Sgtools::TSnapControl* FSnapControl;
	bool FStretch;
	TNavigatingScrollBar* FVertScrollBar;
	TsgNavigatorView *FViews;
	Sgconsts::TFRect FVPortRect;
	bool FVPortOpened;
	Graphics::TGraphic* FTmpGraphic;
	Dxfconv::TsgDXFLayout* FTmpLayout;
	double FWidthInPixels;
	float FZoomChangeByMouseMove;
	float FZoomInChange;
	float FZoomOutChange;
	Windows::TRect FZoomingRect;
	bool FAutoFocus;
	bool FViewRectMode;
	Sgrectangle::TsgRectangle* FRectangle;
	#pragma pack(push, 1)
	Messages::TWMPaint FPaintMessage;
	#pragma pack(pop)
	
	Classes::TNotifyEvent FOnPictureMove;
	bool FDrawed;
	bool FPictureRectChanged;
	Classes::TThreadList* FClients;
	void __fastcall ClearViews(void);
	Sgconsts::TFPoint __fastcall CoordinateConvertion(int X, int Y, Sgconsts::TFPoint &PointInUCS);
	void __fastcall CoordinateParameters(AnsiString &AName, double &AFactor);
	Sgconsts::TFPoint __fastcall ConvertUnits(const Sgconsts::TFPoint &Pt, AnsiString &Units);
	bool __fastcall CreateBuffer(void);
	bool __fastcall CreateHorScroll(void);
	bool __fastcall CreateVertScroll(void);
	void __fastcall DestroyBuffer(void);
	void __fastcall DoChangeScrolls(void);
	void __fastcall DoHorScrollChange(System::TObject* Sender);
	void __fastcall DoPictureChange(System::TObject* Sender);
	void __fastcall DoVertScrollChange(System::TObject* Sender);
	void __fastcall DrawZoomingRect(const Windows::TRect &ARect);
	Graphics::TGraphic* __fastcall GetActualGraphic(void);
	bool __fastcall GetClipRectangle(void);
	Windows::TRect __fastcall GetClipRectCoords(void);
	int __fastcall GetPictureHeight(void);
	int __fastcall GetPictureWidth(void);
	void __fastcall GetPointToImageSizeRatio(int X, int Y, Extended &AXScaled, Extended &AYScaled);
	Windows::TPoint __fastcall GetPictureRectCenter(void);
	double __fastcall GetScale(void);
	Windows::TRect __fastcall GetSimilarRect(const Sgconsts::TFRect &AExtents, const Sgconsts::TFRect &
		AViewFRect, Windows::TRect &APictureRect);
	bool __fastcall GetZoomInEnable(void);
	bool __fastcall GetZoomOutEnable(void);
	Windows::TRect __fastcall InitialPicRect(int APicWidth, int APicHeight);
	bool __fastcall IsClipRectActive(void);
	void __fastcall MovePicRect(int Dx, int Dy);
	int __fastcall PicRectWidth(void);
	int __fastcall PicRectHeight(void);
	void __fastcall RectZoomingOperation(int X, int Y, bool Erase);
	void __fastcall SetActualGraphic(Graphics::TGraphic* Gr);
	void __fastcall SetClipRectangle(const bool Value);
	void __fastcall SetClipRectCoords(const Windows::TRect &Value);
	void __fastcall SetClipRectPopupMenu(const Menus::TPopupMenu* Value);
	void __fastcall SetCommonUnitsWidth(void);
	void __fastcall SetLinearDimensionsScale(double AFactor);
	void __fastcall SetMMToPixel(void);
	void __fastcall SetPictureRect(const Windows::TRect &ARect);
	void __fastcall SetPicture(const Graphics::TPicture* Value);
	void __fastcall SetScale(const double Value);
	void __fastcall SetScrollsPosition(void);
	void __fastcall SetScrollsRange(void);
	void __fastcall SetVisibleArea(void);
	MESSAGE void __fastcall StopMouseOperations(Messages::TMessage &Message);
	void __fastcall StopZoomingProcess(void);
	void __fastcall StoreActualGraphic(Graphics::TGraphic* Gr);
	Windows::TRect __fastcall ViewRect(void);
	int __fastcall ViewRectWidth(void);
	int __fastcall ViewRectHeight(void);
	void __fastcall SetAutoFocus(const bool Value);
	void __fastcall DrawScrollBarsJoint(void);
	void __fastcall SetStretch(const bool Value);
	void __fastcall DrawThrowBuffer(void);
	Sgconsts::TFRect __fastcall ActiveVPort(void);
	void __fastcall BroadcastClients(void *Message);
	Sgrectangle::TsgRectangle* __fastcall GetRectangle(void);
	
protected:
	bool FLockPaintOnPictureChange;
	DYNAMIC void __fastcall DoChangeScale(void);
	DYNAMIC void __fastcall DoPictureMove(void);
	HIDESBASE MESSAGE void __fastcall WMContextMenu(Messages::TWMContextMenu &Message);
	MESSAGE void __fastcall ObtainFocus(Messages::TMessage &Message);
	MESSAGE void __fastcall VScroll(Messages::TWMScroll &Message);
	MESSAGE void __fastcall HScroll(Messages::TWMScroll &Message);
	DYNAMIC bool __fastcall DoMouseWheelDown(Classes::TShiftState Shift, const Windows::TPoint &MousePos
		);
	DYNAMIC bool __fastcall DoMouseWheelUp(Classes::TShiftState Shift, const Windows::TPoint &MousePos)
		;
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
		int Y);
	DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int 
		Y);
	Windows::TPoint __fastcall GetPoint(const Sgconsts::TFPoint &Pt);
	bool __fastcall OpenVPort(void);
	virtual void __fastcall Paint(void);
	virtual void __fastcall PaintWindow(HDC DC);
	DYNAMIC void __fastcall Progress(System::TObject* Sender, Graphics::TProgressStage Stage, Byte PercentDone
		, bool RedrawNow, const Windows::TRect &R, const AnsiString Msg);
	__property Sgrectangle::TsgRectangle* Rectangle = {read=GetRectangle};
	DYNAMIC void __fastcall Resize(void);
	virtual void __fastcall SaveCurrentView(void);
	virtual void __fastcall SetParent(Controls::TWinControl* AParent);
	HIDESBASE MESSAGE void __fastcall WMPaint(Messages::TWMPaint &Message);
	bool __fastcall ZoomRect(const Windows::TRect &Rect);
	
public:
	__fastcall virtual TSGDrawingNavigator(Classes::TComponent* AOwner);
	virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
	__fastcall virtual ~TSGDrawingNavigator(void);
	int __fastcall AddClient(System::TObject* AClient);
	int __fastcall RemoveClient(System::TObject* AClient);
	bool __fastcall AlterScale(double Factor, bool IsAbsolute, const Windows::TPoint &Position);
	virtual void __fastcall CallPreviousView(void);
	Windows::TPoint __fastcall Center(void);
	Sgconsts::TFPoint __fastcall GetRealPoint(int X, int Y, Sgconsts::TFPoint &PtInUCS);
	bool __fastcall Empty(void);
	void __fastcall FitToSize(void);
	Sgconsts::TFPoint __fastcall GetDrawingCoords(int X, int Y, AnsiString &Units);
	Sgconsts::TFPoint __fastcall GetDrawingInternalCoords(int X, int Y);
	Sgconsts::TFPoint __fastcall GetDrawingInternalCoordsWithoutSnap(int X, int Y);
	Sgconsts::TFPoint __fastcall GetDrawingUCSCoords(int X, int Y, AnsiString &Units);
	double __fastcall HeightToWeightRatio(void);
	bool __fastcall HasPreviousView(void);
	__property TNavigatingScrollBar* HorzScrollBar = {read=FHorzScrollBar};
	void __fastcall KeepCurrentView(void);
	void __fastcall LoadFromFile(const AnsiString FileName);
	bool __fastcall ShowPoint(const Sgconsts::TFPoint &APoint, double AScale);
	bool __fastcall ShowRect(const Sgconsts::TFRect &ARect);
	__property Graphics::TGraphic* ActualGraphic = {read=GetActualGraphic, write=SetActualGraphic};
	__property Graphics::TCanvas* Canvas = {read=FCanvas};
	__property bool ClipRectangle = {read=GetClipRectangle, write=SetClipRectangle, nodefault};
	__property Windows::TRect ClipRectCoords = {read=GetClipRectCoords, write=SetClipRectCoords};
	__property Menus::TPopupMenu* ClipRectPopupMenu = {read=FClipRectPopupMenu, write=SetClipRectPopupMenu
		};
	__property Sgconsts::TsgDistUnitsMode LinearDimensionsMode = {read=FLinearDimensionsMode, write=FLinearDimensionsMode
		, nodefault};
	__property double LinearDimensionsScale = {read=FLinearDimensionsScaleFactor, write=SetLinearDimensionsScale
		};
	__property Sgorbit3d::TsgOrbit3D* Orbit3D = {read=FOrbit3D, write=FOrbit3D};
	__property int PictureHeight = {read=GetPictureHeight, nodefault};
	__property Windows::TRect PictureRect = {read=FPictureRect, write=SetPictureRect};
	__property Windows::TPoint PictureRectCenter = {read=GetPictureRectCenter};
	__property int PictureWidth = {read=GetPictureWidth, nodefault};
	__property bool ScalingOnMouseWheel = {read=FScalingOnMouseWheel, write=FScalingOnMouseWheel, nodefault
		};
	__property Sgtools::TSnapControl* SnapControl = {read=FSnapControl};
	__property TNavigatingScrollBar* VertScrollBar = {read=FVertScrollBar};
	__property bool ViewRectMode = {read=FViewRectMode, write=FViewRectMode, nodefault};
	__property float ZoomInChange = {read=FZoomInChange, write=FZoomInChange};
	__property bool ZoomInEnable = {read=GetZoomInEnable, nodefault};
	__property float ZoomOutChange = {read=FZoomOutChange, write=FZoomOutChange};
	__property bool ZoomOutEnable = {read=GetZoomOutEnable, nodefault};
	virtual void __fastcall WndProc(Messages::TMessage &Message);
	
__published:
	__property Align ;
	__property bool AutoFocus = {read=FAutoFocus, write=SetAutoFocus, nodefault};
	__property Anchors ;
	__property Constraints ;
	__property DragKind ;
	__property OnEndDock ;
	__property OnStartDock ;
	__property bool CenterAlignment = {read=FCenterAlignment, write=FCenterAlignment, default=1};
	__property Color ;
	__property DragCursor ;
	__property DragMode ;
	__property Enabled ;
	__property bool MouseDragging = {read=FMouseDragging, write=FMouseDragging, default=1};
	__property bool MouseScaling = {read=FMouseScaling, write=FMouseScaling, default=0};
	__property ParentShowHint ;
	__property Graphics::TPicture* Picture = {read=FPicture, write=SetPicture};
	__property bool PictureBuffer = {read=FPictureBuffer, write=FPictureBuffer, default=1};
	__property PopupMenu ;
	__property bool RectZooming = {read=FRectZooming, write=FRectZooming, default=1};
	__property double Scale = {read=GetScale, write=SetScale};
	__property ShowHint ;
	__property bool Stretch = {read=FStretch, write=SetStretch, default=0};
	__property Visible ;
	__property Classes::TNotifyEvent OnChangeScale = {read=FOnChangeScale, write=FOnChangeScale};
	__property Classes::TNotifyEvent OnPictureMove = {read=FOnPictureMove, write=FOnPictureMove};
	__property OnClick ;
	__property OnContextPopup ;
	__property OnDblClick ;
	__property OnDragDrop ;
	__property OnDragOver ;
	__property OnEndDrag ;
	__property OnMouseDown ;
	__property OnMouseMove ;
	__property OnMouseUp ;
	__property Classes::TNotifyEvent OnPaint = {read=FOnPaint, write=FOnPaint};
	__property Graphics::TProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
	__property OnStartDrag ;
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TSGDrawingNavigator(HWND ParentWindow) : TsgCustomControl(
		ParentWindow) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint iMinPicSize = 0x2;
static const Shortint iScrollSmallChange = 0x4;
#define mmPerInch  (2.540000E+01)
static const Word iMaxNonWinNTDim = 0x7fff;
static const int iMaxWinNTDim = 0x20dfffff;
extern PACKAGE void __fastcall CorrectRect(Windows::TRect &ARect);

}	/* namespace Sgdrawingnavigator */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Sgdrawingnavigator;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// SGDrawingNavigator
