Changeset 23 in Sophya
- Timestamp:
- Oct 17, 1996, 5:06:52 PM (29 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piapplx.cc
r18 r23 25 25 10, 10, 0, 0); 26 26 menubar = new PIMenubar(this, "DefMenubar"); 27 Menubar()->SetBinding( true, true, true, false);27 Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free); 28 28 sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize(); 29 29 syt = ( sy > 0 ) ? sy : 0; … … 35 35 topcont = new PIContainerX(MBCont(), "TopLevelCont", 36 36 sx, sy, 0, 40); 37 topcont->SetBinding( true, true, true, true);37 topcont->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 38 38 topcont->Show(); 39 39 } -
trunk/SophyaPI/PI/pibwdggen.cc
r18 r23 43 43 void PIBaseWdgGen::But1Press(int /*x*/, int /*y*/) 44 44 { 45 Send( PIMsg_ActiveWdg);45 Send(Msg(), PIMsg_Active); 46 46 #ifdef DEBUG_RZXB 47 47 printf ("PIBaseWdgGen::But1Press PosX,Y= %d %d \n", x, y); -
trunk/SophyaPI/PI/pibwdgx.cc
r18 r23 398 398 399 399 400 /* --Methode-- */401 void PIBaseWdgX::SelectFont(int isz, int jat)402 {403 mFAtt = fntatt[jat];404 mFSize = fntsz[isz];405 mFSt = fntst[isz][jat];406 XSetFont(XtDisplay(XtWdg()), DefGC(), fntst[isz][jat]->fid);407 return;408 }409 400 410 401 /* --Methode-- */ … … 584 575 void PIBaseWdgX::But1Release(int x, int y) 585 576 { 586 Send( PIMsg_ActiveWdg);577 Send(Msg(), PIMsg_Active); 587 578 #ifdef DEBUG_PIBWDGX 588 579 printf ("PIBaseWdgX::ButReleasePosX,Y= %d %d \n", x, y); … … 667 658 "medium-o-normal", "medium-i-normal" }; 668 659 660 static XFontStruct * defnt = NULL; 661 static char * fnbi[3]; 662 663 669 664 /* --Methode-- */ 670 665 void PIBaseWdgX::Init() … … 673 668 int i,j,k, count; 674 669 char **list; 675 XFontStruct * defnt;676 char * fnbi[3];677 670 678 671 if (fgbwdg) return; … … 740 733 else defnt = XLoadQueryFont(mdsp, buff); 741 734 742 /* Allocation des fonts */743 735 for (i=0; i<NMAXFONTSZ; i++) 744 for (j=0; j<3; j++) 745 { 746 for (k=0; k<5; k++) 747 { 748 sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam, fnbi[j], fntsz[i]+k); 749 list = XListFonts(mdsp, buff, 10, &count); 750 XFreeFontNames(list); 751 if (count > 0) break; 752 } 753 if (count > 0) 754 { 755 fntst[i][j] = XLoadQueryFont(mdsp, buff); 756 // printf("PIBaseWdgX::Init: font %s loaded \n", buff); 757 } 758 else 759 { 760 printf("PIBaseWdgX::Init: Pb font %s \n", buff); 761 fntst[i][j] = defnt; 762 } 763 } 736 for (j=0; j<3; j++) fntst[i][j] = NULL; 764 737 765 738 … … 793 766 return; 794 767 } 768 769 770 /* --Methode-- */ 771 void PIBaseWdgX::SelectFont(int isz, int jat) 772 { 773 774 if (!fntst[isz][jat]) // Il faut charger la fonte 775 { 776 char buff[256]; 777 int count,k; 778 Display * mdsp = PIXDisplay(); 779 char **list; 780 781 for (k=0; k<5; k++) // Recherche de la fonte pour tailles croissantes 782 { 783 sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam, fnbi[jat], fntsz[isz]+k); 784 list = XListFonts(mdsp, buff, 10, &count); 785 XFreeFontNames(list); 786 if (count > 0) break; 787 } 788 if (count > 0) 789 fntst[isz][jat] = XLoadQueryFont(mdsp, buff); 790 else 791 { printf("PIBaseWdgX::SelectFont/ Pb font %s - Using default \n", buff); 792 fntst[isz][jat] = defnt; } 793 } 794 795 mFAtt = fntatt[jat]; 796 mFSize = fntsz[isz]; 797 mFSt = fntst[isz][jat]; 798 XSetFont(XtDisplay(XtWdg()), DefGC(), fntst[isz][jat]->fid); 799 return; 800 } -
trunk/SophyaPI/PI/pidemo.cc
r22 r23 202 202 203 203 /* --Methode-- */ 204 void PIDemoApp::Process( longmsg, PIMsgHandler* sender, void* data)204 void PIDemoApp::Process(PIMessage msg, PIMsgHandler* sender, void* data) 205 205 { 206 206 PIWdg *sndw; 207 PIMessage tmsg, smm; 208 209 tmsg = msg; 210 msg = UserMsg(msg); 211 smm = ModMsg(tmsg); 207 212 208 213 if ((GetState()) && (msg > 9999)) { PIBeep(); return; } … … 213 218 else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data); 214 219 else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data); 215 else if ( msg == PIMsg_ActiveWdg)220 else if (smm == PIMsg_Active) 216 221 { 217 222 sndw = (PIWdg *)sender; … … 226 231 } 227 232 } 228 else printf("PIDemoApp::Process() BUG?? Msg %d \n", (int)msg); 233 else if (smm == PIMsg_Close) 234 { 235 sndw = (PIWdg *)sender; 236 if(sndw->kind() == PIWindow::ClassId) 237 { 238 mCurWin = (PIWindow *)sender; 239 CloseCurrent(); 240 } 241 else 242 printf("PIDemoApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n", 243 (int)tmsg, (int)sndw->kind(), (long)sender); 244 } 245 246 else printf("PIDemoApp::Process() BUG?? Msg %d (%d-%d) \n", 247 (int)tmsg,(int)msg,(int)smm); 229 248 230 249 /* Changement palette outil */ … … 239 258 240 259 /* --Methode-- */ 241 void PIDemoApp::MBProcess1( longmsg, PIMsgHandler* /*sender*/, void* data)260 void PIDemoApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data) 242 261 { 243 262 … … 293 312 294 313 /* --Methode-- */ 295 void PIDemoApp::MBProcess2( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)314 void PIDemoApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 296 315 { 297 316 int snx,sny,sx,sy,zm,wt; … … 359 378 360 379 /* --Methode-- */ 361 void PIDemoApp::MBProcess3( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)380 void PIDemoApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 362 381 { 363 382 ImageR4 * pim; … … 415 434 416 435 /* --Methode-- */ 417 void PIDemoApp::MBProcess4( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)436 void PIDemoApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 418 437 { 419 438 ImageR4 * pim; … … 584 603 { 585 604 pii[i] = new PIImage(win, "Pave", 160, 160, 5+170*i, 65); 586 pii[i]->SetBinding( true, true, true, true);605 pii[i]->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 587 606 pii[i]->SetZoomWin(zoom); 588 607 pii[i]->SetTextWin(labimg); … … 677 696 sx, sy, 200, 200); 678 697 pii = new PIImage(awp[mNwin], (char *)name.c_str(), sx, sy, 0, 0); 679 pii->SetBinding( true, true, true, true);698 pii->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 680 699 pii->SetZoomWin(zoom); 681 700 pii->SetTextWin(labimg); … … 909 928 910 929 /* --Methode-- */ 911 void VisuTools::Process( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)930 void VisuTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 912 931 { 913 932 CMapId cmap[5] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32, … … 916 935 if (dap->CurrentPIImage() == NULL) return; 917 936 dap->SetBusy(); 937 msg = UserMsg(msg); 918 938 if ((msg < 110) && (msg > 90)) // Zoom 919 939 dap->CurrentPIImage()->SetZoom((int)(msg-100)); … … 1016 1036 1017 1037 /* --Methode-- */ 1018 void CutTools::Process( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)1038 void CutTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 1019 1039 { 1020 1040 if ((fgpb) || (dap->CurrentPIImage() == NULL)) … … 1022 1042 return; } 1023 1043 1024 1044 msg = UserMsg(msg); 1025 1045 switch(msg) 1026 1046 { … … 1238 1258 1239 1259 /* --Methode-- */ 1240 void LutWind::Process( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)1260 void LutWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 1241 1261 { 1242 1262 float min, max; … … 1244 1264 int typlut[2] = {kLutType_Lin, kLutType_Log} ; 1245 1265 1266 msg = UserMsg(msg); 1246 1267 switch (msg) 1247 1268 { … … 1319 1340 1320 1341 /* --Methode-- */ 1321 void UserProcWind::Process( longmsg, PIMsgHandler* /*sender*/, void* /*data*/)1342 void UserProcWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 1322 1343 { 1323 1344 ImageR4 *mimg, *oimg; 1324 1345 int xp, yp, dx, dy; 1325 1346 1347 msg = UserMsg(msg); 1326 1348 switch (msg) 1327 1349 { … … 1497 1519 1498 1520 /* --Methode-- */ 1499 void OptionWind::Process(long msg, PIMsgHandler* /*sender*/, void* data) 1500 { 1501 1521 void OptionWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data) 1522 { 1523 1524 msg = UserMsg(msg); 1502 1525 switch (msg) 1503 1526 { -
trunk/SophyaPI/PI/pidemo.h
r18 r23 29 29 ~PIDemoApp(); 30 30 31 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);31 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 32 32 33 33 void AddImage(ImageR4 * nouv, string const & name, int zm=0, int typ=3); … … 51 51 52 52 private: 53 void MBProcess1( longmsg, PIMsgHandler* sender, void* data=NULL);54 void MBProcess2( longmsg, PIMsgHandler* sender, void* data=NULL);55 void MBProcess3( longmsg, PIMsgHandler* sender, void* data=NULL);56 void MBProcess4( longmsg, PIMsgHandler* sender, void* data=NULL);53 void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 54 void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 55 void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 56 void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 57 57 bool FitPSF_Res(ImageR4 *pim); 58 58 … … 86 86 VisuTools(PIDemoApp *par, PIContainer *pw); 87 87 ~VisuTools(); 88 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);88 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 89 89 90 90 PIPUMenu * ZoomOptMenu() { return mPum[1]; } … … 108 108 ~CutTools(); 109 109 virtual void Show(); 110 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);110 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 111 111 112 112 private: … … 139 139 ~LutWind(); 140 140 virtual void Show(); 141 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);141 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 142 142 143 143 private: … … 159 159 ~UserProcWind(); 160 160 virtual void Show(); 161 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);161 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 162 162 void SelectUP(int n) { mUpr = n; }; 163 163 … … 179 179 ~OptionWind(); 180 180 virtual void Show(); 181 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);181 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 182 182 183 183 private: -
trunk/SophyaPI/PI/pidrawwin.cc
r18 r23 6 6 { 7 7 mDrawWdg = new PIScDrawWdg(this, nom, sx-20, sy-20, 10, 10); 8 mDrawWdg->SetBinding( true, true, true, true);8 mDrawWdg->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 9 9 } 10 10 -
trunk/SophyaPI/PI/pierrdisp.cc
r21 r23 67 67 68 68 void 69 PIErrorDisplay::Process( longmsg, PIMsgHandler *sender, void *data)69 PIErrorDisplay::Process(PIMessage msg, PIMsgHandler *sender, void *data) 70 70 { 71 msg = UserMsg(msg); 71 72 switch(msg) { 72 73 case 5000: -
trunk/SophyaPI/PI/pierrdisp.h
r15 r23 36 36 37 37 void UpdData(); 38 void Process( longmsg, PIMsgHandler *sender, void *data);38 void Process(PIMessage msg, PIMsgHandler *sender, void *data); 39 39 void DoPeriodic() {UpdData();} 40 40 protected: -
trunk/SophyaPI/PI/pifilechogen.cc
r2 r23 4 4 /************* PIFileChooserGen ************/ 5 5 6 PIFileChooserGen::PIFileChooserGen(PIMsgHandler* par, char* nom, longmsg)6 PIFileChooserGen::PIFileChooserGen(PIMsgHandler* par, char* nom, PIMessage msg) 7 7 : PIWdg(NULL, nom) 8 8 { -
trunk/SophyaPI/PI/pifilechogen.h
r2 r23 10 10 enum {ClassId = 2100}; 11 11 12 PIFileChooserGen(PIMsgHandler* par, char* nom, longmsg);12 PIFileChooserGen(PIMsgHandler* par, char* nom, PIMessage msg); 13 13 virtual ~PIFileChooserGen(); 14 14 -
trunk/SophyaPI/PI/pifilechomac.cc
r9 r23 72 72 73 73 74 PIFileChooserMac::PIFileChooserMac(PIMsgHandler* par, char* nom, longmsg)74 PIFileChooserMac::PIFileChooserMac(PIMsgHandler* par, char* nom, PIMessage msg) 75 75 : PIFileChooserGen(par, nom, msg) 76 76 { … … 92 92 // Envoyer un message.... 93 93 if (mFileName == "") 94 Send(Msg(), NULL);94 Send(Msg(), PIMsg_Cancel, NULL); 95 95 else 96 Send(Msg(), (void *) (GetFileName().c_str()));96 Send(Msg(), PIMsg_OK, (void *) (GetFileName().c_str())); 97 97 } 98 98 -
trunk/SophyaPI/PI/pifilechomac.h
r9 r23 9 9 public: 10 10 11 PIFileChooserMac(PIMsgHandler* par, char* nom, longmsg);11 PIFileChooserMac(PIMsgHandler* par, char* nom, PIMessage msg); 12 12 virtual ~PIFileChooserMac(); 13 13 -
trunk/SophyaPI/PI/pifilechox.cc
r18 r23 11 11 #include <Xm/FileSB.h> 12 12 13 // Fonction prive(CallBack)14 static void filesel_okact(Widget w, XtPointer *usd, XtPointer *calld);13 // Fonctions privees (CallBack) 14 //static void filesel_okact(Widget w, XtPointer *usd, XtPointer *calld); 15 15 static void filesel_cancelact(Widget w, XtPointer *usd, XtPointer *calld); 16 16 17 17 /* Nouvelle-Fonction */ 18 void filesel_okact(Widget w, XtPointer *usd, XtPointer *calld) 18 void filesel_okact(Widget /*w*/, XtPointer *usd, 19 XmFileSelectionBoxCallbackStruct *calld) 19 20 { 20 21 PIFileChooserX *pif; … … 22 23 pif->mSt = 1; 23 24 pif->MWin()->Unmanage(); 24 pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str())); 25 //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 pif->Send( pif->Msg(), PIMsg_OK, (void *) pif->mFName); 25 30 return; 26 31 } 27 32 28 33 /* Nouvelle-Fonction */ 29 void filesel_cancelact(Widget w, XtPointer *usd, XtPointer *calld)34 void filesel_cancelact(Widget /*w*/, XtPointer *usd, XtPointer */*calld*/) 30 35 { 31 36 PIFileChooserX *pif; 32 37 pif = (PIFileChooserX *) usd ; 33 38 pif->mSt = 0; 39 pif->mFName[0] = '\0'; 34 40 pif->MWin()->Unmanage(); 35 pif->Send(pif->Msg(), NULL);41 pif->Send(pif->Msg(), PIMsg_Cancel, NULL); 36 42 return; 37 43 } … … 41 47 42 48 /* --Methode-- */ 43 PIFileChooserX::PIFileChooserX(PIMsgHandler* par, char* nom, longmsg)49 PIFileChooserX::PIFileChooserX(PIMsgHandler* par, char* nom, PIMessage msg) 44 50 : PIFileChooserGen(par, nom, msg) 45 51 { … … 51 57 52 58 mSt = 0; 59 mFName[0] = mFName[511] = '\0'; 53 60 54 61 CreateXtWdg(nom, xmFileSelectionBoxWidgetClass, mWin->XtWdg(), PIFC_SzX, PIFC_SzY, 0, 0); -
trunk/SophyaPI/PI/pifilechox.h
r8 r23 11 11 public: 12 12 13 PIFileChooserX(PIMsgHandler* par, char* nom, longmsg);13 PIFileChooserX(PIMsgHandler* par, char* nom, PIMessage msg); 14 14 virtual ~PIFileChooserX(); 15 15 … … 25 25 inline PIWdg * MWin() { return mWin; } 26 26 27 // Je les declare ici, en public, a cause des callback 27 28 int mSt; 29 char mFName[512]; 28 30 29 31 protected: -
trunk/SophyaPI/PI/piimage.cc
r18 r23 25 25 winovis = true; // $CHECK$ Reza A enlever si possible 17/6/96 26 26 zow = NULL; 27 txw = NULL; 27 trtw = NULL; 28 trtlb = txw = NULL; 29 SetTextWin(NULL); 28 30 zpixm = pixm = NULL; 29 31 xszpxm = xspxm = 0; … … 32 34 offx = offy = 0; 33 35 xpav = ypav = 0; 36 xpv0 = ypv0 = 0; 34 37 xszpav = yszpav = 1; 35 38 xmv0 = ymv0 = -1; … … 59 62 if (lut) delete lut; 60 63 if (aisup) delete img; // Suppression automatique d'image 64 if (trtw) delete trtw; 61 65 } 62 66 … … 91 95 return; 92 96 } 97 98 /* --Methode-- */ 99 void PIImage::SetTextWin(PILabel * tw, bool trw, int tx, int ty) 100 { 101 txw = tw; 102 if (trw) 103 { 104 if (trtw) trtw->SetSize(tx, ty); 105 else 106 { 107 trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0); 108 trtw->SetAutoDelChilds(true); 109 trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0); 110 trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed); 111 } 112 } 113 else 114 if (trtw) { delete trtw; trtw = NULL; trtlb = NULL; } 115 116 return; 117 } 118 93 119 94 120 /* --Methode-- */ … … 161 187 162 188 /* --Methode-- */ 163 void PIImage::SetZoom (float fzm, bool refr)189 void PIImage::SetZoomF(float fzm, bool refr) 164 190 { 165 191 int zm; 166 192 167 193 if (fzm < 0.01) return; 168 if (fzm < 1.) zm = -(1./fzm);194 if (fzm < 1.) zm = (int)(-(1./fzm)); 169 195 else zm = (int)(fzm+0.25); 170 196 SetZoom(zm, refr); … … 186 212 187 213 /* --Methode-- */ 188 float PIImage::GetZoom ()214 float PIImage::GetZoomF() 189 215 { 190 216 if (zoom >= 1) return((float)zoom); … … 248 274 { 249 275 ComputePixmap(); 250 Send( PIMsg_ActiveWdg);276 Send(Msg(), PIMsg_Active); 251 277 } 252 278 if (zow != NULL) … … 255 281 ComputeZoomPixmap(); 256 282 } 257 if (txw )283 if (txw || trtlb) 258 284 { 259 285 char buff[256]; 260 sprintf(buff,"%s : X= %d , Y= %d PixVal= %g ", 261 (char *)Nom().c_str(), xpav, ypav, img->FValue(xpav, ypav)); 262 txw->SetLabel((string)buff); 286 sprintf(buff,"X= %d , Y= %d PixVal= %g ", /*(char *)Nom().c_str(),*/ 287 xpav, ypav, img->FValue(xpav, ypav)); 288 if (txw) txw->SetLabel((string)buff); 289 if (trtlb) trtlb->SetLabel((string)buff); 263 290 } 264 291 … … 296 323 int xp, yp; 297 324 298 Send( PIMsg_ActiveWdg);325 Send(Msg(), PIMsg_Active); 299 326 if (img == NULL) return; 300 327 if ( PosW2Img(x, y, &xp, &yp) ) return; 301 328 SelPointerShape(PI_CrossPointer); 302 329 xpav = xp; ypav = yp; 330 ShowTrTxW(); 303 331 Apply(false); 304 332 if (curshow) DrawCursor(-1,-1); … … 324 352 SelPointerShape(PI_ArrowPointer); 325 353 if (curshow) DrawCursor(); 354 if (trtw) trtw->Hide(); 326 355 return; 327 356 } … … 333 362 int xp, yp; 334 363 335 Send( PIMsg_ActiveWdg);336 if (img == NULL) return; 337 if ( PosW2Img(x, y, &xp , &yp) ) {xmv0 = -1; return; }364 Send(Msg(), PIMsg_Active); 365 if (img == NULL) return; 366 if ( PosW2Img(x, y, &xpv0, &ypv0) ) { xmv0 = -1; return; } 338 367 xmv0 = x; ymv0 = y; dxmv = dymv = 0; 339 368 if (curshow) DrawCursor(-1,-1); … … 343 372 else SelForeground(PI_Magenta); 344 373 SelLine(PI_NormalLine); 374 ShowTrTxW(); 345 375 return; 346 376 } … … 356 386 dxmv = x-xmv0; dymv = y-ymv0; 357 387 DrawBox(xmv0, ymv0, dxmv, dymv); 388 if (txw || trtlb) 389 { 390 char buff[256]; 391 sprintf(buff,"X,Y= %d,%d PixVal= %g (X,Yc= %d,%d)", 392 xp, yp, img->FValue(x, yp), (xp+xpv0)/2, (yp+ypv0)/2); 393 if (txw) txw->SetLabel((string)buff); 394 if (trtlb) trtlb->SetLabel((string)buff); 395 } 358 396 return; 359 397 } … … 362 400 void PIImage::But2Release(int x, int y) 363 401 { 364 int xp , yp, xp2, yp2;402 int xp2, yp2; 365 403 366 404 if (img == NULL) return; … … 369 407 SelGOMode(PI_GOCopy); 370 408 SelForeground(PI_White); 371 PosW2Img(xmv0, ymv0, &xp, &yp);372 409 if ( PosW2Img(x, y, &xp2, &yp2) ) 373 410 PosW2Img(xmv0+dxmv, ymv0+dymv, &xp2, &yp2); 374 xpav = (xp +xp2)/2;375 ypav = (yp +yp2)/2;376 xszpav = ((xp2-xp ) > 0) ? (xp2-xp) : 1;377 yszpav = ((yp2-yp ) > 0) ? (yp2-yp) : 1;411 xpav = (xpv0+xp2)/2; 412 ypav = (ypv0+yp2)/2; 413 xszpav = ((xp2-xpv0) > 0) ? (xp2-xpv0) : 1; 414 yszpav = ((yp2-ypv0) > 0) ? (yp2-ypv0) : 1; 378 415 379 416 Apply(false); 380 417 if (curshow) DrawCursor(); 418 if (trtw) trtw->Hide(); 381 419 return; 382 420 } … … 388 426 int xp, yp; 389 427 390 Send( PIMsg_ActiveWdg);428 Send(Msg(), PIMsg_Active); 391 429 if (img == NULL) return; 392 430 if ( PosW2Img(x, y, &xp, &yp) ) { xmv0 = -1; return; } 393 431 if (curshow) DrawCursor(-1,-1); 432 ShowTrTxW(); 394 433 SelPointerShape(PI_TDLRArrowPointer); 395 434 xmv0 = xp; … … 406 445 if (xmv0 < 0) return; 407 446 if ( PosW2Img(x, y, &xp, &yp) ) return; 408 if (txw )447 if (txw || trtlb) 409 448 { 410 449 char buff[256]; 411 sprintf(buff,"%s : DelX= %d , DelY= %d ", (char *)Nom().c_str(), xp-xmv0, yp-ymv0); 412 txw->SetLabel((string)buff); 450 sprintf(buff,"DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0); 451 if (txw) txw->SetLabel((string)buff); 452 if (trtlb) trtlb->SetLabel((string)buff); 413 453 } 414 454 } … … 420 460 421 461 SelPointerShape(PI_ArrowPointer); 462 if (trtw) trtw->Hide(); 422 463 if (img == NULL) return; 423 464 if (xmv0 < 0) return; … … 611 652 } 612 653 else { xcurs = ycurs = -1; } 654 655 return; 656 } 657 658 /* --Methode-- */ 659 void PIImage::ShowTrTxW() 660 { 661 if (trtw) 662 { 663 int tpx, tpy; 664 GetScreenPos(tpx, tpy); 665 tpy -= (trtw->YSize()+5); 666 if (tpy < 0) tpy = 0; 667 trtw->SetPos(tpx, tpy); 668 trtw->Show(); 669 } 613 670 614 671 return; -
trunk/SophyaPI/PI/piimage.h
r18 r23 13 13 #include PIPIXMAP_H 14 14 #include PISTDWDG_H 15 #include PIWIN_H 15 16 16 17 class PIImage : public PIPixmap … … 28 29 29 30 void SetZoomWin(PIPixmap * zw, bool refr=true); 30 inline void SetTextWin(PILabel * tw) { txw = tw; };31 void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30); 31 32 void ShowCursor(bool sc=true); 32 33 … … 36 37 37 38 void SetZoom(int zm, bool refr=true); 38 void SetZoom (float fzm, bool refr=true);39 float GetZoom ();39 void SetZoomF(float fzm, bool refr=true); 40 float GetZoomF(); 40 41 41 42 void SetOffset(int ox, int oy, bool refr=true); … … 78 79 void DrawCursor(int xc, int yc); 79 80 81 void ShowTrTxW(); 82 80 83 int PosW2Img(int xiw, int yiw, int * xp, int * yp); 81 84 int PosImg2W(int xp, int yp, int * xiw, int * yiw); … … 103 106 104 107 PILabel * txw; 108 PILabel * trtlb; 109 PIWindow * trtw; 110 105 111 int xpav, ypav; 112 int xpv0, ypv0; 106 113 int xmv0, ymv0; 107 114 int dxmv, dymv; -
trunk/SophyaPI/PI/pimenubarx.cc
r2 r23 28 28 29 29 SetPos(0,0); 30 SetBinding( true, true, true, false);30 SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free); 31 31 32 32 Manage(); -
trunk/SophyaPI/PI/pimenugen.h
r8 r23 14 14 ~PIMenuGen(); 15 15 16 virtual void AppendItem(char* nom, longmsg)=0;16 virtual void AppendItem(char* nom, PIMessage msg)=0; 17 17 18 18 virtual void DeleteItem(char *nom)=0; 19 virtual void DeleteItemMsg( longmsg)=0;19 virtual void DeleteItemMsg(PIMessage msg)=0; 20 20 virtual void DeleteItemNum(int n)=0; 21 21 22 22 virtual void CheckItem(char *nom, bool st=false)=0; 23 virtual void CheckItemMsg( longmsg, bool st=false)=0;23 virtual void CheckItemMsg(PIMessage msg, bool st=false)=0; 24 24 virtual void CheckItemNum(int n, bool st=false)=0; 25 25 -
trunk/SophyaPI/PI/pimenumac.cc
r9 r23 24 24 25 25 int 26 PIMenuMac::FindItemByMsg( longmsg)26 PIMenuMac::FindItemByMsg(PIMessage msg) 27 27 { 28 28 if (mMsgs.size() == 0) return -1; … … 43 43 44 44 void 45 PIMenuMac::AppendItem(char* nom, longmsg)45 PIMenuMac::AppendItem(char* nom, PIMessage msg) 46 46 { 47 47 LStr255 titre(nom); … … 59 59 60 60 void 61 PIMenuMac::CheckItemMsg( longmsg, bool st)61 PIMenuMac::CheckItemMsg(PIMessage msg, bool st) 62 62 { 63 63 int i = FindItemByMsg(msg); … … 83 83 84 84 void 85 PIMenuMac::DeleteItemMsg( longmsg)85 PIMenuMac::DeleteItemMsg(PIMessage msg) 86 86 { 87 87 int i = FindItemByMsg(msg); … … 104 104 { 105 105 if (item<0 || item >= mMsgs.size()) return; // $CHECK$ exception ? 106 Send(mMsgs[item], (void*) GetMenuItemText(item).c_str());106 Send(mMsgs[item], PIMsg_Click, (void*) GetMenuItemText(item).c_str()); 107 107 } 108 108 -
trunk/SophyaPI/PI/pimenumac.h
r9 r23 13 13 ~PIMenuMac(); 14 14 15 virtual void AppendItem(char* nom, longmsg);15 virtual void AppendItem(char* nom, PIMessage msg); 16 16 17 17 virtual void DeleteItem(char *nom); 18 virtual void DeleteItemMsg( longmsg);18 virtual void DeleteItemMsg(PIMessage msg); 19 19 virtual void DeleteItemNum(int n); 20 20 21 21 virtual void CheckItem(char *nom, bool st=false); 22 virtual void CheckItemMsg( longmsg, bool st=false);22 virtual void CheckItemMsg(PIMessage msg, bool st=false); 23 23 virtual void CheckItemNum(int n, bool st=false); 24 24 … … 33 33 string GetMenuItemText(int item); 34 34 int GetMenuItemMsg(int item); 35 int FindItemByMsg( longmsg);35 int FindItemByMsg(PIMessage msg); 36 36 int FindItemByName(string const& nom); 37 37 … … 40 40 LMenu* macMenu; 41 41 int mMenuId; 42 vector< long> mMsgs;42 vector<PIMessage> mMsgs; 43 43 static int lastId; 44 44 static list<PIMenuMac*> sMenus; -
trunk/SophyaPI/PI/pimenux.cc
r8 r23 25 25 26 26 // pim->Hide(); 27 pim->Send(cusd->msg, (void *)pim->ItemNameWdg(cusd->itb).c_str());27 pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb).c_str()); 28 28 #ifdef DEBUG_PIMenuX 29 29 printf("%%%Debug_menub_action: Msg= %d %lx\n", (int)cusd->msg, (long)pim); … … 60 60 61 61 /* --Methode-- */ 62 void PIMenuX::AppendItem(char* nom, longmsg)62 void PIMenuX::AppendItem(char* nom, PIMessage msg) 63 63 { 64 64 AddItem(nom, msg, false); … … 78 78 79 79 /* --Methode-- */ 80 void PIMenuX::DeleteItemMsg( longmsg)80 void PIMenuX::DeleteItemMsg(PIMessage msg) 81 81 { 82 82 for(int i=0; i<mNItem; i++) … … 121 121 122 122 /* --Methode-- */ 123 void PIMenuX::CheckItemMsg( longmsg, bool st)123 void PIMenuX::CheckItemMsg(PIMessage msg, bool st) 124 124 { 125 125 for(int i=0; i<mNItem; i++) … … 189 189 190 190 /* --Methode-- */ 191 longPIMenuX::ItemMsg(int n)191 PIMessage PIMenuX::ItemMsg(int n) 192 192 { 193 193 if ( (n < 0) || (n >= mNItem)) return(0); … … 208 208 209 209 /* --Methode-- */ 210 int PIMenuX::GetNumItemMsg( longmsg)210 int PIMenuX::GetNumItemMsg(PIMessage msg) 211 211 { 212 212 for(int i=0; i<mNItem; i++) … … 224 224 225 225 /* --Methode-- */ 226 void PIMenuX::AddItem(char* nom, longmsg, bool tog)226 void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog) 227 227 { 228 228 _pimxit_ *buto; … … 288 288 289 289 /* --Methode-- A virer 290 void PIMenuX::AppendCheckItem(char* nom, longmsg)290 void PIMenuX::AppendCheckItem(char* nom, PIMessage msg) 291 291 { 292 292 AddItem(nom, msg, true); -
trunk/SophyaPI/PI/pimenux.h
r8 r23 11 11 SysDWdg itb; 12 12 PIMenuX *pmen; 13 longmsg;13 PIMessage msg; 14 14 bool togg; 15 15 }; … … 22 22 ~PIMenuX(); 23 23 24 virtual void AppendItem(char* nom, longmsg);24 virtual void AppendItem(char* nom, PIMessage msg); 25 25 26 26 virtual void DeleteItem(char *nom); 27 virtual void DeleteItemMsg( longmsg);27 virtual void DeleteItemMsg(PIMessage msg); 28 28 virtual void DeleteItemNum(int n); 29 29 30 30 virtual void CheckItem(char *nom, bool st=false); 31 virtual void CheckItemMsg( longmsg, bool st=false);31 virtual void CheckItemMsg(PIMessage msg, bool st=false); 32 32 virtual void CheckItemNum(int n, bool st=false); 33 33 34 34 virtual void Show(); 35 virtual void Show(PIWdg *w, int px, int py);35 virtual void Show(PIWdg *w, int px, int py); 36 36 virtual void Hide(); 37 37 38 38 // Pour usage prive et par OptionMenu, ... 39 longItemMsg(int n);39 PIMessage ItemMsg(int n); 40 40 int GetNumItem(char *nom); 41 int GetNumItemMsg( longmsg);41 int GetNumItemMsg(PIMessage msg); 42 42 SysDWdg GetItemWdg(int n); 43 43 string ItemName(int n); … … 45 45 46 46 protected: 47 void AddItem(char* nom, longmsg, bool tog);47 void AddItem(char* nom, PIMessage msg, bool tog); 48 48 void Check(); 49 49 -
trunk/SophyaPI/PI/pimsghandler.cc
r18 r23 10 10 11 11 void 12 PIMsgHandler::Process( longmsg, PIMsgHandler* sender, void* data)12 PIMsgHandler::Process(PIMessage msg, PIMsgHandler* sender, void* data) 13 13 { 14 14 ReSend(msg, sender, data); … … 16 16 17 17 void 18 PIMsgHandler::Send( long msg,void* data)18 PIMsgHandler::Send(PIMessage msg, PIMsgMod mm, void* data) 19 19 { 20 20 // Process(msg, this, data); $CHECK$ Reza 12/06/96 21 21 // Send par defaut appelle le process du parent $CHECK$ 22 22 if (msgParent) 23 msgParent->Process( msg, this, data);23 msgParent->Process(BuildMsg(msg, mm), this, data); 24 24 25 25 } 26 26 27 27 void 28 PIMsgHandler::ReSend( longmsg, PIMsgHandler* sender, void* data)28 PIMsgHandler::ReSend(PIMessage msg, PIMsgHandler* sender, void* data) 29 29 { 30 30 if (msgParent) 31 31 msgParent->Process(msg, sender, data); 32 32 } 33 34 35 -
trunk/SophyaPI/PI/pimsghandler.h
r18 r23 7 7 8 8 enum { 9 // Les messages 10 PIMsg_ActiveWdg = 1, 11 PIMsg_OK = 2, 12 PIMsg_Cancel = 3, 13 PIMsg_Help = 4, 14 PIMsg_DataChanged = 5, 15 PIMsg_Click = 6, 16 PIMsg_Press = 7 9 // Les messages reserves systeme (PI) les 8 premiers bits 10 // Messages user, les bits restants 11 PIMsg_Active = 1, 12 PIMsg_Close = 2, 13 14 PIMsg_OK = 11, 15 PIMsg_Cancel = 12, 16 PIMsg_Help = 13, 17 18 PIMsg_DataChanged = 21, 19 PIMsg_Click = 22, 20 PIMsg_Press = 23 17 21 }; 22 23 24 // Definition de type pour les messages - Il est peu probable que le typedef change ... 25 // Reza 17/10/96 26 typedef unsigned long PIMessage; 27 typedef unsigned char PIMsgMod; 18 28 19 29 class PIMsgHandler { 20 30 public: 21 22 virtual ~PIMsgHandler();31 PIMsgHandler(PIMsgHandler* par=NULL); 32 virtual ~PIMsgHandler(); 23 33 24 virtual void SetMsgParent(PIMsgHandler* par) {msgParent = par;}34 virtual void SetMsgParent(PIMsgHandler* par) {msgParent = par;} 25 35 26 virtual void Send(long msg, void* data=NULL); 27 28 36 virtual void Send(PIMessage msg, PIMsgMod mm=0, void* data=NULL); 37 38 inline PIMessage UserMsg(PIMessage msg) { return (msg >> 8); } 39 inline PIMessage ModMsg(PIMessage msg) { return (msg & 0xFF); } 40 inline PIMessage BuildMsg(PIMessage um, PIMsgMod mm) 41 { return ((um << 8) | mm); } 42 29 43 protected: 30 virtual void ReSend( longmsg, PIMsgHandler* sender, void* data=NULL);31 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);44 virtual void ReSend(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 45 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 32 46 33 47 private: -
trunk/SophyaPI/PI/pioptmenugen.h
r8 r23 18 18 19 19 virtual string GetValueStr() = 0; // Option choisie 20 virtual longGetValue() = 0; // Message correspondant a l'option choisie20 virtual PIMessage GetValue() = 0; // Message correspondant a l'option choisie 21 21 virtual void SetValueStr(string & s) = 0; 22 virtual void SetValue( longmsg) = 0;22 virtual void SetValue(PIMessage msg) = 0; 23 23 24 24 protected: -
trunk/SophyaPI/PI/pioptmenumac.cc
r9 r23 34 34 35 35 /* --Methode-- */ 36 void PIOptMenuMac::Process( longmsg, PIMsgHandler* sender, void* data)36 void PIOptMenuMac::Process(PIMessage msg, PIMsgHandler* sender, void* data) 37 37 { 38 Select((char *)data, msg);38 Select((char *)data, UserMsg(msg)); // Reza 17/10/96 $CHECK$ ??? 39 39 ReSend(msg, sender, data); 40 40 } … … 48 48 49 49 void 50 PIOptMenuMac::Select(char *txt, longmsg)50 PIOptMenuMac::Select(char *txt, PIMessage msg) 51 51 { // Ca doit faire quoi ???? 52 52 mStext = txt; mSmsg = msg; … … 68 68 69 69 /* --Methode-- */ 70 void PIOptMenuMac::SetValue( longmsg)70 void PIOptMenuMac::SetValue(PIMessage msg) 71 71 { 72 72 int n; -
trunk/SophyaPI/PI/pioptmenumac.h
r9 r23 10 10 ~PIOptMenuMac(); 11 11 12 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);12 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 13 13 14 14 virtual void ListenToMessage(MessageT inMessage, void *ioParam); 15 15 virtual string GetValueStr() { return(mStext); } 16 virtual longGetValue() { return(mSmsg); }16 virtual PIMessage GetValue() { return(mSmsg); } 17 17 virtual void SetValueStr(string & s); 18 virtual void SetValue( longmsg);18 virtual void SetValue(PIMessage msg); 19 19 20 inline void Select(char *txt, longmsg); // public ou protege ???20 inline void Select(char *txt, PIMessage msg); // public ou protege ??? 21 21 22 22 23 23 protected: 24 24 string mStext; 25 longmSmsg;25 PIMessage mSmsg; 26 26 //MenuHandle macMenu; 27 27 PIPUMenu* mPUMenu; -
trunk/SophyaPI/PI/pioptmenux.cc
r8 r23 20 20 sy -= 2; 21 21 SetBorderWidth(1); 22 // SetBinding(true, true, true, true);23 22 mAB = new PIButton(this, "?", 0, sy-2, sy-2, 1, 1); 24 mAB->SetBinding( true, true, false, true);25 mAB-> SetPressMsg(PIMsg_Press);23 mAB->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_free, PIBK_fixed); 24 mAB->ActivatePress(true); 26 25 mLab = new PILabel(this, "OptLabel", sx-sy-1, sy, sy+1, 0); 27 mLab->SetBinding( true, true, true, true);26 mLab->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 28 27 mMen = pum; 29 28 SetValue(mMen->ItemMsg(0)); … … 40 39 41 40 /* --Methode-- */ 42 void PIOptMenuX::Process( longmsg, PIMsgHandler* sender, void* data)41 void PIOptMenuX::Process(PIMessage msg, PIMsgHandler* sender, void* data) 43 42 { 44 43 // printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender); 45 if ((sender == mAB) && ( msg== PIMsg_Press))44 if ((sender == mAB) && (ModMsg(msg) == PIMsg_Press)) 46 45 { mMen->SetMsgParent(this); mMen->Show(this, 0, YSize()); } 47 46 else if (sender == mMen) 48 47 { 49 48 mAB->ReleaseButton(); 50 SetValue( msg);49 SetValue(UserMsg(msg)); 51 50 ReSend(msg, this, data); 52 51 } … … 72 71 73 72 /* --Methode-- */ 74 void PIOptMenuX::SetValue( longmsg)73 void PIOptMenuX::SetValue(PIMessage msg) 75 74 { 76 75 int n; -
trunk/SophyaPI/PI/pioptmenux.h
r8 r23 12 12 ~PIOptMenuX(); 13 13 14 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);14 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 15 15 16 16 virtual string GetValueStr() { return(mStext); } 17 virtual longGetValue() { return(mSmsg); }17 virtual PIMessage GetValue() { return(mSmsg); } 18 18 virtual void SetValueStr(string & s); 19 virtual void SetValue( longmsg);19 virtual void SetValue(PIMessage msg); 20 20 21 21 … … 26 26 PIPUMenu *mMen; 27 27 string mStext; 28 longmSmsg;28 PIMessage mSmsg; 29 29 30 30 }; -
trunk/SophyaPI/PI/piqualmon.cc
r21 r23 88 88 89 89 void 90 PIQualiteWin::Process(long msg, PIMsgHandler *sender, void *data) 91 { 90 PIQualiteWin::Process(PIMessage msg, PIMsgHandler *, void *) 91 { 92 msg = UserMsg(msg); // Reza 17/10/96 $CHECK$ 92 93 switch (msg) { 93 94 case 80100: -
trunk/SophyaPI/PI/piqualmon.h
r21 r23 23 23 virtual void UpdateInfo(LImageInfo linfor, LImageInfo linfob, 24 24 string labflnmr, string labflnmb); 25 virtual void Process( longmsg, PIMsgHandler *sender, void *data);25 virtual void Process(PIMessage msg, PIMsgHandler *sender, void *data); 26 26 27 27 protected: -
trunk/SophyaPI/PI/piscdrawwdg.cc
r18 r23 14 14 clip = true; 15 15 padsup = false; 16 mTxw = NULL; 16 mTrlb = mTxw = NULL; 17 mTrW = NULL; 18 SetTextWin(NULL); 17 19 ActivateButton(1); // Pour pouvoir activer la fenetre et coordonnees 18 20 ActivateMove(1); // " " " " … … 25 27 { 26 28 DeleteDrawers(); 29 if (mTrW) delete mTrW; 27 30 } 28 31 … … 531 534 axesFlags |= kMajTicks; 532 535 } 536 void 537 PIScDrawWdg::SetTextWin(PILabel * tw, bool trw, int tx, int ty) 538 { 539 mTxw = tw; 540 if (trw) 541 { 542 if (mTrW) mTrW->SetSize(tx, ty); 543 else 544 { 545 mTrW = new PIWindow(this, "Point", PIWK_transient, tx, ty, 0, 0); 546 mTrW->SetAutoDelChilds(true); 547 mTrlb = new PILabel(mTrW, "PixVal", tx, ty, 0, 0); 548 mTrlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed); 549 } 550 } 551 else 552 if (mTrW) { delete mTrW; mTrW = NULL; mTrlb = NULL; } 553 554 return; 555 } 533 556 534 557 void … … 547 570 PIScDrawWdg::But1Press(int x, int y) 548 571 { 549 if (UpdateText(x, y)) 572 if (UpdateText(x, y)) 573 { 574 if (mTrW) 575 { 576 int tpx, tpy; 577 GetScreenPos(tpx, tpy); 578 tpy -= (mTrW->YSize()+5); 579 if (tpy < 0) tpy = 0; 580 mTrW->SetPos(tpx, tpy); 581 mTrW->Show(); 582 } 550 583 SelPointerShape(PI_CrossPointer); 551 Send(PIMsg_ActiveWdg); 584 } 585 Send(Msg(), PIMsg_Active); 552 586 553 587 } … … 564 598 if (UpdateText(x, y)) 565 599 SelPointerShape(PI_ArrowPointer); 566 600 if (mTrW) mTrW->Hide(); 567 601 } 568 602 … … 570 604 PIScDrawWdg::UpdateText(int xp, int yp) 571 605 { 572 if ( mTxw == NULL)return(false);606 if ((mTxw == NULL) && (mTrlb == NULL)) return(false); 573 607 574 608 char buff[128]; … … 576 610 Local2Sc(xp, yp, dx, dy); 577 611 sprintf(buff, "X= %g Y= %g", dx, dy); 578 mTxw->SetLabel((string)buff); 612 if (mTxw) 613 mTxw->SetLabel((string)buff); 614 if (mTrlb) 615 mTrlb->SetLabel((string)buff); 579 616 return(true); 580 617 … … 595 632 SelGOMode(PI_GOXOR); 596 633 SelLine(PI_ThinLine); 597 Send( PIMsg_ActiveWdg);634 Send(Msg(), PIMsg_Active); 598 635 } 599 636 -
trunk/SophyaPI/PI/piscdrawwdg.h
r18 r23 6 6 #include PIBWDG_H 7 7 #include PISTDWDG_H 8 #include PIWIN_H 8 9 9 10 #include <list.h> … … 68 69 virtual void SetAxesFlags(int flags=kAxesDflt); 69 70 70 void SetTextWin(PILabel * tw) {mTxw = tw; }71 void SetTextWin(PILabel * tw, bool trw=true, int tx=200, int ty=30); 71 72 72 73 double XMin() const {return xMin;} … … 111 112 PILineAtt cLatt; 112 113 PILabel * mTxw; 114 PILabel * mTrlb; 115 PIWindow * mTrW; 113 116 bool clip; 114 117 bool padsup; -
trunk/SophyaPI/PI/pistatmon.cc
r21 r23 69 69 } 70 70 71 void PIStatWin::Process(long msg, PIMsgHandler *, void *) 72 { 71 void PIStatWin::Process(PIMessage msg, PIMsgHandler *, void *) 72 { 73 msg = UserMsg(msg); // Reza 17/10/96 $CHECK$ 73 74 switch (msg) { 74 75 case 1010: -
trunk/SophyaPI/PI/pistatmon.h
r15 r23 19 19 int sx, int sy, int px, int py); 20 20 virtual ~PIStatWin(); 21 virtual void Process( longmsg, PIMsgHandler *sender, void *data);21 virtual void Process(PIMessage msg, PIMsgHandler *sender, void *data); 22 22 void UpdateInfo(LImageInfo linfoR, LImageInfo linfoB, 23 23 string var); -
trunk/SophyaPI/PI/pistdwdggen.cc
r8 r23 14 14 /************* PIButtonGen ************/ 15 15 16 PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, longmsg,16 PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, PIMessage msg, 17 17 int sx, int sy, int px, int py, PIBtnSign bsgn) 18 18 : PIWdg(par, nom, sx, sy, px, py) 19 19 { 20 20 SetMsg(msg); 21 mPressMsg = 0;22 21 mSgn = bsgn; 23 22 } … … 26 25 {} 27 26 28 void PIButtonGen::SetPressMsg(long prmsg)29 {30 mPressMsg = prmsg;31 }32 27 33 28 /************* PIScaleGen ************/ 34 29 35 PIScaleGen::PIScaleGen(PIContainerGen *par, char *nom, longmsg,30 PIScaleGen::PIScaleGen(PIContainerGen *par, char *nom, PIMessage msg, 36 31 int /*min*/, int /*max*/, int sx, int sy, int px, int py) 37 32 : PIWdg(par, nom, sx, sy, px, py) … … 58 53 /************* PICheckBoxGen ************/ 59 54 60 PICheckBoxGen::PICheckBoxGen(PIContainerGen *par, char *nom, longmsg,55 PICheckBoxGen::PICheckBoxGen(PIContainerGen *par, char *nom, PIMessage msg, 61 56 int sx, int sy, int px, int py) 62 57 : PIWdg(par, nom, sx, sy, px, py) -
trunk/SophyaPI/PI/pistdwdggen.h
r8 r23 26 26 enum {ClassId = 1010}; 27 27 28 PIButtonGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click, 28 PIButtonGen(PIContainerGen* par, char* nom, 29 PIMessage msg = PIMsg_Click, 29 30 int sx=10, int sy=10, int px=0, int py=0, 30 31 PIBtnSign bsgn = PIBtn_Label); … … 33 34 virtual long kind() {return ClassId; } 34 35 35 virtual void SetPressMsg(long prmsg); 36 inline long PressMsg() { return(mPressMsg); } 36 virtual void ActivatePress(bool acp=false)=0; 37 37 38 38 protected: 39 long mPressMsg;40 39 PIBtnSign mSgn; 41 40 }; … … 54 53 virtual string GetText() const = 0; 55 54 55 virtual void SetMutiLineMode(bool mlm=false) = 0; 56 virtual void SetTextEditable(bool te=true) = 0; 57 56 58 virtual long kind() {return ClassId; } 57 59 }; … … 63 65 enum {ClassId = 1030}; 64 66 65 PIScaleGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click, 67 PIScaleGen(PIContainerGen* par, char* nom, 68 PIMessage msg = PIMsg_Click, 66 69 int min=0, int max=10, int sx=100, int sy=10, int px=0, int py=0); 67 70 ~PIScaleGen(); … … 85 88 86 89 PICheckBoxGen(PIContainerGen* par, char* nom, 87 longmsg = PIMsg_Click,90 PIMessage msg = PIMsg_Click, 88 91 int sx=10, int sy=10, int px=0, int py=0); 89 92 virtual ~PICheckBoxGen()=0; -
trunk/SophyaPI/PI/pistdwdgmac.cc
r9 r23 22 22 #include <LStdControl.h> 23 23 24 PIButtonMac::PIButtonMac(PIContainerGen *par, char *nom, longmsg,24 PIButtonMac::PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg, 25 25 int sx, int sy, int px, int py, PIBtnSign bsgn) 26 26 : PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn) … … 39 39 { 40 40 if (inMessage == msg_Click) 41 Send(myMsg );41 Send(myMsg, PIMsg_Press); 42 42 } 43 43 … … 77 77 78 78 79 PIScaleMac::PIScaleMac(PIContainerGen* par, char* nom, longmsg,79 PIScaleMac::PIScaleMac(PIContainerGen* par, char* nom, PIMessage msg, 80 80 int min, int max, int sx, int sy, int px, int py) 81 81 : PIScaleGen(par, nom, msg, min, max, sx, sy, px, py) … … 100 100 { 101 101 if (inMessage == msg_ThumbDragged) 102 Send(myMsg );102 Send(myMsg, PIMsg_DataChanged); 103 103 } 104 104 … … 166 166 #include <LStdControl.h> 167 167 168 PICheckBoxMac::PICheckBoxMac(PIContainerGen *par, char *nom, longmsg,168 PICheckBoxMac::PICheckBoxMac(PIContainerGen *par, char *nom, PIMessage msg, 169 169 int sx, int sy, int px, int py) 170 170 : PICheckBoxGen(par, nom, msg, sx, sy, px, py) … … 183 183 { 184 184 if (inMessage == msg_Click) 185 Send(myMsg );185 Send(myMsg, PIMsg_DataChanged); 186 186 } 187 187 -
trunk/SophyaPI/PI/pistdwdgmac.h
r9 r23 16 16 { 17 17 public: 18 PIButtonMac(PIContainerGen *par, char *nom, longmsg = PIMsg_Click,18 PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg = PIMsg_Click, 19 19 int sx=10, int sy=10, int px=0, int py=0, 20 20 PIBtnSign bsgn = PIBtn_Label); … … 36 36 { 37 37 public: 38 PIScaleMac(PIContainerGen* par, char* nom, longmsg=PIMsg_Click,38 PIScaleMac(PIContainerGen* par, char* nom, PIMessage msg=PIMsg_Click, 39 39 int min=0, int max=10, int sx=100, int sy=10, int px=0, int py=0); 40 40 ~PIScaleMac(); … … 55 55 public: 56 56 PICheckBoxMac(PIContainerGen* par, char* nom, 57 longmsg = PIMsg_Click,57 PIMessage msg = PIMsg_Click, 58 58 int sx=10, int sy=10, int px=0, int py=0); 59 59 virtual ~PICheckBoxMac(); -
trunk/SophyaPI/PI/pistdwdgx.cc
r8 r23 37 37 38 38 /* Nouvelle-Fonction */ 39 void button_action(Widget w, XtPointer *usd, XtPointer *calld)39 void button_action(Widget , XtPointer *usd, XtPointer *) 40 40 { 41 41 PIButtonX *pib; 42 42 pib = (PIButtonX *) usd ; 43 pib->Send(pib->Msg() );43 pib->Send(pib->Msg(),PIMsg_Click,NULL); 44 44 return; 45 45 } 46 46 47 47 /* Nouvelle-Fonction */ 48 void button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld)48 void button_press(Widget, XtPointer *usd, XmAnyCallbackStruct *calld) 49 49 { 50 50 PIButtonX *pib; 51 51 pib = (PIButtonX *) usd ; 52 pib->Send(pib-> PressMsg());52 pib->Send(pib->Msg(),PIMsg_Press,NULL); 53 53 pib->myevt = *(calld->event); 54 54 pib->myevt.type = pib->myevt.xbutton.type = ButtonRelease; … … 60 60 61 61 /* --Methode-- */ 62 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, longmsg,62 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, PIMessage msg, 63 63 int sx, int sy, int px, int py, PIBtnSign bsgn) 64 64 : PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn) … … 96 96 XtAddCallback(XtWdg(), XmNactivateCallback, 97 97 button_action, (XtPointer)this); 98 99 mAcP = false; 98 100 SetBorderWidth(0); 99 101 Manage(); … … 105 107 106 108 /* --Methode-- */ 107 void PIButtonX:: SetPressMsg(long prmsg)108 { 109 if ( PressMsg() == prmsg) return;109 void PIButtonX::ActivatePress(bool acp) 110 { 111 if (mAcP == acp) return; 110 112 111 if ( (PressMsg() != 0) && (prmsg == 0) )113 if (mAcP) 112 114 XtRemoveCallback(XtWdg(), XmNarmCallback, 113 115 button_press, (XtPointer)this); 114 else if (PressMsg() == 0)116 else 115 117 XtAddCallback(XtWdg(), XmNarmCallback, 116 118 button_press, (XtPointer)this); 117 118 PIButtonGen::SetPressMsg(prmsg); 119 119 mAcP = acp; 120 120 return; 121 121 } … … 138 138 { 139 139 CreateXtWdg(nom, xmTextWidgetClass, NULL, sx, sy, px, py); 140 SetMutiLineMode(false); 141 SetTextEditable(true); 140 142 Manage(); 141 143 } … … 162 164 } 163 165 166 /* --Methode-- */ 167 void PITextX::SetMutiLineMode(bool mlm) 168 { 169 Arg warg[2]; 170 int n = 0; 171 172 if (mlm) 173 { XtSetArg(warg[n],XmNeditMode, XmMULTI_LINE_EDIT); n++; } 174 else 175 { XtSetArg(warg[n],XmNeditMode, XmSINGLE_LINE_EDIT); n++; } 176 177 XtSetValues(XtWdg(), warg, n); 178 return; 179 } 180 181 /* --Methode-- */ 182 void PITextX::SetTextEditable(bool te) 183 { 184 Arg warg[2]; 185 int n = 0; 186 187 if (te) 188 { XtSetArg(warg[n],XmNeditable, TRUE); n++; } 189 else 190 { XtSetArg(warg[n],XmNeditable, FALSE); n++; } 191 192 XtSetValues(XtWdg(), warg, n); 193 return; 194 } 195 196 // Fonction privee (CallBack) 197 static void text_action(Widget w, XtPointer *usd, XtPointer *calld); 198 199 void text_action(Widget, XtPointer *usd, XtPointer *) 200 { 201 PIText *pit; 202 203 pit = (PIText *) usd ; 204 pit->Send(pit->Msg(), PIMsg_DataChanged, NULL); 205 } 206 207 208 /* --Methode-- */ 209 void PITextX::SetMsg(PIMessage msg) 210 { 211 212 if (Msg() && !msg) 213 XtRemoveCallback(XtWdg(), XmNactivateCallback, 214 text_action, (XtPointer)this); 215 if (!Msg() && msg) 216 XtAddCallback(XtWdg(), XmNactivateCallback, 217 text_action, (XtPointer)this); 218 219 PIWdg::SetMsg(msg); 220 } 221 164 222 165 223 /************* PIScaleX ************/ … … 167 225 168 226 // Fonction prive (CallBack) 169 static void scale_action(Widget w, XtPointer *usd, XtPointer *calld); 170 171 void scale_action(Widget w, XtPointer *usd, XtPointer *calld) 227 static void scale_action(Widget w, XtPointer *usd, 228 XmScaleCallbackStruct *calld); 229 230 void scale_action(Widget, XtPointer *usd, 231 XmScaleCallbackStruct *calld) 172 232 { 173 233 PIScale *pis; 174 234 175 235 pis = (PIScale *) usd ; 176 pis-> Send(pis->Msg(), (void *)pis->GetValue());177 178 return; 179 } 180 181 /* --Methode-- */ 182 PIScaleX::PIScaleX(PIContainerGen *par, char *nom, longmsg,236 pis->CBSetVal(calld->value); 237 pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)calld->value); 238 return; 239 } 240 241 /* --Methode-- */ 242 PIScaleX::PIScaleX(PIContainerGen *par, char *nom, PIMessage msg, 183 243 int min, int max, int sx, int sy, int px, int py) 184 244 : PIScaleGen(par, nom, msg, min, max, sx, sy, px, py) … … 188 248 CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py); 189 249 XtSetArg(warg[n], XmNshowValue, TRUE); n++; 190 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 250 if (sx > sy) 251 { 252 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 253 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; 254 } 255 else 256 { 257 XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++; 258 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++; 259 } 191 260 XtSetArg(warg[n], XmNscaleWidth, sx); n++; 192 261 XtSetArg(warg[n], XmNscaleHeight, sy); n++; 193 262 XtSetArg(warg[n], XmNstringDirection, XmSTRING_DIRECTION_R_TO_L); n++; 194 XtSetArg(warg[n], XmRProcessingDirection, XmMAX_ON_RIGHT); n++; 263 195 264 XtSetValues(XtWdg(), warg, n); 196 265 SetMinMax(min, max); 266 SetValue(min); 197 267 XtAddCallback(XtWdg(), XmNvalueChangedCallback, 198 268 scale_action, (XtPointer)this); … … 207 277 void PIScaleX::SetMinMax(int min, int max) 208 278 { 279 if (min >= max) max = min+10; 280 if (mVal < min) mVal = min; 281 if (mVal > max) mVal = max; 209 282 int n=0; 210 Arg warg[ 2];283 Arg warg[3]; 211 284 XtSetArg(warg[n], XmNminimum, min); n++; 212 285 XtSetArg(warg[n], XmNmaximum, max); n++; 213 XtSetValues(XtWdg(), warg, n); 286 XtSetArg(warg[n], XmNvalue, mVal); n++; 287 XtSetValues(XtWdg(), warg, n); 288 mMin = min; mMax = max; 214 289 return; 215 290 } … … 220 295 { 221 296 int n=0; 297 if (val < mMin) val = mMin; 298 if (val > mMax) val = mMax; 222 299 Arg warg[2]; 223 300 XtSetArg(warg[n], XmNvalue, val); n++; … … 234 311 XtSetArg(warg[n], XmNvalue, &val); n++; 235 312 XtGetValues(this->sdw, warg, n); 313 mVal = val; 236 314 return(val); 237 315 } 238 316 317 /* --Methode-- */ 318 void PIScaleX::CBSetVal(int val) 319 { 320 mVal = val; 321 return; 322 } 239 323 240 324 /************* PICheckBoxX ************/ … … 245 329 246 330 /* Nouvelle-Fonction */ 247 void toggb_action(Widget w, XtPointer *usd, XtPointer *calld)331 void toggb_action(Widget , XtPointer *usd, XtPointer *) 248 332 { 249 333 PICheckBoxX *picb; 250 334 picb = (PICheckBoxX *) usd ; 251 picb->Send(picb->Msg(), (void *)picb->GetState());252 return; 253 } 254 255 /* --Methode-- */ 256 PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, longmsg,335 picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState()); 336 return; 337 } 338 339 /* --Methode-- */ 340 PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, PIMessage msg, 257 341 int sx, int sy, int px, int py) 258 342 : PICheckBoxGen(par, nom, msg, sx, sy, px, py) -
trunk/SophyaPI/PI/pistdwdgx.h
r8 r23 17 17 { 18 18 public: 19 PIButtonX(PIContainerGen *par, char *nom, long msg = PIMsg_Click, 19 PIButtonX(PIContainerGen *par, char *nom, 20 PIMessage msg = PIMsg_Click, 20 21 int sx=10, int sy=10, int px=0, int py=0, 21 22 PIBtnSign bsgn = PIBtn_Label); 22 23 virtual ~PIButtonX(); 23 24 24 virtual void SetPressMsg(long prmsg);25 virtual void ActivatePress(bool acp=false); 25 26 26 27 void ReleaseButton(); // Fonction a utiliser avec attention 27 28 28 29 XEvent myevt; // Attention - Pour usage interne 30 31 protected : 32 bool mAcP; 29 33 }; 34 30 35 31 36 class PITextX : public PITextGen … … 37 42 virtual void SetText(string const&); 38 43 virtual string GetText() const; 44 45 virtual void SetMutiLineMode(bool mlm=false); 46 virtual void SetTextEditable(bool te=true); 47 48 virtual void SetMsg(PIMessage msg=0); 39 49 }; 40 50 … … 42 52 { 43 53 public: 44 PIScaleX(PIContainerGen* par, char* nom, longmsg=PIMsg_Click,54 PIScaleX(PIContainerGen* par, char* nom, PIMessage msg=PIMsg_Click, 45 55 int min=0, int max=10, int sx=100, int sy=10, int px=0, int py=0); 46 56 ~PIScaleX(); … … 48 58 virtual void SetMinMax(int min, int max); 49 59 virtual void SetValue(int val); 50 virtual int GetValue();60 virtual int GetValue(); 51 61 62 virtual void CBSetVal(int val); // A ne pas utiliser pour Callback 52 63 protected: 64 int mVal, mMin, mMax; 53 65 }; 54 66 … … 58 70 public: 59 71 PICheckBoxX(PIContainerGen *par, char *nom, 60 longmsg=PIMsg_Click,72 PIMessage msg=PIMsg_Click, 61 73 int sx=10, int sy=10, int px=0, int py=0); 62 74 virtual ~PICheckBoxX(); -
trunk/SophyaPI/PI/pitestapp.cc
r18 r23 20 20 #include "piimage.h" 21 21 22 RzImage * RzReadFits(char *flnm); 22 #include "fitsimage.h" 23 23 24 24 int SysBeep(int n) … … 48 48 ~PITestApp(); 49 49 50 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);50 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 51 51 52 52 // PIMenubar * menb; … … 116 116 ckb = new PICheckBox(this->MainWin(), "CheckBox", 166, 60, 20, 10, 10); 117 117 text = new PIText(this->MainWin(), "TEXTE", 100, 30, 20,40); 118 text->SetMsg(7440); 118 119 label = new PILabel(this->MainWin(), "Label", 140, 20, 20,80); 119 120 label->SetBorderWidth(1); … … 186 187 static PIWindow *imgw[5]; 187 188 static PIImage *cur=NULL; 188 static ScSample *scs1, *scs2; 189 static ScSample *scs1, *scs2, *scs3; 190 static ExBWdg *exb1; 189 191 190 192 static PIWindow * wp3, *wp2, *wp4, *wp5; … … 197 199 198 200 void 199 PITestApp::Process( longmsg, PIMsgHandler* sender, void* data)201 PITestApp::Process(PIMessage msg, PIMsgHandler* sender, void* data) 200 202 { 201 203 static int x = 0; … … 203 205 204 206 // SysBeep(1); 205 char truc[ 100];207 char truc[256]; 206 208 sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind()); 207 209 this->label->SetLabel(truc); 208 209 if (msg == PIMsg_ActiveWdg) 210 { /* printf("Process: Setting active ImageWindow (%lx) \n", (long)data); */ 211 cur = (PIImage *)data; } 212 210 sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)",x, msg, (int)UserMsg(msg), 211 (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind()); 212 puts(truc); 213 214 if (ModMsg(msg) == PIMsg_Active) 215 { printf("Process: Setting active ImageWindow (%lx) \n", (long)sender); 216 cur = (PIImage *)data; return;} 217 218 if (ModMsg(msg) == PIMsg_Close) 219 { 220 printf("Close Message received (Sender= %lx)\n", (long)sender); 221 return; 222 } 223 224 msg = UserMsg(msg); 213 225 if (msg == 33) ckb->SetState(true); 214 226 … … 278 290 PIWK_normal, 400, 400, 500, 500); 279 291 pimg[nimg] = new PIImage(imgw[nimg], "MyImage", 400, 400, 0, 0); 280 pimg[nimg]->SetBinding( true, true, true, true);292 pimg[nimg]->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed ); 281 293 pimg[nimg]->SetZoomWin(zoom); 282 294 pimg[nimg]->SetTextWin(labimg); … … 301 313 wp2 = new PIWindow(app, "Window-2", PIWK_normal, 150, 150, 250, 250); 302 314 ExBWdg bw(wp2, "BWdg", 150, 150, 0, 0); 303 // bw.SetBinding(false, true, true, false);304 315 // bw.ActivateButton(1); 305 316 // bw.ActivatePtrCross(); 306 317 // bw.ActivateKeyboard(); 307 318 308 wp4 = new PIWindow(app, "Window-4", PIWK_dialog, 120, 120, 350, 350); 309 PIButton bt1(wp4, "OK", 6001, 40, 20, 10, 80); 310 PIButton bt2(wp4, "Cancel", 6002, 40, 20, 60, 80); 311 PILabel lb1(wp4, "Mat_00", 30, 20, 10, 10); 312 PIText tx1(wp4, "A00", 50, 20, 50, 10); 313 PILabel lb2(wp4, "Mat_11", 30, 20, 10, 40); 314 PIText tx2(wp4, "A11", 50, 20, 50, 40); 319 320 wp4 = new PIWindow(app, "Window-4", PIWK_dialog, 200, 200, 350, 350); 321 PIButton bt1(wp4, "OK", 6001, 60, 30, 20, 160); 322 PIButton bt2(wp4, "Cancel", 6002, 60, 30, 100, 160); 323 bt1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 324 bt2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 325 PILabel lb1(wp4, "Editable", 40, 30, 10, 10); 326 lb1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 327 PIText tx1(wp4, "A00", 100, 30, 60, 10); 328 tx1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 329 tx1.SetText("Hello"); 330 tx1.SetTextEditable(false); 331 // PILabel lb2(wp4, "", 30, 20, 10, 40); 332 PIText tx2(wp4, "A11", 180, 100, 15, 50); 333 tx2.SetMutiLineMode(true); 334 tx2.SetText(" Bonjour, \n Comment ca va ? \n A demain. "); 335 tx2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 315 336 316 337 wp3 = new PIWindow(app, "Window-3", PIWK_normal, 200, 200, 350, 350); 317 338 pxm = new PIPixmap(wp3, "myPixmap", 150, 150, 10, 10); 318 pxm->SetBinding( true, true, true, true);339 pxm->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed ); 319 340 pxm->SetPixmap(pixels, 150, 150); 320 341 321 wp5 = new PIWindow(app, "Window-5", PIWK_normal, 400, 200, 200, 200);342 wp5 = new PIWindow(app, "Window-5", PIWK_normal, 400, 450, 200, 200); 322 343 scs1 = new ScSample(wp5, "ScSample", 200, 200, 0, 0); 323 scs1->SetBinding(true, true, true, true); 324 scs2 = new ScSample(wp5, "ScSample", 200, 200, 200, 0); 325 scs2->SetBinding(true, true, true, true); 326 344 scs1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 345 scs2 = new ScSample(wp5, "ScSample", 160, 160, 220, 20); 346 scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic); 347 348 scs3 = new ScSample(wp5, "ScSample", 200, 200, 100, 220); 349 350 scs3->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 351 /* 352 exb1 = new ExBWdg(wp5, "ExB1", 200, 200, 100, 220); 353 exb1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 354 */ 327 355 // wp4 = new PIWindow(app, "Open...", PIWK_dialog, 300, 300, 400, 400); 328 356 -
trunk/SophyaPI/PI/piwdggen.cc
r18 r23 23 23 } 24 24 25 /* --Methode-- */ 26 void PIWdgGen::SetMsg(PIMessage msg) 27 { 28 myMsg = msg; 29 } 30 31 /* --Methode-- */ 32 void PIWdgGen::GetScreenPos(int & spx, int & spy) 33 /* Renvoie la position de la fenetre par rapport a l'ecran */ 34 { 35 PIWdgGen * wc; 36 spx = 0; spy = 0; 37 wc = this; 38 39 while (wc) 40 { spx += wc->XPos(); 41 spy += wc->YPos(); wc = wc->Parent(); 42 } 43 return; 44 } 45 25 46 26 47 /* --Methode-- -
trunk/SophyaPI/PI/piwdggen.h
r11 r23 12 12 void PIBeep(); 13 13 14 // Les differents types d'accrochage aux containers 15 16 enum PIBindingKind { 17 PIBK_free = 0, 18 PIBK_fixed = 1, 19 PIBK_elastic = 2 20 }; 21 14 22 class PIContainerGen; 15 23 class PIWdgGen : public PIMsgHandler … … 24 32 25 33 virtual long kind() {return ClassId; } 34 // string kindstr(); 26 35 27 // string kindstr(); 36 inline PIWdgGen* Parent() { return( (PIWdgGen*)parent ); } 28 37 29 38 inline void SetUserData( void * p, int fg = 0) {pdata=p; flag=fg; } … … 32 41 inline int UserFlag() { return(flag); }; 33 42 34 inline void SetMsg(long msg = 0) { myMsg = msg; } 35 inline long Msg() { return(myMsg); } 43 44 virtual void SetMsg(PIMessage msg = 0); 45 inline PIMessage Msg() { return (myMsg); } 36 46 37 47 virtual void SetSize(int sx, int sy)=0; … … 39 49 virtual void SetBorderWidth(int bw)=0; 40 50 virtual void SetLabel(string const&) {} 41 virtual void SetBinding(bool left, bool top, bool right, bool bottom)=0; 51 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 52 PIBindingKind right, PIBindingKind bottom)=0; 42 53 43 54 virtual int XSize()=0; … … 47 58 48 59 virtual string Nom()=0; 60 virtual void GetScreenPos(int & spx, int & spy); 49 61 50 62 protected: 51 63 PIContainerGen *parent; 52 longmyMsg;64 PIMessage myMsg; 53 65 54 66 private: -
trunk/SophyaPI/PI/piwdgmac.cc
r15 r23 81 81 82 82 void 83 PIWdgMac::SetBinding(bool left, bool top, bool right, bool bottom) 83 PIWdgMac::SetBinding(PIBindingKind left, PIBindingKind top, 84 PIBindingKind right, PIBindingKind bottom) 85 // $CHECK$ Reza 13/10/96 Code a modifier 84 86 { 85 87 SBooleanRect r; -
trunk/SophyaPI/PI/piwdgmac.h
r15 r23 20 20 virtual void SetPos(int px, int py); 21 21 virtual void SetBorderWidth(int /*bw*/) {} 22 virtual void SetBinding(bool left, bool top, bool right, bool bottom); 22 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 23 PIBindingKind right, PIBindingKind bottom); 23 24 virtual int XSize(); 24 25 virtual int YSize(); -
trunk/SophyaPI/PI/piwdgx.cc
r8 r23 117 117 #endif 118 118 119 SetBinding( false, false, false, false);119 SetBinding(PIBK_free, PIBK_free, PIBK_free, PIBK_free); 120 120 return(0); 121 121 } … … 210 210 211 211 /* --Methode-- */ 212 void PIWdgX::SetBinding(bool left, bool top, bool right, bool bottom) 212 void PIWdgX::SetBinding(PIBindingKind left, PIBindingKind top, 213 PIBindingKind right, PIBindingKind bottom) 213 214 { 214 215 Arg wargs[3]; … … 217 218 if (!parent) return; 218 219 219 if (left) 220 { 221 n = 0; 222 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM); n++; 223 XtSetArg(wargs[n],XmNleftOffset, XPos() ); n++; 224 XtSetValues(this->sdw, wargs, n); 225 } 226 else 227 { 228 n = 0; 229 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE); n++; 230 XtSetValues(this->sdw, wargs, n); 231 } 232 233 if (top) 234 { 235 n = 0; 236 XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM); n++; 237 XtSetArg(wargs[n],XmNtopOffset, YPos() ); n++; 238 XtSetValues(this->sdw, wargs, n); 239 } 240 else 241 { 242 n = 0; 243 XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE); n++; 244 XtSetValues(this->sdw, wargs, n); 220 /* 221 n = 0; 222 XtSetArg(wargs[n],XmNfractionBase, 500); n++; 223 XtSetValues(this->sdw, wargs, n); 224 */ 225 switch (left) 226 { 227 case PIBK_free : 228 n = 0; 229 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE); n++; 230 XtSetValues(this->sdw, wargs, n); 231 break; 232 case PIBK_fixed : 233 n = 0; 234 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM); n++; 235 XtSetArg(wargs[n],XmNleftOffset, XPos() ); n++; 236 XtSetValues(this->sdw, wargs, n); 237 break; 238 case PIBK_elastic : 239 n = 0; 240 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_POSITION); n++; 241 XtSetArg(wargs[n],XmNleftPosition, (XPos()*100/parent->XSize()) ); n++; 242 XtSetValues(this->sdw, wargs, n); 243 break; 244 } 245 246 switch (top) 247 { 248 case PIBK_free : 249 n = 0; 250 XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE); n++; 251 XtSetValues(this->sdw, wargs, n); 252 break; 253 case PIBK_fixed : 254 n = 0; 255 XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM); n++; 256 XtSetArg(wargs[n],XmNtopOffset, YPos() ); n++; 257 XtSetValues(this->sdw, wargs, n); 258 break; 259 case PIBK_elastic : 260 n = 0; 261 XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_POSITION); n++; 262 XtSetArg(wargs[n],XmNtopPosition, (YPos()*100/parent->YSize()) ); n++; 263 XtSetValues(this->sdw, wargs, n); 264 break; 245 265 } 246 266 247 if(right)248 { 249 n = 0;250 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM); n++;251 XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos())); n++;252 XtSetValues(this->sdw, wargs, n);253 }254 else 255 {256 n = 0;257 XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE); n++;258 XtSetValues(this->sdw, wargs, n);259 }260 261 if (right) 262 {263 n = 0;264 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM); n++;265 XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) ); n++;266 XtSetValues(this->sdw, wargs, n);267 } 268 else269 { 270 n = 0;271 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE); n++;272 XtSetValues(this->sdw, wargs, n);273 }274 275 if (bottom) 276 {277 n = 0;278 XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM); n++;279 XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) ); n++;280 XtSetValues(this->sdw, wargs, n);281 }282 else 283 {284 n = 0;285 XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE); n++;286 XtSetValues(this->sdw, wargs, n);287 } 267 switch (right) 268 { 269 case PIBK_free : 270 n = 0; 271 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE); n++; 272 XtSetValues(this->sdw, wargs, n); 273 break; 274 case PIBK_fixed : 275 n = 0; 276 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM); n++; 277 XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) ); n++; 278 XtSetValues(this->sdw, wargs, n); 279 break; 280 case PIBK_elastic : 281 n = 0; 282 XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_POSITION); n++; 283 XtSetArg(wargs[n],XmNrightPosition, ((XPos()+XSize())*100/parent->XSize()) ); n++; 284 XtSetValues(this->sdw, wargs, n); 285 break; 286 } 287 288 switch (bottom) 289 { 290 case PIBK_free : 291 n = 0; 292 XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE); n++; 293 XtSetValues(this->sdw, wargs, n); 294 break; 295 case PIBK_fixed : 296 n = 0; 297 XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM); n++; 298 XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) ); n++; 299 XtSetValues(this->sdw, wargs, n); 300 break; 301 case PIBK_elastic : 302 n = 0; 303 XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_POSITION); n++; 304 XtSetArg(wargs[n],XmNbottomPosition, ((YPos()+YSize())*100/parent->YSize()) ); n++; 305 XtSetValues(this->sdw, wargs, n); 306 break; 307 } 288 308 289 309 return; … … 359 379 return(bw); 360 380 } 381 382 /* --Methode-- */ 383 void PIWdgX::GetScreenPos(int & spx, int & spy) 384 { 385 PIWdgX * wc; 386 Display *mdsp; 387 Window w, rw, pw, *cw; 388 unsigned int ncw; 389 Status st; 390 int x,y; 391 unsigned int bw, l, h, d; 392 393 spx = 0; spy = 0; 394 wc = this; 395 396 while (wc) 397 { spx += wc->XPos(); 398 spy += wc->YPos(); wc = (PIWdgX *)wc->Parent(); 399 } 400 401 mdsp = XtDisplay(XtWdg()); 402 w = XtWindow(XtWdg()); 403 ncw = 0; 404 st = XQueryTree(mdsp, w, &rw, &pw, &cw, &ncw); 405 if (st) 406 { XFree(cw); 407 if (pw == rw) return; } 408 409 while (st && (pw != rw)) 410 { 411 w = pw; 412 st = XQueryTree(mdsp, w, &rw, &pw, &cw, &ncw); 413 if (st) XFree(cw); 414 XGetGeometry(mdsp, w, &rw, &x, &y, &l, &h, &bw, &d); 415 spy += y; spx += x; 416 } 417 return; 418 } 419 361 420 362 421 -
trunk/SophyaPI/PI/piwdgx.h
r7 r23 41 41 virtual void SetBorderWidth(int bw); 42 42 virtual void SetLabel(string const & lab); 43 virtual void SetBinding(bool left, bool top, bool right, bool bottom); 43 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 44 PIBindingKind right, PIBindingKind bottom); 44 45 45 46 virtual int XSize(); … … 50 51 51 52 virtual string Nom() { return mNom; } 53 virtual void GetScreenPos(int & spx, int & spy); 52 54 53 55 void Manage(); -
trunk/SophyaPI/PI/piwindowgen.cc
r18 r23 17 17 18 18 /* --Methode-- */ 19 void PIWindowGen::Process( longmsg, PIMsgHandler* sender, void* data)20 /* On intercepte le message Active Wdg, avant de le renvoyer,*/21 /* avec un message ActiveWdg de la part de la fenetre */19 void PIWindowGen::Process(PIMessage msg, PIMsgHandler* sender, void* data) 20 /* On intercepte le message Active, et Close avant de les renvoyer */ 21 /* avec un message ActiveWdg de la part de la fenetre */ 22 22 { 23 if (msg == PIMsg_ActiveWdg) 24 Send(msg); 23 24 if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this)) 25 Hide(); // Action par defaut en cas de MsgClose. 26 27 if (ModMsg(msg) == PIMsg_Active) 28 Send(Msg(),PIMsg_Active); 29 25 30 ReSend(msg, sender, data); 26 31 return; -
trunk/SophyaPI/PI/piwindowgen.h
r18 r23 9 9 PIWK_normal = 0, 10 10 PIWK_dialog = 1, 11 PIWK_floating = 2 11 PIWK_transient = 2, 12 PIWK_floating = 3 12 13 }; 13 14 … … 21 22 virtual long kind() {return ClassId; } 22 23 23 virtual void Process( longmsg, PIMsgHandler* sender, void* data=NULL);24 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 24 25 25 26 protected: -
trunk/SophyaPI/PI/piwindowx.cc
r8 r23 2 2 3 3 #include "piwindowx.h" 4 5 #include <X11/Xlib.h> 4 6 5 7 #include <X11/Intrinsic.h> … … 8 10 #include <X11/Shell.h> 9 11 #include <Xm/Form.h> 10 // #include <Xm/BulletinB.h> 12 13 /* Fonctions (Callback et action) pour traiter le message Close de WM */ 14 15 /* Nouvelle-Fonction */ 16 static void popdwn_cb(Widget /*w*/, XtPointer *usd, XtPointer * ) 17 { 18 PIWindowX * dw = (PIWindowX *) usd; 19 dw->Process(dw->BuildMsg(dw->Msg(),PIMsg_Close), dw, NULL) ; 20 } 21 22 23 /* Nouvelle-Fonction */ 24 static int fgactl = 0; 25 26 static void CloseWindow (Widget w, XEvent*, String*,Cardinal*) 27 { 28 XtCallCallbacks(w, XtNpopdownCallback, NULL); 29 } 30 31 11 32 12 33 /* --Methode-- */ … … 15 36 : PIWindowGen(par, nom, k, -1, -1, 0, 0) 16 37 { 38 XtTranslations trans; 39 17 40 pwm = new PIWdgX(NULL, nom, sx, sy, px, py); 18 41 19 if (k == PIWK_normal ) 20 pwm->CreateXtWdg(nom, topLevelShellWidgetClass, NULL, sx, sy, px, py); 21 else 22 pwm->CreateXtWdg(nom, transientShellWidgetClass, NULL, sx, sy, px, py); 23 // pwm->CreateXtWdg(nom, overrideShellWidgetClass, NULL, sx, sy, px, py); 42 switch (k) 43 { 44 case PIWK_normal : 45 case PIWK_floating : 46 pwm->CreateXtWdg(nom, topLevelShellWidgetClass, NULL, sx, sy, px, py); 47 break; 48 case PIWK_dialog : 49 pwm->CreateXtWdg(nom, transientShellWidgetClass, NULL, sx, sy, px, py); 50 break; 51 case PIWK_transient : 52 pwm->CreateXtWdg(nom, overrideShellWidgetClass, NULL, sx, sy, px, py); 53 break; 54 } 55 56 57 /* Il faut "attraper" l'action close, genere par le window-manager */ 58 /* 2 actions sont necessaires, installation d'une action (CloseWindow()) */ 59 /* et j'utilise ensuite un callback ds CloseWindow() */ 60 /* Il faut aussi desactiver l'action de destruction du widget par defaut */ 61 /* (XtSetArg(warg, XmNdeleteResponse, ... */ 62 /* Attention, voir la fonction Show(), pour l'appel a XSetWMProptocols() */ 63 /* Pour une fenetre donnee, on peut recuperer les Map, UnMap, Destroy, */ 64 /* etc... il faut appeler XtAddEventHandler( w, Mask, ...) */ 65 /* Mask = StructureNotifyMask | SubstructureNotifyMask */ 66 67 68 69 if ((k == PIWK_normal) || (k == PIWK_floating) || (k == PIWK_dialog)) 70 { 71 72 /* XtAddEventHandler(pwm->XtWdg(), StructureNotifyMask | SubstructureNotifyMask, 73 FALSE, wmaction_evthandler, this);*/ 74 75 XtAddCallback(pwm->XtWdg(), XtNpopdownCallback, 76 popdwn_cb, (XtPointer)this); 77 78 if (!fgactl) 79 { 80 XtActionsRec desact = {"CloseWindow" ,CloseWindow}; 81 XtAddActions(&desact, 1); fgactl = 1; 82 } 83 84 trans = XtParseTranslationTable("<Message>WM_PROTOCOLS:CloseWindow()"); 85 XtOverrideTranslations(pwm->XtWdg() , trans); 86 Arg warg[2]; 87 XtSetArg(warg[0], XmNdeleteResponse, XmDO_NOTHING); 88 XtSetValues(pwm->XtWdg(), warg, 1); 89 } 24 90 25 91 CreateXtWdg(nom, xmFormWidgetClass, pwm->XtWdg(), sx, sy, 0, 0); … … 31 97 delete pwm; 32 98 } 99 33 100 /* --Methode-- */ 34 void PIWindowX::SetBinding(bool left, bool top, bool right, bool bottom) 101 void PIWindowX::SetBinding(PIBindingKind /*left*/, PIBindingKind /*top*/, 102 PIBindingKind /*right*/, PIBindingKind /*bottom*/) 35 103 { 36 104 // On ne doit rien faire pour les fenetres … … 56 124 void PIWindowX::Show() 57 125 { 126 int fgr = 0; 127 Display *mdsp; 128 129 mdsp = XtDisplay(pwm->XtWdg()); 130 58 131 PIContainerGen::Show(); 59 132 Manage(); 133 if (!XtIsRealized(pwm->XtWdg())) fgr = 1; 60 134 pwm->Manage(); 135 if (fgr) 136 { 137 Atom wmd; 138 if ((mWtyp == PIWK_normal) || (mWtyp == PIWK_floating) || (mWtyp == PIWK_dialog)) 139 { 140 wmd = XInternAtom(mdsp, "WM_DELETE_WINDOW",False); 141 XSetWMProtocols(mdsp, XtWindow(pwm->XtWdg()), &wmd, 1); 142 } 143 else 144 XSetTransientForHint(mdsp, XtWindow(PIXtTopWdg()), XtWindow(pwm->XtWdg())); 145 } 146 147 // XRaiseWindow est necessaire, sinon la fenetre passe des fois derriere ... 148 if (mWtyp == PIWK_transient) 149 XRaiseWindow(mdsp, XtWindow(pwm->XtWdg())); 150 151 return; 61 152 } 62 153 -
trunk/SophyaPI/PI/piwindowx.h
r8 r23 12 12 virtual ~PIWindowX(); 13 13 14 virtual void SetBinding( bool left, bool top, bool right, bool bottom);15 14 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 15 PIBindingKind right, PIBindingKind bottom); 16 16 virtual void SetSize(int sx, int sy); 17 17 virtual void SetPos(int px, int py);
Note:
See TracChangeset
for help on using the changeset viewer.