Changeset 127 in Sophya for trunk/SophyaPI
- Timestamp:
- Jul 31, 1998, 5:22:21 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/ex_dessin.cc
r72 r127 40 40 41 41 /* --Methode-- */ 42 void ExBWdg::Draw(PIGraphicGen* g )42 void ExBWdg::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 43 43 { 44 44 EraseWindow(); -
trunk/SophyaPI/PI/ex_dessin.h
r72 r127 22 22 23 23 virtual void Resize(); 24 virtual void Draw(PIGraphic Gen* g);24 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 25 25 26 26 virtual void But1Press(int x, int y); -
trunk/SophyaPI/PI/lut.h
r106 r127 28 28 if (x < Min()) return(0); 29 29 if (x >= Max() ) return(nLevel+1); 30 int k = ( x-Min())/tablebinwidth;30 int k = (int)((x-Min())/tablebinwidth); 31 31 return(table[k]); 32 32 } -
trunk/SophyaPI/PI/pibwdggen.cc
r119 r127 35 35 { 36 36 if ( IsVisible() ) { 37 Draw(mWGrC );37 Draw(mWGrC, 0, 0, XSize(), YSize()); 38 38 CallDrawers(mWGrC); 39 39 } … … 41 41 } 42 42 43 // On met une variable pour eviter des boucles infinies entre les deux methodes 44 // Draw(PIGraphic* g, int, int, int, int) et Draw(PIGraphic* g) 45 static int fgdrawloop = 0; 46 47 /* --Methode-- */ 48 void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 49 { 50 if (fgdrawloop == 0) 51 { fgdrawloop=1; Draw(g); } 52 fgdrawloop = 0; 53 return; 54 } 55 56 /* --Methode-- */ 57 void PIBaseWdgGen::Draw(PIGraphic* g) 43 44 /* --Methode-- */ 45 void PIBaseWdgGen::Draw(PIGraphic* g, int x0, int y0, int dx, int dy) 58 46 { 59 47 #ifdef DEBUG_RZXB 60 48 puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! "); 61 49 #endif 62 if (g->kind() != PI_PSFileGraphics) EraseWindow(0, 0, XSize(), YSize()); 63 if (fgdrawloop == 0) 64 { fgdrawloop=2; Draw(g, 0, 0, XSize(), YSize()); } 65 fgdrawloop = 0; 66 return; 67 } 68 50 if (g->kind() != PI_PSFileGraphics) EraseWindow(x0, y0, dx, dy); 51 return; 52 } 69 53 70 54 /* --Methode-- */ … … 178 162 if (!psf) return; 179 163 PIGraphicPS grpsf(psf, (PIWdg *)this, ofx, ofy); 180 Draw(&grpsf );164 Draw(&grpsf, 0, 0, XSize(), YSize()); 181 165 CallDrawers(&grpsf); 182 166 return; … … 298 282 299 283 /* --Methode-- */ 300 void PIBaseWdgGen::CallDrawers(PIGraphic Gen* g, int x0, int y0, int dx, int dy)284 void PIBaseWdgGen::CallDrawers(PIGraphic* g, int x0, int y0, int dx, int dy) 301 285 { 302 286 float xmin,ymin, xmax, ymax; -
trunk/SophyaPI/PI/pibwdggen.h
r120 r127 58 58 59 59 // Fonctions qui doivent contenir le dessin du contenu du widget lui-meme 60 virtual void Draw(PIGraphic* g);61 60 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 62 61 … … 99 98 100 99 // Trace des Drawers ... 101 virtual void CallDrawers(PIGraphic Gen* g, int x0=0, int y0=0, int dx=0, int dy=0);100 virtual void CallDrawers(PIGraphic* g, int x0=0, int y0=0, int dx=0, int dy=0); 102 101 virtual void CallDrawer(int id); 103 102 -
trunk/SophyaPI/PI/picmapview.cc
r113 r127 1 #include <stdio.h> 2 #include <string.h> 1 // Module PI : Peida Interactive PICMapView 2 // Visualisation de table de couleur R. Ansari 07/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 3 4 4 5 #include "picmapview.h" … … 12 13 13 14 { 14 15 cmap = NULL; 15 16 } 16 17 … … 19 20 PICMapView::~PICMapView() 20 21 { 22 if (cmap) delete cmap; 21 23 } 22 24 23 25 24 26 /* --Methode-- */ 27 void PICMapView::SetColMap(PIColorMap* cmp, bool refr) 28 { 29 if (cmap) delete cmap; 30 if (cmp == NULL) cmap = NULL; 31 else cmap = new PIColorMap(*cmp); 32 if (refr) Refresh(); 33 return; 34 } 25 35 26 36 /* --Methode-- */ 27 void PICMapView:: Resize()37 void PICMapView::SetColMapId(CMapId cmapid, bool refr) 28 38 { 29 39 if (cmap && (cmap->Type() == cmapid) && (cmapid != CMAP_OTHER) ) return; 40 if (cmap) delete cmap; 41 cmap = new PIColorMap(cmapid); 42 if (refr) Refresh(); 43 return; 30 44 } 31 45 32 46 33 47 /* --Methode-- */ 34 void PICMapView::Draw(PIGraphicGen* g )48 void PICMapView::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 35 49 { 36 EraseWindow(); 37 g->SelLine(PI_NormalLine); 38 g->DrawBox(10,10, XSize()-20, YSize()-20); 50 if (!cmap) { 51 EraseWindow(0, 0, XSize(), YSize()); 52 return; 53 } 54 // On presente la table de couleur verticalement si SizeY > SizeX 55 // ou horizontale si SizeX > SizeY 39 56 40 g->SelLine(PI_ThinLine); 41 g->DrawFBox(20, 20, 20, 20); 42 g->DrawCircle(30, 30, 15); 57 int sx = XSize(); 58 int sy = YSize(); 43 59 44 g->SelForeground(PI_Red); 45 g->DrawFCircle(70, 30, 15); 46 47 g->SelForeground(PI_Yellow); 48 g->DrawFBox(10, 60, 100, 15); 49 50 g->SelForeground(PI_Black); 51 52 g->SelLine(PI_ThinLine); 53 g->DrawLine(10, 120, 40, 120); 54 g->SelLine(PI_NormalLine); 55 g->DrawLine(40, 120, 70, 120); 56 g->SelLine(PI_ThickLine); 57 g->DrawLine(70, 120, 100, 120); 58 59 g->SelForeground(PI_Magenta); 60 g->DrawFCircle(120, 30, 15); 61 g->SelForeground(PI_Grey); 62 g->DrawFCircle(120, 60, 15); 63 64 PIGrCoord x[5] = { 20, 35, 50, 65, 80 }; 65 PIGrCoord y[5] = { 130, 130, 130, 130, 130 }; 66 67 g->SelForeground(PI_Black); 68 g->DrawMarkers(x, y, 5); 69 return; 60 int k; 61 if (sx > sy) { // horizontal 62 int xc, dx; 63 xc = 0; 64 for(k=0; k<cmap->NCol(); k++) { 65 dx = (sx-xc)/(cmap->NCol()-k); 66 g->SelForeground((*cmap), k); 67 g->DrawFBox(xc, 0, dx, sy); 68 xc += dx; 69 } 70 } 71 else { // vertical 72 int yc, dy; 73 yc = sy; 74 for(k=0; k<cmap->NCol(); k++) { 75 dy = yc/(cmap->NCol()-k); 76 yc -= dy; 77 g->SelForeground((*cmap), k); 78 g->DrawFBox(0, yc, sx, dy); 79 } 80 } 81 82 return; 70 83 } 71 84 -
trunk/SophyaPI/PI/picmapview.h
r113 r127 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PICMapView 3 // Visualisation de table de couleur R. Ansari 07/98 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #ifndef PICMAPVIEW_H_SEEN 2 7 #define PICMAPVIEW_H_SEEN … … 5 10 6 11 #include PIBWDG_H 12 #include PICMAP_H 7 13 8 14 class PICMapView : public PIBaseWdg 9 15 { 10 16 public: 17 enum {ClassId = 5150}; 18 11 19 PICMapView(PIContainerGen *par, char *nom, 12 int sx=10, int sy=10, int px=0, int py=0);20 int sx=256, int sy=10, int px=0, int py=0); 13 21 virtual ~PICMapView(); 14 22 23 virtual long kind() {return ClassId; } 24 25 void SetColMap(PIColorMap* cmp=NULL, bool refr=true); 26 void SetColMapId(CMapId cmapid, bool refr=true); 15 27 16 28 // Traitement des evenements 17 29 18 virtual void Resize(); 19 virtual void Draw(PIGraphicGen* g); 30 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 20 31 21 32 22 33 protected: 34 PIColorMap* cmap; 23 35 }; 24 36 -
trunk/SophyaPI/PI/picons.cc
r126 r127 228 228 if (nmxrec > 0) { 229 229 NMxRecall = (nmxrec > 5) ? nmxrec : 5; 230 if (mRStr) delete[] mRStr; 230 231 mRStr = new string[NMxRecall]; 231 232 mNComm = mRCindx = mRindx = 0; 233 mRStr[0] = ""; 232 234 } 233 235 } … … 259 261 if (mScb) mScb->SetValue(0); 260 262 mOffL = 0; 261 }262 mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;263 } 264 else mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1; 263 265 } 264 266 … … 278 280 279 281 /* --Methode-- */ 280 void PIConsole::Draw(PIGraphicGen* g )282 void PIConsole::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 281 283 { 282 284 EraseWindow(); … … 332 334 mCmdStr[mCLC] = '\0'; 333 335 // printf("Keyb()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) ); 334 335 336 // Gestion de rappel des commandes 336 mRStr[mRCindx] = mCmdStr; 337 mRCindx++; mNComm++; 338 if (mRCindx >= NMxRecall) mRCindx = 0; 339 mRindx = mRCindx; 340 337 if (mCLC > 0) { 338 mRStr[mRCindx] = mCmdStr; 339 mRCindx++; mNComm++; 340 if (mRCindx >= NMxRecall) mRCindx = 0; 341 mRindx = mRCindx; 342 } 341 343 Send( Msg(), PIMsg_OK, mCmdStr); 342 344 ClrCmd(); … … 358 360 // printf("Keyb()-Debug- CursorUp/Down(%d) Index= %d %d \n", key, mRindx, mRCindx); 359 361 if (mNComm > 0) { 360 int nmxrec = ( mNComm < NMxRecall) ? mNComm: NMxRecall;362 int nmxrec = ((mNComm+1) < NMxRecall) ? mNComm+1 : NMxRecall; 361 363 if (key == PIK_Up) { 362 364 mRindx--; … … 392 394 } 393 395 394 /* Pour debugger le code - Reza 23/02/98395 #ifdef DEBUG_PICONS396 static int lines = 0;397 if ( (kmod == PIKM_Alt) ) {398 char buff[128];399 int l = 0;400 switch (toupper(key)) {401 case 'P' :402 DebugPrint(1);403 break;404 case 'H' :405 DebugPrint(0);406 break;407 case 'J' :408 AddChar('\n');409 DebugPrint(0);410 break;411 case 'R' :412 for(l=0; l<1; l++) {413 sprintf(buff, "Line type Reverse No %d ", lines);414 AddStr(buff, PIVA_Reverse, false);415 sprintf(buff, "Normal ");416 AddStr(buff, PIVA_Def, false);417 sprintf(buff, "Bold ");418 AddStr(buff, PIVA_Bold, false);419 lines++;420 }421 Refresh();422 break;423 424 case 'B' :425 for(l=0; l<3; l++) {426 sprintf(buff, "Line type Bold No %d \n", lines);427 AddStr(buff, PIVA_Bold, false);428 lines++;429 }430 Refresh();431 break;432 433 case 'I' :434 for(l=0; l<3; l++) {435 sprintf(buff, "Line type Italique No %d \n", lines);436 AddStr(buff, PIVA_Ital, false);437 lines++;438 }439 Refresh();440 break;441 442 case 'N' :443 for(l=0; l<3; l++) {444 sprintf(buff, "Line type Normal No %d \n", lines);445 AddStr(buff, PIVA_Def, false);446 lines++;447 }448 Refresh();449 break;450 }451 }452 #endif453 */454 396 455 397 /* --Methode-- */ -
trunk/SophyaPI/PI/picons.h
r126 r127 1 // This may look like C code, but it is really -*- C++ -*- 2 // composant graphique de type console (terminal) 3 // R. Ansari 12/97 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #ifndef PICONSOLE_H 2 7 #define PICONSOLE_H … … 36 41 37 42 // Gestion des evenements input/draw 38 virtual void Draw(PIGraphic Gen* g);43 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 39 44 virtual void Resize(); 40 45 virtual void Keyboard(int key, PIKeyModifier kmod); -
trunk/SophyaPI/PI/pidrawer.h
r120 r127 1 // This may look like C code, but it is really -*- C++ -*- 2 // Objets traceur qui peuvent etre attaches a un PIBaseWidget 3 // R. Ansari 97-98 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 1 5 #ifndef PIDRAWER_H 2 6 #define PIDRAWER_H -
trunk/SophyaPI/PI/pidrwtools.cc
r120 r127 23 23 void PIDrwTools::SetCurrentBaseWdg(PIBaseWdgGen* cbw) 24 24 { 25 if (mCurBW == cbw) return; 25 26 mCurBW = cbw; 26 27 if (cwdrwt) { 27 cwdrwt->mNlb->SetLabel("0"); 28 cwdrwt->mNDr = 0; 28 if (mCurBW != NULL) { 29 cwdrwt->mNDr = mCurBW->NbDrawers()-1; 30 if (cwdrwt->mNDr < 0) cwdrwt->mNDr = 0; 31 } 32 else cwdrwt->mNDr = 0; 33 char buff[32]; 34 sprintf(buff,"%d", cwdrwt->mNDr); 35 cwdrwt->mNlb->SetLabel(buff); 29 36 } 30 37 } … … 234 241 char buff[92]; 235 242 mNDr = 0; 243 if (mCurBW != NULL) { 244 mNDr = mCurBW->NbDrawers()-1; 245 if (mNDr < 0) mNDr = 0; 246 } 236 247 if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) { 237 248 PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW; … … 240 251 sprintf(buff, "%g %g", scd->YMin(), scd->YMax()); 241 252 mText[1]->SetText(buff); 242 if (scd->NbDrawers() > 1) mNDr = 1;243 253 } 244 254 else { -
trunk/SophyaPI/PI/piimage.cc
r119 r127 13 13 #include "piimgtools.h" 14 14 #include "pidrwtools.h" 15 #include PIAPP_H 15 16 16 17 // -------------------------------------------------------------------------------- … … 43 44 44 45 45 zow = NULL; 46 gvw = NULL; 47 trtw = NULL; 48 trtlb = txw = NULL; 49 SetTextWin(NULL); 46 zow = NULL; // Widget zoom 47 gvw = NULL; // widget vue globale 48 cmvw = NULL; // widget ColorMapView 49 // Fenetre transient et Label pour affichage de l'info (texte PixVal) 50 int tx, ty; 51 PIApplicationPrefCompSize(tx, ty); 52 tx *= 5; ty = (int)(ty*0.8); 53 trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0); 54 trtw->SetAutoDelChilds(true); 55 trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0); 56 trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed); 57 ustrtw = atrtw = false; 58 if ((sx < 300) || (sy < 150) ) atrtw = true; 59 showinfo = false; 60 50 61 gpixm = zpixm = pixm = NULL; 51 62 xsgpxm = xszpxm = xspxm = 0; … … 68 79 SetColMap(CMAP_COLRJ32); 69 80 81 // pour le copier-coller 82 cpbuffer = NULL; 83 cpbuflen = 0; 84 70 85 SetBackgroundColor(PI_Black); 71 86 … … 86 101 if (pixm) delete pixm; 87 102 if (zpixm) delete zpixm; 88 if (txw) txw->SetLabel("");89 103 if (zow) 90 104 { … … 100 114 gvw->SetUserData(NULL, 0); 101 115 } 116 if (cmvw) cmvw->SetColMap(NULL, true); 102 117 if (lut) delete lut; 103 118 delete mdrw; 104 119 delete gvdrw; 105 120 if (aisup && img) delete img; // Suppression automatique d'image 106 if (trtw) delete trtw; 121 delete trtw; 122 if (cpbuffer) delete[] cpbuffer; 107 123 if (this == cur_piimage) cur_piimage = NULL; 108 124 } … … 181 197 } 182 198 183 184 /* --Methode-- */ 185 void PIImage::SetTextWin(PILabel * tw, bool trw, int tx, int ty) 186 { 187 txw = tw; 188 if (trw) 189 { 190 if (trtw) trtw->SetSize(tx, ty); 191 else 192 { 193 trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0); 194 trtw->SetAutoDelChilds(true); 195 trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0); 196 trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed); 197 } 198 } 199 else 200 if (trtw) { delete trtw; trtw = NULL; trtlb = NULL; } 201 202 return; 199 /* --Methode-- */ 200 void PIImage::SetCMapWin(PICMapView * cw, bool refr) 201 { 202 cmvw = cw; 203 if (cmvw && refr) cmvw->SetColMapId(GetColMapId(),true); 204 } 205 206 207 /* --Methode-- */ 208 void PIImage::UseInfoWin(bool trw) 209 { 210 ustrtw = trw; 211 } 212 213 /* --Methode-- */ 214 void PIImage::ShowInfo(bool si) 215 { 216 if (showinfo == si) return; 217 showinfo = si; 218 if (showinfo && img) { 219 char buff[256]; 220 float x,y; 221 img->XYCoord(xpav, ypav, x, y); 222 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 223 x, y , (*img)(xpav, ypav), xpav, ypav ); 224 DrawInfo(mWGrC, buff); 225 } 226 else DrawInfo(mWGrC, NULL); 203 227 } 204 228 … … 326 350 if (zow) zow->SetColMap(cmap, refr); 327 351 if (gvw) gvw->SetColMap(cmap, refr); 352 if (cmvw) cmvw->SetColMapId(cmap, true); 328 353 return; 329 354 } … … 334 359 { 335 360 if (img == NULL) return; 336 if (mw) 337 { 361 if (mw) { 338 362 ComputePixmap(); 339 363 Send(Msg(), PIMsg_Active); … … 341 365 PIDrwTools::SetCurrentBaseWdg(this); 342 366 } 367 else { 368 char buff[256]; 369 float x,y; 370 img->XYCoord(xpav, ypav, x, y); 371 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 372 x, y , (*img)(xpav, ypav), xpav, ypav ); 373 if (ustrtw || atrtw) trtlb->SetLabel((string)buff); 374 else DrawInfo(mWGrC, buff); 375 } 343 376 if (zow != NULL) ComputeZoomPixmap(); 344 377 if (gvw != NULL) 345 378 if ( (gvw->UserData() != this) || (mw) ) SetGloVPixmap(); 346 347 if (txw || trtlb) 348 { 349 char buff[256]; 350 float x,y; 351 img->XYCoord(xpav, ypav, x, y); 352 sprintf(buff,"X= %g , Y= %g PixVal= %g (%d,%d)", 353 x, y , (*img)(xpav, ypav), xpav, ypav ); 354 if (txw) txw->SetLabel((string)buff); 355 if (trtlb) trtlb->SetLabel((string)buff); 356 } 357 379 if (cmvw) cmvw->SetColMapId(GetColMapId(),true); 380 358 381 return; 359 382 } … … 363 386 { 364 387 // printf("PIImage::Resize\n"); 388 // On bascule sur la fenetre transient pour l'affichage des valeurs si fenetre trop petite 389 if ((XSize() < 300) || (YSize() < 150) ) atrtw = true; 390 else atrtw = false; 365 391 PIPixmap::Resize(); 366 392 CenterPave(); … … 374 400 PIPixmap::Draw(g, x0, y0, dx, dy); 375 401 winovis = false; // $CHECK$ Reza A enlever si possible 17/6/96 376 if (curshow) 377 { 402 if (curshow) { 378 403 int xc,yc; 379 404 PosImg2W(xpav, ypav, &xc, &yc); 380 405 if ((xc >= x0) && (xc < x0+dx) && 381 406 (yc >= y0) && (yc < y0+dy) ) DrawCursor(g, xc, yc); 407 } 408 409 if (showinfo) { 410 char buff[256]; 411 float x,y; 412 img->XYCoord(xpav, ypav, x, y); 413 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 414 x, y , (*img)(xpav, ypav), xpav, ypav ); 415 DrawInfo(mWGrC, buff); 382 416 } 383 417 … … 393 427 if (key == 'Z' || key == 'z') { mdrw->ElDelAll(); Refresh(); } // Pour supprimer tous les signes 394 428 if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools(); // Fentre LUT et options 395 } 429 430 // ---- Le copier ---- 431 if (key == 'C' || key == 'c') { 432 // On limite la taille a 48x48 433 int i1 = XPave(); 434 int i2 = ( XSzPave() < 48 ) ? i1+XSzPave() : i1+48; 435 int j1 = YPave(); 436 int j2 = ( YSzPave() < 48 ) ? j1+YSzPave() : i1+48; 437 if ( ( (i2-i1) < 1 ) || ((j2-j1) < 1) ) return; 438 if (!ClaimSelection()) return; // On n'a pas pu prendre possession de la zone d'echange 439 if (cpbuffer) delete[] cpbuffer; 440 cpbuflen = (j2-j1)*(i2-i1+2)*12+(j2-j1)+128; 441 cpbuffer = new char[cpbuflen]; 442 sprintf(cpbuffer,"PIImage: Pave(%dx%d) en (%d, %d) MaxCopie= 48x48 \n", 443 XSzPave(), YSzPave(), i1, j1); 444 int i,j; 445 int l = strlen(cpbuffer); 446 for(j=j1; j<j2; j++) { 447 sprintf(cpbuffer+l,"L %3d:",j); 448 l += 6; 449 for(i=i1; i<i2; i++) { sprintf(cpbuffer+l," %10g", (*img)(i, j)); l += 11; } 450 cpbuffer[l] = '\n'; l++; 451 } 452 cpbuffer[l] = '\0'; 453 cpbuflen = l+1; 454 } 455 } 456 396 457 397 458 else if (kmod == PIKM_Blank) { … … 429 490 SelPointerShape(PI_CrossPointer); 430 491 xpav = xp; ypav = yp; 431 ShowTrTxW();492 if (ustrtw || atrtw) ShowTrTxW(); 432 493 Apply(false); 433 494 if (curshow) DrawCursor(mWGrC, -1,-1); … … 453 514 SelPointerShape(PI_ArrowPointer); 454 515 if (curshow) DrawCursor(mWGrC); 455 if (trtw) trtw->Hide(); 516 if (ustrtw || atrtw) trtw->Hide(); 517 else if (!showinfo) DrawInfo(mWGrC, NULL); 456 518 return; 457 519 } … … 474 536 else mWGrC->SelForeground(PI_Magenta); 475 537 mWGrC->SelLine(PI_NormalLine); 476 ShowTrTxW();538 if (ustrtw || atrtw) ShowTrTxW(); 477 539 return; 478 540 } … … 488 550 dxmv = x-xmv0; dymv = y-ymv0; 489 551 mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv); 490 if (txw || trtlb) 491 { 492 char buff[256]; 493 float x,y; 494 img->XYCoord(xp, yp, x, y); 495 sprintf(buff,"X= %g , Y= %g PixVal= %g (C= %d,%d)", 496 x, y , (*img)(xp, yp), (xp+xpv0)/2, (yp+ypv0)/2 ); 497 if (txw) txw->SetLabel((string)buff); 498 if (trtlb) trtlb->SetLabel((string)buff); 499 } 552 553 { 554 char buff[256]; 555 float x,y; 556 img->XYCoord(xp, yp, x, y); 557 sprintf(buff," X= %g , Y= %g Pix= %g (C= %d,%d) ", 558 x, y , (*img)(xp, yp), (xp+xpv0)/2, (yp+ypv0)/2 ); 559 if (ustrtw || atrtw) trtlb->SetLabel((string)buff); 560 else DrawInfo(mWGrC, buff); 561 } 562 500 563 return; 501 564 } … … 520 583 Apply(false); 521 584 if (curshow) DrawCursor(mWGrC); 522 if (trtw) trtw->Hide(); 585 if (ustrtw || atrtw) trtw->Hide(); 586 else if (!showinfo) DrawInfo(mWGrC, NULL); 523 587 return; 524 588 } … … 536 600 if ( PosW2Img(x, y, &xp, &yp) ) { xmv0 = -1; return; } 537 601 if (curshow) DrawCursor(mWGrC,-1,-1); 538 ShowTrTxW();602 if (ustrtw || atrtw) ShowTrTxW(); 539 603 SelPointerShape(PI_TDLRArrowPointer); 540 604 xmv0 = xp; … … 551 615 if (xmv0 < 0) return; 552 616 if ( PosW2Img(x, y, &xp, &yp) ) return; 553 if (txw || trtlb) 554 { 555 char buff[256]; 556 sprintf(buff,"DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0); 557 if (txw) txw->SetLabel((string)buff); 558 if (trtlb) trtlb->SetLabel((string)buff); 559 } 617 618 char buff[256]; 619 sprintf(buff," DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0); 620 if (ustrtw || atrtw) trtlb->SetLabel((string)buff); 621 else DrawInfo(mWGrC, buff); 560 622 } 561 623 … … 566 628 567 629 SelPointerShape(PI_ArrowPointer); 568 if ( trtw)trtw->Hide();630 if (ustrtw || atrtw) trtw->Hide(); 569 631 if (img == NULL) return; 570 632 if (xmv0 < 0) return; … … 597 659 mdrw->Refresh(); 598 660 } 661 662 /* --Methode-- */ 663 void * PIImage::ProvideSelection(unsigned int& typ, unsigned int& len) 664 { 665 typ = PICP_string; 666 len = cpbuflen; 667 return(cpbuffer); 668 } 669 670 /* --Methode-- */ 671 void PIImage::SelectionLost() 672 { 673 if (cpbuffer) delete[] cpbuffer; 674 cpbuffer = NULL; 675 cpbuflen = 0; 676 return; 677 } 678 679 599 680 600 681 /* --Methode-- */ … … 733 814 734 815 /* --Methode-- */ 735 void PIImage::DrawCursor(PIGraphic Gen* g)816 void PIImage::DrawCursor(PIGraphic* g) 736 817 { 737 818 int xc, yc; … … 744 825 745 826 /* --Methode-- */ 746 void PIImage::DrawCursor(PIGraphic Gen* g, int xc, int yc)827 void PIImage::DrawCursor(PIGraphic* g, int xc, int yc) 747 828 { 748 829 … … 776 857 } 777 858 859 860 /* --Methode-- */ 861 void PIImage::DrawInfo(PIGraphic* g, char* txt) 862 { 863 g->SelFont(PI_NormalSizeFont, PI_RomanFont); 864 if (txt) { 865 PIColors fgc = g->GetForeground(); 866 PIGOMode gm = g->GetGOMode(); 867 g->SelGOMode(PI_GOCopy); 868 g->SelForeground(PI_White); 869 g->SelBackground(PI_Black); 870 g->DrawOpaqueString(20, YSize()-5, txt); 871 g->SelGOMode(gm); 872 g->SelForeground(fgc); 873 } 874 else { 875 int a,d,h; 876 h = g->GetFontHeight(a, d); 877 PIPixmap::Draw(g, 0, YSize()-10-h, XSize(), h+10); 878 } 879 return; 880 } 778 881 779 882 /* --Methode-- */ -
trunk/SophyaPI/PI/piimage.h
r118 r127 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Module PI : Peida Interactive PIImage 2 3 // Affichage d image R. Ansari 05/95 … … 14 15 #include PISTDWDG_H 15 16 #include PIWIN_H 17 #include "picmapview.h" 16 18 17 19 class PIImage : public PIPixmap … … 35 37 { mdrw->SetAxesFlags(flags); mdrw->Refresh(); } 36 38 37 // Fenetre de Zoom, text, ... 38 void SetZoomWin(PIPixmap * zw, bool refr=true); 39 void SetGloVWin(PIPixmap * zw, bool refr=true); 40 void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30); 39 // Fenetre de Zoom, Vue global, ColorMap, text, ... 40 void SetZoomWin(PIPixmap * zw, bool refr=false); 41 void SetGloVWin(PIPixmap * zw, bool refr=false); 42 void SetCMapWin(PICMapView * cw, bool refr=false); 43 44 void UseInfoWin(bool trw=false); 45 void ShowInfo(bool si=true); 41 46 void ShowCursor(bool sc=true); 42 47 … … 67 72 void Apply(bool mw=true); 68 73 74 // Gestion du trace et des evenements 69 75 virtual void Resize(); 70 76 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); … … 81 87 virtual void Ptr3Move(int x, int y); 82 88 83 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l); 89 // Gestion du copier-coller 90 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l); 91 virtual void* ProvideSelection(unsigned int& typ, unsigned int& len); 92 virtual void SelectionLost(); 84 93 85 94 // Pour acces par les ImgTools (LutWind, ...) … … 94 103 void SetGloVPixmap(); 95 104 96 void DrawCursor(PIGraphicGen* g); 97 void DrawCursor(PIGraphicGen* g, int xc, int yc); 105 void DrawCursor(PIGraphic* g); 106 void DrawCursor(PIGraphic* g, int xc, int yc); 107 void DrawInfo(PIGraphic* g, char* txt); 98 108 99 109 void ShowTrTxW(); … … 127 137 int xsgpxm, ysgpxm; 128 138 PIElDrawer* gvdrw; 139 // Fenetre d'affichage du ColMap 140 PICMapView* cmvw; 129 141 // Fenetre/champ de texte 130 PILabel * txw;131 142 PILabel * trtlb; 132 143 PIWindow * trtw; 144 bool ustrtw, atrtw; 145 bool showinfo; 133 146 // Le pave et le curseur 134 147 int xpav, ypav; … … 138 151 int xcurs, ycurs; 139 152 int xszpav, yszpav; 153 // buffer pour copier-coller 154 char* cpbuffer; 155 int cpbuflen; 140 156 141 157 // PIImage courante -
trunk/SophyaPI/PI/piimgtools.cc
r126 r127 346 346 break; 347 347 348 case 5311 : 349 mpii->ShowInfo(true); 350 break; 351 352 case 5312 : 353 mpii->ShowInfo(false); 354 break; 355 348 356 case 5321 : 349 357 mpii->ShowCursor(true); -
trunk/SophyaPI/PI/pipixmapx.cc
r120 r127 60 60 } 61 61 62 /* --Methode-- */62 /*DEL07 --Methode-- 63 63 void PIPixmapX::Draw(PIGraphicGen* g) 64 64 { … … 67 67 if (g->kind() == PI_PSFileGraphics ) { 68 68 g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap); 69 /* Il faut faire quelque chose Sinon ??! */69 // Il faut faire quelque chose Sinon ??! 70 70 } 71 71 else Draw(g, 0, 0, XSize(), YSize()); 72 72 } 73 */ 73 74 74 75 /* --Methode-- */ 75 void PIPixmapX::Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy)76 void PIPixmapX::Draw(PIGraphic* g, int x0, int y0, int dx, int dy) 76 77 { 77 int mx, my, ox, oy; 78 Window xw; 79 Display * mdsp; 78 80 79 if (!g) return; 81 if (g->kind() == PI_PSFileGraphics ) return;82 80 if ((myximg == NULL) || (cmap == NULL)) return; 83 81 84 xw = XtWindow(XtWdg()); 85 mdsp = PIXDisplay(); 82 if (g->kind() == PI_PSFileGraphics ) { 83 if (pixmap) g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap); 84 return; 85 } 86 87 Window xw = XtWindow(XtWdg()); 88 Display * mdsp = PIXDisplay(); 89 90 int mx, my, ox, oy; 86 91 87 92 if (x0 < 0) x0 = 0; -
trunk/SophyaPI/PI/pipixmapx.h
r71 r127 13 13 virtual void Refresh(); 14 14 virtual void Resize(); 15 virtual void Draw(PIGraphicGen* g); 16 virtual void Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy); 15 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 17 16 18 17 -
trunk/SophyaPI/PI/piscdrawwdg.h
r120 r127 5 5 #ifndef PISCDRAWWDG_H 6 6 #define PISCDRAWWDG_H 7 8 #include <vector>9 7 10 8 #include "pisysdep.h"
Note:
See TracChangeset
for help on using the changeset viewer.