Changeset 37 in Sophya
- Timestamp:
- Feb 24, 1997, 4:34:49 PM (29 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 2 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Makefile
r30 r37 4 4 5 5 all: $(LIB)libPI.a 6 $(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pi up.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o6 $(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psdict.o $(OBJ)psfile.o 7 7 $(AR) $(ARFLAGS) $@ $? 8 8 … … 14 14 pimenubargen.h pimenux.h pimenugen.h 15 15 $(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \ 16 pimsghandler.h 16 pimsghandler.h psfile.h $(INC)defs.h \ 17 pibwdgx.h picmap.h picmapx.h picmapgen.h 17 18 $(OBJ)pibwdgx.o: pibwdgx.cc pibwdgx.h pisysdep.h pibwdggen.h piwdgx.h \ 18 piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h 19 piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h psfile.h \ 20 $(INC)defs.h picmap.h picmapx.h picmapgen.h 19 21 $(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h 20 22 $(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h … … 44 46 $(INC)perrors.h \ 45 47 $(INC)exceptions.h \ 46 $(INC)peidainit.h 48 $(INC)peidainit.h \ 49 $(INC)fmath.h 47 50 $(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \ 48 51 $(INC)rzimage.h \ … … 55 58 $(INC)imaginit.h \ 56 59 $(INC)datatypes.h \ 60 $(INC)ppersist.h \ 61 $(INC)pclassids.h \ 62 $(INC)dvlist.h \ 57 63 $(INC)lut.h pisysdep.h pipixmapx.h \ 58 64 pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h \ … … 71 77 $(INC)peida.h \ 72 78 $(INC)utils.h \ 79 $(INC)fmath.h \ 73 80 $(INC)array.h \ 74 81 $(INC)lockfile.h \ … … 104 111 $(OBJ)pipixmapx.o: pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \ 105 112 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \ 106 picmapx.h picmapgen.h 113 picmapx.h picmapgen.h psfile.h $(INC)defs.h 107 114 $(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \ 108 115 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \ … … 117 124 $(INC)machine.h \ 118 125 $(INC)perrors.h \ 126 $(INC)fmath.h \ 119 127 $(INC)ppersist.h \ 120 128 $(INC)pclassids.h \ … … 124 132 $(OBJ)pistdwdgx.o: pistdwdgx.cc pisysdep.h pistdwdgx.h pistdwdggen.h \ 125 133 piwdgx.h piwdggen.h pimsghandler.h 134 $(OBJ)pistlist.o: pistlist.cc pistlist.h piscdrawwdg.h pisysdep.h pibwdgx.h \ 135 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \ 136 pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \ 137 picontainergen.h $(INC)stlist.h \ 138 $(INC)machine.h \ 139 $(INC)defs.h \ 140 $(INC)exceptions.h \ 141 $(INC)peidainit.h \ 142 $(INC)perrors.h \ 143 $(INC)dynccd.h \ 144 $(INC)ppersist.h \ 145 $(INC)pclassids.h \ 146 $(INC)imaginit.h \ 147 $(INC)star.h \ 148 $(INC)strecinit.h \ 149 $(INC)starmacro.h \ 150 $(INC)psf.h \ 151 $(INC)peida.h \ 152 $(INC)utils.h \ 153 $(INC)fmath.h \ 154 $(INC)cimage.h \ 155 $(INC)rzimage.h \ 156 $(INC)rzvect.h \ 157 $(INC)datatypes.h \ 158 $(INC)dvlist.h \ 159 $(INC)generalfit.h \ 160 $(INC)matrix.h \ 161 $(INC)cvector.h \ 162 $(INC)transfo.h \ 163 $(INC)poly.h \ 164 $(INC)zfidu.h 126 165 $(OBJ)piup.o: piup.cc $(INC)ctimer.h \ 127 166 $(INC)peida.h \ … … 132 171 $(INC)exceptions.h \ 133 172 $(INC)peidainit.h \ 173 $(INC)fmath.h \ 134 174 $(INC)imageop.h \ 135 175 $(INC)cimage.h \ … … 138 178 $(INC)imaginit.h \ 139 179 $(INC)datatypes.h \ 180 $(INC)ppersist.h \ 181 $(INC)pclassids.h \ 182 $(INC)dvlist.h \ 140 183 $(INC)fitsimage.h \ 141 184 $(INC)fitsheader.h \ … … 153 196 $(INC)tarlib.h piup.h 154 197 $(OBJ)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \ 155 pisysdep.h piwdgx.h 198 pisysdep.h piwdgx.h psfile.h $(INC)defs.h \ 199 pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h 156 200 $(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \ 157 201 pisysdep.h picontainergen.h 158 202 $(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \ 159 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h 203 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h psfile.h \ 204 $(INC)defs.h pibwdgx.h pibwdggen.h picmap.h \ 205 picmapx.h picmapgen.h 160 206 $(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \ 161 207 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h 162 208 $(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \ 163 209 piwdgx.h piwdggen.h pimsghandler.h pixtbase.h 210 $(OBJ)psdict.o: psdict.cc psfile.h $(INC)defs.h \ 211 pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \ 212 picmap.h picmapx.h picmapgen.h 213 $(OBJ)psfile.o: psfile.cc psfile.h $(INC)defs.h \ 214 pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \ 215 picmap.h picmapx.h picmapgen.h -
trunk/SophyaPI/PI/pibwdggen.h
r32 r37 57 57 // Trace graphiques 58 58 virtual void EraseWindow() = 0; 59 virtual void DrawString(int x, int y, char* s, int pos = 0) 59 virtual void DrawString(int x, int y, char* s, int pos = 0) = 0; 60 60 virtual void DrawLine(int x1, int y1, int x2, int y2) = 0; 61 61 virtual void DrawBox(int x0, int y0, int dx, int dy) = 0; -
trunk/SophyaPI/PI/picmapx.cc
r30 r37 95 95 96 96 if ( (index < 0) || (index > mNCol) ) return; 97 98 if ( (col.red == 0) && (col.green == 0) && (col.blue == 0) ) 99 { 100 mColors[index] = BlackPixel(PIXDisplay(), PIXScreen()); 101 mColRGB[index] = col; 102 return; 103 } 104 97 105 myxcol.red = col.red; 98 106 myxcol.blue = col.blue; 99 107 myxcol.green = col.green; 108 100 109 101 110 if ( XAllocColor(PIXDisplay(), defxcmap, &myxcol) ) … … 121 130 void PIColorMapX::FreeColors() 122 131 { 132 PIXColor bpix; 133 PIColor blc; 134 123 135 if (!xinicmap) 124 136 { … … 127 139 } 128 140 129 XFreeColors(PIXDisplay(), defxcmap, mColors, mNCol, 0); 141 for (int i=0; i<mNCol; i++) 142 if ( (mColRGB[i].red != 0) && (mColRGB[i].blue != 0) && (mColRGB[i].green != 0) ) 143 XFreeColors(PIXDisplay(), defxcmap, mColors+i, 1, 0); 130 144 145 bpix = BlackPixel(PIXDisplay(), PIXScreen()); 146 blc.red = blc.green = blc.blue = 0; 131 147 for (int i=0; i<mNCol; i++) 132 { mColors[i] = BlackPixel(PIXDisplay(), PIXScreen()); 133 mColRGB[i].red = mColRGB[i].green = mColRGB[i].blue = 0; } 148 { mColors[i] = bpix; mColRGB[i] = blc; } 134 149 135 150 printf("PIColorMapX::FreeColors() Type= %d mNCol= %d \n", -
trunk/SophyaPI/PI/pifilechox.cc
r23 r37 10 10 #include <X11/Shell.h> 11 11 #include <Xm/FileSB.h> 12 13 // Pour ces sal... de XmString (ds piwdgx.cc) 14 int CStrFrXmStr(XmString xms, char* buff, int nmx); 12 15 13 16 // Fonctions privees (CallBack) … … 24 27 pif->MWin()->Unmanage(); 25 28 //pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str())); 26 char *flnm; 27 XmStringGetLtoR(calld->value, XmSTRING_DEFAULT_CHARSET, &flnm); 28 strncpy(pif->mFName, flnm, 511); 29 CStrFrXmStr(calld->value, pif->mFName, 512); 29 30 pif->Send( pif->Msg(), PIMsg_OK, (void *) pif->mFName); 30 31 return; … … 142 143 if (mSt) 143 144 { 144 char *buff;145 145 XmString xmstr; 146 146 Arg warg[2]; … … 148 148 XtSetArg(warg[0], XmNtextString, &xmstr); 149 149 XtGetValues(XtWdg(), warg, 1); 150 XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);151 string s( buff);150 CStrFrXmStr(xmstr, mFName, 512); 151 string s(mFName); 152 152 XmStringFree(xmstr); 153 153 return(s); … … 155 155 else 156 156 { 157 string s(""); 157 mFName[0] = '\0'; 158 string s(mFName); 158 159 return(s); 159 160 } -
trunk/SophyaPI/PI/pihisto.cc
r18 r37 12 12 if (ahisup) 13 13 delete mHisto; 14 }15 16 void17 PIHisto::SetAutoDelHisto(bool ad)18 {19 ahisup = ad;20 14 } 21 15 -
trunk/SophyaPI/PI/pihisto.h
r18 r37 13 13 virtual void DrawStats(); 14 14 virtual void Refresh(); // Recalcule les limites, et reaffiche 15 void SetAutoDelHisto(bool ad=false); 15 inline void SetAutoDelHisto(bool ad=false) { ahisup = ad; } 16 inline Histo* Histogram() { return(mHisto); } 17 16 18 protected: 17 19 Histo* mHisto; -
trunk/SophyaPI/PI/piimage.cc
r36 r37 24 24 curshow = true; 25 25 winovis = true; // $CHECK$ Reza A enlever si possible 17/6/96 26 zow = NULL; 26 27 admrk = true; 28 xpmrk = ypmrk = NULL; nbmrk = 0; 29 mrkt = PI_PlusMarker; mrkbsz = 3; 30 31 zow = NULL; 32 gvw = NULL; 27 33 trtw = NULL; 28 34 trtlb = txw = NULL; 29 35 SetTextWin(NULL); 30 zpixm = pixm = NULL;31 xs zpxm = xspxm = 0;32 ys zpxm = yspxm = 0;36 gpixm = zpixm = pixm = NULL; 37 xsgpxm = xszpxm = xspxm = 0; 38 ysgpxm = yszpxm = yspxm = 0; 33 39 lut = NULL; 34 40 offx = offy = 0; … … 40 46 xcurs = ycurs = -1; 41 47 zoom = 1; 48 zmgv = 1; 42 49 43 50 SetColMap(CMAP_COLRJ32); … … 60 67 if (pixm) delete pixm; 61 68 if (zpixm) delete zpixm; 69 if (txw) txw->SetLabel(""); 70 if (zow) 71 { 72 zow->SetPixmap(NULL,0,0); 73 zow->EraseWindow(); 74 } 75 if (gpixm) delete gpixm; 76 if (gvw) 77 { 78 gvw->SetPixmap(NULL,0,0); 79 gvw->EraseWindow(); 80 gvw->SetMsg(0); gvw->SetMsgParent(NULL); 81 gvw->SetUserData(NULL, 0); 82 } 62 83 if (lut) delete lut; 63 84 if (aisup) delete img; // Suppression automatique d'image 85 if (admrk) 86 { 87 if (xpmrk) delete xpmrk; 88 if (ypmrk) delete ypmrk; 89 } 64 90 if (trtw) delete trtw; 91 } 92 93 /* --Methode-- */ 94 void PIImage::Process(PIMessage msg, PIMsgHandler* sender, void* data) 95 { 96 if (UserMsg(msg) == (Msg()+626)) 97 { 98 if (ModMsg(msg) == PIMsg_Click) 99 { int* pxy=(int *)data; SetPave(pxy[0]*zmgv, pxy[1]*zmgv); } 100 if (ModMsg(msg) == PIMsg_Resize) 101 { ComputeGloVPixmap(); SetGloVPixmap(); } 102 } 103 else ReSend(msg, sender, data); 104 return; 65 105 } 66 106 … … 73 113 xszpav = yszpav = 1; 74 114 img = pim; 115 if (gpixm) delete gpixm; 116 gpixm = NULL; 117 xsgpxm = ysgpxm = 0; 118 zmgv = 1; 119 75 120 if (img) 76 121 { … … 83 128 } 84 129 130 /* --Methode-- */ 131 void PIImage::AddMarks(int nm, float* px, float* py, bool refr, bool ad, PIMarker mrk, int msz) 132 { 133 if ( (nbmrk > 0) && admrk ) { 134 if (xpmrk) delete xpmrk; 135 if (ypmrk) delete ypmrk; 136 } 137 if (nm <= 0) { nbmrk = 0; xpmrk = ypmrk = NULL; } 138 else { nbmrk = nm; xpmrk = px, ypmrk = py; } 139 admrk = ad; mrkt = mrk; mrkbsz = msz; 140 if (refr) DrawMarks(0, XSize(), 0, YSize()); 141 return; 142 } 143 144 /* --Methode-- */ 145 void PIImage::RemoveMarks(bool refr) 146 { 147 if (nbmrk < 1) return; 148 if (admrk ) { 149 if (xpmrk) delete xpmrk; 150 if (ypmrk) delete ypmrk; 151 } 152 nbmrk = 0; xpmrk = ypmrk = NULL; 153 if (refr) Refresh(); 154 } 85 155 86 156 /* --Methode-- */ … … 89 159 zow = zw; 90 160 if (zow && refr && img) 91 {92 zow->SetColMap(GetColMapId(), false);93 161 ComputeZoomPixmap(); 94 } 95 return; 96 } 162 return; 163 } 164 165 /* --Methode-- */ 166 void PIImage::SetGloVWin(PIPixmap * zw, bool refr) 167 { 168 gvw = zw; 169 if (gvw && img) 170 { ComputeGloVPixmap(); 171 if (refr) SetGloVPixmap(); } 172 return; 173 } 174 175 97 176 98 177 /* --Methode-- */ … … 170 249 lut = new LUT(min, max, NbCol(), typlut); 171 250 251 ComputeGloVPixmap(); 172 252 if (refr) Apply(); 173 253 return; … … 182 262 if (olut) delete olut; 183 263 264 ComputeGloVPixmap(); 184 265 if (refr) Apply(); 185 266 return; … … 202 283 { 203 284 if ((zm == 0) || (zm == -1) ) zoom = 1; 204 else if (zm > 10) zoom = 10;205 else if (zm < - 10) zoom = -10;285 else if (zm > 20) zoom = 20; 286 else if (zm < -20) zoom = -20; 206 287 else zoom = zm; 207 288 if (img) … … 235 316 236 317 /* --Methode-- */ 237 void PIImage::SetPave(int x, int y, bool refr )318 void PIImage::SetPave(int x, int y, bool refr, bool cent) 238 319 { 239 320 int xc, yc; … … 247 328 (y >= (img->YSize()-1)) || ( y < 0) ) return; 248 329 330 if ( (x == xpav) && (y == ypav) ) return; 249 331 xpav = x; ypav = y; 250 if (PosImg2W(xpav,ypav,&xc, &yc)) // Il faut recenter l'image 332 333 if ( PosImg2W(xpav,ypav,&xc, &yc) || cent) // Il faut recenter l'image 251 334 { SetOffsetFromPave(); 252 335 if (refr) Apply(true); } … … 263 346 PIPixmap::SetColMap(cmap, refr); 264 347 if (zow) zow->SetColMap(cmap, refr); 348 if (gvw) gvw->SetColMap(cmap, refr); 265 349 return; 266 350 } … … 272 356 if (img == NULL) return; 273 357 if (mw) 274 { 358 { 275 359 ComputePixmap(); 276 360 Send(Msg(), PIMsg_Active); 277 361 } 278 if (zow != NULL) 279 { 280 zow->SetColMap(GetColMapId(), false); 281 ComputeZoomPixmap(); 282 } 362 if (zow != NULL) ComputeZoomPixmap(); 363 if (gvw != NULL) 364 if ( (gvw->UserData() != this) || (mw) ) SetGloVPixmap(); 365 283 366 if (txw || trtlb) 284 367 { … … 315 398 (yc >= y0) && (yc < y0+dy) ) DrawCursor(xc, yc); 316 399 } 400 401 DrawMarks(x0, x0+dx, y0, y0+dy); 317 402 return; 318 403 } … … 360 445 void PIImage::But2Press(int x, int y) 361 446 { 362 int xp, yp;363 447 364 448 Send(Msg(), PIMsg_Active); … … 614 698 615 699 zpixm = ComputePixmap(ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm); 700 zow->SetColMap(GetColMapId(), false); 616 701 zow->SetPixmap(zpixm, xszpxm, yszpxm); 617 702 zow->SetUserData((void *)this, 0); … … 621 706 } 622 707 708 709 /* --Methode-- */ 710 void PIImage::ComputeGloVPixmap() 711 { 712 unsigned int xwsz, ywsz; 713 int zmx,zmy; 714 715 if (gvw == NULL) return; 716 if (img == NULL) return; 717 718 xwsz = gvw->XSize(); 719 ywsz = gvw->YSize(); 720 721 zmx = img->XSize()/xwsz; 722 zmy = img->YSize()/ywsz; 723 724 if (zmx < zmy) zmx = zmy; 725 if (zmx < 1) zmx = 1; 726 zmgv = zmx; 727 if (zmx > 1) zmx = -zmx; 728 gpixm = ComputePixmap(0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm); 729 return; 730 } 731 732 /* --Methode-- */ 733 void PIImage::SetGloVPixmap() 734 { 735 float zm; 736 int x,y, dx,dy; 737 738 if (zoom > 0) zm = zmgv*zoom; 739 else zm = (float)zmgv/(float)(-zoom); 740 x = offx/zmgv+1; 741 y = offy/zmgv+1; 742 dx = (int) ( (float)XSize()/zm-1. ); 743 dy = (int) ( (float)YSize()/zm-1. ); 744 745 gvw->ElDelAll(); 746 gvw->SelForeground(PI_Yellow); 747 gvw->SelLine(PI_NormalLine); 748 gvw->ElAddRect(x,y,dx,dy); 749 gvw->SetColMap(GetColMapId(), false); 750 gvw->SetPixmap(gpixm, xsgpxm, ysgpxm); 751 gvw->SetUserData((void *)this, 0); 752 gvw->SetMsg(Msg()+626); 753 gvw->SetMsgParent(this); 754 755 return; 756 } 757 623 758 /* --Methode-- */ 624 759 void PIImage::DrawCursor() … … 645 780 if (zoom < 3) SelLine(PI_NormalLine); 646 781 else SelLine(PI_ThickLine); 782 if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) ) 783 SelForeground(PI_Red); 784 else SelForeground(PI_White); 647 785 SelGOMode(PI_GOCopy); 648 786 DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs); … … 653 791 else { xcurs = ycurs = -1; } 654 792 793 return; 794 } 795 796 /* --Methode-- */ 797 void PIImage::DrawMarks(int x1, int x2, int y1, int y2) 798 { 799 float fz; 800 float tofx, tofy; 801 int i,x,y; 802 803 if ( (winovis || (nbmrk < 1) ) ) return; 804 tofx = tofy = 0; 805 if ( img ) { tofx = img->XOrg(); tofy = img->YOrg(); } 806 tofx += offx; tofy += offy; 807 fz = GetZoomF(); 808 SelGOMode(PI_GOCopy); 809 SelMarker((int)(fz*mrkbsz), mrkt); 810 if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) ) 811 SelForeground(PI_Red); 812 else SelForeground(PI_White); 813 for(i=0; i<nbmrk; i++) 814 { 815 x = (int) ((xpmrk[i]-tofx)*fz); 816 y = (int) ((ypmrk[i]-tofy)*fz); 817 if ((x < x1) || (x > x2) || (y < y1) || (y > y2)) continue; 818 DrawMarker(x,y); 819 } 655 820 return; 656 821 } -
trunk/SophyaPI/PI/piimage.h
r23 r37 19 19 20 20 public: 21 enum {ClassId = 5150}; 22 21 23 // Les methodes 22 24 … … 25 27 ~PIImage(); 26 28 27 void SetImage(RzImage *pim, bool refr=true); 29 virtual long kind() {return ClassId; } 30 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 31 32 void SetImage(RzImage* pim, bool refr=true); 28 33 void SetAutoDelImage(bool ad = false); 29 34 35 void AddMarks(int nm, float* px, float* py, bool refr=true, 36 bool ad=true, PIMarker mrk=PI_PlusMarker, int msz=3); 37 void RemoveMarks(bool refr=true); 38 30 39 void SetZoomWin(PIPixmap * zw, bool refr=true); 40 void SetGloVWin(PIPixmap * zw, bool refr=true); 31 41 void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30); 32 42 void ShowCursor(bool sc=true); … … 41 51 42 52 void SetOffset(int ox, int oy, bool refr=true); 43 void SetPave(int x, int y, bool refr=true );53 void SetPave(int x, int y, bool refr=true, bool cent=true); 44 54 45 55 virtual void SetColMap(CMapId cmap, bool refr=true); … … 75 85 void ComputePixmap(); 76 86 void ComputeZoomPixmap(); 87 void ComputeGloVPixmap(); 88 void SetGloVPixmap(); 77 89 78 90 void DrawCursor(); 79 91 void DrawCursor(int xc, int yc); 92 void DrawMarks(int x1, int x2, int y1, int y2); 80 93 81 94 void ShowTrTxW(); … … 94 107 bool winovis; // $CHECK$ Reza A enlever si possible 17/6/96 95 108 109 // Pour gerer les marques ajoutees 110 bool admrk; 111 int nbmrk, mrkbsz; 112 float * xpmrk, * ypmrk; 113 PIMarker mrkt; 114 // Tableau des pixels principal 96 115 unsigned char * pixm; 97 116 int xspxm, yspxm; 98 99 117 LUT * lut; 100 118 int offx, offy; 101 119 // Fenetre de zoom 102 120 int zoom; 103 121 PIPixmap * zow; 104 122 unsigned char * zpixm; 105 123 int xszpxm, yszpxm; 106 124 // Fenetre pour l'image entiere 125 int zmgv; 126 PIPixmap * gvw; 127 unsigned char * gpixm; 128 int xsgpxm, ysgpxm; 129 // Fenetre/champ de texte 107 130 PILabel * txw; 108 131 PILabel * trtlb; 109 132 PIWindow * trtw; 110 133 // Le pave et le curseur 111 134 int xpav, ypav; 112 135 int xpv0, ypv0; -
trunk/SophyaPI/PI/pilistx.cc
r30 r37 7 7 #include <Xm/List.h> 8 8 9 9 10 /************* PIListX ************/ 10 11 12 // Pour ces sal... de XmString (ds piwdgx.cc) 13 int CStrFrXmStr(XmString xms, char* buff, int nmx); 11 14 12 15 // Fonction prive (CallBack) … … 228 231 { 229 232 Arg warg[2]; 230 char *buff;231 233 XmString *xmst; 232 234 233 if ( (n < 0) || (n >= mNItem)) return("");235 if ( (n < 0) || (n >= mNItem)) { mSItem[0] = '\0'; return(mSItem); } 234 236 235 237 XtSetArg(warg[0], XmNitems, &xmst); 236 238 XtGetValues(mlist, warg, 1); 237 XmStringGetLtoR(xmst[n], XmSTRING_DEFAULT_CHARSET, &buff);238 return( buff);239 CStrFrXmStr(xmst[n], mSItem, 320); 240 return(mSItem); 239 241 } 240 242 -
trunk/SophyaPI/PI/pilistx.h
r30 r37 43 43 int * mSelNum; 44 44 bool mMultSel; 45 char mSItem[320]; 45 46 46 47 SysDWdg mlist; -
trunk/SophyaPI/PI/pimenugen.h
r23 r37 14 14 ~PIMenuGen(); 15 15 16 virtual void AppendItem(char* nom, PIMessage msg )=0;16 virtual void AppendItem(char* nom, PIMessage msg, char* sc=NULL)=0; 17 17 18 18 virtual void DeleteItem(char *nom)=0; -
trunk/SophyaPI/PI/pimenumac.cc
r23 r37 43 43 44 44 void 45 PIMenuMac::AppendItem(char* nom, PIMessage msg )45 PIMenuMac::AppendItem(char* nom, PIMessage msg, char* sc) // sc = short-cut , raccourci clavier 46 46 { 47 47 LStr255 titre(nom); -
trunk/SophyaPI/PI/pimenumac.h
r23 r37 13 13 ~PIMenuMac(); 14 14 15 virtual void AppendItem(char* nom, PIMessage msg);15 virtual void AppendItem(char* nom, PIMessage msg, char* sc=NULL); 16 16 17 17 virtual void DeleteItem(char *nom); -
trunk/SophyaPI/PI/pimenux.cc
r23 r37 11 11 /************* PIMenuX ************/ 12 12 13 // Pour ces sal... de XmString (ds piwdgx.cc) 14 int CStrFrXmStr(XmString xms, char* buff, int nmx); 13 15 14 16 // Fonction prive (CallBack) … … 25 27 26 28 // pim->Hide(); 27 pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb) .c_str());29 pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb)); 28 30 #ifdef DEBUG_PIMenuX 29 31 printf("%%%Debug_menub_action: Msg= %d %lx\n", (int)cusd->msg, (long)pim); … … 60 62 61 63 /* --Methode-- */ 62 void PIMenuX::AppendItem(char* nom, PIMessage msg )63 { 64 AddItem(nom, msg, false );64 void PIMenuX::AppendItem(char* nom, PIMessage msg, char* sc) 65 { 66 AddItem(nom, msg, false, sc); 65 67 } 66 68 … … 68 70 void PIMenuX::DeleteItem(char *nom) 69 71 { 70 string s(nom); 71 72 for(int i=0; i<mNItem; i++) 73 if (ItemName(i) == s) 72 73 for(int i=0; i<mNItem; i++) 74 if (strcmp(ItemName(i), nom) == 0) 74 75 { DeleteItemNum(i); break; } 75 76 … … 111 112 void PIMenuX::CheckItem(char *nom, bool st) 112 113 { 113 string s(nom); 114 115 for(int i=0; i<mNItem; i++) 116 if (ItemName(i) == s) 114 115 for(int i=0; i<mNItem; i++) 116 if (strcmp(ItemName(i), nom) == 0) 117 117 { CheckItemNum(i, st); break; } 118 118 … … 159 159 160 160 /* --Methode-- */ 161 string PIMenuX::ItemName(int n) 162 { 163 if ( (n < 0) || (n >= mNItem)) return(""); 164 return (ItemNameWdg(mBut[n].itb)); 165 } 166 167 168 /* --Methode-- */ 169 string PIMenuX::ItemNameWdg(SysDWdg itw) 170 { 171 string s; 172 char *buff; 161 char* PIMenuX::ItemName(int n) 162 { 163 if ( (n < 0) || (n >= mNItem)) { mSItem[0] = '\0'; return(mSItem); } 164 else return (ItemNameWdg(mBut[n].itb)); 165 } 166 167 168 /* --Methode-- */ 169 char* PIMenuX::ItemNameWdg(SysDWdg itw) 170 { 173 171 XmString xmstr; 174 172 Arg warg[2]; … … 178 176 if (xmstr) 179 177 { 180 XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff); 181 s=buff; 178 CStrFrXmStr(xmstr, mSItem, 96); 182 179 XmStringFree(xmstr); 183 180 } 184 else s = "";185 186 return( s);181 else mSItem[0] = '\0'; 182 183 return(mSItem); 187 184 } 188 185 … … 200 197 int PIMenuX::GetNumItem(char *nom) 201 198 { 202 string s(nom); 203 204 for(int i=0; i<mNItem; i++) 205 if (ItemName(i) == s) return(i); 199 200 for(int i=0; i<mNItem; i++) 201 if (strcmp(ItemName(i),nom) == 0) return(i); 206 202 return(-1); 207 203 } … … 224 220 225 221 /* --Methode-- */ 226 void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog )222 void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog, char* sc) 227 223 { 228 224 _pimxit_ *buto; … … 264 260 XtAddCallback(mBut[mNItem].itb, cbckn, 265 261 menub_action, (XtPointer)(mBut+mNItem)); 262 if (sc) // Raccourci clavier 263 { 264 char acc[16]; 265 int n=0; 266 Arg warg[2]; 267 XmString xmstr; 268 269 sprintf(acc,"Ctrl/%c", sc[0]); 270 xmstr = XmStringLtoRCreate(acc, XmSTRING_DEFAULT_CHARSET); 271 XtSetArg(warg[n], XmNacceleratorText, xmstr); n++; 272 sprintf(acc,"Ctrl<Key>%c", sc[0]); 273 XtSetArg(warg[n], XmNaccelerator, acc); n++; 274 XtSetValues(mBut[mNItem].itb, warg, n); 275 XmStringFree(xmstr); 276 } 277 266 278 #ifdef DEBUG_PIMenuX 267 279 printf("DBG>> %d (%d) %lx \n", mNItem, mNItemMax, (long)(mBut+mNItem)); … … 394 406 } 395 407 408 -
trunk/SophyaPI/PI/pimenux.h
r23 r37 22 22 ~PIMenuX(); 23 23 24 virtual void AppendItem(char* nom, PIMessage msg );24 virtual void AppendItem(char* nom, PIMessage msg, char* sc=NULL); 25 25 26 26 virtual void DeleteItem(char *nom); … … 41 41 int GetNumItemMsg(PIMessage msg); 42 42 SysDWdg GetItemWdg(int n); 43 stringItemName(int n);44 stringItemNameWdg(SysDWdg itw);43 char* ItemName(int n); 44 char* ItemNameWdg(SysDWdg itw); 45 45 46 46 protected: 47 void AddItem(char* nom, PIMessage msg, bool tog );47 void AddItem(char* nom, PIMessage msg, bool tog, char* sc=NULL); 48 48 void Check(); 49 49 50 50 int mNItem, mNItemMax; 51 51 _pimxit_ * mBut; 52 52 char mSItem[96]; 53 53 }; 54 54 -
trunk/SophyaPI/PI/pimsghandler.h
r30 r37 11 11 PIMsg_Active = 1, 12 12 PIMsg_Close = 2, 13 PIMsg_Resize = 3, 13 14 14 15 PIMsg_OK = 11, … … 20 21 PIMsg_Press = 23, 21 22 PIMsg_Drag = 24, 23 PIMsg_Drop = 25, 22 24 23 25 PIMsg_Select = 31, -
trunk/SophyaPI/PI/pipixmapgen.cc
r10 r37 18 18 pixmap = NULL; 19 19 nx = ny = 0; 20 ofx = ofy = 0; 21 mPpos[0] = mPpos[0] = 0; 20 22 cmap = new PIColorMap(CMAP_GREY32); 23 mEn = 0; 24 ActivateButton(1); 21 25 } 22 26 … … 29 33 30 34 /* --Methode-- */ 31 void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr )35 void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy) 32 36 { 33 pixmap = pix; nx = sx; ny = sy; 37 pixmap = pix; 38 if (pixmap) 39 { 40 if (sx < 0) sx = 0; 41 if (sy < 0) sy = 0; 42 if (ox < 0) ox = 0; 43 if (oy < 0) oy = 0; 44 nx = sx; ny = sy; 45 ofx = ox; ofy = oy; 46 } 47 else { ofx = ofy = nx = ny = 0; } 34 48 if (refr) Refresh(); 35 49 } … … 45 59 46 60 61 /* --Methode-- */ 62 void PIPixmapGen::But1Press(int x, int y) 63 { 64 mPpos[0] = x; mPpos[1] = y; 65 if (Msg()) Send(Msg(), PIMsg_Click, mPpos); 66 return; 67 } 68 69 70 /* --Methode-- */ 71 int PIPixmapGen::ElAdd(int typ, int x, int y, int dx, int dy, char* s) 72 { 73 DrwEl dre; 74 mEn++; 75 dre.eid = mEn; dre.etyp = typ; 76 dre.ex = x; dre.ey = y; 77 dre.edx = dx; dre.edy = dy; 78 if (s) dre.es = s; 79 mElist.push_back(dre); 80 return(mEn); 81 } 82 83 /* --Methode-- */ 84 void PIPixmapGen::ElDel(int id) 85 { 86 DrwElList::iterator it; 87 for (it = mElist.begin(); it != mElist.end(); it++) 88 if ( (*it).eid == id) { mElist.erase(it); break; } 89 return; 90 } 91 92 /* --Methode-- */ 93 void PIPixmapGen::ElDelAll() 94 { 95 mElist.erase(mElist.begin(), mElist.end()); 96 return; 97 } 98 99 /* --Methode-- */ 100 void PIPixmapGen::DrawElements() 101 { 102 char* txt; 103 DrwElList::iterator it; 104 for (it = mElist.begin(); it != mElist.end(); it++) 105 { 106 switch ( (*it).etyp ) 107 { 108 case PIDEL_Line : 109 DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 110 break; 111 case PIDEL_Text : 112 txt = (*it).es.c_str(); 113 DrawString((*it).ex, (*it).ey, txt ); 114 break; 115 case PIDEL_Rect : 116 DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 117 break; 118 case PIDEL_FRect : 119 DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 120 break; 121 case PIDEL_Circ : 122 DrawCircle((*it).ex, (*it).ey, (*it).edx ); 123 break; 124 case PIDEL_FCirc : 125 DrawFCircle((*it).ex, (*it).ey, (*it).edx ); 126 break; 127 default : 128 break; 129 } 130 } 131 return; 132 } 133 47 134 48 135 // Fin des methodes de la classe -
trunk/SophyaPI/PI/pipixmapgen.h
r10 r37 9 9 #include PICMAP_H 10 10 11 #include <list.h> 12 11 13 class PIPixmapGen : public PIBaseWdg 12 14 { … … 14 16 enum {ClassId = 5100}; 15 17 18 enum { PIDEL_Line = 1, PIDEL_Text = 2, 19 PIDEL_Rect = 3, PIDEL_FRect = 4, 20 PIDEL_Circ = 5, PIDEL_FCirc = 6 } ; 21 16 22 PIPixmapGen(PIContainerGen *par, char *nom, 17 23 int sx=10, int sy=10, int px=0, int py=0); 18 virtual ~PIPixmapGen();24 virtual ~PIPixmapGen(); 19 25 20 virtual long 26 virtual long kind() {return ClassId; } 21 27 22 virtual void SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true); 28 virtual void SetPixmap(unsigned char *pix, int sx, int sy, 29 bool refr=true, int ox=0, int oy=0); 23 30 void SetColMap(CMapId cmapid, bool refr=true); 24 31 inline CMapId GetColMapId() { return (cmap->Type()); }; 25 32 inline int NbCol() { return(cmap->NCol()); }; 26 33 34 virtual void But1Press(int x, int y); 35 inline int XPPos() { return mPpos[0]; } 36 inline int YPPos() { return mPpos[1]; } 37 38 inline int ElAddLine(int x1, int y1, int x2, int y2) 39 { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL) ); } 40 inline int ElAddText(int x, int y, char* s) 41 { return( ElAdd(PIDEL_Text, x, y, 0, 0, s) ); } 42 inline int ElAddRect(int x, int y, int dx, int dy) 43 { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL) ); } 44 inline int ElAddFRect(int x, int y, int dx, int dy) 45 { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL) ); } 46 inline int ElAddCirc(int x, int y, int r) 47 { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL) ); } 48 inline int ElAddFCirc(int x, int y, int r) 49 { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL) ); } 50 51 void ElDel(int id); 52 void ElDelAll(); 53 27 54 protected: 55 int ElAdd(int typ, int x, int y, int dx, int dy, char* s); 56 virtual void DrawElements(); 57 28 58 unsigned char *pixmap; 29 59 int nx, ny; 60 int ofx, ofy; 30 61 PIColorMap* cmap; 62 63 typedef struct { 64 int eid, etyp; 65 int ex,ey; 66 int edx,edy; 67 string es; 68 } DrwEl; 69 typedef list<DrwEl> DrwElList; 70 71 DrwElList mElist; 72 int mEn; 73 int mPpos[2]; 31 74 }; 32 75 -
trunk/SophyaPI/PI/pipixmapx.cc
r32 r37 41 41 { XPutPixel(myximg, i, j, cmap->Color(*pp) ); pp++; } 42 42 } 43 } 43 44 44 45 46 47 } 45 for(j=ny; j<YSize(); j++) 46 for(i=nx; i<XSize(); i++) 47 XPutPixel(myximg, i, j, 0 ); 48 48 49 PIBaseWdgX::Refresh(); 49 50 } … … 56 57 XFree(myximg); 57 58 AllocXImg(); 59 if (Msg()) Send(Msg(), PIMsg_Resize, mPpos); 58 60 } 61 59 62 /* --Methode-- */ 60 63 void PIPixmapX::Draw() 61 64 { 62 65 if(mPSOut) 66 { 63 67 if(pixmap) 64 68 mPSOut->Image(0, 0, (float)XSize(), (float)YSize(), nx, ny, pixmap, cmap); 65 else 66 return; /* pour l'instant */ 69 /* Il faut faire quelque chose Sinon ??! */ 70 DrawElements(); 71 } 67 72 else 68 73 Draw(0, 0, XSize(), YSize()); … … 72 77 void PIPixmapX::Draw(int x0, int y0, int dx, int dy) 73 78 { 79 int mx, my, ox, oy; 74 80 Window xw; 75 81 Display * mdsp; … … 81 87 if (x0 < 0) x0 = 0; 82 88 if (y0 < 0) y0 = 0; 83 89 mx = nx+ofx; my = ny+ofy; 84 90 if (dx > (XSize()-x0)) dx = XSize()-x0; 85 91 if (dy > (YSize()-y0)) dy = YSize()-y0; 86 92 if ((dx <= 0) || (dy <= 0)) return; 87 93 88 if ( ( nx < x0 ) || (ny < y0) )94 if ( (mx < x0 ) || (my < y0) ) 89 95 { XClearArea(mdsp, xw, x0, y0, dx, dy, False); return; } 90 96 91 if (nx < (x0+dx)) 92 { XClearArea(mdsp, xw, nx, y0, x0+dx-nx, dy, False); dx = nx-x0; } 93 if (ny < (y0+dy)) 94 { XClearArea(mdsp, xw, x0, ny, dx, y0+dy-ny, False); dy = ny-y0; } 95 96 XPutImage(mdsp, xw, mygc, myximg, x0, y0, x0, y0, dx, dy); 97 ox = oy = 0; 98 99 if (ofx > x0) 100 { XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False); 101 dx -= (ofx-x0); x0 = ofx; ox = 0; } 102 else ox = x0-ofx; 103 if (ofy > y0) 104 { XClearArea(mdsp, xw, x0, y0, dx, ofy-y0, False); 105 dy -= (ofy-y0); y0 = ofy; oy = 0; } 106 else oy = y0-ofy; 107 108 if (mx < (x0+dx)) 109 { XClearArea(mdsp, xw, mx, y0, x0+dx-mx, dy, False); dx = mx-x0; } 110 if (my < (y0+dy)) 111 { XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False); dy = my-y0; } 112 113 XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy); 114 DrawElements(); 97 115 XFlush(mdsp); 98 116 -
trunk/SophyaPI/PI/piscdrawwdg.cc
r23 r37 32 32 33 33 void 34 PIScDrawWdg::SetLimits(double xmin, double xmax, 35 double ymin, double ymax, bool tmp)34 PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax, 35 bool axrl, bool ayud, bool tmp) 36 36 { 37 37 if (xmax <= xmin || ymax <= ymin) 38 38 return; // $CHECK$ exception ? 39 aXdir = axrl; // Vrai si Axe X de Droite vers Gauche 40 aYdir = ayud; // Vrai si Axe Y de Haut vers Bas 39 41 xMin = xmin; 40 42 xMax = xmax; 41 43 yMin = ymin; 42 44 yMax = ymax; 45 mPPos[0] = 0.5*(xMin+xMax); 46 mPPos[1] = 0.5*(yMin+yMax); 43 47 if (!tmp) { 44 48 xMinS = xmin; … … 63 67 PIScDrawWdg::CalcScale() 64 68 { 65 double margeH = (xMax-xMin)*0. 2;66 double margeV = (yMax-yMin)*0. 2;69 double margeH = (xMax-xMin)*0.15; 70 double margeV = (yMax-yMin)*0.15; 67 71 xScale = XSize() / (xMax-xMin + 2*margeH); 68 yScale = -YSize() / (yMax-yMin + 2*margeV); 69 xOrg = (-xMin + margeH) * xScale;// + XPos(); 70 yOrg = (-yMax - margeV) * yScale;// + YPos(); 72 if (aXdir) { 73 xScale = -xScale; 74 xOrg = (-xMax - margeH) * xScale;// + XPos(); 75 } 76 else xOrg = (-xMin + margeH) * xScale;// + XPos(); 77 yScale = YSize() / (yMax-yMin + 2*margeV); 78 if (!aYdir) { 79 yScale = -yScale; 80 yOrg = (-yMax - margeV) * yScale;// + YPos(); 81 } 82 else yOrg = (-yMin + margeV) * yScale;// + YPos(); 83 return; 71 84 } 72 85 … … 361 374 { 362 375 double xOffset = 0; 363 376 int kk; 364 377 ScSelFontSz(xMajTickLen*4); 365 378 for (double x=xBeg; x<=xMax; x += xStep) { 366 379 char label[20]; sprintf(label, "%-6g", x); 380 for(kk=0; kk<20; kk++) 381 if (label[kk] == ' ') { label[kk] = '\0' ; break; } 367 382 double largeur = ScStringWidth(label); 368 383 if (just == 1) … … 372 387 else 373 388 xOffset = 0; 389 if (aXdir) xOffset = -xOffset; 374 390 ScDrawString(x+xOffset, y, label); 375 391 } … … 390 406 else 391 407 xOffset = 0; 408 if (aXdir) xOffset = -xOffset; 392 409 ScDrawString(x+xOffset, y, label); 393 410 } … … 427 444 428 445 if (flags & kLabels) { 446 if (!aYdir) 429 447 DrawHLabels(-xMajTickLen*8, xFirstMajTick, xMajTickStep,0); 448 else 449 DrawHLabels(xMajTickLen*8, xFirstMajTick, xMajTickStep,0); 450 if (!aXdir) 430 451 DrawVLabels(-yMajTickLen*2, yFirstMajTick, yMajTickStep,1); 452 else 453 DrawVLabels(yMajTickLen*2, yFirstMajTick, yMajTickStep,1); 431 454 } 432 455 … … 475 498 476 499 if (flags & kLabels) { 500 if (!aYdir) { 477 501 DrawHLabels(yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0); 478 502 DrawHLabels(yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0); 503 } 504 else { 505 DrawHLabels(yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0); 506 DrawHLabels(yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0); 507 } 508 if (!aXdir) { 479 509 DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1); 480 510 DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1); 511 } 512 else { 513 DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1); 514 DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1); 515 } 481 516 } 482 517 } … … 604 639 PIScDrawWdg::UpdateText(int xp, int yp) 605 640 { 606 if ((mTxw == NULL) && (mTrlb == NULL)) return(false); 607 608 char buff[128]; 641 609 642 double dx, dy; 610 643 Local2Sc(xp, yp, dx, dy); 644 mPPos[0] = dx; mPPos[1] = dy; 645 if ((mTxw == NULL) && (mTrlb == NULL)) return(false); 646 647 char buff[128]; 611 648 sprintf(buff, "X= %g Y= %g", dx, dy); 612 649 if (mTxw) … … 647 684 648 685 if (xBegDrag == xEndDrag || yBegDrag == yEndDrag) 649 SetLimits(xMinS, xMaxS, yMinS, yMaxS );686 SetLimits(xMinS, xMaxS, yMinS, yMaxS, aXdir, aYdir ); 650 687 else { 651 688 double xl,yl,xh,yh; … … 654 691 if (xl > xh) swap(xl, xh); 655 692 if (yl > yh) swap(yl, yh); 656 SetLimits(xl,xh,yl,yh, true);693 SetLimits(xl,xh,yl,yh, aXdir, aYdir, true); 657 694 } 658 695 -
trunk/SophyaPI/PI/piscdrawwdg.h
r23 r37 29 29 virtual ~PIScDrawWdg(); 30 30 31 virtual void SetLimits(double xmin, double xmax, double ymin, double ymax, bool tmp=false); 31 virtual void SetLimits(double xmin, double xmax, double ymin, double ymax, 32 bool axrl=false, bool ayud=false, bool tmp=false); 32 33 33 34 virtual void ScDrawString(double x, double y, char* s, int pos = 0); … … 75 76 double YMin() const {return yMin;} 76 77 double YMax() const {return yMax;} 78 double XPPos() const { return mPPos[0]; } 79 double YPPos() const { return mPPos[1]; } 77 80 int LimitsFixed() const {return limitsFixed;} 78 81 void FreeLimits() {limitsFixed = 0;} … … 94 97 double xOrg, yOrg; // Position en pixels de (0.0, 0.0) 95 98 double xScale, yScale; // Pixels par unites graphiques 99 bool aXdir, aYdir; // Sens des axes horiz, vertical 100 double mPPos[2]; // Position click souris X,Y 96 101 double xFirstMajTick, xFirstMinTick; 97 102 double yFirstMajTick, yFirstMinTick; -
trunk/SophyaPI/PI/pistdwdgx.cc
r30 r37 225 225 226 226 // Fonction prive (CallBack) 227 static void toggb_action(Widget w, XtPointer *usd, X tPointer *calld);227 static void toggb_action(Widget w, XtPointer *usd, XmToggleButtonCallbackStruct* calld); 228 228 229 229 /* Nouvelle-Fonction */ 230 void toggb_action(Widget , XtPointer *usd, X tPointer *)230 void toggb_action(Widget , XtPointer *usd, XmToggleButtonCallbackStruct* calld) 231 231 { 232 232 PICheckBoxX *picb; 233 233 picb = (PICheckBoxX *) usd ; 234 picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState()); 234 if (calld->set == True) picb->mSt = true; 235 else picb->mSt = false; 236 picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)(picb->mSt)); 235 237 return; 236 238 } … … 247 249 XtSetArg(warg[0],XmNhighlightThickness, 0); 248 250 XtSetValues(XtWdg(), warg, 1); 251 SetState(false); 249 252 Manage(); 250 253 } … … 260 263 { 261 264 Arg warg[2]; 262 XtSetArg(warg[0],XmNset, st); 265 mSt = st; 266 XtSetArg(warg[0],XmNset, mSt); 263 267 XtSetValues(XtWdg(), warg, 1); 264 268 return; … … 268 272 bool PICheckBoxX::GetState() 269 273 { 270 int val; 271 Arg warg[2]; 272 XtSetArg(warg[0], XmNset, &val); 273 XtGetValues(XtWdg(), warg, 1); 274 return ((bool)val); 274 return(mSt); 275 275 } 276 276 -
trunk/SophyaPI/PI/pistdwdgx.h
r30 r37 60 60 virtual void SetState(bool st=false); 61 61 virtual bool GetState(); 62 63 bool mSt; // Etat du bouton, en public a cause du Callback 62 64 }; 63 65 -
trunk/SophyaPI/PI/piup.cc
r18 r37 8 8 #include "piup.h" 9 9 10 ImageR4 * PIUserProc_1(ImageR4 *myimg, int xp, int yp, int dx, int dy,10 RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy, 11 11 char * arg1, char * arg2) 12 12 { … … 23 23 24 24 filt.PrintImage(); 25 out = new ImageR4(myimg ->XSize(), myimg->YSize());25 out = new ImageR4(myimg.XSize(), myimg.YSize()); 26 26 TIMEF ; 27 FilterImage( (ImageR4 *) myimg, (ImageR4 *)out, &filt);28 return( out);27 FilterImage(&myimg, out, &filt); 28 return((RzImage*)out); 29 29 } 30 30 31 ImageR4 * PIUserProc_2(ImageR4 *myimg, int xp, int yp, int dx, int dy,31 RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy, 32 32 char * arg1, char * arg2) 33 33 { … … 46 46 filt(2,0) = 2.; 47 47 filt.PrintImage(); 48 out = new ImageR4(myimg ->XSize(), myimg->YSize());48 out = new ImageR4(myimg.XSize(), myimg.YSize()); 49 49 TIMEF ; 50 FilterImage( (ImageR4 *) myimg, (ImageR4 *)out, &filt);51 return( out);50 FilterImage(&myimg, out, &filt); 51 return((RzImage*)out); 52 52 } 53 53 54 54 55 ImageR4 * PIUserProc_3(ImageR4 *, int xp, int yp, int dx, int dy,55 RzImage * PIUserProc_3(ImageR4& , int xp, int yp, int dx, int dy, 56 56 char * arg1, char * arg2) 57 57 { -
trunk/SophyaPI/PI/piup.h
r18 r37 1 1 #include "cimage.h" 2 2 3 ImageR4 * PIUserProc_1(ImageR4 *myimg, int xp, int yp, int dx, int dy,3 RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy, 4 4 char * arg1, char * arg2); 5 ImageR4 * PIUserProc_2(ImageR4 *myimg, int xp, int yp, int dx, int dy,5 RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy, 6 6 char * arg1, char * arg2); 7 ImageR4 * PIUserProc_3(ImageR4 *myimg, int xp, int yp, int dx, int dy,7 RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy, 8 8 char * arg1, char * arg2); -
trunk/SophyaPI/PI/piup_def.cc
r18 r37 8 8 #include "piup.h" 9 9 10 ImageR4 * PIUserProc_1(ImageR4 *, int xp, int yp, int dx, int dy,10 RzImage * PIUserProc_1(ImageR4 & , int xp, int yp, int dx, int dy, 11 11 char * arg1, char * arg2) 12 12 { … … 16 16 } 17 17 18 ImageR4 * PIUserProc_2(ImageR4 *, int xp, int yp, int dx, int dy,18 RzImage * PIUserProc_2(ImageR4 & , int xp, int yp, int dx, int dy, 19 19 char * arg1, char * arg2) 20 20 { … … 24 24 } 25 25 26 ImageR4 * PIUserProc_3(ImageR4 *, int xp, int yp, int dx, int dy,26 RzImage * PIUserProc_3(ImageR4 & , int xp, int yp, int dx, int dy, 27 27 char * arg1, char * arg2) 28 28 { -
trunk/SophyaPI/PI/piwdggen.cc
r32 r37 13 13 parent = par; 14 14 SetMsg(0); 15 SetUserData(NULL, 0); 15 16 if (par) par->ChildAdd(this); // On previent le container parent 16 17 return; -
trunk/SophyaPI/PI/piwdgx.cc
r23 r37 42 42 } 43 43 44 /* Nouvelle-Fonction */ 45 int CStrFrXmStr(XmString xms, char* buff, int nmx) 46 /* Pour recuperer le contenu d'un string Motif */ 47 { 48 int n,l,m; 49 XmStringContext cntx; 50 char *txs; 51 XmStringDirection dir; 52 XmStringCharSet cset; 53 Boolean sep; 54 55 if (nmx < 2) return(0); 56 n = 0; m = nmx-1; buff[0] = buff[m] = '\0'; 57 XmStringInitContext (&cntx, xms); 58 while (m > 0) 59 { 60 if (XmStringGetNextSegment( cntx, &txs, &cset, &dir, &sep) ) 61 { 62 l = strlen(txs); 63 if (m < l) txs[m] = '\0'; 64 strcpy(buff+n, txs); 65 n += l; m -= l; 66 if (sep) m = -2; 67 XtFree(txs); 68 } 69 else m = -1; 70 } 71 72 return(n); 73 } 74 44 75 45 76 /* --Methode-- */ 46 77 PIWdgX::PIWdgX(int narg, char *arg[]) 47 :PIWdgGen(NULL, "PITopLevel") , mNom("PITopLevel")78 :PIWdgGen(NULL, "PITopLevel") 48 79 { 49 80 if (top == NULL) InitXt(narg, arg); … … 61 92 PIWdgX::PIWdgX(PIContainerGen *par, char *nom, 62 93 int sx, int sy, int px, int py) 63 :PIWdgGen(par, nom, sx, sy, px, py) , mNom(nom)94 :PIWdgGen(par, nom, sx, sy, px, py) 64 95 { 65 96 sdw = NULL; … … 378 409 XtGetValues(this->sdw, wargs, 1); 379 410 return(bw); 411 } 412 413 /* --Methode-- */ 414 string PIWdgX::Nom() 415 { 416 return(XtName(this->sdw)); 380 417 } 381 418 -
trunk/SophyaPI/PI/piwdgx.h
r23 r37 50 50 virtual int BorderWidth(); 51 51 52 virtual string Nom() { return mNom; }52 virtual string Nom(); 53 53 virtual void GetScreenPos(int & spx, int & spy); 54 54 … … 67 67 WmIntState wmis; 68 68 int stmng; 69 string mNom;70 69 71 70 }; -
trunk/SophyaPI/PI/psdict.cc
r34 r37 72 72 $BlocEnteredState restore} bind def\n\ 73 73 \ 74 %% Trace\ 74 %% Trace\n\ 75 75 /n {newpath} bind def /c {closepath} bind def\n\ 76 76 /gs {gsave} bind def /gr {grestore} bind def\n\
Note:
See TracChangeset
for help on using the changeset viewer.