Changeset 2426 in Sophya for trunk/SophyaPI/PI/pigraphgen.cc
- Timestamp:
- Sep 5, 2003, 5:32:47 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pigraphgen.cc
r2394 r2426 163 163 //-- 164 164 165 inline 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 174 inline 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 } 181 inline void compstring_chksgn_dx( unsigned long txtdir, int & dx) 182 { 183 if (txtdir == PI_TextDirectionVerticalUp) dx = -dx; 184 } 185 165 186 /* --Methode-- */ 166 187 void … … 188 209 if (s_dn != NULL) sw_sdn = fnt_ss.GetStringWidth(s_dn); 189 210 190 PIGrCoord xs,ys ;211 PIGrCoord xs,ys,xss,yss; 191 212 int posh = pos & PI_HorizontalPosition; 192 213 int posv = pos & PI_VerticalPosition; 214 unsigned long txtdir = pos&PI_TextDirection; 193 215 194 216 int dyu, dyd; … … 209 231 int deltaposx = ((fh/8) > 0) ? fh/8 : 1; 210 232 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); 211 240 212 241 if ((pos == 0) || ((posh == PI_HorizontalLeft) && (posv == PI_VerticalBaseLine))) { 213 242 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); 215 246 xs = (int)x+sw_s+deltaposx; 216 247 ys = (int)y+dyu; 217 248 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; 219 252 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); 221 255 } 222 256 else { 223 257 if (posh == PI_HorizontalRight) { 224 258 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); 227 263 SelFont(fnt_ss); 228 xs = (int)xs +deltaposx;264 xs = (int)xss+deltaposx; 229 265 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; 231 269 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); 233 272 } 234 273 else if (posh == PI_HorizontalCenter) { 235 274 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); 238 279 SelFont(fnt_ss); 239 xs = (int)xs +deltaposx;280 xs = (int)xss+deltaposx; 240 281 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; 242 285 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); 244 288 } 245 289 else { 246 290 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); 248 294 SelFont(fnt_ss); 249 295 xs = (int)x+sw_s+deltaposx; 250 296 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; 252 300 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); 254 303 } 255 304 }
Note:
See TracChangeset
for help on using the changeset viewer.