home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d925 / donsgenies.lha / DonsGenies / FrenchGenies.lha / Rexx / AligneBoîtesGrille.pprx < prev    next >
Text File  |  1993-08-03  |  3KB  |  119 lines

  1. /*
  2. @BAligneBoîtesGrille @P @I Ecrit et © par Don Cox Août 1992
  3. @IN'est pas du Domaine Publique. Tous Droits Réservés.
  4. Traduit par Fabien Larini le 22/07/93.
  5.  
  6. Ce Génie aligne les coins des boîtes sur le points de la grille.
  7. */                             
  8.  
  9.  
  10. /*BoxesToGrid*/
  11. /* This Genie snaps the corners of the boxes to the nearest grid point.
  12. Written by Don Cox  Aug 92   Copyright but freely usable for non-commercial purposes */
  13.  
  14. /*trace r*/
  15. signal on error
  16. signal on syntax
  17. address command
  18. call SafeEndEdit.rexx()
  19. call ppm_AutoUpdate(0)
  20. cr="0a"x
  21.  
  22. cpage = ppm_CurrentPage()
  23. counter=0
  24.  
  25. choice = ppm_Inform(2,"Quelle(s) Boîte(s) ?","Toutes Celles de la Page","Sélection de la (des) Boîte(s)")
  26.  
  27. select
  28. when choice = 1 then do
  29.     do forever
  30.         box=ppm_ClickOnBox("Clickez sur les Boîtes à Repositionner")
  31.         if box=0 then break
  32.         counter=counter+1
  33.         boxes.counter=box
  34.         call ppm_SelectBox(box)
  35.         end
  36.     end
  37.  
  38. when choice = 0 then do
  39.     boxes.1 = ppm_PageFirstBox()
  40.     box = boxes.1
  41.     totalboxes = ppm_NumBoxes(cpage)
  42.     counter = totalboxes
  43.     do i=2 to totalboxes
  44.         box = ppm_PageNextBox(box)
  45.         boxes.i = box
  46.         end
  47.     end
  48.  
  49. otherwise exit_msg()
  50. end
  51.  
  52. if counter=0 then exit_msg("Pas de Boîte Sélectoinnée")
  53. currentunits=ppm_GetUnits()
  54. call ppm_SetUnits(2)
  55.  
  56. gridsize = ppm_GetGridSize()
  57. spacingY = word(gridsize,2)
  58. spacingX = word(gridsize,1)
  59.  
  60.  
  61. call ppm_ShowStatus("Arrangement des Boîtes ...")
  62. do i=1 to counter
  63.     box=boxes.i
  64.  
  65.     Ypos = word(ppm_GetBoxPosition(box),2)
  66.     Xpos = word(ppm_GetBoxPosition(box),1)
  67.     oddbit = Ypos//spacingY
  68.     if oddbit<= spacingY/2 then Ypos = Ypos-oddbit
  69.     else Ypos = Ypos+spacingY-oddbit
  70.     oddbit = Xpos//spacingX
  71.     if oddbit<= spacingX/2 then Xpos = Xpos-oddbit
  72.     else Xpos = Xpos+spacingX-oddbit
  73.     call ppm_SetBoxPosition(box,Xpos,Ypos)
  74.  
  75.     width = word(ppm_GetBoxSize(box),1)
  76.     height = word(ppm_GetBoxSize(box),2)
  77.     oddbit = height//spacingY
  78.     if oddbit<= spacingY/2 then newheight = height-oddbit
  79.     else newheight = height+spacingY-oddbit
  80.     oddbit = width//spacingX
  81.     if oddbit<= spacingX/2 then newwidth = width-oddbit
  82.     else newwidth = width+spacingX-oddbit
  83.     call ppm_SetBoxSize(box,newwidth,newheight)
  84.  
  85.     info = ppm_GetBoxInfo(box)
  86.     boxtype = word(info,1)
  87.     if upper(boxtype) = "CLIP" | upper(boxtype) = "VECTORISÉ" then do
  88.         scales = ppm_GetBoxScale(box)
  89.         Xscale = word(scales,1)
  90.         Yscale = word(scales,2)
  91.         call ppm_SetBoxScale(box, Xscale*(newwidth/width), Yscale*(newheight/height))
  92.         end
  93.  
  94.     end
  95.  
  96. call ppm_SetUnits(currentunits)
  97.  
  98. call exit_msg()
  99. end
  100.  
  101.  
  102.  
  103. error:
  104. syntax:
  105.     do
  106.     call exit_msg("Arrêté par l'Utilisateur")
  107.     end
  108.  
  109. exit_msg:
  110.     do
  111.     parse arg message
  112.     if message ~= "" then
  113.     call ppm_Inform(1,message,)
  114.     call ppm_ClearStatus()
  115.     call ppm_AutoUpdate(1)
  116.     exit
  117.     end
  118.  
  119.