Changeset 292 in Sophya for trunk/SophyaPI
- Timestamp:
- May 11, 1999, 6:01:04 AM (26 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/lut.cc
r204 r292 4 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 5 6 #include " defs.h"6 #include "machdefs.h" 7 7 #include <stdlib.h> 8 8 #include <stdio.h> -
trunk/SophyaPI/PI/parradapter.h
r204 r292 7 7 #define PARRADAPTER_SEEN 8 8 9 #include "defs.h" 10 #include "machine.h" 9 #include "machdefs.h" 11 10 #include "lut.h" 12 11 -
trunk/SophyaPI/PI/pibwdgx.cc
r180 r292 108 108 void PIBaseWdgX::Refresh() 109 109 { 110 if ( IsVisible() ) { 110 if (XtIsRealized(XtWdg())) { 111 // if ( IsVisible() ) { 111 112 // EraseWindow(); --> Ne pas faire Reza 12/98 112 113 Draw(mWGrC, 0, 0, XSize(), YSize()); -
trunk/SophyaPI/PI/picons.cc
r158 r292 743 743 nc = (mCPendC-mCPbeginC)/mFLarg; 744 744 nl = (mCPendL-mCPbeginL)/mFHaut; 745 if (nl < 1) nl = 1; // On selectionne au moins une ligne 745 746 // printf("*DBG* NC=%d NL=%d \n",nc, nl); 746 747 l1 = mNL+1; l2 = -1; … … 767 768 mCPendC = (int) ( (float)mCPendC/(float)mFLarg-0.8 ); 768 769 mCPbeginL = (int) ( (float)mCPbeginL/(float)mFHaut-0.5 ) ; 769 mCPendL = (int) ( (float)mCPendL/(float)mFHaut-0.3 ) ; 770 mCPendL = (int) ( (float)mCPendL/(float)mFHaut-0.5 ) ; 771 if (mCPendL <= mCPbeginL) mCPendL = mCPbeginL+1; // Au moins une ligne selectionnee 770 772 // printf("..DBG.. C= %d %d L = %d %d ", mCPbeginC, mCPendC, mCPbeginL, mCPendL); 771 773 j = mNL-mWSzL-mOffL; -
trunk/SophyaPI/PI/pidrawer.cc
r209 r292 5 5 6 6 #include "pidrawer.h" 7 #include <math.h> 7 8 8 9 //++ -
trunk/SophyaPI/PI/pidrwtools.cc
r209 r292 44 44 /* --Methode-- */ 45 45 PIDrwTools::PIDrwTools(PIApplication* par) 46 : PIWindow((PIMsgHandler*)par, "PIDrawerTools", PIWK_ dialog, 240, 240, 150, 150)46 : PIWindow((PIMsgHandler*)par, "PIDrawerTools", PIWK_normal, 240, 240, 150, 150) 47 47 { 48 48 int bsx, bsy, spx, spy; -
trunk/SophyaPI/PI/pigraphgen.cc
r204 r292 181 181 //| PI_Black , PI_White, PI_Grey , PI_Red , PI_Blue , PI_Green , 182 182 //| PI_Yellow , PI_Magenta , PI_Cyan , PI_Turquoise , PI_NavyBlue , 183 //| PI_Orange , PI_SiennaRed , PI_Purple , PI_LimeGreen , PI_Gold 183 //| PI_Orange , PI_SiennaRed , PI_Purple , PI_LimeGreen , PI_Gold , 184 //| PI_ColorAllBits0 , PI_ColorAllBits1 184 185 // void SelBackground(PIColors col=PI_White) 185 186 // Choix de la couleur d'arrière-plan … … 189 190 // Choix de la couleur d'arrière-plan: Couleur numéro "cid" de la table de couleur "cmap" 190 191 // void SelGOMode(PIGOMode mod=PI_GOCopy) 191 // Choix du mode de tracé graphique: "PI_GOCopy" ou "PI_GOXOR" 192 // Choix du mode de tracé graphique: "PI_GOCopy" ou "PI_GOXOR" ou "PI_GOInvert" 192 193 // void SelFont(PIFontSize sz=PI_NormalSizeFont, PIFontAtt att=PI_RomanFont) 193 194 // Choix de la fonte pour le tracé de texte -
trunk/SophyaPI/PI/pigraphgen.h
r204 r292 13 13 14 14 15 enum PIColors { PI_ColorFromMap = - 2, PI_NotDefColor = -1,15 enum PIColors { PI_ColorFromMap = -4, PI_NotDefColor = -1, 16 16 PI_Black = 0, PI_White = 1, PI_Grey = 2, 17 17 PI_Red = 3, PI_Blue = 4, PI_Green = 5, … … 19 19 PI_Cyan = 8, PI_Turquoise = 9, PI_NavyBlue = 10, 20 20 PI_Orange = 11, PI_SiennaRed = 12, PI_Purple = 13, 21 PI_LimeGreen = 14, PI_Gold = 15 }; 21 PI_LimeGreen = 14, PI_Gold = 15, 22 PI_ColorAllBits0 = 16, PI_ColorAllBits1 = 17 }; 22 23 23 24 enum PIFontSize { PI_NotDefFontSize = -1, … … 40 41 PI_StarMarker=9, PI_FStarMarker=10 }; 41 42 42 enum PIGOMode { PI_GOCopy = 0, PI_GOXOR = 1 };43 enum PIGOMode { PI_GOCopy = 0, PI_GOXOR = 1, PI_GOInvert = 2 }; 43 44 44 45 -
trunk/SophyaPI/PI/pigraphx.cc
r204 r292 20 20 static int HugeFontIndex = 6; 21 21 static PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 22 #define NMAXCOL 1 622 #define NMAXCOL 18 23 23 static PIXColor colpix[NMAXCOL]; 24 24 … … 420 420 mGOm = mod; 421 421 break; 422 case PI_GOInvert : 423 XSetFunction(mDisp, DefGC(), GXinvert); 424 mGOm = mod; 425 break; 422 426 } 423 427 return; … … 801 805 colpix[PI_Black] = XBlackPixel(mdsp, scr); 802 806 colpix[PI_White] = XWhitePixel(mdsp, scr); 807 colpix[PI_ColorAllBits0] = 0; 808 colpix[PI_ColorAllBits1] = ~colpix[PI_ColorAllBits0]; 803 809 if ( XAllocNamedColor (mdsp, cmap, "LightGray", &mycol, &exact) ) 804 810 colpix[PI_Grey] = mycol.pixel; -
trunk/SophyaPI/PI/piimage.cc
r212 r292 12 12 #include "piimgtools.h" 13 13 #include "pidrwtools.h" 14 #include "piscdrawwdg.h" 14 15 #include PIAPP_H 15 16 … … 22 23 // Peut contrôler un PIPixmap pour l'affichage d'une zone 23 24 // agrandie (zoom) et un PIPixmap pour l'affichage de toute 24 // l'image (réduite). 25 // l'image (réduite). Peut aussi gerer une fenetre de coupes. 25 26 // Utilise les adaptateur de tableaux 2D manipuler le 26 27 // contenu des images ("P2DArrayAdapter"). … … 40 41 // * <Alt>C : *Copier*/Coller Permet de copier le contenu de la zone sélectionnée 41 42 // de l'image sous forme texte. 43 // * <Alt>P : Active/désactive l'affichage de l'indicateur de la postion du pavé 44 // * <Alt>X : Active/désactive l'affichage des coupes X,Y 42 45 // * <Alt>Z : Supprime les textes et signes ajoutés au dessin. 43 46 // * Touches Curseurs : déplace la pavé. … … 101 104 showinfo = false; 102 105 106 // Fenetre et ScDrawWdg pour les coupes 107 cutwin = NULL; 108 cutscw = NULL; 109 103 110 gpixm = zpixm = pixm = NULL; 104 111 xsgpxm = xszpxm = xspxm = 0; … … 112 119 dxmv = dymv = 0; 113 120 xcurs = ycurs = -1; 121 cuhsz = 8; cuvsz = 8; 122 cucol = PI_Yellow; culat = PI_NormalLine; 114 123 zoom = 1; 115 124 zmgv = 1; … … 157 166 } 158 167 if (cmvw) cmvw->SetColMap(NULL, 1., -1., true); 168 if (cutwin) delete cutwin; 159 169 if (lut) delete lut; 160 170 delete mdrw; … … 169 179 void PIImage::Process(PIMessage msg, PIMsgHandler* sender, void* data) 170 180 { 171 if (UserMsg(msg) == (Msg()+626)) 181 182 if ((ModMsg(msg) == PIMsg_Close) && (sender == cutwin)) { 183 cutwin->Hide(); 184 delete cutwin; 185 cutwin = NULL; 186 cutscw = NULL; 187 } 188 else if (UserMsg(msg) == (Msg()+626)) 172 189 { 173 190 if (ModMsg(msg) == PIMsg_Click) … … 261 278 char buff[256]; 262 279 double x,y; 263 img-> XYCoord(xpav, ypav, x, y);280 img->Coord(xpav, ypav, x, y); 264 281 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 265 282 x, y , (*img)(xpav, ypav), xpav, ypav ); … … 277 294 else DrawCursor(mWGrC, -1, -1); 278 295 return; 296 } 297 298 299 /* --Methode-- */ 300 void PIImage::ShowCuts(bool cuts) 301 { 302 if (cuts) { 303 if (cutwin) { cutwin->Show(); return; } 304 int tpx, tpy; 305 GetScreenPos(tpx, tpy); 306 string nom = Nom() + "-Cuts"; 307 cutwin = new PIWindow(this, const_cast<char *>(nom.c_str()), PIWK_normal, 300, 200, tpx, tpy+YSize()+10); 308 cutwin->SetAutoDelChilds(true); 309 nom += "_ScWdg"; 310 cutscw = new PIScDrawWdg(cutwin, const_cast<char *>(nom.c_str()), 300, 200, 0, 0); 311 cutscw->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 312 cutarrx = new PIImg1DArrAdapter(); 313 cutarry = new PIImg1DArrAdapter(); 314 PIYfXDrawer * drw; 315 drw = new PIYfXDrawer(cutarrx, NULL, true); 316 drw->SetColAtt(PI_Red); 317 drw->SetMarkerAtt(5, PI_CrossMarker); 318 drw->SetLineAtt(PI_ThinLine); 319 cutscw->AddScDrawer(drw, true); 320 drw = new PIYfXDrawer(cutarry, NULL, true); 321 drw->SetColAtt(PI_Blue); 322 drw->SetMarkerAtt(5, PI_TriangleMarker); 323 drw->SetLineAtt(PI_ThinLine); 324 cutscw->AddScDrawer(drw, true); 325 cutscw->SetTitles("Red: X , Blue: Y"); 326 UpdateCuts(); 327 cutwin->Show(); 328 } 329 else { 330 if (!cutwin) return; 331 cutwin->Hide(); 332 delete cutwin; 333 cutwin = NULL; 334 cutscw = NULL; 335 } 279 336 } 280 337 … … 392 449 else mdrw->SetColAtt(PI_White); 393 450 PIPixmap::SetColMap(cmp, refr); 451 if (refr) { xcurs = ycurs = -1; } 394 452 if (zow) zow->SetColMap(cmp, refr); 395 453 if (gvw) gvw->SetColMap(cmp, refr); … … 425 483 char buff[256]; 426 484 double x,y; 427 img-> XYCoord(xpav, ypav, x, y);485 img->Coord(xpav, ypav, x, y); 428 486 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 429 487 x, y , (*img)(xpav, ypav), xpav, ypav ); … … 432 490 } 433 491 if (zow != NULL) ComputeZoomPixmap(); 492 if (cutwin) UpdateCuts(); 434 493 if (gvw != NULL) 435 494 if ( (gvw->UserData() != this) || (mw) ) SetGloVPixmap(); … … 456 515 { 457 516 PIPixmap::Draw(g, x0, y0, dx, dy); 517 xcurs = ycurs = -1; 458 518 winovis = false; // $CHECK$ Reza A enlever si possible 17/6/96 459 519 if (curshow) { … … 467 527 char buff[256]; 468 528 double x,y; 469 img-> XYCoord(xpav, ypav, x, y);529 img->Coord(xpav, ypav, x, y); 470 530 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", 471 531 x, y , (*img)(xpav, ypav), xpav, ypav ); … … 488 548 PIDrwTools::SetCurrentBaseWdg(this); 489 549 PIDrwTools::ShowPIDrwTools(); // Fentre axes et options de trace 550 } 551 else if (key == 'P' || key == 'p') { // Activation/desactivation affichage curseur 552 bool sc = !curshow; 553 ShowCursor(sc); 554 } 555 else if (key == 'X' || key == 'x') { // Activation/desactivation affichage coupes X,Y 556 bool cut = (cutwin == NULL) ? true : false; 557 ShowCuts(cut); 490 558 } 491 559 // ---- Le copier ---- … … 593 661 if (curshow) DrawCursor(mWGrC,-1,-1); 594 662 mWGrC->SelGOMode(PI_GOXOR); 595 if (GetColMapId() == CMAP_COLRJ32) 596 mWGrC->SelForeground(PI_Yellow); 597 else mWGrC->SelForeground(PI_Magenta); 663 PIColors xc; 664 if ((GetColMapId() == CMAP_COLRJ32) || (GetColMapId() == CMAP_COLRJ128)) xc = PI_Yellow; 665 else xc = PI_ColorAllBits1; 666 mWGrC->SelForeground(xc); 598 667 mWGrC->SelLine(PI_NormalLine); 599 668 if (ustrtw || atrtw) ShowTrTxW(); … … 604 673 void PIImage::Ptr2Move(int x, int y) 605 674 { 606 int xp, yp ;675 int xp, yp, tmp; 607 676 if (img == NULL) return; 608 677 if (xmv0 < 0) return; … … 615 684 char buff[256]; 616 685 double x,y; 617 img-> XYCoord(xp, yp, x, y);686 img->Coord(xp, yp, x, y); 618 687 sprintf(buff," X= %g , Y= %g Pix= %g (C= %d,%d) ", 619 688 x, y , (*img)(xp, yp), (xp+xpv0)/2, (yp+ypv0)/2 ); … … 639 708 xpav = (xpv0+xp2)/2; 640 709 ypav = (ypv0+yp2)/2; 641 xszpav = ((xp2-xpv0) > 0) ? (xp2-xpv0) : 1; 642 yszpav = ((yp2-ypv0) > 0) ? (yp2-ypv0) : 1; 710 xszpav = xp2-xpv0; 711 yszpav = yp2-ypv0; 712 if (xszpav < 0) xszpav = -xszpav; 713 if (yszpav < 0) yszpav = -yszpav; 643 714 644 715 Apply(false); … … 879 950 880 951 /* --Methode-- */ 952 void PIImage::UpdateCuts() 953 { 954 if (!cutwin || !img) return; 955 956 int hsx, hsy; 957 hsx = XSzPave()/2; 958 hsy = YSzPave()/2; 959 cutarrx->SetData(img, false, 2*hsx+1, XPave(), YPave()); 960 cutarry->SetData(img, true, 2*hsy+1, XPave(), YPave()); 961 double x1,y1,x2,y2; 962 double xmin, xmax, ymin, ymax; 963 img->Coord(XPave()-hsx, YPave()-hsy, x1, y1); 964 img->Coord(XPave()+hsx, YPave()+hsy, x2, y2); 965 if (x1 < x2) cutarrx->DefineXCoordinate(-cutarrx->Size()/2, 1.); 966 else cutarrx->DefineXCoordinate(cutarrx->Size()/2, -1.); 967 if (y1 < y2) cutarry->DefineXCoordinate(-cutarry->Size()/2, 1.); 968 else cutarry->DefineXCoordinate(cutarry->Size()/2, -1.); 969 970 // On calcule les limites : 971 if (cutarrx->Size() > cutarry->Size() ) { 972 xmax = cutarrx->Size()/2. + 1.; 973 xmin = -xmax; 974 } 975 else { 976 xmax = cutarry->Size()/2. + 1.; 977 xmin = -xmax; 978 } 979 980 int i; 981 double cv; 982 ymax = ymin = cutarrx->Value(0); 983 for(i=1; i<cutarrx->Size(); i++) { 984 cv = cutarrx->Value(i); 985 if (cv < ymin) ymin = cv; 986 if (cv > ymax) ymax = cv; 987 } 988 for(i=0; i<cutarry->Size(); i++) { 989 cv = cutarry->Value(i); 990 if (cv < ymin) ymin = cv; 991 if (cv > ymax) ymax = cv; 992 } 993 ymin -= 0.05*(ymax-ymin); 994 ymax += 0.05*(ymax-ymin); 995 cutscw->SetLimits(xmin, xmax, ymin, ymax); 996 //cutscw->UpdateLimits(); 997 cutscw->Refresh(); 998 //printf("UpdateCuts()-DBG X: %d -> %g , Y: %d -> %g \n", cutarrx->Size(), cutarrx->Value(0), 999 // cutarry->Size(), cutarry->Value(0)); 1000 } 1001 1002 /* --Methode-- */ 881 1003 void PIImage::DrawCursor(PIGraphic* g) 882 1004 { … … 887 1009 } 888 1010 889 #define CURSHSIZE 25890 1011 891 1012 /* --Methode-- */ … … 894 1015 895 1016 if (winovis) return; // $CHECK$ Reza A enlever si possible 17/6/96 896 897 g->SelGOMode(PI_GOCopy); 898 if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) || 899 (GetColMapId() == CMAP_GREY128) || (GetColMapId() == CMAP_GREYINV128) ) g->SelForeground(PI_Red); 900 else g->SelForeground(PI_White); 901 902 if (zoom < 3) g->SelLine(PI_NormalLine); 903 else g->SelLine(PI_ThickLine); 904 905 if ((xcurs>=0) && (ycurs>=0) && (g->kind() != PI_PSFileGraphics ) ) { 906 PIPixmap::Draw(g, xcurs-3, ycurs-CURSHSIZE, 6, CURSHSIZE*2); 907 PIPixmap::Draw(g, xcurs-CURSHSIZE, ycurs-3, CURSHSIZE*2, 6); 908 } 1017 //printf("DBG-DrawCursor(g, %d, %d) \n", xc, yc); 1018 int cmapid = cmap->Type(); 1019 if ( (xcurs>=0) && (ycurs>=0) ) { 1020 if (g->kind() == PI_PSFileGraphics ) { 1021 g->SelGOMode(PI_GOCopy); 1022 if ( (cmapid == CMAP_GREY32) || (cmapid == CMAP_GREYINV32) || 1023 (cmapid == CMAP_GREY128) || (cmapid == CMAP_GREYINV128) ) g->SelForeground(PI_Red); 1024 else g->SelForeground(PI_Yellow); 1025 } 1026 else { 1027 // g->SelGOMode(PI_GOXOR); 1028 g->SelGOMode(PI_GOInvert); 1029 g->SelForeground(cucol); 1030 } 1031 g->SelLine(culat); 1032 // On efface le curseur precedant ou on le trace ds le postscript 1033 g->DrawLine(xcurs-cuhsz, ycurs, xcurs-4, ycurs); 1034 g->DrawLine(xcurs+4, ycurs, xcurs+cuhsz, ycurs); 1035 g->DrawLine(xcurs, ycurs-cuvsz, xcurs, ycurs-4); 1036 g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+cuvsz); 1037 // printf("DrawCursor/Erase() %d %d - %d %d -> %d %d \n", xcurs, ycurs, cuhsz, cuvsz, xc, yc); 1038 } 1039 1040 if (g->kind() == PI_PSFileGraphics ) { 1041 g->SelLine(PI_NormalLine); 1042 g->SelForeground(PI_White); 1043 return; 1044 } 1045 909 1046 if ((xc >= 0) && (yc >= 0)) 910 1047 { 1048 // g->SelGOMode(PI_GOXOR); 1049 g->SelGOMode(PI_GOInvert); 1050 // Nouvelle epaisseur de trait du curseur 1051 if (zoom < -2) culat = PI_ThinLine; 1052 else if (zoom < 4) culat = PI_NormalLine; 1053 else culat = PI_ThickLine; 1054 g->SelLine(culat); 1055 1056 // couleur de trait du curseur 1057 if ((cmapid == CMAP_COLRJ32) || (cmapid == CMAP_COLRJ128)) cucol = PI_Yellow; 1058 else cucol = PI_ColorAllBits1; 1059 g->SelForeground(cucol); 1060 1061 // Nouveau taille du curseur 1062 cuhsz = xszpav/2; cuvsz = yszpav/2; 1063 if (zoom > 0) { cuhsz = xszpav*zoom/2; cuvsz = yszpav*zoom/2; } 1064 else { cuhsz = xszpav/(-zoom*2); cuvsz = yszpav/(-zoom*2); } 1065 if ( cuhsz < 10) cuhsz = 10; 1066 if ( cuvsz < 10) cuvsz = 10; 1067 911 1068 xcurs = xc; ycurs = yc; 912 g->DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs); 913 g->DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs); 914 g->DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4); 915 g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE); 916 } 917 else { xcurs = ycurs = -1; } 1069 1070 g->DrawLine(xcurs-cuhsz, ycurs, xcurs-4, ycurs); 1071 g->DrawLine(xcurs+4, ycurs, xcurs+cuhsz, ycurs); 1072 g->DrawLine(xcurs, ycurs-cuvsz, xcurs, ycurs-4); 1073 g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+cuvsz); 1074 // printf("DrawCursor() %d %d - %d %d \n", xcurs, ycurs, cuhsz, cuvsz); 1075 } 1076 else { 1077 xcurs = ycurs = -1; cuhsz = cuvsz = 10; 1078 cucol = PI_Yellow; culat = PI_NormalLine; 1079 } 918 1080 919 1081 g->SelGOMode(PI_GOCopy); … … 1049 1211 xpav = offx+xwsz/2; 1050 1212 ypav = offx+ywsz/2; 1051 xszpav = ((xwsz+ywsz)/ 20) ;1213 xszpav = ((xwsz+ywsz)/15) ; 1052 1214 if (xszpav < 1) xszpav = 1; 1053 1215 yszpav = xszpav; … … 1055 1217 return; 1056 1218 } 1219 1220 1221 //--------------------------------------------------------------------------------- 1222 //------- On definit une classe ArrayAdapter pour les donnees des coupes -------- 1223 //--------------------------------------------------------------------------------- 1224 1225 /* --Methode-- */ 1226 PIImage::PIImg1DArrAdapter::PIImg1DArrAdapter() : P1DArrayAdapter(0) 1227 { 1228 data = NULL; 1229 fgay = false; 1230 off1 = off2 = 0; 1231 } 1232 1233 /* --Methode-- */ 1234 void PIImage::PIImg1DArrAdapter::SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2) 1235 { 1236 data = d; 1237 fgay = ax; 1238 if (o1 < 0) o1 = 0; 1239 if (o2 < 0) o2 = 0; 1240 if (o1 >= d->XSize()) o1 = d->XSize()-1; 1241 if (o2 >= d->YSize()) o2 = d->YSize()-1; 1242 off1 = o1; 1243 off2 = o2; 1244 if ((sz%2) == 0) sz++; 1245 if (sz < 0) sz = 1; 1246 mSize = sz; 1247 } 1248 1249 /* --Methode-- */ 1250 double PIImage::PIImg1DArrAdapter::Value(int i) 1251 { 1252 if (!data) return(0.); 1253 int k; 1254 if (fgay) { 1255 k = off2-mSize/2+i; 1256 if (k < 0) k = 0; 1257 if (k >= data->YSize()) k = data->YSize()-1; 1258 return((*data)(off1, k)); 1259 } 1260 else { 1261 k = off1-mSize/2+i; 1262 if (k < 0) k = 0; 1263 if (k >= data->XSize()) k = data->XSize()-1; 1264 return((*data)(k, off2)); 1265 } 1266 } -
trunk/SophyaPI/PI/piimage.h
r204 r292 16 16 #include PIWIN_H 17 17 #include "picmapview.h" 18 19 class PIScDrawWdg; 18 20 19 21 class PIImage : public PIPixmap … … 45 47 void ShowInfo(bool si=true); 46 48 void ShowCursor(bool sc=true); 49 50 void ShowCuts(bool cuts=true); 47 51 48 52 // Gestion du choix de LUT, facteur d agrandissement, table de couleur … … 101 105 static void SetCurrentPIImage(PIImage* curimg); 102 106 107 // On definit une classe ArrayAdapter pour les donnees des coupes 108 class PIImg1DArrAdapter : public P1DArrayAdapter { 109 public : 110 PIImg1DArrAdapter(); 111 virtual double Value(int i); 112 virtual void SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2); 113 protected : 114 P2DArrayAdapter* data; 115 bool fgay; 116 int off1, off2; 117 }; 118 103 119 protected: 104 120 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); … … 107 123 void ComputeGloVPixmap(); 108 124 void SetGloVPixmap(); 125 void UpdateCuts(); 109 126 110 127 void DrawCursor(PIGraphic* g); … … 154 171 int xmv0, ymv0; 155 172 int dxmv, dymv; 156 int xcurs, ycurs; 173 int xcurs, ycurs; // Position curseur 174 int cuhsz, cuvsz; // Taille vertical, horizontal curseur 175 PILineAtt culat; // Attribut de ligne du curseur 176 PIColors cucol; // Attribut de couleur du curseur 157 177 int xszpav, yszpav; 178 // Pour gerer une fenetre pour les coupes en X,Y 179 bool hascuts; 180 PIWindow * cutwin; 181 PIScDrawWdg * cutscw; 182 PIImg1DArrAdapter * cutarrx; 183 PIImg1DArrAdapter * cutarry; 184 158 185 // buffer pour copier-coller 159 186 char* cpbuffer; 160 187 int cpbuflen; 161 162 188 // PIImage courante 163 189 static PIImage* cur_piimage; -
trunk/SophyaPI/PI/piimgtools.cc
r204 r292 20 20 /* --Methode-- */ 21 21 PIImgTools::PIImgTools(PIApplication* par) 22 : PIWindow((PIMsgHandler*)par, "PIImageTools", PIWK_ dialog, 240, 240, 150, 150)22 : PIWindow((PIMsgHandler*)par, "PIImageTools", PIWK_normal, 240, 240, 150, 150) 23 23 { 24 24 int bsx, bsy, spx, spy; -
trunk/SophyaPI/PI/pimsghandler.h
r180 r292 4 4 /* Classe de gestion de messages */ 5 5 6 #include "machdefs.h" 6 7 #include <stdlib.h> 7 8 8 #include "defs.h"9 9 10 10 enum { -
trunk/SophyaPI/PI/pipixmapgen.cc
r190 r292 73 73 // L'action sur le bouton 1 déclenche l'envoi d'un message 74 74 // avec le modifier PIMsg_Click. La position du bouton-press 75 // est stocké. 75 // est stocké. (- Offset affichage) 76 76 // int XPPos() 77 // Position X du click 77 // Position X du click - Offset Affichage pixmap 78 78 // int YPPos() 79 // Position Y du click 79 // Position Y du click - Offset Affichage pixmap 80 80 //-- 81 81 … … 141 141 void PIPixmapGen::But1Press(int x, int y) 142 142 { 143 mPpos[0] = x ; mPpos[1] =y;143 mPpos[0] = x-ofx; mPpos[1] = y-ofy; 144 144 if (Msg()) Send(Msg(), PIMsg_Click, mPpos); 145 145 return; -
trunk/SophyaPI/PI/piscdrawwdg.cc
r211 r292 324 324 SelPointerShape(cPointer); 325 325 mWGrC->SelLine(cLatt); 326 327 if (xBegDrag == xEndDrag || yBegDrag == yEndDrag) 326 327 // Pour rendre le changement de zoom moins delicat $REZA - 05/99$ 328 int dxd = xEndDrag-xBegDrag; 329 if (dxd < 0) dxd = -dxd; 330 int dyd = yEndDrag-yBegDrag; 331 if (dyd < 0) dyd = -dyd; 332 // if (xBegDrag == xEndDrag || yBegDrag == yEndDrag) // $REZA - 05/99$ 333 if ( (dxd < 5) || (dyd < 5) ) // $REZA - 05/99$ 328 334 SetLimits(xMinS, xMaxS, yMinS, yMaxS, kAxeDirSame, kAxeDirSame ); 329 335 else { … … 362 368 mAx = ax; 363 369 mAy = ay; 370 } 371 372 /* --Methode-- */ 373 PIYfXDrawer::~PIYfXDrawer() 374 { 375 if (mAdDO && mAx) delete mAx; 376 if (mAdDO && mAy) delete mAy; 377 } 378 379 /* --Methode-- */ 380 void PIYfXDrawer::UpdateLimits() 381 { 364 382 if ((mAx == NULL)) mSz = 0; 365 383 else { … … 367 385 else mSz = (mAx->Size() < mAy->Size()) ? mAx->Size() : mAy->Size(); 368 386 } 369 }370 371 /* --Methode-- */372 PIYfXDrawer::~PIYfXDrawer()373 {374 if (mAdDO && mAx) delete mAx;375 if (mAdDO && mAy) delete mAy;376 }377 378 /* --Methode-- */379 void PIYfXDrawer::UpdateLimits()380 {381 387 if (mSz <= 0) return; 382 388 double xmin, xmax, ymin, ymax; … … 423 429 int i; 424 430 431 if ((mAx == NULL)) mSz = 0; 432 else { 433 if (!mAy) mSz = mAx->Size(); 434 else mSz = (mAx->Size() < mAy->Size()) ? mAx->Size() : mAy->Size(); 435 } 425 436 if (mSz <= 0) return; 426 437 -
trunk/SophyaPI/PI/piwdgx.cc
r204 r292 592 592 char **ppc; 593 593 if (narg > 0) { n = narg, ppc = arg; } 594 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)595 594 else { ppc = const_cast<char **>(&pc); n = 1; } 596 #else597 else { ppc = (char **)(&pc); n = 1; }598 #endif599 595 // strncpy(appname, ppc[0], 63); appname[63] = '\0'; 600 596 strncpy(appclass,"PeidaInt",63); appclass[63] = '\0'; 601 597 // top = XtAppInitialize(&appctx, appclass, NULL, 0, &n, ppc); 602 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)603 598 top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, const_cast<String*>(fallback_res), NULL); 604 #else605 top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, (String*)(fallback_res), NULL);606 #endif607 599 if (top == NULL) { 608 600 fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize() -> Exit \n"); -
trunk/SophyaPI/PI/piwindowgen.cc
r80 r292 97 97 return; 98 98 } 99 else if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 99 else if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) { 100 100 Hide(); // Action par defaut en cas de MsgClose. 101 else if (ModMsg(msg) == PIMsg_Active) 102 Send(Msg(),PIMsg_Active); 103 104 ReSend(msg, sender, data); 101 ReSend(msg, sender, data); 102 } 103 else if (ModMsg(msg) == PIMsg_Active) { 104 ReSend(msg, sender, data); 105 PIWdg * sndw = dynamic_cast<PIWdg *>(sender); 106 if (sndw && (sndw->kind() != PIWindowGen::ClassId)) Send(Msg(),PIMsg_Active); 107 } 108 else ReSend(msg, sender, data); 105 109 return; 106 110 } -
trunk/SophyaPI/PI/piwindowx.cc
r204 r292 154 154 155 155 // XRaiseWindow est necessaire, sinon la fenetre passe des fois derriere ... 156 if (mWtyp == PIWK_transient)156 //if (mWtyp == PIWK_transient) 157 157 XRaiseWindow(mdsp, XtWindow(pwm->XtWdg())); 158 158 -
trunk/SophyaPI/PI/psfile.cc
r204 r292 295 295 */ 296 296 PSFile::PSFile(const char * FileName, double sc) 297 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)298 297 : mPSFileName(FileName==NULL? "unnamed.eps" : const_cast<char *>(FileName)), 299 #else300 : mPSFileName(FileName==NULL? "unnamed.eps" : (char *)(FileName)),301 #endif302 298 Tw (-1.), Th(-1.), /* Non specifies pour du eps */ 303 299 WMargin (-1), HMargin(-1), /* Non specifiees en eps */ … … 360 356 PIPaperSize paperSize, 361 357 double marginX, double marginY) 362 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)363 358 : mPSFileName (FileName == NULL ? "unnamed.ps" : const_cast<char *>(FileName)), 364 #else365 : mPSFileName (FileName == NULL ? "unnamed.ps" : (char *)(FileName)),366 #endif367 359 Tw(PaperSizeTable[paperSize].width), /* Format papier utilise */ 368 360 Th(PaperSizeTable[paperSize].height), /* */ -
trunk/SophyaPI/PI/psfile.h
r204 r292 18 18 */ 19 19 20 #include "machdefs.h" 20 21 #include <stdio.h> 21 22 #include <stdlib.h> 22 #include "defs.h"23 23 #ifdef __mac__ 24 24 #include <stat.h>
Note:
See TracChangeset
for help on using the changeset viewer.