Changeset 2426 in Sophya for trunk/SophyaPI/PI/pigraphgen.cc


Ignore:
Timestamp:
Sep 5, 2003, 5:32:47 PM (22 years ago)
Author:
ansari
Message:

1/ Ajouter caractere d'echappement \ pour les parentheses dans les
chaines de caracteres postscript (fichier psfile.cc)
2/ Ajout variable d'environnement PIXKBMODMASK pour choix touche Alt1
et/ou Alt2 (fichier pixtbase.cc)
3) Correction/implementation trace CompString en vertical (pigraphgen.cc)

Reza - 5 Septembre 2003

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pigraphgen.cc

    r2394 r2426  
    163163//--
    164164
     165inline void compstring_swapcoord( unsigned long txtdir, PIGrCoord& x, PIGrCoord& y)
     166{
     167  if (txtdir != PI_TextDirectionHorizontal) {
     168    PIGrCoord tmp = x;
     169    x = y; y = tmp;
     170  }
     171  return;
     172}
     173
     174inline void compstring_chksgn_dyud( unsigned long txtdir, int & dyu, int & dyd)
     175{
     176  if (txtdir == PI_TextDirectionVerticalDown) {
     177    dyu = -dyu;
     178    dyd = -dyd;
     179  }
     180}
     181inline void compstring_chksgn_dx( unsigned long txtdir, int & dx)
     182{
     183  if (txtdir == PI_TextDirectionVerticalUp)  dx = -dx;
     184}
     185
    165186/* --Methode-- */
    166187void
     
    188209  if (s_dn != NULL) sw_sdn = fnt_ss.GetStringWidth(s_dn);
    189210
    190   PIGrCoord xs,ys;
     211  PIGrCoord xs,ys,xss,yss;
    191212  int posh = pos & PI_HorizontalPosition;
    192213  int posv = pos & PI_VerticalPosition;
     214  unsigned long txtdir = pos&PI_TextDirection;
    193215
    194216  int dyu, dyd;
     
    209231  int deltaposx = ((fh/8) > 0) ? fh/8 : 1;
    210232
     233  // Pour gerer les traces de texte verticaux
     234  compstring_swapcoord(txtdir, x, y);
     235  compstring_chksgn_dyud( txtdir, dyu, dyd);
     236  compstring_chksgn_dx( txtdir, deltaposx);
     237  compstring_chksgn_dx( txtdir, sw_s);
     238  compstring_chksgn_dx( txtdir, sw_sup);
     239  compstring_chksgn_dx( txtdir, sw_sdn);
    211240
    212241  if ((pos == 0) || ((posh == PI_HorizontalLeft) && (posv == PI_VerticalBaseLine))) {
    213242    xs = (int)x+sw_s;
    214     if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight);
     243    ys = y;
     244    compstring_swapcoord(txtdir, xs, ys);   
     245    if (s != NULL)  DrawString(xs, ys, s, txtdir | PI_HorizontalRight);
    215246    xs = (int)x+sw_s+deltaposx;
    216247    ys = (int)y+dyu;
    217248    SelFont(fnt_ss);
    218     if (s_up != NULL) DrawString(xs, ys, s_up, PI_HorizontalLeft);
     249    compstring_swapcoord(txtdir, xs, ys);   
     250    if (s_up != NULL) DrawString(xs, ys, s_up, txtdir | PI_HorizontalLeft);
     251    xs = (int)x+sw_s+deltaposx;
    219252    ys = (int)y+dyd;
    220     if (s_dn != NULL) DrawString(xs, ys, s_dn, PI_HorizontalLeft);
     253    compstring_swapcoord(txtdir, xs, ys);   
     254    if (s_dn != NULL) DrawString(xs, ys, s_dn, txtdir | PI_HorizontalLeft);
    221255  }
    222256  else {
    223257    if (posh == PI_HorizontalRight) {
    224258      int sw_ss_max = ( sw_sup > sw_sdn ) ? sw_sup : sw_sdn;
    225       xs = (int)x-sw_ss_max-deltaposx;
    226       if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight | posv);
     259      xss = xs = (int)x-sw_ss_max-deltaposx;
     260      ys = y;
     261      compstring_swapcoord(txtdir, xs, ys);   
     262      if (s != NULL)  DrawString(xs, ys, s, txtdir | PI_HorizontalRight | posv);
    227263      SelFont(fnt_ss);
    228       xs = (int)xs+deltaposx;
     264      xs = (int)xss+deltaposx;
    229265      ys = (int)y+dyu;
    230       if (s_up != NULL) DrawString(xs, ys, s_up, PI_HorizontalLeft);
     266      compstring_swapcoord(txtdir, xs, ys);   
     267      if (s_up != NULL) DrawString(xs, ys, s_up, txtdir | PI_HorizontalLeft);
     268      xs = (int)xss+deltaposx;
    231269      ys = (int)y+dyd;
    232       if (s_dn != NULL) DrawString(xs, ys, s_dn, PI_HorizontalLeft);     
     270      compstring_swapcoord(txtdir, xs, ys);   
     271      if (s_dn != NULL) DrawString(xs, ys, s_dn, txtdir | PI_HorizontalLeft);     
    233272    }
    234273    else if (posh == PI_HorizontalCenter) {
    235274      int sw_tot = sw_sup+sw_sdn+sw_s+deltaposx;
    236       xs = (int)x-sw_tot/2+sw_s;
    237       if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight | posv);
     275      xss = xs = (int)x-sw_tot/2+sw_s;
     276      ys = y;
     277      compstring_swapcoord(txtdir, xs, ys);   
     278      if (s != NULL)  DrawString(xs, ys, s, txtdir | PI_HorizontalRight | posv);
    238279      SelFont(fnt_ss);
    239       xs = (int)xs+deltaposx;
     280      xs = (int)xss+deltaposx;
    240281      ys = (int)y+dyu;
    241       if (s_up != NULL) DrawString(xs, ys, s_up, PI_HorizontalLeft);
     282      compstring_swapcoord(txtdir, xs, ys);   
     283      if (s_up != NULL) DrawString(xs, ys, s_up, txtdir | PI_HorizontalLeft);
     284      xs = (int)xss+deltaposx;
    242285      ys = (int)y+dyd;
    243       if (s_dn != NULL) DrawString(xs, ys, s_dn, PI_HorizontalLeft);           
     286      compstring_swapcoord(txtdir, xs, ys);   
     287      if (s_dn != NULL) DrawString(xs, ys, s_dn, txtdir | PI_HorizontalLeft);           
    244288    }
    245289    else {
    246290      xs = (int)x+sw_s;
    247       if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight | posv);
     291      ys = y;
     292      compstring_swapcoord(txtdir, xs, ys);   
     293      if (s != NULL)  DrawString(xs, ys, s, txtdir | PI_HorizontalRight | posv);
    248294      SelFont(fnt_ss);
    249295      xs = (int)x+sw_s+deltaposx;
    250296      ys = (int)y+dyu;
    251       if (s_up != NULL) DrawString(xs, ys, s_up, PI_HorizontalLeft);
     297      compstring_swapcoord(txtdir, xs, ys);   
     298      if (s_up != NULL) DrawString(xs, ys, s_up, txtdir | PI_HorizontalLeft);
     299      xs = (int)x+sw_s+deltaposx;
    252300      ys = (int)y+dyd;
    253       if (s_dn != NULL) DrawString(xs, ys, s_dn, PI_HorizontalLeft);
     301      compstring_swapcoord(txtdir, xs, ys);   
     302      if (s_dn != NULL) DrawString(xs, ys, s_dn, txtdir | PI_HorizontalLeft);
    254303    }
    255304  }
Note: See TracChangeset for help on using the changeset viewer.