Changeset 32 in Sophya
- Timestamp:
- Jan 10, 1997, 6:02:28 PM (29 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/exclude
r29 r32 18 18 piwindowmac.cc 19 19 piup_def.cc 20 ex_dessin.cc 21 sc_sample.cc -
trunk/SophyaPI/PI/pibwdggen.cc
r23 r32 2 2 3 3 #include "pibwdggen.h" 4 #include "psfile.h" 4 5 5 6 // Les methodes de la classe PIBWdgGen … … 10 11 PIWdg(par, nom, sx, sy, px, py) 11 12 { 13 mPSOut=NULL; 12 14 } 13 15 … … 115 117 } 116 118 119 120 /* --Methode-- */ 121 void PIBaseWdgGen::PSPrint(PSFile * psf, int ofx, int ofy) 122 { 123 if(!psf) return; 124 mPSOut = psf; 125 psf->NewBloc((float)(ofx+XPos()), (float)(ofy+YPos()), 126 (float)XSize(),(float)YSize(), 127 (float)XSize(),(float)YSize()); 128 Draw(); 129 psf->EndBloc(); 130 mPSOut=NULL; 131 } 132 -
trunk/SophyaPI/PI/pibwdggen.h
r11 r32 7 7 #include "pibwdggen.h" 8 8 9 9 10 enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 10 11 11 enum PIColors { PI_Black = 0, PI_White = 1, PI_Grey = 2, 12 enum PIColors { PI_NotDefColor = -1, 13 PI_Black = 0, PI_White = 1, PI_Grey = 2, 12 14 PI_Red = 3, PI_Blue = 4, PI_Green = 5, 13 15 PI_Yellow = 6, PI_Magenta =7 }; 14 16 15 enum PIFontSize { PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 }; 17 enum PIFontSize { PI_NotDefFontSize = -1, 18 PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 }; 16 19 17 enum PIFontAtt { PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 }; 20 enum PIFontAtt { PI_NotDefFontAtt = -1, 21 PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 }; 18 22 19 enum PILineAtt { PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 }; 23 enum PILineAtt { PI_NotDefLineAtt = -1, 24 PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 }; 20 25 21 enum PIMarker { PI_DotMarker = 0, PI_PlusMarker=1, PI_CrossMarker=2, 26 enum PIMarker { PI_NotDefMarker = -1, 27 PI_DotMarker = 0, PI_PlusMarker=1, PI_CrossMarker=2, 22 28 PI_CircleMarker=3, PI_FCircleMarker=4, 23 29 PI_BoxMarker=5, PI_FBoxMarker=6, … … 109 115 virtual void Ptr3Move(int x, int y); 110 116 virtual void Keyboard(int key, PIKeyModifier kmod); 117 118 // PostScript output 119 virtual void PSPrint(PSFile * psf, int ofx = 0, int ofy = 0); 120 121 protected: 122 PSFile * mPSOut; /* Fichier PostScript eventuel */ 111 123 }; 112 124 113 125 114 126 #endif /* PIBWDGGEN_H_SEEN */ 127 -
trunk/SophyaPI/PI/pibwdgx.cc
r23 r32 12 12 #include "pixtbaseP.h" 13 13 #include "pixtbase.h" 14 15 #include "psfile.h" 14 16 15 17 … … 132 134 void PIBaseWdgX::EraseWindow() 133 135 { 136 if(mPSOut) return; 134 137 XClearWindow (XtDisplay(XtWdg()),XtWindow(XtWdg()) ); 135 138 return; … … 139 142 void PIBaseWdgX::DrawString(int x, int y, char* s, int pos) 140 143 { 144 if(mPSOut){ 145 mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* PIFontSize ?? */ 146 } 147 else 141 148 XDrawString (XtDisplay (XtWdg()),XtWindow(XtWdg()), 142 149 DefGC(), x, y, s, strlen(s)); … … 148 155 void PIBaseWdgX::DrawLine(int x1, int y1, int x2, int y2) 149 156 { 157 if(mPSOut){ 158 mPSOut->DrawLine((float)x1,(float)y1,(float)x2,(float)y2, 159 mFCol,mLAtt); 160 } 161 else 150 162 XDrawLine(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), x1, y1, x2, y2); 151 163 return; … … 156 168 void PIBaseWdgX::DrawBox(int x0, int y0, int dx, int dy) 157 169 { 170 if(mPSOut) 171 mPSOut->DrawBox((float)x0,(float)y0,(float)dx,(float)dy,mFCol,mLAtt); 172 else{ 158 173 if (dx < 0) { x0 += dx; dx = -dx; } 159 174 if (dy < 0) { y0 += dy; dy = -dy; } 160 175 XDrawRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 161 176 DefGC(), x0, y0, dx, dy); 177 } 162 178 return; 163 179 } … … 166 182 void PIBaseWdgX::DrawFBox(int x0, int y0, int dx, int dy) 167 183 { 184 if(mPSOut) 185 mPSOut->DrawFBox((float)x0,(float)y0,(float)dx,(float)dy); 186 else{ 168 187 if (dx < 0) { x0 += dx; dx = -dx; } 169 188 if (dy < 0) { y0 += dy; dy = -dy; } 170 189 XFillRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 171 190 DefGC(), x0, y0, dx, dy); 191 } 172 192 return; 173 193 } … … 176 196 void PIBaseWdgX::DrawCircle(int x0, int y0, int r) 177 197 { 198 if(mPSOut) 199 mPSOut->DrawCircle((float)x0,(float)y0,(float)r,mFCol,mLAtt); 200 else 178 201 XDrawArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), 179 202 x0-r, y0-r, 2*r, 2*r, 0, 360*64); … … 184 207 void PIBaseWdgX::DrawFCircle(int x0, int y0, int r) 185 208 { 209 if(mPSOut) 210 mPSOut->DrawFCircle((float)x0,(float)y0,(float)r,mFCol,mFCol,mLAtt); 211 else 186 212 XFillArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), 187 213 x0-r, y0-r, 2*r, 2*r, 0, 360*64); … … 198 224 XPoint *pxp; 199 225 int i; 200 226 float *xtmp; 227 float *ytmp; 228 229 if(mPSOut) 230 { 231 xtmp = (float*)malloc(n*sizeof(float)); 232 ytmp = (float*)malloc(n*sizeof(float)); 233 for(i=0;i<n;i++){ 234 xtmp[i] = (float)x[i]; 235 ytmp[i] = (float)y[i]; 236 } 237 mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt); 238 free(xtmp); 239 free(ytmp); 240 } 241 else { 201 242 if (n <= 0) return; 202 243 if (n > NMXXPOINTS) pxp = new XPoint[n]; … … 205 246 XDrawLines(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), pxp, n, CoordModePrevious); 206 247 if (n > NMXXPOINTS) delete[] pxp; 248 } 207 249 return; 208 250 } … … 215 257 XPoint *pxp; 216 258 int i; 217 259 float *xtmp; 260 float *ytmp; 261 262 if(mPSOut) 263 { 264 xtmp = (float*)malloc(n*sizeof(float)); 265 ytmp = (float*)malloc(n*sizeof(float)); 266 for(i=0;i<n;i++){ 267 xtmp[i] = (float)x[i]; 268 ytmp[i] = (float)y[i]; 269 } 270 mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt); 271 free(xtmp); 272 free(ytmp); 273 } 274 else 275 { 218 276 if (n <= 0) return; 219 277 if (n > NMXXPOINTS) pxp = new XPoint[n]; … … 223 281 Complex, CoordModePrevious); 224 282 if (n > NMXXPOINTS) delete[] pxp; 283 } 225 284 return; 226 285 } … … 233 292 int x[4],y[4]; 234 293 PILineAtt clatt; 235 294 if(mPSOut) 295 mPSOut->DrawMarker((float)x0,(float)y0,mMrk,mFCol); 296 else 297 { 236 298 if (mMrk == PI_DotMarker) 237 299 XDrawPoint(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), x0, y0); … … 279 341 SelLine(clatt); 280 342 } 343 } 281 344 return; 282 345 } … … 286 349 { 287 350 int i; 288 351 float *xtmp; 352 float *ytmp; 353 354 if(mPSOut) 355 { 356 xtmp = (float*)malloc(n*sizeof(float)); 357 ytmp = (float*)malloc(n*sizeof(float)); 358 for(i=0;i<n;i++){ 359 xtmp[i] = (float)x[i]; 360 ytmp[i] = (float)y[i]; 361 } 362 mPSOut->DrawMarkers(xtmp,ytmp,n,mMrk,mFCol); 363 free(xtmp); 364 free(ytmp); 365 } 366 else 367 { 289 368 if (n <= 0) return; 290 369 if (mMrk == PI_DotMarker) … … 299 378 } 300 379 else for(i=0; i<n; i++) DrawMarker(x[i], y[i]); 380 } 301 381 } 302 382 -
trunk/SophyaPI/PI/picmap.h
r2 r32 1 #ifndef PICMAP_H_SEEN 2 #define PICMAP_H_SEEN 3 1 4 #include "pisysdep.h" 2 5 #include PICMAPNTV_H … … 12 15 }; 13 16 17 #endif 18 -
trunk/SophyaPI/PI/picontainergen.cc
r18 r32 23 23 for(int i=0; i<mNCh; i++) delete mChilds[i]; 24 24 delete[] mChilds; 25 } 26 27 /* --Methode-- */ 28 void PIContainerGen::PSPrint(PSFile *psf, int ofx, int ofy) 29 { 30 int i; 31 if (!psf) return; 32 if (!Visible()) return; 33 for(i=0; i<mNCh; i++) mChilds[i]->PSPrint(psf, ofx+XPos(), ofy+YPos()); 34 return; 25 35 } 26 36 -
trunk/SophyaPI/PI/picontainergen.h
r18 r32 18 18 virtual long kind() {return ClassId; } 19 19 20 virtual void PSPrint(PSFile *psf, int ofx=0, int ofy=0); 21 20 22 virtual void Show(); 21 23 virtual void Hide(); -
trunk/SophyaPI/PI/pipixmapx.cc
r18 r32 6 6 7 7 #include "pipixmapx.h" 8 #include "psfile.h" 8 9 9 10 static GC mygc; … … 59 60 void PIPixmapX::Draw() 60 61 { 61 Draw(0, 0, XSize(), YSize()); 62 if(mPSOut) 63 if(pixmap) 64 mPSOut->Image(0, 0, (float)XSize(), (float)YSize(), nx, ny, pixmap, cmap); 65 else 66 return; /* pour l'instant */ 67 else 68 Draw(0, 0, XSize(), YSize()); 62 69 } 63 70 -
trunk/SophyaPI/PI/piwdggen.cc
r23 r32 5 5 #include "picontainergen.h" 6 6 7 #include "psfile.h" 7 8 8 9 /* --Methode-- */ … … 44 45 } 45 46 47 /* --Methode-- */ 48 void PIWdgGen::PSPrint(PSFile *psf, int ofx, int ofy) 49 { 50 char str[256]; 51 52 if (!psf) return; 53 psf->NewBloc((float)ofx+XPos(), (float)ofy+YPos(), (float)XSize(), (float)YSize(), 54 (float)XSize(), (float)YSize()); 55 psf->DrawBox(0., 0., (float)XSize(), (float)YSize()); 56 sprintf(str,"PIWdgGen::PSPrint() Kind=%ld Name= %s", kind(), Nom().c_str()); 57 psf->DrawString(5., 5., str); 58 psf->EndBloc(); 59 60 return; 61 } 46 62 47 63 /* --Methode-- -
trunk/SophyaPI/PI/piwdggen.h
r23 r32 20 20 }; 21 21 22 class PSFile; 22 23 class PIContainerGen; 23 24 class PIWdgGen : public PIMsgHandler … … 60 61 virtual void GetScreenPos(int & spx, int & spy); 61 62 63 virtual void PSPrint(PSFile *psf, int ofx=0, int ofy=0); 64 62 65 protected: 63 66 PIContainerGen *parent; -
trunk/SophyaPI/PI/piwindowgen.cc
r30 r32 1 1 #include "piwindowgen.h" 2 2 #include "psfile.h" 3 3 4 4 /* --Methode-- */ … … 15 15 PIWindowGen::~PIWindowGen() 16 16 {} 17 18 /* --Methode-- */ 19 void PIWindowGen::PSPrint(PSFile *psf, int ofx, int ofy) 20 { 21 if (!psf) return; 22 int ori; 23 ori = (XSize() > YSize()) ? LANDSCAPE : PORTRAIT ; 24 psf->NewPage((float)XSize(), (float)YSize(),ori); 25 PIContainerGen::PSPrint(psf, ofx, ofy); 26 } 17 27 18 28 -
trunk/SophyaPI/PI/piwindowgen.h
r30 r32 22 22 virtual long kind() {return ClassId; } 23 23 24 virtual void PSPrint(PSFile *psf, int ofx=0, int ofy=0); 25 24 26 inline void AutoHideOnClose(bool ahc=true) { mAHC = ahc; } 25 27
Note:
See TracChangeset
for help on using the changeset viewer.