home *** CD-ROM | disk | FTP | other *** search
- /*
- @BMakeGuides @P@ICopyright Gold Disk Inc., January, 1992
- This Genie makes a grid of boxes to help layout symmetry.
- */
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
- cr = '0a'x
-
- units = ppm_GetUnits()
- if units = 3 then
- call ppm_SetUnits(1)
-
- signal on halt
- signal on break_c
- signal on break_e
- signal on break_d
- form = "Columns"cr"Rows"cr"Gutter"
- form = ppm_GetForm("Enter Dimensions of Grid", 8, form)
- if form = '' then exit_msg()
- parse var form columns '0a'x rows '0a'x gutter
-
- if columns = '' then columns = 1
- if rows = '' then rows = 1
- if gutter = '' then gutter = 0
-
- if ~(datatype(columns, n) & datatype(rows, n) & datatype(gutter, n)) then
- exit_msg("Invalid entry")
-
- if units = 3 then gutter = ppm_ConvertUnits(3, 1, gutter)
-
- page = ppm_CurrentPage()
-
- if page = 0 then
- exit_msg("Create Page First")
-
- margins = ppm_GetPageMargins(page)
- psize = ppm_GetPageSize(page)
- pwidth = word(psize, 1)
- pheight = word(psize, 2)
-
- lmarg = word(margins, 1)
- rmarg = pwidth - word(margins, 2)
- tmarg = word(margins, 3)
- bmarg = pheight - word(margins, 4)
-
- csep = (rmarg - lmarg) / columns
- cwidth = max((csep - gutter), gutter)
- rheight = (bmarg - tmarg)/ rows
- oldlc = ppm_GetLineColor()
- call ppm_SetLineColor("Cyan")
- call ppm_SetLineWeight(0.01)
- call ppm_SetFillPattern(0)
-
- call ppm_ShowStatus("Working")
-
- call ppm_NewGroup()
- firstbox = ppm_DrawRect(lmarg, tmarg, lmarg + cwidth, tmarg + rheight)
- call ppm_AddToGroup(firstbox)
-
- call ppm_SetBoxFrame(firstbox, 0)
- call ppm_SetBoxFrameData(firstbox, "cyan", "white", .01, 0, 0)
-
- col = 2
- xoffset = csep
- yoffset = 0
-
- do i = 1 to rows
-
- do while col <= columns
-
- box = ppm_CloneBox(firstbox, xoffset, yoffset)
- xoffset = xoffset + csep
- col = col + 1
- call ppm_AddToGroup(box)
-
- end
-
- yoffset = yoffset + rheight
- xoffset = 0
- col = 1
-
- end
-
- call ppm_SetLineColor(oldlc)
- box = ppm_MergeGroup()
- call ppm_BoxToBack(box)
- call ppm_SetBoxLock(box, 1)
- call ppm_SetBoxName(box, "Grid Lines")
-
- exit_msg()
- break_d:
- break_e:
- break_c:
- halt:
- call exit_msg("User aborted Genie!")
-
- exit_msg: procedure expose units
- do
- parse arg message
-
- call ppm_ClearStatus()
-
- if message ~= '' then
- call ppm_Inform(1, message,)
-
- if units = 3 then call ppm_SetUnits(3)
- call ppm_ClearStatus()
- call ppm_AutoUpdate(1)
- exit
- end
-