home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / ACS_PRO.LZH / ASC / UOEDIT / UOROTSTR.C < prev    next >
C/C++ Source or Header  |  1992-12-07  |  3KB  |  136 lines

  1. /*
  2.  *        (c) 1991 Stefan Bachert
  3.  *
  4.  *        ACS                            Application Construction System
  5.  *
  6.  *        MODULE:                    UOROTSTR
  7.  *
  8.  *        REVISION:                7 DEC 1992
  9.  *
  10.  *        DESCRIPTION:        Userdefined Objecte
  11.  *                                        
  12.  *                                        Rotierter String
  13.  *                                        
  14.  */
  15.  
  16. /*
  17.  * IMPORT / EXPORT Section
  18.  */
  19.  
  20.  
  21. #    include        "string.h"
  22. #    include        "acs.h"
  23.  
  24. /*
  25.  *        Local Defines
  26.  */
  27.  
  28. /*
  29.  *        Local Types
  30.  */
  31.  
  32. /*
  33.  *        Local Prototypes
  34.  */
  35.  
  36. /*
  37.  *        Local Vars & exported const or initialize
  38.  */
  39.  
  40. /*
  41.  *        Modul Initializiation/Termination
  42.  */
  43.  
  44. /*
  45.  *        Functions
  46.  */
  47.  
  48.  
  49. INT16 CDECL A_rotstr (PARMBLK *pb)
  50.         /*
  51.          *        Zeichnet einen Rotierten String
  52.          */
  53. {
  54.     INT16 pxy [4];
  55.     INT16 temp, width, height, chg;
  56.     INT16 x, y, len;
  57.     AUSERBLK *user;
  58.     OBJECT* entry;
  59.     char *string;
  60.  
  61.     pxy [2] = pb-> pb_wc;
  62.     pxy [3] = pb-> pb_hc;
  63.     if (pxy [2] || pxy [3]) {                        /* klippe */
  64.         pxy [0] = pb-> pb_xc;
  65.         pxy [1] = pb-> pb_yc;
  66.         pxy [2] += pxy [0] - 1;
  67.         pxy [3] += pxy [1] - 1;
  68.         vs_clip (vdi_handle, TRUE, pxy);
  69.     };
  70.  
  71.     chg = (pb-> pb_currstate ^ pb-> pb_prevstate);
  72.     if (chg == 0) {
  73.         entry = pb-> pb_tree + pb-> pb_obj;
  74.         user = (AUSERBLK *) entry-> ob_spec. userblk;
  75.         string = user-> ub_ptr1;
  76.         if (string == NULL) return 0;
  77.         if (pb-> pb_parm & 4) {
  78.             vswr_mode (vdi_handle, MD_REPLACE);
  79.         } else {
  80.             vswr_mode (vdi_handle, MD_TRANS);
  81.         }
  82.         vst_font (vdi_handle, 1);
  83.         vst_height (vdi_handle, gl_hchar, &temp, &temp, &width, &height);
  84.         vst_color (vdi_handle, BLACK);
  85.         vst_alignment (vdi_handle, 0, 5, &temp, &temp);
  86.         vst_effects (vdi_handle, 0);
  87.  
  88.         len = (INT16) strlen (string) * width;
  89.         switch ((INT16) (pb-> pb_parm & 3)) {
  90.         case 0:        /*   0 */
  91.             vst_rotation (vdi_handle, 0);
  92.             x = pb-> pb_x + ((pb-> pb_w - len) >> 1);
  93.             y = pb-> pb_y + ((pb-> pb_h - height) >> 1);
  94.             break;
  95.         case 1:        /*  90 */
  96.             vst_rotation (vdi_handle, 900);
  97.             x = pb-> pb_x + ((pb-> pb_w - height) >> 1);
  98.             y = pb-> pb_y + ((pb-> pb_h + len) >> 1) - 1;
  99.             break;
  100.         case 2:        /* 180 */
  101.             x = pb-> pb_x + ((pb-> pb_w + len) >> 1) - 1;
  102.             y = pb-> pb_y + ((pb-> pb_h + height) >> 1) - 1;
  103.             vst_rotation (vdi_handle, 1800);
  104.             break;
  105.         case 3:        /* 270 */
  106.             vst_rotation (vdi_handle, 2700);
  107. /*        vst_rotation (vdi_handle, -900);    */
  108.             x = pb-> pb_x + ((pb-> pb_w + height) >> 1) - 1;
  109.             y = pb-> pb_y + ((pb-> pb_h - len) >> 1);
  110.             break;
  111.         };
  112.         v_gtext (vdi_handle, x, y, string);
  113.     }
  114.  
  115.     if ((chg == 0 && pb-> pb_currstate & SELECTED) ||
  116.              chg & SELECTED) {                                            /* selectiert */
  117.         if (chg == 0) {                                                        /* selectiert */
  118.             vswr_mode (vdi_handle, MD_REPLACE);
  119.         } else {
  120.             vswr_mode (vdi_handle, MD_XOR);
  121.         }
  122.         vsf_interior (vdi_handle, FIS_SOLID);
  123.         vsf_color (vdi_handle, BLACK);
  124.         pxy [0] = pb-> pb_x;
  125.         pxy [1] = pb-> pb_y;
  126.         pxy [2] = pxy [0] + pb-> pb_w - 1;
  127.         pxy [3] = pxy [1] + pb-> pb_h - 1;
  128.         vsf_perimeter (vdi_handle, FALSE);
  129.         v_bar (vdi_handle, pxy);
  130.     };
  131.  
  132.     vs_clip    (vdi_handle, FALSE, pxy);                /* klippen ausschalten */
  133.     return (pb-> pb_currstate & ~(SELECTED));
  134. }
  135.  
  136.