Changeset 6 in Sophya
- Timestamp:
- Feb 19, 1996, 6:04:14 PM (30 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Makefile
r5 r6 85 85 86 86 $(EXE)pitest : $(OBJ)pitestapp.o 87 g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -l Xm -lXt -lX1187 g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm 88 88 89 89 $(OBJ)ex_dessin.o: ex_dessin.cc ex_dessin.h pisysdep.h pibwdgx.h pibwdggen.h \ … … 166 166 piwindowgen.h pioptmenux.h pioptmenugen.h pistdwdgx.h pistdwdggen.h \ 167 167 pibwdgx.h pibwdggen.h pipixmapx.h pipixmapgen.h picmap.h picmapx.h \ 168 picmapgen.h pifilechox.h pifilechogen.h ex_dessin.h168 picmapgen.h pifilechox.h pifilechogen.h piimage.h ex_dessin.h -
trunk/SophyaPI/PI/pi.rsc
r2 r6 8 8 PeidaInt*activeTopShadowColor: White 9 9 PeidaInt*default*activeTopShadowColor: White 10 PeidaInt*background: Grey11 PeidaInt*default*background: Grey10 PeidaInt*background: LightGrey 11 PeidaInt*default*background: LightGrey 12 12 PeidaInt*bottomShadowColor: Black 13 13 PeidaInt*default*bottomShadowColor: Black 14 PeidaInt*Foreground: Yellow15 PeidaInt*default*Foreground: Yellow14 PeidaInt*Foreground: Black 15 PeidaInt*default*Foreground: Black 16 16 PeidaInt*topShadowColor: White 17 17 PeidaInt*default*topShadowColor: White 18 PeidaInt*borderColor: Yellow18 PeidaInt*borderColor: Black 19 19 20 20 PeidaInt*XmLabel.borderWidth: 1 … … 23 23 PeidaInt*XmPushButton*borderWidth: 0 24 24 25 PeidaInt*XmText*XmNshadowThickness: 026 PeidaInt*XmText*XmNhighlightThickness: 025 PeidaInt*XmText*XmNshadowThickness: 1 26 PeidaInt*XmText*XmNhighlightThickness: 2 27 27 28 28 -
trunk/SophyaPI/PI/piapplx.cc
r2 r6 46 46 #endif 47 47 topwdg->Unmanage(); 48 delete topcont; 48 delete menubar; 49 if (topcont != MBCont()) delete topcont; 50 delete intcont; 49 51 delete topwdg; 50 52 exit(0); -
trunk/SophyaPI/PI/pibwdggen.h
r2 r6 16 16 enum PILineAtt { PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 }; 17 17 18 enum PIPointer { PI_ArrowPointer = 1, PI_CrossPointer = 2, PI_HandPointer = 3 }; 18 enum PIPointer { PI_ArrowPointer = 1, PI_CrossPointer = 2, 19 PI_HandPointer = 3, PI_TDLRArrowPointer = 4 }; 19 20 20 21 class PIBaseWdgGen : public PIWdg -
trunk/SophyaPI/PI/pibwdgx.cc
r2 r6 131 131 void PIBaseWdgX::DrawString(int x, int y, char* s, int pos) 132 132 { 133 XDraw ImageString (XtDisplay (XtWdg()),XtWindow(XtWdg()),133 XDrawString (XtDisplay (XtWdg()),XtWindow(XtWdg()), 134 134 DefGC(), x, y, s, strlen(s)); 135 135 return; … … 262 262 void PIBaseWdgX::Refresh() 263 263 { 264 if ( (XtIsRealized( this->XtWdg())) &&264 if ( (XtIsRealized(XtWdg())) && 265 265 (((PIXtBaseWidget)(this->XtWdg()))->core.visible) ) 266 { this->Draw(); }266 { /* EraseWindow(); */ Draw(); } 267 267 268 268 return; … … 457 457 curs[PI_CrossPointer] = XCreateFontCursor(mdsp, XC_crosshair); 458 458 curs[PI_HandPointer] = XCreateFontCursor(mdsp, XC_hand2); 459 460 return; 461 } 459 curs[PI_TDLRArrowPointer] = XCreateFontCursor(mdsp, XC_fleur); 460 461 return; 462 } -
trunk/SophyaPI/PI/pifilechox.cc
r2 r6 80 80 PIFileChooserX::~PIFileChooserX() 81 81 { 82 delete mWin; 82 83 } 83 84 -
trunk/SophyaPI/PI/piimage.cc
r2 r6 14 14 15 15 /* --Methode-- */ 16 PIImage::PIImage(PIContainerGen *par, char *nom, RzImage *pim,16 PIImage::PIImage(PIContainerGen *par, char *nom, 17 17 int sx, int sy, int px, int py) : 18 18 PIPixmap(par, nom, sx, sy, px, py) … … 31 31 32 32 SetColMap(CMAP_COLRJ32); 33 SetImage(pim);34 33 35 34 ActivateButton(1); 35 ActivateMove(1); 36 36 ActivateButton(2); 37 //ActivateMove(1); 37 ActivateMove(2); 38 38 39 39 40 } … … 50 51 void PIImage::SetImage(RzImage *pim) 51 52 { 52 int xwsz, ywsz; 53 53 54 offx = offy = 0; 55 xpav = ypav = 0; 54 56 img = pim; 55 57 if (img) 56 58 { 57 59 SetSize(img->XSize(), img->YSize()); 58 xwsz = XSize(); ywsz = YSize(); 59 if (xwsz > img->XSize()) xwsz = img->XSize(); 60 if (ywsz > img->YSize()) ywsz = img->YSize(); 61 xpav = xwsz/2; 62 ypav = ywsz/2; 60 SetPave(); 63 61 if (img->minPix>img->maxPix) img->CheckDyn(); 64 SetLut(img->minPix, img->maxPix, kLutType_Lin, 2);62 SetLut(img->minPix, img->maxPix, kLutType_Lin, 1); 65 63 } 66 64 //printf("Debug_SetImage: %ld %ld \n", (long)img, (long)lut); … … 101 99 lut = new LUT(min, max, NbCol(), typlut); 102 100 101 Apply(); 103 102 return; 104 103 } … … 111 110 lut = new LUT(clut->Min(), clut->Max(), NbCol(), clut->Type()); 112 111 if (olut) delete olut; 112 113 Apply(); 113 114 return; 114 115 } … … 122 123 else if (zm < -10) zoom = -10; 123 124 else zoom = zm; 124 return; 125 } 126 /* --Methode-- */ 127 void PIImage::SelectColor(CMapId cmap) 128 { 129 SetColMap(cmap); 125 SetOffset(); 126 Apply(); 127 return; 128 } 129 130 131 /* --Methode-- */ 132 void PIImage::SetColMap(CMapId cmap) 133 { 134 PIPixmap::SetColMap(cmap); 130 135 if (zow) zow->SetColMap(cmap); 131 136 return; … … 134 139 135 140 /* --Methode-- */ 136 void PIImage::Apply() 137 { 138 ComputePixmap(); 139 Refresh(); 140 if (zow == NULL) return; 141 ComputeZoomPixmap(); 142 zow->Refresh(); 141 void PIImage::Apply(bool mw) 142 { 143 if (mw) ComputePixmap(); 144 if (zow != NULL) 145 { 146 zow->SetColMap(GetColMapId()); 147 ComputeZoomPixmap(); 148 } 149 if (txw) 150 { 151 char buff[256]; 152 sprintf(buff,"%s : X= %d , Y= %d PixVal= %g ", 153 (char *)Nom().c_str(), xpav, ypav, img->FValue(xpav, ypav)); 154 txw->SetLabel((string)buff); 155 } 156 Send(PIMsg_ActiveWindow, (char *)this); 143 157 return; 144 158 } … … 147 161 void PIImage::Resize() 148 162 { 149 printf("PIImage::Resize\n"); 150 ComputePixmap(); 163 // printf("PIImage::Resize\n"); 164 SetPave(); 165 Apply(); 151 166 return; 152 167 } … … 157 172 int xp, yp; 158 173 174 if (img == NULL) return; 175 if ( PosW2Img(x, y, &xp, &yp) ) return; 176 SelPointerShape(PI_CrossPointer); 177 xpav = xp; ypav = yp; 178 Apply(false); 179 return; 180 } 181 182 /* --Methode-- */ 183 void PIImage::Ptr1Move(int x, int y) 184 { 185 int xp, yp; 159 186 if (img == NULL) return; 160 187 if ( PosW2Img(x, y, &xp, &yp) ) return; 161 188 xpav = xp; ypav = yp; 162 if (zow) 163 { 164 ComputeZoomPixmap(); 165 zow->Refresh(); 166 } 189 Apply(false); 190 return; 191 } 192 193 /* --Methode-- */ 194 void PIImage::But1Release(int /*x*/, int /*y*/) 195 { 196 SelPointerShape(PI_ArrowPointer); 197 return; 198 } 199 200 201 /* --Methode-- */ 202 void PIImage::But2Press(int x, int y) 203 { 204 int xp, yp; 205 206 if (img == NULL) return; 207 if ( PosW2Img(x, y, &xp, &yp) ) return; 208 SelPointerShape(PI_TDLRArrowPointer); 209 xmv0 = xp; 210 ymv0 = yp; 211 Send(PIMsg_ActiveWindow, (char *)this); 212 return; 213 } 214 215 216 /* --Methode-- */ 217 void PIImage::Ptr2Move(int x, int y) 218 { 219 int xp, yp; 220 if (img == NULL) return; 221 if ( PosW2Img(x, y, &xp, &yp) ) return; 167 222 if (txw) 168 223 { 169 224 char buff[256]; 170 sprintf(buff,"Image %s : X= %d , Y= %d PixVal= %g ", 171 img->name, xpav, ypav, img->FValue(xpav, ypav)); 172 txw->SetLabel(buff); 173 } 174 return; 175 } 176 177 178 /* --Methode-- */ 179 void PIImage::But2Press(int x, int y) 225 sprintf(buff,"%s : DelX= %d , DelY= %d ", (char *)Nom().c_str(), xp-xmv0, yp-ymv0); 226 txw->SetLabel((string)buff); 227 } 228 } 229 230 /* --Methode-- */ 231 void PIImage::But2Release(int x, int y) 180 232 { 181 233 int xp, yp; 182 int xwsz, ywsz; 183 234 235 SelPointerShape(PI_ArrowPointer); 184 236 if (img == NULL) return; 185 237 if ( PosW2Img(x, y, &xp, &yp) ) return; 186 xpav = xp; ypav = yp; 187 188 xwsz = XSize(); 189 ywsz = YSize(); 190 if (zoom > 0) 191 { 192 offx = xpav-(xwsz/2/zoom); 193 offy = ypav-(ywsz/2/zoom); 194 } 195 else 196 { 197 offx = xpav+(xwsz*zoom/2); 198 offy = ypav+(ywsz*zoom/2); 199 } 238 239 offx -= (xp-xmv0); 240 offy -= (yp-ymv0); 241 200 242 if (offx < 0) offx = 0; 201 243 if (offy < 0) offy = 0; 202 244 if (offx >= img->XSize()) offx = img->XSize(); 203 245 if (offy >= img->YSize()) offy = img->YSize(); 204 205 ComputePixmap(); 206 Refresh(); 207 if (zow) 208 { 209 ComputeZoomPixmap(); 210 zow->Refresh(); 211 } 246 xpav = xmv0; ypav = ymv0; 247 248 Apply(); 212 249 return; 213 250 } … … 226 263 227 264 if ( (img == NULL) || (lut == NULL) ) 228 { printf("PIImage::ComputePixmap:Pb img ou lut %ld %ld \n",229 (long)img, (long)lut); 265 { /* printf("PIImage::ComputePixmap:Pb img ou lut %ld %ld \n", 266 (long)img, (long)lut); */ 230 267 *oxsp = *oysp = 0; return(NULL); } 231 268 … … 253 290 if ( oszp != nszp ) 254 291 { 255 if (opix) delete opix;292 if (opix) delete[] opix; 256 293 pix = new unsigned char[nppx*nppy]; 257 294 if (pix == NULL) { *oxsp = *oysp = 0; ; return(NULL); } … … 260 297 *oxsp = nppx; *oysp = nppy; 261 298 299 /* 262 300 printf("Debug_ComputePixmap %d %d %d (%d-%d %d-%d)\n", 263 301 ofx, ofy, zm, npx,nppx, npy,nppy); 302 */ 264 303 265 304 pp = pix; … … 312 351 pixm = ComputePixmap(offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm); 313 352 SetPixmap(pixm, xspxm, yspxm); 353 // Refresh(); 314 354 return; 315 355 } … … 345 385 zow->SetPixmap(zpixm, xszpxm, yszpxm); 346 386 zow->SetUserData((void *)this, 0); 387 // zow->Refresh(); 347 388 return; 348 389 … … 372 413 373 414 415 /* --Methode-- */ 416 void PIImage::SetOffset() 417 { 418 if (zoom > 0) 419 { 420 offx = xpav-XSize()/2/zoom; 421 offy = ypav-YSize()/2/zoom; 422 } 423 else 424 { 425 offx = xpav-XSize()/2*zoom; 426 offy = ypav-YSize()/2*zoom; 427 } 428 429 if (offx < 0) offx = 0; 430 if (offx >= (img->XSize()-1)) offx = img->XSize()-2; 431 if (offy < 0) offy = 0; 432 if (offy >= (img->YSize()-1)) offy = img->YSize()-2; 433 434 return; 435 } 436 437 /* --Methode-- */ 438 void PIImage::SetPave() 439 { 440 int xwsz, ywsz; 441 442 xwsz = XSize(); ywsz = YSize(); 443 if (xwsz > (img->XSize()-offx)) xwsz = (img->XSize()-offx); 444 if (ywsz > (img->YSize()-offy)) ywsz = (img->YSize()-offy); 445 xpav = offx+xwsz/2; 446 ypav = offx+ywsz/2; 447 448 return; 449 } -
trunk/SophyaPI/PI/piimage.h
r2 r6 33 33 PILabel * txw; 34 34 int xpav, ypav; 35 35 int xmv0, ymv0; 36 36 public: 37 37 // Les methodes 38 38 39 PIImage(PIContainerGen *par, char *nom=NULL, RzImage *pim=NULL,39 PIImage(PIContainerGen *par, char *nom=NULL, 40 40 int sx=0, int sy=0, int px=0, int py=0); 41 41 ~PIImage(); … … 49 49 void SetLut(LUT *clut); 50 50 void SetZoom(int zm); 51 void SelectColor(CMapId cmap);52 51 53 void Apply(); 54 void Resize(); 52 virtual void SetColMap(CMapId cmap); 55 53 56 // void Ptr1Move(int x, int y); 57 void But1Press(int x, int y);58 void But1Release(int x, int y);59 void But2Press(int x, int y);54 inline RzImage * Image() { return(img); } 55 inline LUT * Lut() { return(lut); } 56 inline int XPave() { return(xpav); } ; 57 inline int YPave() { return(ypav); } ; 60 58 61 inline int GetXPave() { return(xpav); } ; 62 inline int GetYPave() { return(ypav); } ; 59 void Apply(bool mw=true); 60 61 virtual void Resize(); 62 63 virtual void But1Press(int x, int y); 64 virtual void But1Release(int x, int y); 65 virtual void Ptr1Move(int x, int y); 66 virtual void But2Press(int x, int y); 67 virtual void But2Release(int x, int y); 68 virtual void Ptr2Move(int x, int y); 63 69 64 70 private: … … 71 77 72 78 int PosW2Img(int xiw, int yiw, int * xp, int * yp); 79 void SetOffset(); 80 void SetPave(); 73 81 }; 74 82 -
trunk/SophyaPI/PI/pimenux.cc
r2 r6 25 25 26 26 // pim->Unmanage(); 27 pim->Send(cusd->msg, pim->ItemName(cusd->itb).c_str());27 pim->Send(cusd->msg, (void *)pim->ItemNameWdg(cusd->itb).c_str()); 28 28 #ifdef DEBUG_PIMenuX 29 29 printf("%%%Debug_menub_action: Msg= %d \n", (int)cusd->msg); … … 58 58 } 59 59 60 /* --Methode-- */61 void PIMenuX::Show()62 {63 Manage();64 }65 66 /* --Methode-- */67 void PIMenuX::Hide()68 {69 Unmanage();70 }71 72 73 60 74 61 /* --Methode-- */ … … 84 71 85 72 for(int i=0; i<mNItem; i++) 86 if (ItemName( mBut[i].itb) == s)73 if (ItemName(i) == s) 87 74 { DeleteItemNum(i); break; } 88 75 … … 127 114 128 115 for(int i=0; i<mNItem; i++) 129 if (ItemName( mBut[i].itb) == s)116 if (ItemName(i) == s) 130 117 { CheckItemNum(i, st); break; } 131 118 … … 148 135 printf("PIMenuX::CheckItemNum(%d,bool) Error/ Not yet implemented \n", n); 149 136 return; 137 } 138 139 /* --Methode-- */ 140 void PIMenuX::Show() 141 { 142 Manage(); 143 } 144 145 /* --Methode-- */ 146 void PIMenuX::Hide() 147 { 148 Unmanage(); 149 } 150 151 152 153 /* --Methode-- */ 154 string PIMenuX::ItemName(int n) 155 { 156 if ( (n < 0) || (n >= mNItem)) return(""); 157 return (ItemNameWdg(mBut[n].itb)); 158 } 159 160 161 /* --Methode-- */ 162 string PIMenuX::ItemNameWdg(SysDWdg itw) 163 { 164 string s; 165 char *buff; 166 XmString xmstr; 167 Arg warg[2]; 168 169 XtSetArg(warg[0], XmNlabelString, &xmstr); 170 XtGetValues(itw, warg, 1); 171 if (xmstr) 172 { 173 XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff); 174 s=buff; 175 XmStringFree(xmstr); 176 } 177 else s = ""; 178 179 return(s); 180 } 181 182 183 /* --Methode-- */ 184 long PIMenuX::ItemMsg(int n) 185 { 186 if ( (n < 0) || (n >= mNItem)) return(0); 187 else return(mBut[n].msg); 188 } 189 190 191 192 /* --Methode-- */ 193 int PIMenuX::GetNumItem(char *nom) 194 { 195 string s(nom); 196 197 for(int i=0; i<mNItem; i++) 198 if (ItemName(i) == s) return(i); 199 return(-1); 200 } 201 202 /* --Methode-- */ 203 int PIMenuX::GetNumItemMsg(long msg) 204 { 205 for(int i=0; i<mNItem; i++) 206 if (mBut[i].msg == msg) return(i); 207 return(-1); 208 } 209 210 /* --Methode-- */ 211 SysDWdg PIMenuX::GetItemWdg(int n) 212 { 213 if ((n<0) || (n>=mNItem)) return(NULL); 214 else return(mBut[n].itb); 150 215 } 151 216 … … 203 268 204 269 205 /* --Methode-- */206 string PIMenuX::ItemName(SysDWdg itb)207 {208 string s;209 char *buff;210 XmString xmstr;211 Arg warg[2];212 213 214 XtSetArg(warg[0], XmNlabelString, &xmstr);215 XtGetValues(itb, warg, 1);216 if (xmstr)217 {218 XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);219 s=buff;220 XmStringFree(xmstr);221 }222 else s = "";223 224 return(s);225 }226 270 227 271 /* --Methode-- */ -
trunk/SophyaPI/PI/pimenux.h
r2 r6 35 35 virtual void Hide(); 36 36 37 string ItemName(SysDWdg itb); 37 // Pour usage prive et par OptionMenu, ... 38 long ItemMsg(int n); 39 int GetNumItem(char *nom); 40 int GetNumItemMsg(long msg); 41 SysDWdg GetItemWdg(int n); 42 string ItemName(int n); 43 string ItemNameWdg(SysDWdg itw); 38 44 39 45 protected: -
trunk/SophyaPI/PI/pimsghandler.h
r2 r6 7 7 8 8 enum { 9 // Les flags10 11 PIMsg_FgBtn = 0x00010000,12 PIMsg_FgText = 0x00020000,13 PIMsg_FgScale = 0x00040000,14 PIMsg_FgMenu = 0x00080000,15 16 9 // Les messages 17 PIMsg_OK = 1, 18 PIMsg_Cancel = 2, 19 PIMsg_Help = 3, 20 PIMsg_DataChanged = 4, 21 PIMsg_Click = 5 10 PIMsg_ActiveWindow = 1, 11 PIMsg_OK = 2, 12 PIMsg_Cancel = 3, 13 PIMsg_Help = 4, 14 PIMsg_DataChanged = 5, 15 PIMsg_Click = 6 22 16 }; 23 17 -
trunk/SophyaPI/PI/pioptmenugen.h
r2 r6 19 19 virtual string GetValueStr() = 0; // Option choisie 20 20 virtual long GetValue() = 0; // Message correspondant a l'option choisie 21 virtual void SetValueStr(string & s) = 0; 22 virtual void SetValue(long msg) = 0; 21 23 22 24 protected: -
trunk/SophyaPI/PI/pioptmenux.cc
r2 r6 28 28 wmis == k_wmi_normal ; 29 29 stmng = 0; 30 mMen = pdm; 30 31 31 32 cb = XmOptionButtonGadget (XtWdg()); … … 37 38 // SetLabel(pdm->Nom()); 38 39 39 pdm->SetMsgParent(this);40 mMen->SetMsgParent(this); 40 41 Manage(); 41 42 } … … 55 56 } 56 57 58 59 /* --Methode-- */ 60 void PIOptMenuX::SetValueStr(string & s) 61 { 62 int n; 63 Arg warg[2]; 64 n=mMen->GetNumItem((char *)s.c_str()); 65 if (n < 0) return; 66 67 XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n)); 68 XtSetValues(XtWdg(), warg, 1); 69 mStext = s; 70 mSmsg = mMen->ItemMsg(n); 71 72 return; 73 } 74 75 /* --Methode-- */ 76 void PIOptMenuX::SetValue(long msg) 77 { 78 int n; 79 Arg warg[2]; 80 n=mMen->GetNumItemMsg(msg); 81 if (n < 0) return; 82 83 XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n)); 84 XtSetValues(XtWdg(), warg, 1); 85 mStext = mMen->ItemName(n); 86 mSmsg = msg; 87 88 return; 89 } 90 -
trunk/SophyaPI/PI/pioptmenux.h
r2 r6 14 14 virtual string GetValueStr() { return(mStext); } 15 15 virtual long GetValue() { return(mSmsg); } 16 virtual void SetValueStr(string & s); 17 virtual void SetValue(long msg); 18 16 19 17 20 inline void Select(char *txt, long msg) { mStext = txt; mSmsg = msg; } … … 19 22 20 23 protected: 24 PIPDMenu *mMen; 21 25 string mStext; 22 26 long mSmsg; -
trunk/SophyaPI/PI/pipixmapgen.cc
r2 r6 32 32 { 33 33 pixmap = pix; nx = sx; ny = sy; 34 Refresh(); 34 Refresh(); 35 35 } 36 36 … … 41 41 if (cmap) delete cmap; 42 42 cmap = new PIColorMap(cmapid); 43 Refresh(); 43 Refresh(); 44 44 } 45 45 -
trunk/SophyaPI/PI/pipixmapx.cc
r2 r6 27 27 void PIPixmapX::Draw() 28 28 { 29 // EraseWindow(); 29 Window xw; 30 Display * mdsp; 31 xw = XtWindow(XtWdg()); 32 mdsp = PIXDisplay(); 33 if (nx < XSize()) XClearArea(mdsp, xw, nx, 0, XSize()-nx, YSize(), False); 34 if (ny < YSize()) XClearArea(mdsp, xw, 0, ny, XSize(), YSize()-ny, False); 30 35 Draw(0,0,XSize(),YSize()); 31 36 } … … 73 78 XSync(mdsp, 0); 74 79 75 delete ximg->data;80 delete[] ximg->data; 76 81 XFree(ximg); 77 82 return; -
trunk/SophyaPI/PI/pitestapp.cc
r5 r6 17 17 18 18 #include "ex_dessin.h" 19 19 #include "piimage.h" 20 21 RzImage * RzReadFits(char *flnm); 20 22 21 23 int SysBeep(int n) … … 57 59 PIPUMenu * menu; 58 60 PIPDMenu * pdm; 59 PIOptMenu * opt; 61 PIOptMenu * opt, * opt2; 62 PIPixmap * zoom; 63 PILabel * labimg; 60 64 61 65 }; … … 111 115 text = new PIText(this->MainWin(), "TEXTE", 100, 30, 20,40); 112 116 label = new PILabel(this->MainWin(), "Label", 140, 20, 20,80); 117 label->SetBorderWidth(1); 113 118 bouton = new PIButton(this->MainWin(), "OK", 66, 40, 25, 20, 120); 114 119 bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120); … … 116 121 bouton4 = new PIButton(this->MainWin(), "Menu", 555, 40, 25, 200, 120); 117 122 scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150); 123 124 zoom = new PIPixmap(this->MainWin(), "Zoom", 100,100,5,195); 125 labimg = new PILabel(this->MainWin(), "PixelValue", 250, 20, 10, 320); 118 126 119 127 menu = new PIPUMenu((PIMsgHandler *)this, "myMenu"); … … 133 141 134 142 opt = new PIOptMenu(this->MainWin(), pdm, 80, 20, 110, 150); 135 136 printf("Debug_PITestApp::PITestApp() MenBarSizeX,Y= %d %d \n", 137 Menubar()->XSize(), Menubar()->YSize()); 143 opt->SetValueStr("Sqrt"); 144 opt2 = new PIOptMenu(this->MainWin(), m[1], 80, 20, 150, 200); 138 145 139 146 } … … 151 158 delete menu; 152 159 delete m[0]; delete m[1]; delete m[2]; 153 // delete menb; 154 155 } 160 delete opt; 161 delete opt2; 162 delete pdm; 163 delete zoom; 164 delete labimg; 165 166 } 167 168 static int nimg = 0; 169 static PIImage *pimg[5]; 170 static RzImage *img[5]; 171 static PIWindow *imgw[5]; 172 static PIImage *cur=NULL; 156 173 157 174 static PIWindow * wp3, *wp2, *wp4; … … 172 189 sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind()); 173 190 this->label->SetLabel(truc); 191 192 if (msg == PIMsg_ActiveWindow) 193 { /* printf("Process: Setting active ImageWindow (%lx) \n", (long)data); */ 194 cur = (PIImage *)data; } 195 174 196 if (msg == 133) 175 197 { … … 179 201 if ((x % 3) == 1) pxm->SetColMap(CMAP_COLRJ32); 180 202 if ((x % 3) == 2) pxm->SetColMap(CMAP_COLBR32); 181 pxm->Refresh(); 203 // pxm->Refresh(); 204 if (cur) 205 { 206 // printf("Process: Setting ColMap for (%lx) \n", (long)cur); 207 if ((x % 3) == 0) cur->SetColMap(CMAP_GREY32); 208 if ((x % 3) == 1) cur->SetColMap(CMAP_COLRJ32); 209 if ((x % 3) == 2) cur->SetColMap(CMAP_COLBR32); 210 } 182 211 } 183 212 if (msg == 233) … … 193 222 194 223 if (msg == 10301) 195 { numsg++; m[1]->AppendItem((char *)text->GetText().c_str(), numsg); } 224 { 225 numsg++; 226 m[1]->AppendItem((char *)text->GetText().c_str(), numsg); 227 opt2->SetValue(numsg); 228 } 229 196 230 if (msg == 10302) { m[1]->DeleteItem((char *)text->GetText().c_str()); } 197 if (msg == 10303) { m[1]->DeleteItemMsg(atol(text->GetText().c_str())); } 231 if (msg == 10303) 232 { 233 long ml = atol(text->GetText().c_str()); 234 m[1]->DeleteItemMsg(ml); 235 opt2->SetValue(10201); 236 } 198 237 199 238 if (msg == 555) wp4->Show(); … … 202 241 if ((msg > 8000) && data) printf("PITestApp::MenubarReturn: %s \n", (char *)data); 203 242 if (msg == 5000) 204 { if (data) printf("PITestApp::Process(5000) : %s \n", (char *)data); 243 { 244 if (data) 245 { 246 printf("PITestApp::Process(5000) : %s \n", (char *)data); 247 if (nimg < 5) img[nimg] = RzReadFits((char *)data); 248 if (img[nimg]) 249 { 250 imgw[nimg] = new PIWindow(this, "WindImage", 251 PIWK_normal, 400, 400, 500, 500); 252 pimg[nimg] = new PIImage(imgw[nimg], "MyImage", 400, 400, 0, 0); 253 pimg[nimg]->SetBinding(true, true, true, true); 254 pimg[nimg]->SetZoomWin(zoom); 255 pimg[nimg]->SetTextWin(labimg); 256 pimg[nimg]->SetImage(img[nimg]); 257 pimg[nimg]->Apply(); 258 imgw[nimg]->Show(); 259 nimg++; 260 } 261 } 205 262 else printf("PITestApp::Process(5000) (data=NULL) \n"); } 263 206 264 if (msg == 66) ckb->SetState(true); 207 if ((msg / 100) == 56) printf("PITestApp::Process(%d) : %s \n", (int)msg, (char *)data); 265 if ((msg / 100) == 56) 266 printf("PITestApp::Process(%d) : %s \n", (int)msg, (char *)data); 208 267 209 268 } … … 212 271 { 213 272 PITestApp * app; 214 app = new PITestApp(3 00, 200);273 app = new PITestApp(350, 350); 215 274 216 275 wp2 = new PIWindow(app, "Window-2", PIWK_normal, 150, 150, 250, 250); … … 238 297 239 298 pfc = new PIFileChooser(app,"FileChooser", 5000); 240 pfc->SetPath("/ users/eros/ansari/Images++");299 pfc->SetPath("/exp/eros/ImagRed/"); 241 300 242 301 -
trunk/SophyaPI/PI/piwdggen.h
r2 r6 35 35 virtual void SetSize(int sx, int sy)=0; 36 36 virtual void SetPos(int px, int py)=0; 37 virtual void SetBorderWidth(int bw)=0; 37 38 virtual void SetLabel(string const&) {} 38 39 virtual void SetBinding(bool left, bool top, bool right, bool bottom)=0; -
trunk/SophyaPI/PI/piwdgx.h
r2 r6 39 39 virtual void SetSize(int sx, int sy); 40 40 virtual void SetPos(int px, int py); 41 virtual void SetBinding(bool left, bool top, bool right, bool bottom);42 41 virtual void SetBorderWidth(int bw); 43 42 virtual void SetLabel(string const & lab); 43 virtual void SetBinding(bool left, bool top, bool right, bool bottom); 44 44 45 45 virtual int XSize();
Note:
See TracChangeset
for help on using the changeset viewer.