home *** CD-ROM | disk | FTP | other *** search
/ DTP Toolbox / DTPToolbox.iso / propage4.0 / arexx / colourchart.pprx < prev    next >
Encoding:
Text File  |  1995-05-07  |  4.4 KB  |  110 lines

  1. /*
  2. This genie will make a colour chart showing all the colours in the current palette. Note that starting a new document sets the palette back to the basic set. Pro Page and Pro Draw palette files are interchangeable.
  3. To load in a and make a chart of a palette, start a new document, select "Fill Color" from the "Draw" menu, and select one of the ProDraw palettes provided, or one you have created and saved.
  4. If you load in the PantoneColorsCV palette, you can print out a chart showing how all the ProPage selection of Pantone colours appears on your printer. This is NOT a proper book of Pantone samples, but a test of your printer, printer driver, and paper. However, it may be useful for reference.
  5. A chart of Focoltone colours will not show the relationships between the colours, which are the heart of the Focoltone system. To see these you will need the original Focoltone charts.
  6. Written by Don Cox ©1995. Not public domain.
  7. */
  8. /* $VER: ColourChart May 95 */
  9.  
  10. /*call open("STDERR","ram:traceCC","W")
  11. trace r*/
  12.  
  13. cr = '0a'x
  14. call SafeEndEdit.rexx()
  15. call ppm_AutoUpdate(0)
  16. oldunits = ppm_GetUnits()
  17. call ppm_SetUnits(2)
  18. cmode = ppm_GetColorMode()
  19. call ppm_SetColorMode(0)
  20.  
  21. prevdoc  = ppm_GetDocName()
  22. if ppm_DocChanged() then
  23. do
  24.     if ppm_SavedDate() = "Not Saved" then prevdoc = ""
  25.     if ppm_Inform(2, "You must save the current document first. Should I save and continue?", "Cancel", "Ok") then
  26.                 call ppm_SaveDocument(prevdoc)
  27.     else
  28.             exit_msg("Aborted by User")
  29.     prevdoc = ppm_GetDocName()
  30. end
  31.  
  32.  
  33. colorlist = ppm_GetColorList()
  34. parse var colorlist numcolors '0a'x colorlist
  35. formstring = "Rows:6"||cr||"Columns:4"||cr|| "Page width (mm):210"||cr||"Page height (mm):297"||cr||"Margin (mm):20"
  36. form = ppm_GetForm("Set sizes",12,formstring)
  37. if form = "" then exit_msg("Aborted by User")
  38. parse var form Rows '0a'x Columns '0a'x Pagewidth '0a'x Pageheight '0a'x margin
  39.  
  40. PageWidth = PageWidth/10
  41. PageHeight = PageHeight/10
  42. margin= margin/10
  43. UsedWidth = PageWidth-(margin*2)
  44. UsedHeight = PageHeight-(margin*2)
  45. SampleWidth = (UsedWidth*4)/((Columns*4)+(Columns-1)) /* 4 because gap is 1/4 of width; -1 because 1 less gaps than columns  */
  46. SampleHeight = (UsedHeight*3)/((Rows*3)+(Rows)) /* Same number of gaps as rows, because gaps are text boxes */
  47. SampleArea = SampleWidth*SampleHeight
  48. TextHeight = SampleHeight*0.6 /* text box */
  49. FontSize = 10*((SampleWidth+SampleHeight)/6) /* Arbitrary formula - bigger type for bigger samples */
  50. FontSize = max(FontSize,6)
  51. FontSize = ppm_SetSize(FontSize)
  52.  
  53. Sampleheight2 = Sampleheight*1.333 /* including spacing */
  54. Samplewidth2 = Samplewidth * 1.25
  55.  
  56. SamplesPerPage = rows*columns
  57. Pages = numcolors % SamplesPerPage
  58. Leftover = numcolors // SamplesPerPage
  59. if Leftover>0 then Pages = Pages+1
  60.  
  61. message = "  Making colour chart: page 1 of "pages
  62. call ppm_ShowStatus(message)
  63.  
  64. thispage = ppm_DocLastPage()
  65. lastpage = thispage
  66. if thispage = 0 then thispage = ppm_CreatePage(1,1,1,1,0)
  67. do i=1 to pages
  68. /* Create a new page without adding a blank page at end of document */
  69.     newpage = ppm_CreatePage(thispage,1,1,0,0)
  70.     newpage = ppm_MovePage(newpage+1,newpage)
  71.     thispage = ppm_GoToPage(newpage+1)
  72.     call ppm_SetPageSize(thispage, Pagewidth, Pageheight)
  73.     do j= 1 to rows
  74.         ypos = margin+(SampleHeight2*(j-1))
  75.         message = "  Making colour chart: page "i" of "pages", row "j" of "rows" ..."
  76.         call ppm_ShowStatus(message)
  77.         do k= 1 to columns
  78.             xpos = margin+(Samplewidth2*(k-1))
  79.             parse var colorlist thiscolor '0a'x colorlist
  80.             if thiscolor ~="" then do
  81.                 box = ppm_CreateBox(xpos, ypos, Samplewidth, Sampleheight,0)
  82.                 call ppm_SetBoxFrameData(box, "Black", thiscolor, 2,1,1)
  83.                 call ppm_SetBoxFrame(box,1)
  84.                 TextTop = ypos+(SampleHeight*1.05)
  85.                 box = ppm_CreateBox(xpos, TextTop,SampleWidth, TextHeight,0)
  86.                 call ppm_SetBoxFrame(box,0)
  87.                 if right(thiscolor,2) = "CV" then do
  88.                     thiscolor = strip(thiscolor,"t","V")
  89.                     thiscolor = strip(thiscolor,"t", "C")
  90.                     end
  91.                 overflow = ppm_TextIntoBox(box, thiscolor)
  92.                 end
  93.             end
  94.         end
  95.     end
  96.  
  97. if lastpage = 0 then numgone = ppm_DeletePage(1,1)
  98.  
  99. exit_msg:
  100. do
  101. parse arg message
  102.     if message ~= '' then
  103.     call ppm_Inform(1, message,"Resume" )
  104.     call ppm_ClearStatus()
  105.     call ppm_SetUnits(oldunits)
  106.     call ppm_SetColorMode(cmode)
  107.     call ppm_AutoUpdate(1)
  108.     exit
  109. end
  110.