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

  1. /* Copyright 1989 GROUPE BULL -- See licence conditions in file COPYRIGHT */
  2. #include <stdio.h>
  3. #include "couche.h"    /* myEvent */
  4. #include "edit.h"     /* MODBACK .. NOCONSTRAINT ..*/
  5. #include "clientimage.h"
  6. #include "fedor.h"
  7. extern char * strcpy() ;
  8. extern char * strcat() ;
  9.  
  10. extern fedchar cartrav;
  11. extern modcolor ;
  12. extern modepoint ;
  13. extern CurColor ;
  14.  
  15. static Apoint(x,y)
  16.     int x,y ;
  17. {    int color ;
  18.     if ((color = Adjpoint(x,y))!= -1) Carpoint(x,y,color) ;
  19. }
  20.  
  21. Autom_point (pev)
  22.     myEvent * pev ; 
  23. {   static short etat ;
  24.     static int a,b,x,y,xi,yi ;     /* coords courantes et prec en 0-128 */
  25.     char s[10] ;
  26.     
  27.     switch (pev->type) {
  28.     case EnterZone : strcpy(s,(modepoint==XCONSTRAINT)?"x":
  29.                   (modepoint==YCONSTRAINT)?"y":"");
  30.              strcat(s,(modcolor==MODBACK)?"Erase":
  31.                   (modcolor==MODINV)?"Inverse":"Color");
  32.              Afficher_boutons(s,"Select");
  33.              break ;
  34.     case ButtonPressed :
  35.             etat = 1 ;
  36.             xi = x = convert(pev->x) ;
  37.             yi = y = convert(pev->y) ;
  38.             if (pev->click == 1) Apoint(x,y) ;
  39.                       else {
  40.                 CurColor = Rast_Inq(cartrav.image,x,y) ;
  41.                 Afficher_colors() ;  /* sur fenetre tr_edit */
  42.               }
  43.             break ;
  44.     case ButtonReleased : etat = 0 ;
  45.              Aff_all() ;
  46.                   break ;
  47.     case MoveMouse : if (etat) {
  48.                 if (modepoint == NOCONSTRAINT) {
  49.                     a = convert(pev->x) ;
  50.                     b = convert(pev->y) ;
  51.                     if ( (x!=a) || (y!=b)) Apoint(a,b) ;
  52.                 } else
  53.                 if (modepoint == XCONSTRAINT) {
  54.                 b = convert(pev->y) ;
  55.                     if (y!=b) Apoint(xi,b) ;
  56.                 } else
  57.                 if (modepoint == YCONSTRAINT) {
  58.                 a = convert(pev->x) ;
  59.                     if (x!=a) Apoint(a,yi) ;
  60.                 }
  61.                 x = a ; y = b ;
  62.              }
  63.              break ;                
  64.     case LeaveZone : 
  65.         Afficher_boutons("","");
  66.             Afficher_numview(-1,-1) ; /* restaure le gris */
  67.         break ;
  68.     case CloseWindow : break ;                
  69.     }
  70.