home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0925.lha / DonsGenies / FrenchGenies.lha / Rexx / PagesAutomatiques.pprx < prev    next >
Text File  |  1993-08-03  |  3KB  |  101 lines

  1. /*
  2. @BPagesAutomatiques @P @I Ecrit et ⌐ par Don Cox juillet 1993
  3. @IN'est pas du Domaine Publique. Tous Droits RΘservΘs.
  4. Traduit par Fabien Larini le 29/07/93.
  5.  
  6. Ce GΘnie crΘe le nombre nΘcessaire de pages pour pouvoir faire rentrer 
  7. un texte qui est trop grand pour sa boεte. Il est conτu pour Ωtre utilisΘ
  8. pour des mises en page simples. Il sous remplis plut⌠t que de faire 
  9. dΘborder. Il rajoute une boεte contenant le numΘro de page en bas de la 
  10. page.
  11. */
  12.  
  13.  
  14. /* This Genie will make the necessary number of new pages to accommodate an
  15. article which is currently overflowing its box. It is intended for use with
  16. simple essays and the like, not complex layouts. I have set the genie to
  17. underflow rather than overflow.
  18. Written by Don Cox   July 93  Not Public Domain. All rights reserved. */
  19.  
  20. trace n
  21.  
  22. signal on error
  23. signal on syntax
  24. address command
  25.  
  26. call SafeEndEdit.rexx()
  27. call ppm_AutoUpdate(0)
  28. fsize = ppm_GetSize()
  29. cr="0a"x
  30. currentunits=ppm_GetUnits()
  31. call ppm_SetUnits(2)
  32.  
  33. cpage = ppm_CurrentPage()
  34. psize = ppm_GetPageSize(cpage)
  35. pagewidth = word(psize,1)
  36. pageheight = word(psize,2)
  37. numberbox = ppm_CreateBox(pagewidth-6,pageheight-2,3,1,0,)
  38. call ppm_SetSize(12)
  39. overflow = ppm_TextIntoBox(numberbox,"Page \#<Pc0>")
  40.  
  41. box=ppm_ClickOnBox("Clickez dans la boεte contenant le texte")
  42. if box=0 then exit_msg("Pas de Boεte SΘlectionnΘe")
  43. call ppm_SelectBox(box)
  44.  
  45.  
  46. call ppm_ShowStatus("Ajustement du Texte ...")
  47.     
  48. boxtype = upper(word(ppm_GetBoxInfo(box), 1))
  49. if boxtype~="TEXTE" then exit_msg("Cette Boεte ne Contient pas de Texte")
  50. howbig = ppm_GetBoxSize(box)
  51. boxwidth = word(howbig,1)
  52. boxheight = word(howbig,2)
  53. where = ppm_GetBoxPosition(box)
  54. boxX = word(where,1)
  55. boxY = word(where,2)
  56. tilt = ppm_GetBoxAngle(box)
  57. thispage = cpage
  58.  
  59. do 100  /* 100 pages is enough for most purposes - you can always run the genie again */
  60.     call ppm_ShowStatus("Ajustement du Texte ... " )
  61. /* Create a new page without adding a blank page at end of document */
  62.     newpage = ppm_CreatePage(thispage,1,1,0,0)
  63.     newpage = ppm_MovePage(newpage+1,newpage)
  64.     thispage = ppm_GoToPage(newpage+1)
  65.  
  66.     newbox = ppm_CreateBox(boxX, boxY, boxwidth, boxheight, tilt, )
  67.     call ppm_BoxChangePage(newbox,thispage)
  68.     overflow = ppm_LinkBox(box,newbox)
  69.     numberbox = ppm_CloneBox(numberbox,0,0)
  70.     call ppm_BoxChangePage(numberbox,thispage)
  71.     box = newbox
  72.     if newtext="" | overflow = 0  then break 
  73.  
  74.     end
  75.  
  76. newpage = ppm_GoToPage(cpage)
  77. call ppm_SetUnits(currentunits)
  78.  
  79. call exit_msg()
  80. end
  81.  
  82.  
  83. /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  84.  
  85. error:
  86. syntax:
  87.     do
  88.     exit_msg("ArrΩt du GΘnie d√ α l'erreur: "errortext(rc))
  89.     end
  90.  
  91. exit_msg:
  92.     do
  93.     parse arg message
  94.     if message ~= "" then
  95.     call ppm_Inform(1,message,)
  96.     call ppm_ClearStatus()
  97.     call ppm_AutoUpdate(1)
  98.     exit
  99.     end
  100.                               
  101.