/* Call this when a new image is opened. */

CALL VpWindow window,'SETTITLE', MasterM' - 'in

/* Load from file  Image Editor */
CALL VpImgEdt window,'IMAGE','LOAD',in,''

rc=sysini(INIFile,MasterM,'in',in)


if CoordinateWindowId=0 then nop /* Coordinate window is closed. */
else do
   /* Initiallize coordinate and setup panels. */
   CALL VpSetItemValue CoordinateWindowId,'IMAGE_XY',''
   CALL VpSetItemValue CoordinateWindowId,'DATA_XY' ,''
   end
   
call OpenTransformWindow /* This is a forced call to the Transform menu item.*/

CALL VpSetItemValue TransformWindowID,'IMAGE_ORIGIN_XY',''
CALL VpSetItemValue TransformWindowID,'DATA_ORIGIN_XY' ,''
CALL VpSetItemValue TransformWindowID,'IMAGE_XMAX_XY'  ,''
CALL VpSetItemValue TransformWindowID,'DATA_XMAX'      ,''
CALL VpSetItemValue TransformWindowID,'IMAGE_YMAX_XY'  ,''
CALL VpSetItemValue TransformWindowID,'DATA_YMAX'      ,''
    
/* Get size of image and size of display.  Compute scaling. */
rc=VpImgEdt(window, 'IMAGE', 'GETBMPATTRIBUTES')
PARSE VAR rc ImageSizeX ImageSizeY numcolors
/* Get item size IMAGE Image Editor */
xy=VpItem(window,'IMAGE','ITEMSIZE')
PARSE VAR xy DisplaySizeX DisplaySizeY
   
RatioX=ImageSizeX/DisplaySizeX
RatioY=ImageSizeY/DisplaySizeY
         
/* Initialize some variables. */
zoom        = 65536        /* = scale of 1 */

Xoffset=0
Yoffset=0

DeltaX=-1
DeltaY=-1
