home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / xfedor.zip / XFree86 / src / xfedor / ed_rect.c < prev    next >
C/C++ Source or Header  |  1999-03-02  |  2KB  |  68 lines

  1. /* Copyright 1989 GROUPE BULL -- See licence conditions in file COPYRIGHT */
  2. #include <stdio.h>
  3. #include "couche.h"    /* myEvent */
  4. #include "style.h"    /* NORMAL .. */
  5.  
  6. extern          editresol;
  7.  
  8. static CarRect(xorig,yorig,xfin,yfin,click)
  9.     int xorig,yorig,xfin,yfin ;
  10.     int click ;
  11. {        
  12.     register int bit,i,j,x1,y1,x2,y2;
  13.  
  14.     x1 = Min(xorig,xfin) ; 
  15.     x2 = Max(xorig,xfin) ;
  16.     y1 = Min(yorig,yfin) ; 
  17.     y2 = Max(yorig,yfin) ;
  18.     if (click==1) {     /* contour */
  19.         for(i=x1; i<=x2 ; i++) Adjpoint(i,y1) ;
  20.         for(j=y1; j<=y2 ; j++) {
  21.             Adjpoint(x1,j) ;
  22.             Adjpoint(x2,j) ;
  23.         }
  24.         for(i=x1; i<=x2 ; i++) Adjpoint(i,y2) ;
  25.     } else     /*  plein */
  26.         for(i=x1; i<=x2 ; i++) 
  27.            for(j=y1; j<=y2 ; j++)     Adjpoint(i,j) ;
  28.         CarFen();
  29.     Aff_all();
  30. }
  31.  
  32.  
  33. Autom_rect (pev)
  34.     myEvent * pev ; 
  35. {   static int x,y ;
  36.     short           pas = (512 / editresol);
  37.     
  38.     switch (pev->type) {
  39.     case EnterZone : Afficher_boutons("OUTSIDE","FILLED");
  40.              x = -1 ;
  41.              break ;
  42.     case ButtonPressed : if (x == -1) {
  43.                 Afficher_boutons("ENDRECT","ENDRECT");
  44.                      x = pev->x ; 
  45.                      y = pev->y ; 
  46.                      stylesouris(FIXRECT,x,y);
  47.                  }
  48.                  break ;
  49.     case ButtonReleased : stylesouris(NORMAL,0,0);
  50.                   Afficher_boutons("OUTSIDE","FILLED");
  51.                   if (x != -1) {Dodo();
  52.                         CarRect(convert(x),
  53.                                convert(y),
  54.                                convert(pev->x),
  55.                                convert(pev->y),
  56.                                pev->click);
  57.                   }
  58.                   x = -1 ;
  59.                   break ;
  60.     case MoveMouse : break ;                
  61.     case CloseWindow : break ;                
  62.     case LeaveZone : stylesouris(NORMAL,0,0);
  63.                  Afficher_numview(-1,-1) ; /* restaure le gris */
  64.              Afficher_boutons("","");
  65.              break ;
  66.     }
  67.