home *** CD-ROM | disk | FTP | other *** search
- /*
- @N
- This Genie will scale the current selection to a user specified size.
- */
-
- parse arg obj, nwidth, nheight
-
- msg = PDSetup.rexx(2,0)
- units = getclip(pds_units)
- if msg ~= 1 then exit_msg(msg)
-
- if obj = '' then
- do
- obj = pdm_SelFirstObj()
- if obj = 0 then
- do
- obj = pdm_ClickOnObj("Click on object to be scaled")
- if obj = 0 then exit_msg()
- call pdm_SelectObj(obj)
- end
-
- objsize = pdm_GetObjVisSize()
- width = word(objsize, 1)
- height = word(objsize, 2)
-
- if units = 3 then
- do
- nwidth = pdm_ConvertUnits(1,3,nwidth)
- width = pdm_ConvertUnits(1,3,width)
- end
-
-
- size = pdm_GetForm("Enter new dimensions..", 8, "Width:"width || '0a'x || "Height:"height)
- if size = '' then exit_msg()
-
- parse var size nwidth '0a'x nheight
-
- if ~(datatype(nwidth, n) & datatype(nheight, n)) then
- exit_msg("Invalid entry")
-
- if units = 3 then
- do
- nwidth = pdm_ConvertUnits(units, 1, nwidth)
- nheight = pdm_ConvertUnits(units, 1, nheight)
- end
-
- end
- else
- do
- objsize = pdm_GetObjVisSize()
- width = word(objsize, 1)
- height = word(objsize, 2)
- end
-
- objpos = pdm_GetObjPosn(obj)
- left = word(objpos, 1)
- top = word(objpos, 2)
-
-
- xscale = nwidth/width
- yscale = nheight/height
-
- call pdm_ScaleObj(, xscale, yscale, left, top)
-
- exit_msg()
-
- exit_msg: procedure expose units
- do
- parse arg message
-
- if message ~= "" then call pdm_Inform(1,message,)
- call pdm_SetUnits(units)
- exit
- end