Changeset 1882 in Sophya
- Timestamp:
- Jan 21, 2002, 11:05:32 PM (24 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piscdrawwdg.cc
r1879 r1882 82 82 mFgDeltaPos = false; 83 83 mPosForDelta[0] = mPosForDelta[1] = 0.; 84 mPosF orDeltaX = mPosForDeltaY = 0;84 mPosFDX = mPosFDY = 0; 85 85 86 86 mBDrw = new PIElDrawer; … … 186 186 mFormatOpt[0] = SetFormatOpt(xmin,xmax); 187 187 mFormatOpt[1] = SetFormatOpt(ymin,ymax); 188 UpdatePosForDeltaMarker(false, true); 188 189 } 189 190 … … 320 321 PIScDrawWdg::But1Press(int x, int y) 321 322 { 322 int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;323 323 UpdateText(x, y); 324 324 if (mTrW) … … 331 331 mTrW->Show(); 332 332 } 333 if (mFgReticule ) { // On trace une reticule333 if (mFgReticule || mFgDeltaPos) { // On trace une reticule 334 334 cForCol = mWGrC->GetForeground(); 335 335 cGOmod = mWGrC->GetGOMode(); … … 338 338 mWGrC->SelGOMode(PI_GOXOR); 339 339 mWGrC->SelLine(PI_ThinLine); 340 mWGrC->DrawLine(x, 0, x, YSize()); 341 mWGrC->DrawLine(0, y, XSize(), y); 342 mCPosX = x; mCPosY = y; 343 char buff[128]; 344 string format1 = "X= "; format1 += mFormatOpt[0].c_str(); 345 string format2 = "Y= "; format2 += mFormatOpt[1].c_str(); 346 sprintf(buff,format1.c_str(), mPPos[0], pos); 347 mWGrC->DrawString(x+10, y-10, buff); 348 sprintf(buff,format2.c_str(), mPPos[1], pos); 349 mWGrC->DrawString(x+10, y+20, buff); 350 } 340 } 341 if (mFgReticule) DrawReticule(x,y,0); 351 342 else SelPointerShape(PI_CrossPointer); 343 if (mFgDeltaPos) DrawDeltaPosMarker(); 352 344 353 345 Send(Msg(), PIMsg_Active); … … 359 351 PIScDrawWdg::Ptr1Move(int x, int y) 360 352 { 361 int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;362 char buff[128];363 string format1 = "X= "; format1 += mFormatOpt[0].c_str();364 string format2 = "Y= "; format2 += mFormatOpt[1].c_str();365 if (mFgReticule) { // On trace une reticule366 mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());367 mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);368 sprintf(buff,format1.c_str(), mPPos[0]);369 mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos);370 sprintf(buff,format2.c_str(), mPPos[1]);371 mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos);372 mWGrC->DrawLine(x, 0, x, YSize());373 mWGrC->DrawLine(0, y, XSize(), y);374 mCPosX = x; mCPosY = y;375 }376 353 UpdateText(x, y); // Met a jour mPPos 377 if (mFgReticule) { 378 sprintf(buff,format1.c_str(), mPPos[0]); 379 mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos); 380 sprintf(buff,format2.c_str(), mPPos[1]); 381 mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos); 382 } 354 if (mFgReticule) DrawReticule(x,y,1); 383 355 } 384 356 … … 386 358 PIScDrawWdg::But1Release(int x, int y) 387 359 { 388 int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;389 360 UpdateText(x, y); 390 if (mFgReticule) { // On efface la reticule 391 mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize()); 392 mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY); 393 char buff[128]; 394 string format1 = "X= "; format1 += mFormatOpt[0].c_str(); 395 string format2 = "Y= "; format2 += mFormatOpt[1].c_str(); 396 sprintf(buff,format1.c_str(), mPPos[0]); 397 mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos); 398 sprintf(buff,format2.c_str(), mPPos[1]); 399 mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos); 400 mWGrC->SelForeground(cForCol); 401 mWGrC->SelGOMode(cGOmod); 402 mWGrC->SelLine(cLatt); 403 mCPosX = mCPosY = 0; 404 } 361 if (mFgReticule) DrawReticule(x,y,2); 405 362 else SelPointerShape(PI_ArrowPointer); 363 if (mFgDeltaPos) DrawDeltaPosMarker(); 406 364 if (mTrW) mTrW->Hide(); 407 365 } … … 410 368 PIScDrawWdg::UpdateText(int xp, int yp) 411 369 { 412 413 370 double dx, dy; 414 371 mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy); … … 427 384 428 385 void 429 PIScDrawWdg::UpdatePosForDeltaMarker(bool fg) 430 { 431 if (!mFgDeltaPos && !fg ) return; 432 cForCol = mWGrC->GetForeground(); 433 cGOmod = mWGrC->GetGOMode(); 434 cLatt = mWGrC->GetLineAtt(); 435 mWGrC->SelForeground(PI_Magenta); 436 mWGrC->SelGOMode(PI_GOXOR); 437 mWGrC->SelLine(PI_NormalLine); 438 if (mFgDeltaPos) { 439 mWGrC->DrawLine(mPosForDeltaX-7, mPosForDeltaY, mPosForDeltaX+7, mPosForDeltaY); 440 mWGrC->DrawLine(mPosForDeltaX, mPosForDeltaY-7, mPosForDeltaX, mPosForDeltaY+7); 441 } 442 mFgDeltaPos = fg; 386 PIScDrawWdg::UpdatePosForDeltaMarker(bool fg, bool fgupd) 387 { 388 if (!fgupd) mFgDeltaPos = fg; 443 389 if (mFgDeltaPos) { 444 390 mPosForDelta[0] = mPPos[0]; 445 391 mPosForDelta[1] = mPPos[1]; 446 mPosForDeltaX = mCPosX; 447 mPosForDeltaY = mCPosY; 448 mWGrC->DrawLine(mPosForDeltaX-7, mPosForDeltaY, mPosForDeltaX+7, mPosForDeltaY); 449 mWGrC->DrawLine(mPosForDeltaX, mPosForDeltaY-7, mPosForDeltaX, mPosForDeltaY+7); 450 } 451 mWGrC->SelForeground(cForCol); 452 mWGrC->SelGOMode(cGOmod); 453 mWGrC->SelLine(cLatt); 392 double pfdx, pfdy; 393 mBDrw->GetGraphicUC()->UC2GrC(mPosForDelta[0], mPosForDelta[1], 394 pfdx, pfdy); 395 mPosFDX = (int)pfdx; mPosFDY = (int)pfdy; 396 } 454 397 return; 455 398 } 456 399 400 401 void 402 PIScDrawWdg::DrawReticule(int x, int y, int op) 403 { 404 if (!mFgReticule) return; 405 // int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft; 406 // char buff[128]; 407 // string format1 = "X= "; format1 += mFormatOpt[0].c_str(); 408 // string format2 = "Y= "; format2 += mFormatOpt[1].c_str(); 409 if (op > 0) { // on efface le precedent 410 mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize()); 411 mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY); 412 // sprintf(buff,format1.c_str(), mPPos[0]); 413 // mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos); 414 // sprintf(buff,format2.c_str(), mPPos[1]); 415 // mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos); 416 } 417 if (op < 2) { 418 mWGrC->DrawLine(x, 0, x, YSize()); 419 mWGrC->DrawLine(0, y, XSize(), y); 420 mCPosX = x; mCPosY = y; 421 } 422 } 423 424 void 425 PIScDrawWdg::DrawDeltaPosMarker() 426 { 427 if (mFgDeltaPos) { 428 mWGrC->DrawLine(mPosFDX-14., mPosFDY, mPosFDX+14, mPosFDY); 429 mWGrC->DrawLine(mPosFDX, mPosFDY-14, mPosFDX, mPosFDY+14); 430 } 431 } 457 432 458 433 // ............................. -
trunk/SophyaPI/PI/piscdrawwdg.h
r1879 r1882 90 90 double mPPos[2]; // Position courante (user coordinates) 91 91 double mPSz[2]; // Taille courant du pave info 92 int mCPosX, mCPosY; // Position click souris X,Y 92 int mCPosX, mCPosY; // Position click souris X,Y (pour trace de reticule) 93 93 bool mFgDeltaPos; // affichage de l'ecart par rapport a la position memorisee 94 94 double mPosForDelta[2]; // Position memorisee - Pour affichage d'ecart 95 int mPosF orDeltaX, mPosForDeltaY; // Position click memorisee - Pour affichage d'ecart95 int mPosFDX, mPosFDY; // Position (coord fenetre memorise) 96 96 bool mFgReticule; // Controle l'affiche d'une réticule (Bouton-1) 97 97 string mFormatOpt[2]; // Format optimal d'impression des textes … … 115 115 private: 116 116 void UpdateText(int xp, int yp); 117 void UpdatePosForDeltaMarker(bool fg); 117 void UpdatePosForDeltaMarker(bool fg, bool fgupd=false); 118 void DrawReticule(int x, int y, int op); 119 void DrawDeltaPosMarker(); 118 120 }; 119 121
Note:
See TracChangeset
for help on using the changeset viewer.