Changeset 8 in Sophya
- Timestamp:
- Mar 1, 1996, 5:54:25 PM (30 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 13 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Makefile
r6 r8 77 77 #------------------------------------------------- End of Makefile.h ------- 78 78 79 all: $(LIB)libPI.a $(SLB)libPI.so $(EXE)pitest80 $(LIB)libPI.a : $(OBJ)ex_dessin.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pi filechogen.o $(OBJ)pifilechox.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwdgxt.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o79 all: $(LIB)libPI.a $(SLB)libPI.so 80 $(LIB)libPI.a : $(OBJ)ex_dessin.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwdgxt.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)sc_sample.o 81 81 ar -rs $@ $? 82 82 83 83 $(SLB)libPI.so : $(LIB)libPI.a 84 84 ld -S -shared -o $(SLB)libPI.so -all -L$(LIB) $(LIB)libPI.a 2>/dev/null 85 86 $(EXE)pitest : $(OBJ)pitestapp.o87 g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm88 89 85 $(OBJ)ex_dessin.o: ex_dessin.cc ex_dessin.h pisysdep.h pibwdgx.h pibwdggen.h \ 90 86 piwdgx.h piwdggen.h pimsghandler.h … … 107 103 $(OBJ)picontainerx.o: picontainerx.cc picontainerx.h pisysdep.h \ 108 104 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h 105 $(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h piwindowx.h \ 106 piwindowgen.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \ 107 pimsghandler.h piscdrawwdg.h pibwdgx.h pibwdggen.h 109 108 $(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \ 110 109 piwdggen.h pimsghandler.h … … 112 111 piwdgx.h piwdggen.h pimsghandler.h piwindowx.h piwindowgen.h \ 113 112 picontainerx.h picontainergen.h 113 $(OBJ)pihisto.o: pihisto.cc pihisto.h piscdrawwdg.h pisysdep.h pibwdgx.h \ 114 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \ 115 $(INC)histos.h $(INC)peida.h \ 116 $(INC)defs.h $(INC)utils.h \ 117 $(INC)machine.h \ 118 $(INC)perrors.h \ 119 $(INC)exceptions.h 114 120 $(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \ 115 121 $(INC)rzimage.h \ … … 133 139 piwdggen.h pimsghandler.h 134 140 $(OBJ)pimsghandler.o: pimsghandler.cc pimsghandler.h 135 $(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h piwdgx.h \ 136 piwdggen.h pimsghandler.h pimenux.h pimenugen.h 141 $(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h \ 142 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \ 143 pimenux.h pimenugen.h 137 144 $(OBJ)pioptmenux.o: pioptmenux.cc pisysdep.h pioptmenux.h pioptmenugen.h \ 138 pi wdgx.h piwdggen.h pimsghandler.h pimenux.h pimenugen.h \139 pi containerx.h picontainergen.h145 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \ 146 pimenux.h pimenugen.h pistdwdgx.h pistdwdggen.h 140 147 $(OBJ)pipixmapgen.o: pipixmapgen.cc pipixmapgen.h pisysdep.h pibwdgx.h \ 141 148 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \ … … 144 151 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \ 145 152 picmapx.h picmapgen.h 153 $(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \ 154 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \ 155 $(INC)generalfit.h \ 156 $(INC)exceptions.h \ 157 $(INC)defs.h $(INC)matrix.h \ 158 $(INC)peida.h $(INC)utils.h \ 159 $(INC)machine.h \ 160 $(INC)perrors.h \ 161 $(INC)ppersist.h \ 162 $(INC)pclassids.h \ 163 $(INC)cvector.h 146 164 $(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \ 147 165 piwdggen.h pimsghandler.h … … 160 178 $(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \ 161 179 piwdgx.h piwdggen.h pimsghandler.h pixtbase.h 180 $(OBJ)sc_sample.o: sc_sample.cc sc_sample.h pisysdep.h piscdrawwdg.h \ 181 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h 182 $(OBJ)pidemo.o: pidemo.cc pidemo.h pidemoup.h \ 183 $(INC)perrors.h \ 184 $(INC)exceptions.h \ 185 $(INC)defs.h \ 186 $(INC)fitsimage.h \ 187 $(INC)cimage.h \ 188 $(INC)rzimage.h \ 189 $(INC)rzvect.h \ 190 $(INC)machine.h \ 191 $(INC)datatypes.h \ 192 $(INC)fitsheader.h \ 193 $(INC)fitskeys.h pisysdep.h piapplx.h piapplgen.h \ 194 pimsghandler.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \ 195 pimenubarx.h pimenubargen.h pimenux.h pimenugen.h piwindowx.h \ 196 piwindowgen.h pioptmenux.h pioptmenugen.h pistdwdgx.h pistdwdggen.h \ 197 pifilechox.h pifilechogen.h piimage.h $(INC)lut.h \ 198 pipixmapx.h pipixmapgen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \ 199 picmapgen.h pihisto.h piscdrawwdg.h \ 200 $(INC)histos.h $(INC)peida.h \ 201 $(INC)utils.h pidrawwin.h 202 $(OBJ)pidemoup.o: pidemoup.cc pidemoup.h \ 203 $(INC)perrors.h \ 204 $(INC)exceptions.h \ 205 $(INC)defs.h \ 206 $(INC)fitsimage.h \ 207 $(INC)cimage.h \ 208 $(INC)rzimage.h \ 209 $(INC)rzvect.h \ 210 $(INC)machine.h \ 211 $(INC)datatypes.h \ 212 $(INC)fitsheader.h \ 213 $(INC)fitskeys.h \ 214 $(INC)utils.h $(INC)peida.h 215 piapp : $(EXE)piapp 216 217 $(EXE)piapp : $(OBJ)pidemo.o $(OBJ)pidemoup.o $(LIB)libPI.a 218 g++ -o $(EXE)piapp $(OBJ)pidemo.o $(OBJ)pidemoup.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm 162 219 163 220 $(OBJ)pitestapp.o: pitestapp.cc pisysdep.h piapplx.h piapplgen.h \ … … 166 223 piwindowgen.h pioptmenux.h pioptmenugen.h pistdwdgx.h pistdwdggen.h \ 167 224 pibwdgx.h pibwdggen.h pipixmapx.h pipixmapgen.h picmap.h picmapx.h \ 168 picmapgen.h pifilechox.h pifilechogen.h piimage.h ex_dessin.h 225 picmapgen.h pifilechox.h pifilechogen.h ex_dessin.h piimage.h \ 226 $(INC)cimage.h \ 227 $(INC)rzimage.h \ 228 $(INC)rzvect.h \ 229 $(INC)machine.h $(INC)defs.h \ 230 $(INC)exceptions.h \ 231 $(INC)perrors.h \ 232 $(INC)datatypes.h $(INC)lut.h 233 234 pitest : $(EXE)pitest 235 236 $(EXE)pitest : $(OBJ)pitestapp.o $(LIB)libPI.a 237 g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm -
trunk/SophyaPI/PI/pibwdggen.h
r6 r8 51 51 virtual void SelFont(PIFontSize sz=PI_NormalSizeFont, 52 52 PIFontAtt att=PI_RomanFont) = 0; 53 virtual void SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont) = 0; 53 54 virtual void SelLine(PILineAtt att=PI_NormalLine) = 0; 54 55 virtual void SelPointerShape(PIPointer ptr) = 0; -
trunk/SophyaPI/PI/pibwdgx.cc
r6 r8 15 15 16 16 /* Variables globales pour modifier les GC */ 17 static Font fnt[3][3]; 17 #define NMAXFONTSZ 5 18 static Font fnt[NMAXFONTSZ][3]; 19 static int fntsz[NMAXFONTSZ] = {9,10,12,14,16}; 20 static PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 18 21 #define NMAXCOL 10 19 22 static unsigned long colpix[NMAXCOL]; … … 146 149 void PIBaseWdgX::DrawBox(int x0, int y0, int dx, int dy) 147 150 { 151 if (dx < 0) { x0 += dx; dx = -dx; } 152 if (dy < 0) { y0 += dy; dy = -dy; } 148 153 XDrawRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 149 154 DefGC(), x0, y0, dx, dy); … … 154 159 void PIBaseWdgX::DrawFBox(int x0, int y0, int dx, int dy) 155 160 { 161 if (dx < 0) { x0 += dx; dx = -dx; } 162 if (dy < 0) { y0 += dy; dy = -dy; } 156 163 XFillRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 157 164 DefGC(), x0, y0, dx, dy); … … 190 197 XSetBackground(XtDisplay(XtWdg()), DefGC(), colpix[col]); 191 198 return; 199 } 200 201 /* --Methode-- */ 202 void PIBaseWdgX::SelFontSzPt(int npt, PIFontAtt att) 203 { 204 int dsz,i,isel, j; 205 206 isel = 0; 207 dsz = 9999; 208 for(i=0; i<NMAXFONTSZ; i++) 209 { 210 j = npt - fntsz[i]; if (j < 0) j = -j; 211 if (j < dsz) { isel = i; dsz = j; } 212 } 213 214 j = 0; 215 if (att & PI_RomanFont) j = 0; 216 if (att & PI_BoldFont) j = 1; 217 if (att & PI_ItalicFont) j = 2; 218 219 SelectFont(isel, j); 192 220 } 193 221 … … 202 230 break; 203 231 case PI_NormalSizeFont: 204 i = 1;232 i = 2; 205 233 break; 206 234 case PI_BigSizeFont: 207 i = 2;235 i = 4; 208 236 break; 209 237 default: 210 i= 0;238 i=2; 211 239 break; 212 240 } … … 217 245 if (att & PI_ItalicFont) j = 2; 218 246 219 XSetFont(XtDisplay(XtWdg()), DefGC(), fnt[i][j]); 247 SelectFont(i, j); 248 } 249 250 251 /* --Methode-- */ 252 void PIBaseWdgX::SelectFont(int isz, int jat) 253 { 254 mFAtt = fntatt[jat]; 255 mFSize = fntsz[isz]; 256 XSetFont(XtDisplay(XtWdg()), DefGC(), fnt[isz][jat]); 220 257 return; 221 258 } … … 402 439 char buff[200]; 403 440 int i,j; 404 int fsz[3]={10,12,14};405 441 406 442 if (fgbwdg) return; … … 417 453 418 454 /* Allocation des fonts */ 419 for (i=0; i< 3; i++)455 for (i=0; i<NMAXFONTSZ; i++) 420 456 { 421 sprintf(buff,"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-ISO8859-1", f sz[i]);457 sprintf(buff,"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]); 422 458 fnt[i][0] = XLoadFont(mdsp, buff); 423 459 if (fnt[i][0] == 0) printf("PIBaseWdgX::Init: Pb font %s \n", buff); 424 sprintf(buff,"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-ISO8859-1", f sz[i]);460 sprintf(buff,"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]); 425 461 fnt[i][1] = XLoadFont(mdsp, buff); 426 462 if (fnt[i][0] == 0) printf("PIBaseWdgX::Init: Pb font %s \n", buff); 427 sprintf(buff,"-*-helvetica-medium-o-normal-*-%d-*-*-*-*-*-ISO8859-1", f sz[i]);463 sprintf(buff,"-*-helvetica-medium-o-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]); 428 464 fnt[i][2] = XLoadFont(mdsp, buff); 429 465 if (fnt[i][0] == 0) printf("PIBaseWdgX::Init: Pb font %s \n", buff); 430 466 } 431 467 432 for(i=0; i< 3; i++)468 for(i=0; i<NMAXFONTSZ; i++) 433 469 for(j=0; j<3; j++) 434 if (fnt[i][ 0] == 0) XLoadFont(mdsp, "fixed");470 if (fnt[i][j] == 0) XLoadFont(mdsp, "fixed"); 435 471 436 472 -
trunk/SophyaPI/PI/pibwdgx.h
r2 r8 36 36 virtual void SelFont(PIFontSize sz=PI_NormalSizeFont, 37 37 PIFontAtt att=PI_RomanFont); 38 virtual void SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont); 38 39 virtual void SelLine(PILineAtt att=PI_NormalLine); 39 40 virtual void SelPointerShape(PIPointer ptr); … … 65 66 protected: 66 67 void Init(); 68 void SelectFont(int isz, int jat); 67 69 68 70 GC mDefGC; 71 PIFontAtt mFAtt; 72 int mFSize; 69 73 }; 70 74 -
trunk/SophyaPI/PI/pifilechox.h
r2 r8 34 34 typedef PIFileChooserX PIFileChooser ; 35 35 36 #define FILESEP '/' 37 38 36 39 #endif 37 40 -
trunk/SophyaPI/PI/piimage.cc
r7 r8 128 128 } 129 129 130 /* --Methode-- */ 131 void PIImage::SetOffset(int ox, int oy) 132 { 133 if (img == NULL) {offx = offy = 0; return; } 134 if (ox < 0) ox = 0; 135 if (ox >= (img->XSize()-1)) ox = img->XSize()-2; 136 if (oy < 0) oy = 0; 137 if (oy >= (img->YSize()-1)) oy = img->YSize()-2; 138 offx = ox; offy = oy; 139 return; 140 } 130 141 131 142 /* --Methode-- */ -
trunk/SophyaPI/PI/piimage.h
r6 r8 50 50 void SetZoom(int zm); 51 51 52 void SetOffset(int ox, int oy); 53 52 54 virtual void SetColMap(CMapId cmap); 53 55 -
trunk/SophyaPI/PI/pimenugen.h
r2 r8 25 25 26 26 virtual void Show()=0; 27 virtual void Show(PIWdg *w, int px, int py)=0; 27 28 virtual void Hide()=0; 28 29 -
trunk/SophyaPI/PI/pimenux.cc
r6 r8 24 24 pim = (PIMenuX *) (cusd->pmen); 25 25 26 // pim-> Unmanage();26 // pim->Hide(); 27 27 pim->Send(cusd->msg, (void *)pim->ItemNameWdg(cusd->itb).c_str()); 28 28 #ifdef DEBUG_PIMenuX 29 printf("%%%Debug_menub_action: Msg= %d \n", (int)cusd->msg);29 printf("%%%Debug_menub_action: Msg= %d %lx\n", (int)cusd->msg, (long)pim); 30 30 #endif 31 31 return; … … 144 144 145 145 /* --Methode-- */ 146 void PIMenuX::Show(PIWdg *w, int px, int py) 147 { 148 Manage(); 149 } 150 151 152 /* --Methode-- */ 146 153 void PIMenuX::Hide() 147 154 { 148 Unmanage();155 // Unmanage(); 149 156 } 150 157 … … 318 325 void PIPUMenuX::Show() 319 326 { 327 // XEvent mevt; 320 328 XButtonEvent evt; 321 329 330 // XPeekEvent(PIXDisplay(), &mevt); 331 // evt = mevt.xbutton; 322 332 evt.type = ButtonPress; 323 evt.serial = 55998877;324 evt.send_event = False;325 333 evt.display = PIXDisplay(); 326 334 evt.window = XtWindow(PIXtTopWdg()); 327 335 evt.root = DefaultRootWindow(evt.display); 336 evt.serial = 8866559909; 337 evt.send_event = False; 328 338 evt.same_screen = XQueryPointer(evt.display, evt.window, &(evt.root), 329 339 &(evt.subwindow), &(evt.x_root), &(evt.y_root), … … 340 350 341 351 /* --Methode-- */ 352 void PIPUMenuX::Show(PIWdg *w, int px, int py) 353 { 354 // This method should only be used by a button press ... 355 int xr, yr; 356 Window cw, sw, rw; 357 SysDWdg xtw; 358 Display *dsp; 359 XButtonEvent evt; 360 361 xtw = w->XtWdg(); 362 dsp = XtDisplay(xtw); 363 sw = XtWindow(xtw); 364 rw = DefaultRootWindow(dsp); 365 XTranslateCoordinates(dsp, sw, rw, px, py, &xr, &yr, &cw); 366 367 evt.type = ButtonPress; 368 evt.display = dsp; 369 evt.window = sw; 370 evt.root = rw; 371 evt.x_root = xr; 372 evt.y_root = yr; 373 evt.x = px; 374 evt.y = py; 375 evt.serial = 8866559909; 376 evt.send_event = False; 377 evt.same_screen = True; 378 XmMenuPosition(XtWdg(), &evt); 379 // SetPos(xr, yr); 380 Manage(); 381 return; 382 } 383 384 385 /* --Methode-- */ 342 386 PIPDMenuX::PIPDMenuX(PIMsgHandler* par, char* nom) 343 387 : PIMenuX(par, nom, k_PulldownMenu) -
trunk/SophyaPI/PI/pimenux.h
r6 r8 33 33 34 34 virtual void Show(); 35 virtual void Show(PIWdg *w, int px, int py); 35 36 virtual void Hide(); 36 37 … … 55 56 { 56 57 public: 57 PIPUMenuX(PIMsgHandler* par, char* nom);58 ~PIPUMenuX();58 PIPUMenuX(PIMsgHandler* par, char* nom); 59 ~PIPUMenuX(); 59 60 60 virtual void Show(); 61 virtual void Show(); 62 virtual void Show(PIWdg *w, int px, int py); 61 63 62 64 protected: … … 67 69 { 68 70 public: 69 PIPDMenuX(PIMsgHandler* par, char* nom);70 ~PIPDMenuX();71 PIPDMenuX(PIMsgHandler* par, char* nom); 72 ~PIPDMenuX(); 71 73 72 74 protected: -
trunk/SophyaPI/PI/pimsghandler.h
r6 r8 13 13 PIMsg_Help = 4, 14 14 PIMsg_DataChanged = 5, 15 PIMsg_Click = 6 15 PIMsg_Click = 6, 16 PIMsg_Press = 7 16 17 }; 17 18 -
trunk/SophyaPI/PI/pioptmenugen.cc
r2 r8 2 2 3 3 4 PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIP DMenu *pdm,4 PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm, 5 5 int sx, int sy, int px, int py) 6 : PI Wdg(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !6 : PIContainer(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const ! 7 7 { 8 8 } -
trunk/SophyaPI/PI/pioptmenugen.h
r6 r8 4 4 #include <string> 5 5 #include "pisysdep.h" 6 #include PI WDG_H6 #include PICONT_H 7 7 #include PIMENU_H 8 8 9 class PIOptMenuGen : public PI Wdg{9 class PIOptMenuGen : public PIContainer { 10 10 public: 11 11 enum {ClassId = 1100}; 12 12 13 PIOptMenuGen(PIContainerGen* par, PIP DMenu *pdm,13 PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm, 14 14 int sx=10, int sy=10, int px=0, int py=0); 15 15 ~PIOptMenuGen(); -
trunk/SophyaPI/PI/pioptmenux.cc
r7 r8 4 4 #include "pioptmenux.h" 5 5 #include PICONT_H 6 #include PISTDWDG_H 6 7 7 8 #include <Xm/Xm.h> … … 12 13 13 14 /* --Methode-- */ 14 PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIP DMenu *pdm,15 PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPUMenu *pum, 15 16 int sx, int sy, int px, int py) 16 : PIOptMenuGen(par, p dm, sx, sy, px, py)17 : PIOptMenuGen(par, pum, sx-2, sy-2, px, py) 17 18 { 18 SysDWdg cb; 19 20 XmString xmstr; 21 xmstr = XmStringLtoRCreate(pdm->Nom().c_str(), XmSTRING_DEFAULT_CHARSET); 22 23 Arg warg[7]; 24 int n = 0; 25 XtSetArg(warg[n], XmNsubMenuId, pdm->XtWdg()); n++; 26 XtSetArg(warg[n],XmNlabelString, xmstr); n++; 27 XtSetArg(warg[n],XmNresizeWidth, FALSE); n++; 28 XtSetArg(warg[n],XmNresizeHeight, FALSE); n++; 29 if ((sx > 0) && (sy > 0)) 30 { 31 XtSetArg(warg[n],XtNwidth,sx); n++; 32 XtSetArg(warg[n],XtNheight,sy); n++; 33 } 34 35 XtWdg() = XmCreateOptionMenu( par->XtWdg(), pdm->Nom().c_str(), warg, n); 36 wmis == k_wmi_normal ; 37 stmng = 0; 38 mMen = pdm; 39 40 cb = XmOptionButtonGadget (XtWdg()); 41 XtSetArg(warg[0],XmNhighlightThickness, 0); 42 XtSetValues(cb, warg, 1); 43 if ((sx > 0) && (sy > 0)) 44 { 45 cb = XmOptionLabelGadget (XtWdg()); 46 XtSetArg(warg[0],XtNwidth,sx/2); n++; 47 XtSetArg(warg[1],XtNheight,sy); n++; 48 XtSetValues(cb, warg, 2); 49 } 50 51 SetPos(px,py); 52 SetSize(sx, sy); 53 SetBinding(false, false, false, false); 54 55 mMen->SetMsgParent(this); 19 sx -= 2; 20 sy -= 2; 21 SetBorderWidth(1); 22 // SetBinding(true, true, true, true); 23 mAB = new PIButton(this, "?", 0, sy-2, sy-2, 1, 1); 24 mAB->SetBinding(true, true, false, true); 25 mAB->SetPressMsg(PIMsg_Press); 26 mLab = new PILabel(this, "OptLabel", sx-sy-1, sy, sy+1, 0); 27 mLab->SetBinding(true, true, true, true); 28 mMen = pum; 29 SetValue(mMen->ItemMsg(0)); 56 30 Manage(); 57 31 } … … 61 35 PIOptMenuX::~PIOptMenuX() 62 36 { 37 delete mAB; 38 delete mLab; 63 39 } 64 40 … … 66 42 void PIOptMenuX::Process(long msg, PIMsgHandler* sender, void* data) 67 43 { 68 printf("PIOptMenuX::Process Msg= %d \n", (int)msg); 69 Select((char *)data, msg); 70 ReSend(msg, sender, data); 44 // printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender); 45 if ((sender == mAB) && (msg == PIMsg_Press)) 46 { mMen->SetMsgParent(this); mMen->Show(this, 0, YSize()); } 47 else if (sender == mMen) 48 { 49 mAB->ReleaseButton(); 50 SetValue(msg); 51 ReSend(msg, this, data); 52 } 53 return; 71 54 } 72 55 … … 84 67 mStext = s; 85 68 mSmsg = mMen->ItemMsg(n); 86 69 mLab->SetLabel(mStext); 87 70 return; 88 71 } … … 100 83 mStext = mMen->ItemName(n); 101 84 mSmsg = msg; 102 85 mLab->SetLabel(mStext); 103 86 return; 104 87 } -
trunk/SophyaPI/PI/pioptmenux.h
r6 r8 2 2 #define PIOPTMENX_H_SEEN 3 3 4 #include "pisysdep.h" 4 5 #include "pioptmenugen.h" 6 #include PISTDWDG_H 5 7 6 8 class PIOptMenuX : public PIOptMenuGen { 7 9 public: 8 PIOptMenuX(PIContainerGen* par, PIP DMenu *pdm,10 PIOptMenuX(PIContainerGen* par, PIPUMenu *pum, 9 11 int sx=10, int sy=10, int px=0, int py=0); 10 12 ~PIOptMenuX(); … … 18 20 19 21 20 inline void Select(char *txt, long msg) { mStext = txt; mSmsg = msg; }21 22 22 23 23 protected: 24 PIPDMenu *mMen; 24 PIButton *mAB; 25 PILabel *mLab; 26 PIPUMenu *mMen; 25 27 string mStext; 26 28 long mSmsg; -
trunk/SophyaPI/PI/pistdwdggen.cc
r2 r8 15 15 16 16 PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, long msg, 17 int sx, int sy, int px, int py )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 mSgn = bsgn; 21 23 } 22 24 … … 24 26 {} 25 27 26 28 void PIButtonGen::SetPressMsg(long prmsg) 29 { 30 mPressMsg = prmsg; 31 } 32 27 33 /************* PIScaleGen ************/ 28 34 -
trunk/SophyaPI/PI/pistdwdggen.h
r2 r8 17 17 }; 18 18 19 // Les differents types de boutons avec un signe dessus ... 20 enum PIBtnSign { PIBtn_Label=0, PIBtn_ArrowUp=1, PIBtn_ArrowDown=2, 21 PIBtn_ArrowLeft=3, PIBtn_ArrowRight=4 }; 22 19 23 class PIButtonGen : public PIWdg 20 24 { 21 25 public: 22 enum {ClassId = 10 02};26 enum {ClassId = 1010}; 23 27 24 28 PIButtonGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click, 25 int sx=10, int sy=10, int px=0, int py=0); 29 int sx=10, int sy=10, int px=0, int py=0, 30 PIBtnSign bsgn = PIBtn_Label); 26 31 virtual ~PIButtonGen(); 27 32 28 33 virtual long kind() {return ClassId; } 29 34 35 virtual void SetPressMsg(long prmsg); 36 inline long PressMsg() { return(mPressMsg); } 37 30 38 protected: 39 long mPressMsg; 40 PIBtnSign mSgn; 41 }; 31 42 32 };33 43 34 44 class PITextGen : public PIWdg … … 36 46 public: 37 47 38 enum {ClassId = 10 03};48 enum {ClassId = 1020}; 39 49 40 50 PITextGen(PIContainerGen* par, char* nom, … … 51 61 { 52 62 public: 53 enum {ClassId = 10 04};63 enum {ClassId = 1030}; 54 64 55 65 PIScaleGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click, … … 72 82 public: 73 83 74 enum {ClassId = 10 05};84 enum {ClassId = 1040}; 75 85 76 86 PICheckBoxGen(PIContainerGen* par, char* nom, -
trunk/SophyaPI/PI/pistdwdgx.cc
r2 r8 14 14 : PILabelGen(par, nom, sx, sy, px, py) 15 15 { 16 Arg warg[2]; 17 16 18 CreateXtWdg(nom, xmLabelWidgetClass, NULL, sx, sy, px, py); 17 19 SetBorderWidth(0); 20 XtSetArg(warg[0], XmNrecomputeSize, FALSE); 21 XtSetValues(XtWdg(), warg, 1); 18 22 Manage(); 19 23 } … … 26 30 /************* PIButtonX ************/ 27 31 #include <Xm/PushB.h> 28 29 // Fonction prive (CallBack) 32 #include <Xm/ArrowB.h> 33 34 // Fonctions privees (CallBack) 30 35 static void button_action(Widget w, XtPointer *usd, XtPointer *calld); 36 static void button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld); 31 37 32 38 /* Nouvelle-Fonction */ … … 39 45 } 40 46 41 /* --Methode-- */ 42 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, long msg, 43 int sx, int sy, int px, int py) 44 : PIButtonGen(par, nom, msg, sx, sy, px, py) 45 { 46 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py); 47 /* Nouvelle-Fonction */ 48 void button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld) 49 { 50 PIButtonX *pib; 51 pib = (PIButtonX *) usd ; 52 pib->Send(pib->PressMsg()); 53 pib->myevt = *(calld->event); 54 pib->myevt.type = pib->myevt.xbutton.type = ButtonRelease; 55 pib->myevt.xbutton.serial += 10; 56 57 return; 58 } 59 60 61 /* --Methode-- */ 62 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, long msg, 63 int sx, int sy, int px, int py, PIBtnSign bsgn) 64 : PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn) 65 { 66 67 Arg warg[3]; 68 int n = 0; 69 70 XtSetArg(warg[n],XmNhighlightThickness, 0); n++; 71 XtSetArg(warg[n], XmNrecomputeSize, FALSE); n++; 72 73 if (bsgn == PIBtn_Label) 74 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py); 75 else 76 { 77 CreateXtWdg(nom, xmArrowButtonWidgetClass, NULL, sx, sy, px, py); 78 switch (bsgn) 79 { 80 case PIBtn_ArrowUp : 81 XtSetArg(warg[n], XmNarrowDirection, XmARROW_UP); n++; 82 break; 83 case PIBtn_ArrowDown : 84 XtSetArg(warg[n], XmNarrowDirection, XmARROW_DOWN); n++; 85 break; 86 case PIBtn_ArrowLeft : 87 XtSetArg(warg[n], XmNarrowDirection, XmARROW_LEFT); n++; 88 break; 89 case PIBtn_ArrowRight : 90 XtSetArg(warg[n], XmNarrowDirection, XmARROW_RIGHT); n++; 91 break; 92 } 93 } 94 95 XtSetValues(XtWdg(), warg, n); 47 96 XtAddCallback(XtWdg(), XmNactivateCallback, 48 97 button_action, (XtPointer)this); 98 SetBorderWidth(0); 49 99 Manage(); 50 100 } … … 54 104 {} 55 105 106 /* --Methode-- */ 107 void PIButtonX::SetPressMsg(long prmsg) 108 { 109 if (PressMsg() == prmsg) return; 110 111 if ((PressMsg() != 0) && (prmsg == 0) ) 112 XtRemoveCallback(XtWdg(), XmNarmCallback, 113 button_press, (XtPointer)this); 114 else if (PressMsg() == 0) 115 XtAddCallback(XtWdg(), XmNarmCallback, 116 button_press, (XtPointer)this); 117 118 PIButtonGen::SetPressMsg(prmsg); 119 120 return; 121 } 122 123 /* --Methode-- */ 124 void PIButtonX::ReleaseButton() 125 { 126 XPutBackEvent(myevt.xbutton.display, &myevt); 127 return; 128 } 56 129 57 130 -
trunk/SophyaPI/PI/pistdwdgx.h
r2 r8 17 17 { 18 18 public: 19 PIButtonX(PIContainerGen *par, char *nom, long msg=PIMsg_Click, 20 int sx=10, int sy=10, int px=0, int py=0); 19 PIButtonX(PIContainerGen *par, char *nom, long msg = PIMsg_Click, 20 int sx=10, int sy=10, int px=0, int py=0, 21 PIBtnSign bsgn = PIBtn_Label); 21 22 virtual ~PIButtonX(); 22 23 24 virtual void SetPressMsg(long prmsg); 25 26 void ReleaseButton(); // Fonction a utiliser avec attention 27 28 XEvent myevt; // Attention - Pour usage interne 23 29 }; 24 30 -
trunk/SophyaPI/PI/pitestapp.cc
r6 r8 58 58 PIScale * scl; 59 59 PIPUMenu * menu; 60 PIP DMenu * pdm;61 PIOptMenu * opt, * opt2 ;60 PIPUMenu * pum[2]; 61 PIOptMenu * opt, * opt2, *opt3; 62 62 PIPixmap * zoom; 63 63 PILabel * labimg; … … 118 118 bouton = new PIButton(this->MainWin(), "OK", 66, 40, 25, 20, 120); 119 119 bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120); 120 bouton3 = new PIButton(this->MainWin(), "Test", 233, 40, 25, 140, 120);120 bouton3 = new PIButton(this->MainWin(), "Test", 233, 40, 25, 140, 120); 121 121 bouton4 = new PIButton(this->MainWin(), "Menu", 555, 40, 25, 200, 120); 122 122 scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150); … … 133 133 menu->AppendItem("Check-33", 4433); 134 134 135 pdm = new PIPDMenu((PIMsgHandler *)this, "myMenu"); 136 pdm->AppendItem("Linear", 5601); 137 pdm->AppendItem("Log.", 5602); 138 pdm->AppendItem("Sqrt", 5603); 139 pdm->AppendItem("Expon", 5604); 140 pdm->AppendItem("Polyn", 5605); 141 142 opt = new PIOptMenu(this->MainWin(), pdm, 80, 20, 110, 150); 135 pum[1] = new PIPUMenu((PIMsgHandler *)this,"Edit"); 136 pum[1]->AppendItem("Copier", 80201); 137 pum[1]->AppendItem("Coller", 80202); 138 pum[1]->AppendItem("Couper", 80203); 139 pum[1]->AppendItem("Undo", 80204); 140 pum[1]->AppendItem("Select-All", 80205); 141 142 pum[0] = new PIPUMenu((PIMsgHandler *)this, "myMenu"); 143 pum[0]->AppendItem("Linear", 5601); 144 pum[0]->AppendItem("Log.", 5602); 145 pum[0]->AppendItem("Sqrt", 5603); 146 pum[0]->AppendItem("Expon", 5604); 147 pum[0]->AppendItem("Polyn", 5605); 148 149 opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150); 143 150 opt->SetValueStr("Sqrt"); 144 opt2 = new PIOptMenu(this->MainWin(), m[1], 80, 20, 150, 200); 151 opt2 = new PIOptMenu(this->MainWin(), pum[1], 90, 25, 150, 200); 152 153 opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250); 154 opt3->SetValueStr("Linear"); 145 155 146 156 } … … 160 170 delete opt; 161 171 delete opt2; 162 delete pdm; 172 delete opt3; 173 delete pum[0]; delete pum[1]; 163 174 delete zoom; 164 175 delete labimg; -
trunk/SophyaPI/PI/piwdggen.h
r6 r8 56 56 57 57 58 58 void PIBeep(); 59 59 60 60 #endif/* PIWDG_H_SEEN */ -
trunk/SophyaPI/PI/piwdgx.cc
r7 r8 33 33 { 34 34 return(dpy); 35 } 36 37 /* Nouvelle-Fonction */ 38 void PIBeep() 39 { 40 XBell(dpy, 0); 41 return; 35 42 } 36 43 -
trunk/SophyaPI/PI/piwindowx.cc
r2 r8 39 39 40 40 /* --Methode-- */ 41 void PIWindowX::SetSize(int sx, int sy) 42 { 43 pwm->SetSize(sx, sy); 44 return; 45 } 46 47 /* --Methode-- */ 48 void PIWindowX::SetPos(int px, int py) 49 { 50 pwm->SetPos(px, py); 51 return; 52 } 53 54 55 /* --Methode-- */ 41 56 void PIWindowX::Show() 42 57 { -
trunk/SophyaPI/PI/piwindowx.h
r2 r8 14 14 virtual void SetBinding(bool left, bool top, bool right, bool bottom); 15 15 16 virtual void Show(); 17 virtual void Hide(); 16 virtual void SetSize(int sx, int sy); 17 virtual void SetPos(int px, int py); 18 19 virtual void Show(); 20 virtual void Hide(); 18 21 19 22 protected: -
trunk/SophyaPI/PI/so_locations
r2 r8 4 4 5 5 libPI.so \ 6 :st = .text 0x000003ffbff c0000, 0x0000000000020000:\6 :st = .text 0x000003ffbffb0000, 0x0000000000030000:\ 7 7 :st = .data 0x000003fffffe0000, 0x0000000000010000:\ 8 8
Note:
See TracChangeset
for help on using the changeset viewer.