home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / fish / 911-930 / ff925 / donsgenies / frenchgenies.lha / Rexx / RemplaceBoîtesSurPages.pprx < prev    next >
Text File  |  1993-08-03  |  3KB  |  122 lines

  1. /*
  2. @BRemplaceBoîtesSurPages @P @I Ecrit par et © Don Cox en mai 1992
  3. @IN'est pas du Domaine Publique. Tous Droits Réservés.
  4. Traduit par Fabien Larini le 24/07/93.
  5.  
  6. Ce Génie remplace toute les boîtes à une position donnée sur un ensemble
  7. de pages. Il vous demande de sélectionner la boîte qui détermine
  8. la position des boîtes à échanger et qui sera copiée à la place de celles
  9. qui auront le même emplacement au niveau du coin supérieur gauche.
  10. Le contenu des boîtes qui sont remplacées est perdu.
  11. */
  12.  
  13.  
  14. /*
  15. ReplaceBoxesOnPages
  16.  
  17. This Genie will replace each box at a particular position on a range of pages. You will be prompted to select the box which occurs at a position on the range of pages.
  18. The box you click on will replace all boxes in the page range which are in exactly the same position, as defined by the top left corner.
  19. Written by Don Cox  May '92
  20. */
  21. cr = '0a'x
  22. pageopts = "GCHESDRTESTOUTES"
  23. address command
  24. call SafeEndEdit.rexx()
  25. call ppm_AutoUpdate(0)
  26. counter = 0
  27.  
  28. signal on error
  29. signal on syntax
  30.  
  31.  
  32.  
  33. boxpos  = ppm_GetClickPosition("Clickez dans la Boîte à Copier sur chaque Pages")
  34. originalpage = ppm_CurrentPage()
  35. boxtop  = word(boxpos, 2)
  36. boxleft = word(boxpos, 1)
  37. box = ppm_BoxAtPosn(boxleft, boxtop)
  38. if box  = 0 then exit_msg()
  39.  
  40. if upper(word(ppm_GetBoxInfo(box), 1)) = "TEXTE" & ppm_TextOverFlow(box) then
  41.     text = ppm_GetArticleText(box,1)
  42. else
  43.     text = ''
  44.  
  45.  
  46. docstart = ppm_DocFirstPage()
  47. docend = ppm_DocLastPage()
  48. pages = upper(ppm_GetForm("Sur quelles Pages ?", 20, "De la Page :"docstart'0a'x "A la  Page :"docend'0a'x "GCHES/DRTES/TOUTES"))
  49. if pages = '' then exit_msg()
  50.  
  51. parse var pages startpage '0a'x endpage '0a'x pageopt
  52.  
  53. if (startpage ~= '' & datatype(startpage) ~= NUM) | (endpage ~= '' & datatype(endpage) ~= NUM ) then exit_msg("Données Invalides")
  54.  
  55. increment = 1
  56.  
  57. /*
  58.  *  Check error conditions
  59.  */
  60. if startpage < docstart then exit_msg('Intervale Incorrect')
  61. else if startpage > docend then exit_msg('Intervale Incorrect')
  62. if endpage < docstart then exit_msg('Intervale Incorrect')
  63. else if endpage > docend then exit_msg('Intervale Incorrect')
  64. if endpage < startpage then exit_msg('Intervale Incorrect')
  65.  
  66. if (pageopt = 'TOUTES' | pageopt = 'T' | pageopts = "") then
  67. do
  68.     increment = 1
  69. end
  70. else if pageopt = 'GCHES' | pageopt = 'G' then
  71. do
  72.     increment   = 2
  73.     if (startpage // 2) then startpage = startpage + 1
  74. end
  75. else if pageopt = 'DRTES' | pageopt = 'D' then
  76. do
  77.     increment   = 2
  78.     if ~(startpage // 2) then startpage = startpage + 1
  79. end
  80.  
  81.  
  82. if startpage > endpage then
  83. do
  84.     temp    = startpage
  85.     startpage   = endpage
  86.     endpage = temp
  87. end
  88.  
  89.  
  90. do page = startpage to endpage by increment
  91. if page ~= originalpage then do
  92.     call ppm_ShowStatus("Travail en cours sur la Page "page)
  93.     deadbox = ppm_BoxAtPosn(boxleft,boxtop,page)
  94.     if deadbox ~= 0 then do
  95.         newbox  = ppm_CloneBox(box, 0, 0)
  96.         call ppm_BoxChangePage(newbox, page)
  97.         if text ~= '' then do
  98.             call ppm_DeleteContents(newbox)
  99.             call ppm_TextIntoBox(newbox, text)
  100.         end
  101.  
  102.         gone = ppm_DeleteBox(deadbox)
  103.     end
  104. end
  105.  
  106. end
  107.  
  108. exit_msg()
  109.  
  110. exit_msg: procedure
  111. do
  112.     parse arg message
  113.  
  114.     if message ~= '' then
  115.         call ppm_Inform(1,message,)
  116.  
  117.     call ppm_ClearStatus()
  118.     call ppm_AutoUpdate(1)
  119.     exit
  120. end
  121.  
  122.