home *** CD-ROM | disk | FTP | other *** search
- /*
- @BSetPageSize @P@ICopyright Gold Disk Inc., January, 1992
-
- This genie will set the page size for a range of pages.
- */
- cr = '0a'x
- pageopts = "OODDEEVENAALL"
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
-
- 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
-
- cpage = ppm_CurrentPage()
- last = ppm_DocLastPage()
- pagesize = ppm_GetPageSize(cpage)
- pwidth = word(pagesize, 1)
- pheight = word(pagesize, 2)
-
- if units = 3 then
- do
- form = "Page Width:" || ppm_ConvertUnits(1, 3, pwidth) || cr"Page Height:" || ppm_ConvertUnits(1, 3, pheight) || cr"Start Page:"cpage ||cr"End Page:"last ||cr"ODD/EVEN/ALL"
- end
- else
- form = "Page Width:"pwidth||cr"Page Height:"pheight||cr"Start Page:"cpage||cr"End Page:"last||cr"ODD/EVEN/ALL:"ALL
-
- form = upper(ppm_GetForm("Enter Info", 12, form))
- if form = '' then call exit_msg()
- parse var form width '0a'x height '0a'x startpage '0a'x endpage '0a'x pageopt
-
- if pageopt = '' then pageopt = "ALL"
-
- if ~(datatype(width, n) & datatype(height, n) & datatype(startpage, n) & datatype(endpage, n)) | pos(pageopt, pageopts) = 0 then
- call exit_msg("Invalid Entry")
-
- if units = 3 then
- do
- width = ppm_ConvertUnits(3,1, width)
- height = ppm_ConvertUnits(3,1, height)
- end
-
- first = ppm_DocFirstPage()
- pageopt = left(pageopt,1)
- increment = 1
-
- if pageopt = 'O' then
- do
- increment = 2
- if ~(startpage // 2) then startpage = startpage + 1
- end
- else if pageopt = 'E' then
- do
- increment = 2
- if (startpage // 2) then startpage = startpage + 1
- end
- else if pageopt = 'A' then
- do
- startpage = first
- endpage = last
- end
-
- if (startpage < first) | (startpage > last) | (endpage < first) | (endpage > last) | (width > 48) | (width < 0) | (height > 48) | (height < 0) then
- call exit_msg('Invalid input')
-
- if startpage > endpage then
- do
- temp = startpage
- startpage = endpage
- endpage = temp
- end
-
- page = ppm_GotoPage(startpage)
-
- do i = startpage to endpage by increment
-
- call ppm_SetPageSize(i, width,height)
-
- end
-
- 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 ppm_Inform(1, message,)
- call ppm_ClearStatus()
- call ppm_SetUnits(units)
- call ppm_AutoUpdate(1)
- exit
- end
-