Util-Get Page Origin

From Vectorlab
Jump to: navigation, search


Function to get the page origin of a given layer. By Orso B. Schmid


{ Orso ************************************************ }
{ gets page origin }
FUNCTION U_GetPageOrigin(layH : HANDLE): POINT;
	VAR
		userLayer: STRING;
		laySc, pageScalingFact : REAL;
	BEGIN
		IF layH <> NIL THEN BEGIN
			BeginContext;
			userLayer := GetLName(ActLayer);
			
			{ if is not active layer, activate layH, because of pageScalingFact }
			IF (GetLayerByName(GetLName(layH)) <> NIL) & (layH <> ActLayer) THEN
				Layer(GetLName(layH));
				
			laySc := GetLScale(ActLayer);
			pageScalingFact := GetPrefReal(70); { drawing's scaling factor }
			
			U_GetPageOrigin.x := GetPrefReal(80) * laySc * pageScalingFact;
			U_GetPageOrigin.y := -GetPrefReal(81) * laySc * pageScalingFact;
			
			Layer(userLayer);
			EndContext(0);
		END;
	END;