Changeset 1899 in Sophya for trunk/SophyaPI
- Timestamp:
- Feb 13, 2002, 12:03:15 PM (24 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Tests/pist.cc
r1898 r1899 334 334 335 335 if (mTxtDir != PI_TextDirectionHorizontal) { 336 xpos = 50; ypos = 350;336 xpos = 50; ypos = 450; 337 337 s1 = "V_Top-H_Left-TxDUp"; 338 338 g->SelForeground(PI_Red); … … 343 343 PI_HorizontalLeft|PI_VerticalTop|PI_TextDirectionVerticalUp); 344 344 345 xpos = 100; ypos = 300;345 xpos = 100; ypos = 400; 346 346 s1 = "V_Top-H_Center-TxDUp"; 347 347 g->SelForeground(PI_Red); … … 352 352 PI_HorizontalCenter|PI_VerticalTop|PI_TextDirectionVerticalUp); 353 353 354 xpos = 150; ypos = 250;354 xpos = 150; ypos = 350; 355 355 s1 = "V_Top-H_Right-TxDUp"; 356 356 g->SelForeground(PI_Red); … … 361 361 PI_HorizontalRight|PI_VerticalTop|PI_TextDirectionVerticalUp); 362 362 363 xpos = 200; ypos = 50; 363 xpos = 50; ypos = 250; 364 s1 = "V_Center-H_Left-TxDUp"; 365 g->SelForeground(PI_Red); 366 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 367 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 368 g->SelForeground(PI_Black); 369 g->DrawString(xpos, ypos, s1, 370 PI_HorizontalLeft|PI_VerticalCenter|PI_TextDirectionVerticalUp); 371 372 xpos = 100; ypos = 200; 373 s1 = "V_Base-H_Center-TxDUp"; 374 g->SelForeground(PI_Red); 375 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 376 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 377 g->SelForeground(PI_Black); 378 g->DrawString(xpos, ypos, s1, 379 PI_HorizontalCenter|PI_VerticalBaseLine|PI_TextDirectionVerticalUp); 380 381 xpos = 150; ypos = 150; 382 s1 = "V_Bot-H_Right-TxDUp"; 383 g->SelForeground(PI_Red); 384 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 385 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 386 g->SelForeground(PI_Black); 387 g->DrawString(xpos, ypos, s1, 388 PI_HorizontalRight|PI_VerticalBottom|PI_TextDirectionVerticalUp); 389 390 391 xpos = 200; ypos = 100; 364 392 s1 = "V_Top-H_Left-TxDown"; 365 393 g->SelForeground(PI_Red); … … 370 398 PI_HorizontalLeft|PI_VerticalTop|PI_TextDirectionVerticalDown); 371 399 372 xpos = 250; ypos = 1 00;400 xpos = 250; ypos = 150; 373 401 s1 = "V_Top-H_Center-TxDown"; 374 402 g->SelForeground(PI_Red); … … 379 407 PI_HorizontalCenter|PI_VerticalTop|PI_TextDirectionVerticalDown); 380 408 381 xpos = 300; ypos = 150;409 xpos = 300; ypos = 200; 382 410 s1 = "V_Top-H_Right-TxDown"; 383 411 g->SelForeground(PI_Red); … … 387 415 g->DrawString(xpos, ypos, s1, 388 416 PI_HorizontalRight|PI_VerticalTop|PI_TextDirectionVerticalDown); 417 418 xpos = 200; ypos = 300; 419 s1 = "V_Center-H_Left-TxDown"; 420 g->SelForeground(PI_Red); 421 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 422 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 423 g->SelForeground(PI_Black); 424 g->DrawString(xpos, ypos, s1, 425 PI_HorizontalLeft|PI_VerticalCenter|PI_TextDirectionVerticalDown); 426 427 xpos = 250; ypos = 350; 428 s1 = "V_Base-H_Center-TxDown"; 429 g->SelForeground(PI_Red); 430 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 431 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 432 g->SelForeground(PI_Black); 433 g->DrawString(xpos, ypos, s1, 434 PI_HorizontalCenter|PI_VerticalBaseLine|PI_TextDirectionVerticalDown); 435 436 xpos = 300; ypos = 400; 437 s1 = "V_Bot-H_Right-TxDown"; 438 g->SelForeground(PI_Red); 439 g->DrawLine(xpos-10, ypos, xpos+10, ypos); 440 g->DrawLine(xpos, ypos-50, xpos, ypos+50); 441 g->SelForeground(PI_Black); 442 g->DrawString(xpos, ypos, s1, 443 PI_HorizontalRight|PI_VerticalBottom|PI_TextDirectionVerticalDown); 444 389 445 390 446 return; … … 443 499 // --------------- Vertical BaseLine ----------------- 444 500 xpos = 30; ypos = 250; 445 s1 = "V_B ottom-H_Left";501 s1 = "V_Base-H_Left"; 446 502 g->SelForeground(PI_Red); 447 503 g->DrawLine(xpos-50, ypos, xpos+50, ypos); … … 451 507 452 508 xpos = XSize()/2; ypos = 250; 453 s1 = "V_B ottom-H_Center";509 s1 = "V_Base-H_Center"; 454 510 g->SelForeground(PI_Red); 455 511 g->DrawLine(xpos-50, ypos, xpos+50, ypos); … … 459 515 460 516 xpos = XSize()-30; ypos = 250; 461 s1 = "V_B ottom-H_Center";517 s1 = "V_Base-H_Center"; 462 518 g->SelForeground(PI_Red); 463 519 g->DrawLine(xpos-50, ypos, xpos+50, ypos); -
trunk/SophyaPI/PI/picolist.h
r1640 r1899 17 17 PI_Violet = 16, PI_VioletRed = 17, 18 18 PI_BlueViolet = 18, PI_DarkViolet = 19, 19 PI_ColorAllBits0 = 19, PI_ColorAllBits1 = 20 }; 19 PI_HighlightBlue = 20, 20 PI_ColorAllBits0 = 21, PI_ColorAllBits1 = 22 }; 20 21 21 22 #endif -
trunk/SophyaPI/PI/pidrawer.cc
r1897 r1899 42 42 PIDrawer::PIDrawer() 43 43 { 44 mFgDeleteOnDetach = false; 44 45 mBWdg = NULL; 45 46 mGrUC = NULL; … … 324 325 for(it = mBWdgList.begin(); it != mBWdgList.end(); it++) 325 326 if ( ((*it).id == id) && ((*it).wdg == wdg) ) { mBWdgList.erase(it); break; } 327 if (mFgDeleteOnDetach && (mBWdgList.size() == 0)) delete this; 326 328 return; 327 329 } … … 332 334 // On affiche par defaut la fenetre de gestion des attributs graphiques 333 335 PIDrwTools::ShowPIDrwTools(wdg); 336 } 337 338 void 339 PIDrawer::DeactivateControlWindow(PIBaseWdgGen* wdg) 340 { 341 // On affiche par defaut la fenetre de gestion des attributs graphiques 334 342 } 335 343 -
trunk/SophyaPI/PI/pidrawer.h
r1897 r1899 30 30 virtual ~PIDrawer(); 31 31 32 inline void SetAutoDeleteOnDetach(bool fg) 33 { mFgDeleteOnDetach = fg; } 34 32 35 virtual void SetLimits(double xmin, double xmax, double ymin, double ymax, 33 36 int axrl=kAxeDirSame, int ayud=kAxeDirSame); … … 101 104 virtual void ShowControlWindow(PIBaseWdgGen* wdg); 102 105 inline bool HasSpecificControlWindow() const { return mFgSpecContWind; } 106 virtual void DeactivateControlWindow(PIBaseWdgGen* wdg); 103 107 104 108 // Methode permettant de decoder des options a partir de chaines … … 135 139 void DrawGrid(PIGraphicUC* g); 136 140 137 141 142 bool mFgDeleteOnDetach; // si true -> delete drawer on detach 143 // from last BaseWdg 144 138 145 double xMin, xMax, yMin, yMax; // Valeurs en unites user 139 146 int xW0, yW0, xWd, yWd; // Origine/largeur ds la fenetre de trace -
trunk/SophyaPI/PI/pigraphgen.cc
r1898 r1899 127 127 myWdg = NULL; 128 128 myGrb = NULL; 129 myLockFCol = false; 129 130 SelArrowMarker(); 130 131 } … … 135 136 myWdg = wdg; 136 137 myGrb = NULL; 138 myLockFCol = false; 137 139 SelArrowMarker(); 138 140 } … … 143 145 myWdg = NULL; 144 146 myGrb = grb; 147 myLockFCol = false; 145 148 SelArrowMarker(); 146 149 } … … 194 197 void 195 198 PIGraphicGen::DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 196 const char* s_up, const char* s_dn, unsigned long pos) 199 const char* s_up, const char* s_dn, 200 PIFont const & fntss, unsigned long pos) 197 201 { 198 202 if ((s_up == NULL) && (s_dn == NULL)) { … … 207 211 208 212 PIFont fnt_save(myFont); 209 PIFont fnt_ss( myFont);213 PIFont fnt_ss(fntss); 210 214 fnt_ss.SetFontSzPt(2*myFont.GetFontSize()/3); 211 215 … … 272 276 else { 273 277 xs = (int)x+sw_s; 274 if (s != NULL) DrawString(x , y, s, PI_HorizontalRight | posv);278 if (s != NULL) DrawString(xs, y, s, PI_HorizontalRight | posv); 275 279 SelFont(fnt_ss); 276 280 xs = (int)x+sw_s+deltaposx; -
trunk/SophyaPI/PI/pigraphgen.h
r1898 r1899 164 164 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, unsigned long pos = 0) = 0; 165 165 virtual void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 166 const char* s_up, const char* s_dn, unsigned long pos = 0); 166 const char* s_up, const char* s_dn, 167 PIFont const & fntss, unsigned long pos = 0); 168 inline void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 169 const char* s_up, const char* s_dn, 170 unsigned long pos = 0) 171 { DrawCompString(x, y, s, s_up, s_dn, GetFont(), pos); } 167 172 168 173 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) = 0; … … 200 205 virtual void SelArrowMarker(int arrsz=5, 201 206 PIArrowMarker arrmrk=PI_BasicArrowMarker); 207 208 inline void LockForegroundColor() { myLockFCol = true; } 209 inline void UnLockForegroundColor() { myLockFCol = false; } 210 202 211 // Modifications de fonte 203 212 virtual void SelFont(PIFont & fnt) = 0; … … 248 257 PIArrowMarker sArrowMrk; 249 258 int sArrowMrkSz; 250 259 bool myLockFCol; 251 260 }; 252 261 -
trunk/SophyaPI/PI/pigraphps.cc
r1898 r1899 115 115 { 116 116 if(mPSOut) { 117 int posh = pos & PI_HorizontalPosition; 118 int posv = pos & PI_VerticalPosition; 117 unsigned long txtdir = pos&PI_TextDirection; 118 unsigned long posh = pos & PI_HorizontalPosition; 119 unsigned long posv = pos & PI_VerticalPosition; 119 120 int dx,dy; 120 121 double xd = x; 121 122 double yd = y; 122 if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy; 123 bool fgcsps = CalcStringPositionShift(s, posv, dx, dy); 124 if (txtdir == PI_TextDirectionHorizontal) { 125 if (fgcsps) yd -= dy; 126 } 127 else { 128 if (txtdir == PI_TextDirectionVerticalDown) xd += dy; 129 else xd -= dy; 130 } 123 131 mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(), 124 myFont.GetFontSize(), posh );132 myFont.GetFontSize(), posh|txtdir); 125 133 } 126 134 return; … … 131 139 { 132 140 if(mPSOut) { 133 int posh = pos & PI_HorizontalPosition; 134 int posv = pos & PI_VerticalPosition; 141 unsigned long txtdir = pos&PI_TextDirection; 142 unsigned long posh = pos & PI_HorizontalPosition; 143 unsigned long posv = pos & PI_VerticalPosition; 135 144 int dx,dy; 136 145 double xd = x; 137 146 double yd = y; 138 if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy; 147 bool fgcsps = CalcStringPositionShift(s, posv, dx, dy); 148 if (txtdir == PI_TextDirectionHorizontal) { 149 if (fgcsps) yd -= dy; 150 } 151 else { 152 if (txtdir == PI_TextDirectionVerticalDown) xd += dy; 153 else xd -= dy; 154 } 139 155 mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(), 140 myFont.GetFontSize(), posh );156 myFont.GetFontSize(), posh|txtdir); 141 157 } 142 158 return; -
trunk/SophyaPI/PI/pigraphuc.cc
r1898 r1899 154 154 int axrl, int ayud) 155 155 { 156 157 156 if (axrl == kAxeDirAuto) { 158 157 double ff; … … 411 410 /* --Methode-- */ 412 411 void PIGraphicUC::DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 413 const char* s_up, const char* s_dn, unsigned long pos) 412 const char* s_up, const char* s_dn, 413 PIFont const & fntss, unsigned long pos) 414 414 { 415 415 if (!mGrC) return; 416 416 double xf, yf; 417 417 UC2GrC(x, y, xf, yf); 418 mGrC->DrawCompString(xf, yf, s, s_up, s_dn, pos);418 mGrC->DrawCompString(xf, yf, s, s_up, s_dn, fntss, pos); 419 419 } 420 420 -
trunk/SophyaPI/PI/pigraphuc.h
r1898 r1899 33 33 // Definition des coordonnees utilisateur 34 34 virtual void SetUCS(double xmin, double xmax, double ymin, double ymax, 35 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 35 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 36 36 // Echelle logarithmique 37 37 virtual void SetLogScale(bool logx, bool logy); … … 46 46 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, unsigned long pos = 0); 47 47 virtual void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 48 const char* s_up, const char* s_dn, unsigned long pos = 0); 48 const char* s_up, const char* s_dn, 49 PIFont const & fntss, unsigned long pos = 0); 50 inline void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 51 const char* s_up, const char* s_dn, 52 unsigned long pos = 0) 53 { DrawCompString(x, y, s, s_up, s_dn, GetFont(), pos); } 54 49 55 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 50 56 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); -
trunk/SophyaPI/PI/pigraphx.cc
r1898 r1899 14 14 15 15 /* Variables globales pour modifier les GC */ 16 #define NMAXCOL 2416 #define NMAXCOL 32 17 17 static PIXColor colpix[NMAXCOL]; 18 18 … … 491 491 } 492 492 XPutImage(dsx, pxm2, gcbm, ximg2, 0, 0, 0, 0, fh, sw); 493 GC gcvis; 493 494 GC gcvs = XCreateGC (dsx, mWId, GCFunction | GCPlaneMask, &xgv); 494 495 XCopyGC(dsx, DefGC(), ~0, gcvs); 495 496 XSetStipple(dsx, gcvs, pxm2); 496 497 XSetFillStyle(dsx, gcvs, FillStippled); 498 if (imgs) { 499 gcvis = XCreateGC (dsx, mWId, GCFunction | GCPlaneMask, &xgv); 500 XCopyGC(dsx, DefGC(), ~0, gcvis); 501 if (mBCol == PI_ColorFromMap) XSetForeground(mDisp, gcvis, mBCfMap); 502 else XSetForeground(mDisp, gcvis, colpix[mBCol]); 503 } 497 504 if (fgdown) { 498 XSetTSOrigin(dsx, gcvs, x, y); 499 XFillRectangle(dsx, mWId, gcvs, x, y, fh, sw); 505 XSetTSOrigin(dsx, gcvs, x-fdes, y); 506 if (imgs) XFillRectangle(dsx, mWId, gcvis, x-fdes, y, fh, sw); 507 XFillRectangle(dsx, mWId, gcvs, x-fdes, y, fh, sw); 500 508 } 501 509 else { 502 XSetTSOrigin(dsx, gcvs, x-fh, y-sw); 503 XFillRectangle(dsx, mWId, gcvs, x-fh, y-sw, fh, sw); 510 XSetTSOrigin(dsx, gcvs, x-fasc, y-sw); 511 if (imgs) XFillRectangle(dsx, mWId, gcvis, x-fasc, y-sw, fh, sw); 512 XFillRectangle(dsx, mWId, gcvs, x-fasc, y-sw, fh, sw); 504 513 } 505 514 // Cleaning 506 515 XDestroyImage(ximg); 507 516 XDestroyImage(ximg2); 517 XFreeGC(dsx, gcbm); 508 518 XFreeGC(dsx, gcvs); 509 XFreeGC(dsx, gcbm);519 if (imgs) XFreeGC(dsx, gcvis); 510 520 XFreePixmap(dsx, pxm); 511 521 XFreePixmap(dsx, pxm2); … … 517 527 void PIGraphicX::SelForeground(PIColors col) 518 528 { 529 if (myLockFCol) return; 519 530 if (col == mFCol) return; 520 531 if ( (col < 0) || (col >= NMAXCOL)) return; … … 537 548 void PIGraphicX::SelForeground(PIColorMap& cmap, int cid) 538 549 { 550 if (myLockFCol) return; 539 551 SelectFCol(cmap.Color(cid)); 540 552 } … … 849 861 colpix[PI_DarkViolet] = mycol.pixel; 850 862 863 mycol.red = 0; 864 mycol.blue = 65000; 865 mycol.green = 45000; 866 if ( XAllocColor (mdsp, cmap, &mycol) ) colpix[PI_HighlightBlue] = mycol.pixel; 851 867 852 868 /* le GC pour DrawPixmap */ -
trunk/SophyaPI/PI/psfile.cc
r1898 r1899 946 946 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) S gr\n", x, y, s) ; 947 947 else { 948 unsigned long txtdir = pos & PI_TextDirection; 948 949 int posh = pos & PI_HorizontalPosition; 949 950 int posv = pos & PI_VerticalPosition; 951 int angle = 0; 952 if (txtdir == PI_TextDirectionVerticalUp) angle = -90; 953 else if (txtdir == PI_TextDirectionVerticalDown) angle = 90; 954 950 955 if ((posh == PI_HorizontalLeft) && 951 ((posv == PI_VerticalBaseLine) || (posv == 0)) ) 952 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlshstr gr\n", 953 x, y, s) ; 956 ((posv == PI_VerticalBaseLine) || (posv == 0)) ) { 957 if (angle == 0) 958 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlshstr gr\n", 959 x, y, s) ; 960 else 961 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m %d rotate (%s) hlshstr gr\n", 962 x, y, angle, s) ; 963 } 954 964 else { 955 965 char ssvp = 'b'; … … 960 970 else sshp = 'l'; 961 971 } 962 if (posv == 0) 963 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cshstr gr\n", 964 x, y, s, sshp) ; 972 if (posv == 0) { 973 if (angle == 0) 974 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cshstr gr\n", 975 x, y, s, sshp) ; 976 else fprintf(mPSFile, "gs %.2f Ux %.2f Uy m %d rotate (%s) h%cshstr gr\n", 977 x, y, angle, s, sshp) ; 978 } 965 979 else { 966 980 if (posv == PI_VerticalCenter) ssvp = 'c'; … … 968 982 else ssvp = 'b'; 969 983 } 970 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cv%cshstr gr\n", 984 if (angle == 0) 985 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cv%cshstr gr\n", 971 986 x, y, s, sshp, ssvp) ; 987 else 988 fprintf(mPSFile, "gs %.2f Ux %.2f Uy m %d rotate (%s) h%cv%cshstr gr\n", 989 x, y, angle, s, sshp, ssvp) ; 972 990 } 973 991 }
Note:
See TracChangeset
for help on using the changeset viewer.