home *** CD-ROM | disk | FTP | other *** search
Wrap
/* @N This Genie will reposition all the objects in the current selection. Objects will be spaced out by a user-specified distance. Distance can be set between left, right, top, or bottom edges, object centers, or objects. */ msg = PDSetup.rexx(2,0) units = getclip(pds_units) if msg ~= 1 then exit_msg(msg) cr = '0a'x signal on halt signal on break_c signal on break_e signal on break_d if pdm_NumSelObjs() = 0 then exit_msg("Please select a group of objects first") hspacing = "Left"cr"Right"cr"Centers"cr"_Objects"cr"None" vspacing = "Top"cr"Bottom"cr"Centers"cr"_Objects"cr"None" hspacing = pdm_SelectFromList("Horizontal Spacing..", 15, 5, 2, hspacing) if hspacing = '' then exit_msg() vspacing = pdm_SelectFromList("Vertical Spacing..", 15, 5, 2, vspacing) if vspacing = '' then exit_msg() vdist = 0 hdist = 0 if hspacing ~= "None" then do string = hspacing if hspacing="Left" | hspacing="Right" then do string = hspacing" edges" end hdist = pdm_GetForm( "Enter Horizontal Spacing", 8, "Between "string) if hdist = '' then exit_msg() if hdist < 0 then exit_msg() if ~datatype(hdist, n) then call exit_msg("Invalid Input") if units = 3 then hdist = pdm_ConvertUnits(3, 1, hdist) end if vspacing ~= "None" then do string = vspacing if vspacing="Top" | vspacing="Bottom" then do string = vspacing" edges" end vdist = pdm_GetForm( "Enter Vertical Spacing", 8, "Between "string) if vdist = '' then exit_msg() if vdist < 0 then exit_msg() if ~datatype(vdist, n) then call exit_msg("Invalid Input") if units = 3 then vdist = pdm_ConvertUnits(3, 1, vdist) end /****change to getSelRect*****/ grouprect = pdm_GetObjPosn(pdm_SelFirstObj()) groupleft = word(grouprect, 1) grouptop = word(grouprect, 2) hspace = "hpos = hpos + hdist" vspace = "vpos = vpos + vdist" vpos = grouptop hpos = groupleft if vspacing = "Top" then vstring = "vpos" else if vspacing = "Bottom" then vstring = "vpos - height" else if vspacing = "Centers" then vstring = "vpos - .5 * height" else if vspacing = "Objects" then do vstring = "vpos" vspace = "vpos = vpos + height + vdist" end else do vstring = "top" vspace = "/**/" end if hspacing = "Left" then hstring = "hpos" else if hspacing = "Right" then hstring = "hpos - width" else if hspacing = "Centers" then hstring = "hpos - .5 * width" else if hspacing = "Objects" then do hstring = "hpos" hspace = "hpos = hpos + width + hdist" end else do hstring = "left" hspace = "/**/" end obj = pdm_SelFirstObj() do while obj ~= 0 objpos = pdm_GetObjPosn(obj) left = word(objpos, 1) top = word(objpos, 2) objsze = pdm_GetObjSize(obj) width = word(objsze, 1) height = word(objsze, 2) interpret "x = "hstring interpret "y = "vstring call pdm_SetObjPosn(obj, x, y) interpret hspace interpret vspace obj = pdm_SelNextObj(obj) end call exit_msg() break_d: break_e: break_c: halt: call exit_msg("User aborted Genie!") exit_msg: procedure expose units do parse arg message if message ~= '' then call pdm_Inform( 1, message, ) if units = 3 then call pdm_SetUnits(3) call pdm_AutoUpdate(1) exit end