Changeset 15 in Sophya
- Timestamp:
- May 15, 1996, 4:34:53 PM (29 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 9 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pibwdgmac.cc
r9 r15 54 54 GrafPtr p = mPane->GetMacPort(); 55 55 if (p) EraseRgn(p->visRgn); 56 // Rect r; 57 // mPane->CalcPortFrameRect(r); 58 // EraseRect(&r); 56 59 } 57 60 } … … 61 64 { 62 65 if (mPane->FocusDraw()) { 63 Point pt = {y,x}; 64 mPane->LocalToPortPoint(pt); 65 ::MoveTo(pt.h, pt.v); 66 LocalToMacPortPoint(x, y, x, y); 67 ::MoveTo(x, y); 66 68 LStr255 ps = s; 67 69 ::TextFont(applFont); … … 72 74 73 75 /* --Methode-- */ 76 void PIBaseWdgMac::DrawMarker(int x0, int y0) 77 { 78 int hmsz = mMrkSz/2; 79 int dmsz = mMrkSz-hmsz; 80 int x[4],y[4]; 81 PILineAtt clatt; 82 83 if (mMrk == PI_DotMarker) { 84 LocalToMacPortPoint(x0, y0, x0, y0); 85 ::MoveTo( x0, y0); 86 ::Line(0,0); 87 } 88 89 else 90 { 91 clatt = mLAtt; 92 SelLine(PI_ThinLine); 93 switch (mMrk) 94 { 95 case PI_PlusMarker : 96 DrawLine(x0-hmsz, y0, x0+dmsz, y0); 97 DrawLine(x0, y0-hmsz, x0, y0+dmsz); 98 break; 99 case PI_CrossMarker : 100 DrawLine(x0-hmsz, y0-hmsz, x0+dmsz, y0+dmsz); 101 DrawLine(x0-hmsz, y0+dmsz, x0+dmsz, y0-hmsz); 102 break; 103 case PI_CircleMarker : 104 DrawCircle(x0, y0, hmsz); 105 break; 106 case PI_FCircleMarker : 107 DrawFCircle(x0, y0, hmsz); 108 break; 109 case PI_BoxMarker : 110 DrawBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz); 111 break; 112 case PI_FBoxMarker : 113 DrawFBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz); 114 break; 115 case PI_TriangleMarker : 116 x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 117 x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 118 DrawPolygon(x, y, 4); 119 break; 120 case PI_FTriangleMarker : 121 x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 122 x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 123 DrawFPolygon(x, y, 4); 124 break; 125 default : 126 ::MoveTo( x0, y0); 127 ::Line(0,0); 128 break; 129 } 130 SelLine(clatt); 131 } 132 return; 133 } 134 135 /* --Methode-- */ 136 void PIBaseWdgMac::DrawMarkers(int *x, int *y, int n) 137 { 138 int i; 139 140 if (n <= 0) return; 141 for(i=0; i<n; i++) DrawMarker(x[i], y[i]); 142 } 143 144 /* --Methode-- */ 74 145 int PIBaseWdgMac::CalcStringWidth(char const* s) 75 146 { … … 79 150 } 80 151 152 void PIBaseWdgMac::LocalToMacPortPoint(int x, int y, int& xm, int& ym) 153 { 154 Point pt = {y,x}; 155 //mPane->LocalToPortPoint(pt); 156 // SPoint32 loc; 157 // mPane->GetFrameLocation(loc); 158 // xm = pt.h + loc.h; 159 // ym = pt.v + loc.v; // Ou bien ne pas utiliser de Pane, que des View ? 160 xm = pt.h; 161 ym = pt.v; 162 } 163 81 164 82 165 /* --Methode-- */ … … 84 167 { 85 168 if (mPane->FocusDraw()) { 86 Point pt = {y1,x1}; 87 mPane->LocalToPortPoint(pt); 88 ::MoveTo(pt.h, pt.v); 89 SetPt(&pt,x2,y2); 90 mPane->LocalToPortPoint(pt); 91 ::LineTo(pt.h, pt.v); 169 int x,y; 170 LocalToMacPortPoint(x1, y1, x, y); 171 ::MoveTo(x,y); 172 LocalToMacPortPoint(x2, y2, x, y); 173 ::LineTo(x,y); 92 174 } 93 175 } … … 97 179 { 98 180 if (mPane->FocusDraw()) { 99 Point pt = {y0,x0};100 mPane->LocalToPortPoint(pt);101 Rect r = { pt.v, pt.h, pt.v+dy, pt.h+dx};181 int x,y; 182 LocalToMacPortPoint(x0, y0, x, y); 183 Rect r = {y, x, y+dy, x+dx}; 102 184 if (r.top > r.bottom) swap(r.top, r.bottom); 103 185 if (r.left > r.right) swap(r.left, r.right); … … 112 194 { 113 195 if (mPane->FocusDraw()) { 114 Point pt = {y0,x0};115 mPane->LocalToPortPoint(pt);116 Rect r = { pt.v, pt.h, pt.v+dy, pt.h+dx};196 int x,y; 197 LocalToMacPortPoint(x0, y0, x, y); 198 Rect r = {y, x, y+dy, x+dx}; 117 199 if (r.top > r.bottom) swap(r.top, r.bottom); 118 200 if (r.left > r.right) swap(r.left, r.right); … … 126 208 { 127 209 if (mPane->FocusDraw()) { 128 Point pt = {y0,x0};129 mPane->LocalToPortPoint(pt);130 Rect rr = { pt.v-r, pt.h-r, pt.v+r, pt.h+r};210 int x,y; 211 LocalToMacPortPoint(x0, y0, x, y); 212 Rect rr = {y-r, x-r, y+r, x+r}; 131 213 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 132 214 if (rr.left > rr.right) swap(rr.left, rr.right); … … 139 221 { 140 222 if (mPane->FocusDraw()) { 141 Point pt = {y0,x0};142 mPane->LocalToPortPoint(pt);143 Rect rr = { pt.v-r, pt.h-r, pt.v+r, pt.h+r};223 int x,y; 224 LocalToMacPortPoint(x0, y0, x, y); 225 Rect rr = {y-r, x-r, y+r, x+r}; 144 226 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 145 227 if (rr.left > rr.right) swap(rr.left, rr.right); … … 147 229 } 148 230 } 231 232 /* --Methode-- */ 233 void PIBaseWdgMac::DrawPolygon(int *x, int *y, int n) 234 { 235 PolyHandle h = MakePoly(x,y,n); 236 if (h) { 237 ::FramePoly(h); 238 ::KillPoly(h); 239 } 240 } 241 242 243 /* --Methode-- */ 244 void PIBaseWdgMac::DrawFPolygon(int *x, int *y, int n) 245 { 246 PolyHandle h = MakePoly(x,y,n); 247 if (h) { 248 ::PaintPoly(h); 249 ::KillPoly(h); 250 } 251 } 252 /* --Methode-- */ 253 PolyHandle PIBaseWdgMac::MakePoly(int *x, int *y, int n) 254 { 255 if (mPane->FocusDraw()) { 256 PolyHandle h = ::OpenPoly(); 257 int xx,yy; 258 LocalToMacPortPoint(x[0], y[0], xx, yy); 259 ::MoveTo(xx, yy); 260 for (int i=1; i<n; i++) { 261 LocalToMacPortPoint(x[i], y[i], xx, yy); 262 ::LineTo(xx, yy); 263 } 264 LocalToMacPortPoint(x[0], y[0], xx, yy); 265 ::MoveTo(xx, yy); 266 ClosePoly(); 267 return h; 268 } 269 return NULL; 270 } 271 149 272 150 273 /* --Methode-- */ … … 176 299 } 177 300 ::ForeColor(color); 301 mFCol = col; 178 302 } 179 303 } … … 206 330 color = blackColor; 207 331 } 332 mBCol = col; 208 333 ::BackColor(color); 209 334 } … … 211 336 212 337 /* --Methode-- */ 213 void PIBaseWdgMac::SelFont(PIFontSize sz,PIFontAtt att) 214 { 215 if (mPane->FocusDraw()) { 216 ::TextFont(applFont); 217 switch(sz) { 338 void PIBaseWdgMac::SelGOMode(PIGOMode mod) 339 { 340 if (mod == mGOm) return; 341 if (mPane->FocusDraw()) 342 switch (mod) 343 { 344 case PI_GOCopy : 345 ::PenMode(patCopy); 346 mGOm = mod; 347 break; 348 case PI_GOXOR : 349 ::PenMode(patXor); 350 mGOm = mod; 351 break; 352 } 353 return; 354 } 355 356 357 /* --Methode-- */ 358 void PIBaseWdgMac::SelFont(PIFontSize sz, PIFontAtt att) 359 { 360 switch(sz) { 218 361 case PI_SmallSizeFont: 219 ::TextSize(9);362 SelFontSzPt(9, att); 220 363 break; 221 364 case PI_NormalSizeFont: 222 ::TextSize(12);365 SelFontSzPt(12, att); 223 366 break; 224 367 case PI_BigSizeFont: 225 ::TextSize(14); 226 break; 227 } 228 switch(att) { 229 case PI_RomanFont: 230 ::TextFace(0); 231 break; 232 case PI_BoldFont: 233 ::TextFace(bold); 234 break; 235 case PI_ItalicFont: 236 ::TextFace(italic); 237 break; 238 } 368 SelFontSzPt(14, att); 369 break; 239 370 } 240 371 } … … 258 389 } 259 390 } 391 mFSize = npt; 392 mFAtt = att; 260 393 } 261 394 … … 276 409 } 277 410 } 411 mLAtt = att; 278 412 } 279 413 … … 299 433 } 300 434 } 301 } 435 mPtrS = ptr; 436 } 437 438 /* --Methode-- */ 439 void PIBaseWdgMac::SelMarker(int msz, PIMarker mrk) 440 { 441 if (msz > 1) { mMrk = mrk; mMrkSz = msz; } 442 else { mMrk = PI_DotMarker; mMrkSz = 1; } 443 return; 444 } 445 446 /* --Methode-- */ 447 PIColors PIBaseWdgMac::GetForeground() 448 { 449 return (mFCol); 450 } 451 452 /* --Methode-- */ 453 PIColors PIBaseWdgMac::GetBackground() 454 { 455 return (mBCol); 456 } 457 458 459 /* --Methode-- */ 460 PIGOMode PIBaseWdgMac::GetGOMode() 461 { 462 return (mGOm); 463 } 464 465 /* --Methode-- */ 466 PIFontAtt PIBaseWdgMac::GetFontAtt() 467 { 468 return (mFAtt); 469 } 470 471 /* --Methode-- */ 472 int PIBaseWdgMac::GetFontSize() 473 { 474 return (mFSize); 475 } 476 477 /* --Methode-- */ 478 PILineAtt PIBaseWdgMac::GetLineAtt() 479 { 480 return (mLAtt); 481 } 482 483 /* --Methode-- */ 484 PIPointer PIBaseWdgMac::GetPointerShape() 485 { 486 return (mPtrS); 487 } 488 489 /* --Methode-- */ 490 PIMarker PIBaseWdgMac::GetMarker() 491 { 492 return (mMrk); 493 } 494 495 /* --Methode-- */ 496 int PIBaseWdgMac::GetMarkerSize() 497 { 498 return (mMrkSz); 499 } 500 501 302 502 303 503 /* --Methode-- */ -
trunk/SophyaPI/PI/pibwdgmac.h
r9 r15 32 32 virtual void DrawCircle(int x0, int y0, int r); 33 33 virtual void DrawFCircle(int x0, int y0, int r); 34 virtual void DrawPolygon(int *x, int *y, int n); 35 virtual void DrawFPolygon(int *x, int *y, int n); 36 virtual void DrawMarker(int x0, int y0); 37 virtual void DrawMarkers(int *x, int *y, int n); 38 34 39 virtual int CalcStringWidth(char const* s); 35 40 36 41 virtual void SelForeground(PIColors col=PI_White); 37 42 virtual void SelBackground(PIColors col=PI_Black); 43 virtual void SelGOMode(PIGOMode mod=PI_GOCopy); 38 44 virtual void SelFont(PIFontSize sz=PI_NormalSizeFont, 39 45 PIFontAtt att=PI_RomanFont); 40 46 virtual void SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont); 41 47 virtual void SelLine(PILineAtt att=PI_NormalLine); 42 virtual void SelPointerShape(PIPointer ptr); 48 virtual void SelPointerShape(PIPointer ptr=PI_ArrowPointer); 49 virtual void SelMarker(int msz, PIMarker mrk=PI_DotMarker); 43 50 51 52 // Acces aux attributs graphiques 53 virtual PIColors GetForeground(); 54 virtual PIColors GetBackground(); 55 virtual PIGOMode GetGOMode(); 56 virtual PIFontAtt GetFontAtt(); 57 virtual int GetFontSize(); 58 virtual PILineAtt GetLineAtt(); 59 virtual PIPointer GetPointerShape(); 60 virtual PIMarker GetMarker(); 61 virtual int GetMarkerSize(); 62 63 // Fonction qui doit etre appelee pour rafraichir (retracer) tout 44 64 virtual void Refresh(); 45 65 66 // Traitement des evenements 46 67 virtual void Resize(); 47 68 virtual void Draw(); … … 52 73 friend class PIUpdAttachment; 53 74 virtual bool AdjustCursor(); 75 void LocalToMacPortPoint(int x, int y, int& xm, int& ym); 54 76 CursPtr cursor; 77 78 PolyHandle MakePoly(int *x, int *y, int n); 79 80 PIColors mFCol, mBCol; 81 PIGOMode mGOm; 82 PIPointer mPtrS; 83 PIFontAtt mFAtt; 84 PILineAtt mLAtt; 85 int mFSize; 86 PIMarker mMrk; 87 int mMrkSz; 55 88 }; 56 89 -
trunk/SophyaPI/PI/picontainermac.cc
r2 r15 5 5 : PIContainerGen(par, nom, sx, sy, px, py) 6 6 { 7 delete mPane;8 mViewInfo.imageSize.width = sx;9 mViewInfo.imageSize.height = sy;10 mViewInfo.scrollPos.h =11 mViewInfo.scrollPos.v =12 mViewInfo.scrollUnit.h =13 mViewInfo.scrollUnit.v = 0;14 mViewInfo.reconcileOverhang = 0;15 16 mPane = new LView(mPaneInfo, mViewInfo);17 7 } 18 8 -
trunk/SophyaPI/PI/picontainermac.h
r2 r15 16 16 17 17 protected: 18 SViewInfo mViewInfo;19 18 20 19 }; -
trunk/SophyaPI/PI/pidrawwin.h
r9 r15 22 22 23 23 24 24 25 #endif 25 -
trunk/SophyaPI/PI/piimage.cc
r11 r15 6 6 #include <stdlib.h> 7 7 #include <stdio.h> 8 #include <string> 8 9 #include <string.h> 9 10 … … 187 188 { 188 189 // printf("PIImage::Resize\n"); 189 PIPixmap X::Resize();190 PIPixmap::Resize(); 190 191 SetPave(); 191 192 Apply(); -
trunk/SophyaPI/PI/pipixmapmac.cc
r2 r15 12 12 13 13 /* --Methode-- */ 14 void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy )14 void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr) 15 15 { 16 16 if (nx != sx || ny != sy) … … 19 19 mGWorld = NULL; 20 20 } 21 PIPixmapGen::SetPixmap(pix, sx, sy );21 PIPixmapGen::SetPixmap(pix, sx, sy, refr); 22 22 } 23 23 -
trunk/SophyaPI/PI/pipixmapmac.h
r2 r15 11 11 virtual ~PIPixmapMac(); 12 12 13 virtual void SetPixmap(unsigned char *pix, int sx, int sy );13 virtual void SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true); 14 14 virtual void Draw(); 15 15 virtual void Refresh(); -
trunk/SophyaPI/PI/piscdrawwdg.cc
r13 r15 59 59 xScale = XSize() / (xMax-xMin + 2*margeH); 60 60 yScale = -YSize() / (yMax-yMin + 2*margeV); 61 xOrg = (-xMin + margeH) * xScale /* + XPos() */; // $CHECK$ Reza Pourquoi + X,YPos() ?62 yOrg = (-yMax - margeV) * yScale /* + YPos() */;61 xOrg = (-xMin + margeH) * xScale;// + XPos(); 62 yOrg = (-yMax - margeV) * yScale;// + YPos(); 63 63 } 64 64 … … 159 159 if (x2 > xMax && x1 > xMax) return; 160 160 if (y1 < yMin && y2 < yMin) return; 161 if (y 2> yMax && y2 > yMax) return;161 if (y1 > yMax && y2 > yMax) return; 162 162 if (x2 < x1) { 163 163 swap(x1,x2); -
trunk/SophyaPI/PI/piscdrawwdg.h
r13 r15 144 144 virtual void SetParms(double const*); 145 145 protected: 146 GeneralFunction* mFunc;146 GeneralFunction* mFunc; 147 147 int mNParms; 148 148 double* mParms; -
trunk/SophyaPI/PI/pisysdep.h
r2 r15 12 12 #define PIOPTMENU_H "pioptmenumac.h" 13 13 #define PIFILECHO_H "pifilechomac.h" 14 14 #define PIPERIOD_H "piperiodmac.h" 15 15 #define PIAPP_H "piapplmac.h" 16 16 … … 31 31 #define PIOPTMENU_H "pioptmenux.h" 32 32 #define PIFILECHO_H "pifilechox.h" 33 33 #define PIPERIOD_H "piperiodx.h" 34 34 #define PIAPP_H "piapplx.h" 35 35 -
trunk/SophyaPI/PI/pitestapp.cc
r11 r15 216 216 { 217 217 if (!fgpxm) { wp3->Show(); fgpxm = true; } 218 for (int i=0; i<25000; i++) pixels[i] = rand om()%32;218 for (int i=0; i<25000; i++) pixels[i] = rand()%32; 219 219 if ((x % 3) == 0) pxm->SetColMap(CMAP_GREY32); 220 220 if ((x % 3) == 1) pxm->SetColMap(CMAP_COLRJ32); -
trunk/SophyaPI/PI/piupdattachment.cc
r9 r15 16 16 PIUpdAttachment::~PIUpdAttachment() 17 17 { 18 SysBeep(1);18 // SysBeep(1); 19 19 } 20 20 -
trunk/SophyaPI/PI/piwdgmac.cc
r9 r15 31 31 mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL; 32 32 33 mPane = new LPane(mPaneInfo); 33 mViewInfo.imageSize.width = sx; 34 mViewInfo.imageSize.height = sy; 35 mViewInfo.scrollPos.h = 36 mViewInfo.scrollPos.v = 37 mViewInfo.scrollUnit.h = 38 mViewInfo.scrollUnit.v = 0; 39 mViewInfo.reconcileOverhang = 0; 40 41 mPane = new LView(mPaneInfo, mViewInfo); 42 ((LView*)mPane)->CalcPortOrigin(); 34 43 } 35 44 -
trunk/SophyaPI/PI/piwdgmac.h
r9 r15 29 29 LPane* mPane; 30 30 SPaneInfo mPaneInfo; 31 SViewInfo mViewInfo; 31 32 string mNom; 32 33 }; -
trunk/SophyaPI/PI/sc_sample.cc
r11 r15 38 38 SelForeground(PI_Black); 39 39 40 ScDrawLine(-4, -4, 4, 4); 41 ScDrawLine(-2, -5, 5, 2); 42 ScDrawLine(-5, -4, -2, -2); 43 ScDrawLine(1, -10, 1, 10); 40 44 return; 41 45 }
Note:
See TracChangeset
for help on using the changeset viewer.