Changeset 88 in Sophya for trunk/SophyaPI
- Timestamp:
- Mar 5, 1998, 1:58:53 PM (28 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piapplmac.cc
r64 r88 95 95 } 96 96 97 /* --Methode-- */ 98 int PIApplicationMac::PrefXSize() 99 { 100 return(10); // $CHECK$ A remplacer Reza 13/02/98 101 } 102 103 /* --Methode-- */ 104 int PIApplicationMac::PrefYSize() 105 { 106 return(18); // $CHECK$ A remplacer Reza 13/02/98 107 } 108 109 void PIApplicationMac::RedirectOutStream(PIConsole* cons, unsigned char va) 110 {} 111 void PIApplicationMac::RedirectErrStream(PIConsole* cons, unsigned char va) 112 {} -
trunk/SophyaPI/PI/piapplmac.h
r2 r88 13 13 virtual void Stop(); 14 14 15 virtual int PrefXSize(); 16 virtual int PrefYSize(); 17 18 virtual void RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def); 19 virtual void RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital); 15 20 //protected: 16 21 LApplication* macAppli; -
trunk/SophyaPI/PI/pibwdggen.cc
r71 r88 37 37 38 38 /* --Methode-- */ 39 void PIBaseWdgGen::Draw(PIGraphic Gen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)39 void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 40 40 { 41 41 this->Draw(g); … … 44 44 45 45 /* --Methode-- */ 46 void PIBaseWdgGen::Draw(PIGraphic Gen* g)46 void PIBaseWdgGen::Draw(PIGraphic* g) 47 47 { 48 48 #ifdef DEBUG_RZXB -
trunk/SophyaPI/PI/pibwdggen.h
r80 r88 57 57 58 58 // Fonctions qui doivent contenir le dessin du contenu du widget lui-meme 59 virtual void Draw(PIGraphic Gen* g);60 virtual void Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy);59 virtual void Draw(PIGraphic* g); 60 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 61 61 62 62 // Traitement des evenements -
trunk/SophyaPI/PI/pibwdgmac.cc
r69 r88 7 7 #include <string.h> 8 8 9 #define mGraphic mWGrC 10 9 11 // Les methodes de la classe PIBWdgGen 10 12 … … 12 14 PIBaseWdgMac::PIBaseWdgMac(PIContainerGen *par, char *nom, 13 15 int sx, int sy, int px, int py) : 14 PIBaseWdgGen(par, nom, sx, sy, px, py), 15 mFCol(PI_Black), mBCol(PI_White) 16 PIBaseWdgGen(par, nom, sx, sy, px, py) 16 17 { 18 mGraphic = new PIGraphicMac(this); 19 17 20 mAdapter->AddAttachment(new PIUpdAttachment(this)); 18 21 mPane->AddAttachment(new PIUpdAttachment(this)); 19 22 cursor = NULL; 23 24 20 25 } 21 26 … … 59 64 } 60 65 61 /* --Methode-- */ 62 void PIBaseWdgMac::DrawString(int x, int y, char* s, int /*pos*/) 63 { 64 if (mPane->FocusDraw()) { 65 LocalToMacPortPoint(x, y, x, y); 66 ::MoveTo(x, y); 67 LStr255 ps = s; 68 ::TextFont(applFont); 69 ::DrawString(ps); 70 } 71 } 66 72 67 73 68 /* --Methode-- */ 74 void PIBaseWdgMac:: DrawOpaqueString(int x, int y, char* s, int /*pos*/)69 void PIBaseWdgMac::SelPointerShape(PIPointer ptr) 75 70 { 71 CursHandle c; 76 72 if (mPane->FocusDraw()) { 77 LocalToMacPortPoint(x, y, x, y); 78 ::MoveTo(x, y); 79 LStr255 ps = s; 80 ::TextFont(applFont); 81 Rect box; 82 box.left = x; 83 box.bottom = y; 84 int iWidth = TextWidth(s,0,strlen(s)); 85 box.right = box.left + iWidth; 86 int z; 87 box.top = box.bottom + GetFontHeight(z,z); 88 ::TETextBox(s,strlen(s),&box,teForceLeft); 73 switch(ptr) { 74 case PI_ArrowPointer: 75 cursor = &qd.arrow; 76 break; 77 case PI_CrossPointer: 78 c = GetCursor(crossCursor); 79 HLock((Handle)c); 80 cursor = c ? *c : NULL; 81 break; 82 case PI_HandPointer: 83 c = GetCursor(128); 84 HLock((Handle)c); 85 cursor = c ? *c : NULL; 86 break; 87 } 89 88 } 90 } 91 92 /* --Methode-- */ 93 void PIBaseWdgMac::DrawMarker(int x0, int y0) 94 { 95 int hmsz = mMrkSz/2; 96 int dmsz = mMrkSz-hmsz; 97 int x[4],y[4]; 98 PILineAtt clatt; 99 100 if (mMrk == PI_DotMarker) { 101 LocalToMacPortPoint(x0, y0, x0, y0); 102 ::MoveTo( x0, y0); 103 ::Line(0,0); 104 } 105 106 else 107 { 108 clatt = mLAtt; 109 SelLine(PI_ThinLine); 110 switch (mMrk) 111 { 112 case PI_PlusMarker : 113 DrawLine(x0-hmsz, y0, x0+dmsz, y0); 114 DrawLine(x0, y0-hmsz, x0, y0+dmsz); 115 break; 116 case PI_CrossMarker : 117 DrawLine(x0-hmsz, y0-hmsz, x0+dmsz, y0+dmsz); 118 DrawLine(x0-hmsz, y0+dmsz, x0+dmsz, y0-hmsz); 119 break; 120 case PI_CircleMarker : 121 DrawCircle(x0, y0, hmsz); 122 break; 123 case PI_FCircleMarker : 124 DrawFCircle(x0, y0, hmsz); 125 break; 126 case PI_BoxMarker : 127 DrawBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz); 128 break; 129 case PI_FBoxMarker : 130 DrawFBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz); 131 break; 132 case PI_TriangleMarker : 133 x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 134 x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 135 DrawPolygon(x, y, 4); 136 break; 137 case PI_FTriangleMarker : 138 x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 139 x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 140 DrawFPolygon(x, y, 4); 141 break; 142 default : 143 ::MoveTo( x0, y0); 144 ::Line(0,0); 145 break; 146 } 147 SelLine(clatt); 148 } 149 return; 150 } 151 152 /* --Methode-- */ 153 void PIBaseWdgMac::DrawMarkers(int *x, int *y, int n) 154 { 155 int i; 156 157 if (n <= 0) return; 158 for(i=0; i<n; i++) DrawMarker(x[i], y[i]); 159 } 160 161 /* --Methode-- */ 162 int PIBaseWdgMac::CalcStringWidth(char const* s) 163 { 164 if (mPane->FocusDraw()) 165 ::TextFont(applFont); 166 return ::TextWidth(s,0,strlen(s)); 167 } 168 169 void PIBaseWdgMac::LocalToMacPortPoint(int x, int y, int& xm, int& ym) 170 { 171 Point pt = {y,x}; 172 //mPane->LocalToPortPoint(pt); 173 // SPoint32 loc; 174 // mPane->GetFrameLocation(loc); 175 // xm = pt.h + loc.h; 176 // ym = pt.v + loc.v; // Ou bien ne pas utiliser de Pane, que des View ? 177 xm = pt.h; 178 ym = pt.v; 89 mPtrS = ptr; 179 90 } 180 91 181 92 182 /* --Methode-- */183 void PIBaseWdgMac::DrawLine(int x1, int y1, int x2, int y2)184 {185 if (mPane->FocusDraw()) {186 int x,y;187 LocalToMacPortPoint(x1, y1, x, y);188 ::MoveTo(x,y);189 LocalToMacPortPoint(x2, y2, x, y);190 ::LineTo(x,y);191 }192 }193 93 194 94 /* --Methode-- */ 195 void PIBaseWdgMac::DrawBox(int x0, int y0, int dx, int dy)95 PIPointer PIBaseWdgMac::GetPointerShape() 196 96 { 197 if (mPane->FocusDraw()) { 198 int x,y; 199 LocalToMacPortPoint(x0, y0, x, y); 200 Rect r = {y, x, y+dy, x+dx}; 201 if (r.top > r.bottom) swap(r.top, r.bottom); 202 if (r.left > r.right) swap(r.left, r.right); 203 r.right++; r.bottom++; 204 ::FrameRect(&r); 205 } 97 return (mPtrS); 206 98 } 207 99 208 100 101 209 102 /* --Methode-- */ 210 void PIBaseWdgMac::DrawFBox(int x0, int y0, int dx, int dy)103 bool PIBaseWdgMac::AdjustCursor() 211 104 { 212 if (mPane->FocusDraw()) { 213 int x,y; 214 LocalToMacPortPoint(x0, y0, x, y); 215 Rect r = {y, x, y+dy, x+dx}; 216 if (r.top > r.bottom) swap(r.top, r.bottom); 217 if (r.left > r.right) swap(r.left, r.right); 218 r.right++; r.bottom++; 219 ::PaintRect(&r); 105 if (cursor) { 106 ::SetCursor(cursor); 107 return true; 220 108 } 109 return false; 221 110 } 222 111 223 /* --Methode-- */224 void PIBaseWdgMac:: DrawCircle(int x0, int y0, int r)112 /* --Methode-- 113 void PIBaseWdgMac::Refresh() 225 114 { 226 if (mPane->FocusDraw()) { 227 int x,y; 228 LocalToMacPortPoint(x0, y0, x, y); 229 Rect rr = {y-r, x-r, y+r, x+r}; 230 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 231 if (rr.left > rr.right) swap(rr.left, rr.right); 232 ::FrameOval(&rr); 233 } 115 if (mPane->IsVisible()) 116 Draw(); 234 117 } 235 236 /* --Methode-- */ 237 void PIBaseWdgMac::DrawFCircle(int x0, int y0, int r) 238 { 239 if (mPane->FocusDraw()) { 240 int x,y; 241 LocalToMacPortPoint(x0, y0, x, y); 242 Rect rr = {y-r, x-r, y+r, x+r}; 243 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 244 if (rr.left > rr.right) swap(rr.left, rr.right); 245 ::PaintOval(&rr); 246 } 247 } 248 249 /* --Methode-- */ 250 void PIBaseWdgMac::DrawPolygon(int *x, int *y, int n) 251 { 252 PolyHandle h = MakePoly(x,y,n); 253 if (h) { 254 ::FramePoly(h); 255 ::KillPoly(h); 256 } 257 } 118 J'ai mis cette fonction ds PIWdgMac::IsVisible() Reza $CHECK$ 01/12/97 119 */ 258 120 259 121 260 /* --Methode-- */261 void PIBaseWdgMac::DrawFPolygon(int *x, int *y, int n)262 {263 PolyHandle h = MakePoly(x,y,n);264 if (h) {265 ::PaintPoly(h);266 ::KillPoly(h);267 }268 }269 /* --Methode-- */270 PolyHandle PIBaseWdgMac::MakePoly(int *x, int *y, int n)271 {272 if (mPane->FocusDraw()) {273 PolyHandle h = ::OpenPoly();274 int xx,yy;275 LocalToMacPortPoint(x[0], y[0], xx, yy);276 ::MoveTo(xx, yy);277 for (int i=1; i<n; i++) {278 LocalToMacPortPoint(x[i], y[i], xx, yy);279 ::LineTo(xx, yy);280 }281 LocalToMacPortPoint(x[0], y[0], xx, yy);282 ::MoveTo(xx, yy);283 ClosePoly();284 return h;285 }286 return NULL;287 }288 122 289 290 /* --Methode-- */ 291 void PIBaseWdgMac::SelForeground(PIColors col) 292 { 293 if (mPane->FocusDraw()) { 294 long color; 295 switch (col) { 296 case PI_Black: 297 color = blackColor; 298 break; 299 case PI_White: 300 color = whiteColor; 301 break; 302 case PI_Red: 303 color = redColor; 304 break; 305 case PI_Blue: 306 color = blueColor; 307 break; 308 case PI_Green: 309 color = greenColor; 310 break; 311 case PI_Yellow: 312 color = yellowColor; 313 break; 314 default: 315 color = blackColor; 316 } 317 ::ForeColor(color); 318 mFCol = col; 319 } 320 } 321 322 /* --Methode-- */ 323 void PIBaseWdgMac::SelBackground(PIColors col) 123 void PIBaseWdgMac::SetBackgroundColor(PIColors col) 324 124 { 325 125 if (mPane->FocusDraw()) { … … 352 152 } 353 153 354 /* --Methode-- */ 355 void PIBaseWdgMac::SelGOMode(PIGOMode mod) 356 { 357 if (mod == mGOm) return; 358 if (mPane->FocusDraw()) 359 switch (mod) 360 { 361 case PI_GOCopy : 362 ::PenMode(patCopy); 363 mGOm = mod; 364 break; 365 case PI_GOXOR : 366 ::PenMode(patXor); 367 mGOm = mod; 368 break; 369 } 370 return; 371 } 372 373 374 /* --Methode-- */ 375 void PIBaseWdgMac::SelFont(PIFontSize sz, PIFontAtt att) 376 { 377 switch(sz) { 378 case PI_SmallSizeFont: 379 SelFontSzPt(9, att); 380 break; 381 case PI_NormalSizeFont: 382 SelFontSzPt(12, att); 383 break; 384 case PI_BigSizeFont: 385 SelFontSzPt(14, att); 386 break; 387 } 388 } 389 390 /* --Methode-- */ 391 void PIBaseWdgMac::SelFontSzPt(int npt, PIFontAtt att) 392 { 393 if (mPane->FocusDraw()) { 394 ::TextFont(applFont); 395 ::TextSize(npt); 396 switch(att) { 397 case PI_RomanFont: 398 ::TextFace(0); 399 break; 400 case PI_BoldFont: 401 ::TextFace(bold); 402 break; 403 case PI_ItalicFont: 404 ::TextFace(italic); 405 break; 406 } 407 } 408 mFSize = npt; 409 mFAtt = att; 410 } 411 412 /* --Methode-- */ 413 void PIBaseWdgMac::SelLine(PILineAtt att) 414 { 415 if (mPane->FocusDraw()) { 416 switch(att) { 417 case PI_NormalLine: 418 ::PenSize(1,1); 419 break; 420 case PI_ThinLine: 421 ::PenSize(1,1); // Mettre en pointille, ou bien commentaire pour Laser ? 422 break; 423 case PI_ThickLine: 424 ::PenSize(2,2); 425 break; 426 } 427 } 428 mLAtt = att; 429 } 430 431 /* --Methode-- */ 432 void PIBaseWdgMac::SelPointerShape(PIPointer ptr) 433 { 434 CursHandle c; 435 if (mPane->FocusDraw()) { 436 switch(ptr) { 437 case PI_ArrowPointer: 438 cursor = &qd.arrow; 439 break; 440 case PI_CrossPointer: 441 c = GetCursor(crossCursor); 442 HLock((Handle)c); 443 cursor = c ? *c : NULL; 444 break; 445 case PI_HandPointer: 446 c = GetCursor(128); 447 HLock((Handle)c); 448 cursor = c ? *c : NULL; 449 break; 450 } 451 } 452 mPtrS = ptr; 453 } 454 455 /* --Methode-- */ 456 void PIBaseWdgMac::SelMarker(int msz, PIMarker mrk) 457 { 458 if (msz > 1) { mMrk = mrk; mMrkSz = msz; } 459 else { mMrk = PI_DotMarker; mMrkSz = 1; } 460 return; 461 } 462 463 /* --Methode-- */ 464 PIColors PIBaseWdgMac::GetForeground() 465 { 466 return (mFCol); 467 } 468 469 /* --Methode-- */ 470 PIColors PIBaseWdgMac::GetBackground() 154 PIColors PIBaseWdgMac::GetBackgroundColor() 471 155 { 472 156 return (mBCol); 473 157 } 474 475 476 /* --Methode-- */477 PIGOMode PIBaseWdgMac::GetGOMode()478 {479 return (mGOm);480 }481 482 /* --Methode-- */483 PIFontAtt PIBaseWdgMac::GetFontAtt()484 {485 return (mFAtt);486 }487 488 /* --Methode-- */489 int PIBaseWdgMac::GetFontSize()490 {491 return (mFSize);492 }493 494 /* --Methode-- */495 PILineAtt PIBaseWdgMac::GetLineAtt()496 {497 return (mLAtt);498 }499 500 /* --Methode-- */501 PIPointer PIBaseWdgMac::GetPointerShape()502 {503 return (mPtrS);504 }505 506 /* --Methode-- */507 PIMarker PIBaseWdgMac::GetMarker()508 {509 return (mMrk);510 }511 512 /* --Methode-- */513 int PIBaseWdgMac::GetMarkerSize()514 {515 return (mMrkSz);516 }517 518 519 520 /* --Methode-- */521 bool PIBaseWdgMac::AdjustCursor()522 {523 if (cursor) {524 ::SetCursor(cursor);525 return true;526 }527 return false;528 }529 530 /* --Methode--531 void PIBaseWdgMac::Refresh()532 {533 if (mPane->IsVisible())534 Draw();535 }536 J'ai mis cette fonction ds PIWdgMac::IsVisible() Reza $CHECK$ 01/12/97537 */538 539 540 541 void PIBaseWdgMac::DrawPixmap(int x, int y, unsigned char *pix,542 int sx, int sy, PIColorMap* cmap)543 {544 Rect frame;545 SetRect(&frame, 0, 0, sx, sy);546 Rect dstFrame;547 SetRect(&dstFrame, x, y, sx, sy);548 GWorldPtr gWorld;549 ThrowIfOSErr_(NewGWorld(&gWorld, 8, &frame, cmap->GetCTab(), nil, 0));550 PixMapHandle pmh = GetGWorldPixMap(gWorld);551 ::LockPixels (pmh);552 Ptr pmap = GetPixBaseAddr(pmh);553 memcpy(pmap, pix, sx*sy);554 ::ForeColor (blackColor);555 ::BackColor (whiteColor);556 ::CopyBits((BitMap *) (*pmh),557 &mPane->GetMacPort()->portBits,558 &frame, &dstFrame, srcCopy, nil);559 ::UnlockPixels (pmh);560 DisposeGWorld(gWorld);561 }562 563 void PIBaseWdgMac::SetClipRectangle(int x0, int y0, int dx, int dy)564 { // $CHECK$565 }566 567 void PIBaseWdgMac::ClearClipRectangle()568 { // $CHECK$569 }570 571 /* --Methode-- */572 int PIBaseWdgMac::GetFontHeight(int& asc, int& desc)573 {574 if (mPane->FocusDraw()) {575 FontInfo info;576 GetFontInfo(&info);577 asc = info.ascent;578 desc = info.descent;579 return (asc + desc);580 } else {581 return 0;582 }583 } -
trunk/SophyaPI/PI/pibwdgmac.h
r64 r88 24 24 virtual void ActivateKeyboard(); 25 25 26 // Trace graphiques27 26 virtual void EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0); 28 virtual void DrawString(int x, int y, char* s, int pos = 0);29 virtual void DrawOpaqueString(int x, int y, char* s, int pos = 0);30 virtual void DrawLine(int x1, int y1, int x2, int y2);31 virtual void DrawBox(int x0, int y0, int dx, int dy);32 virtual void DrawFBox(int x0, int y0, int dx, int dy);33 virtual void DrawCircle(int x0, int y0, int r);34 virtual void DrawFCircle(int x0, int y0, int r);35 virtual void DrawPolygon(int *x, int *y, int n);36 virtual void DrawFPolygon(int *x, int *y, int n);37 virtual void DrawMarker(int x0, int y0);38 virtual void DrawMarkers(int *x, int *y, int n);39 40 virtual void DrawPixmap(int x, int y, unsigned char *pix,41 int sx, int sy, PIColorMap* cmap);42 43 virtual int CalcStringWidth(char const* s);44 45 virtual void SelForeground(PIColors col=PI_White);46 virtual void SelBackground(PIColors col=PI_Black);47 virtual void SelGOMode(PIGOMode mod=PI_GOCopy);48 virtual void SelFont(PIFontSize sz=PI_NormalSizeFont,49 PIFontAtt att=PI_RomanFont);50 virtual void SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);51 virtual void SelLine(PILineAtt att=PI_NormalLine);52 27 virtual void SelPointerShape(PIPointer ptr=PI_ArrowPointer); 53 virtual void SelMarker(int msz, PIMarker mrk=PI_DotMarker); 54 55 // Selection de zone de trace (clip) 56 virtual void SetClipRectangle(int x0, int y0, int dx, int dy); 57 virtual void ClearClipRectangle(); 58 59 // Acces aux attributs graphiques 60 virtual PIColors GetForeground(); 61 virtual PIColors GetBackground(); 62 virtual PIGOMode GetGOMode(); 63 virtual PIFontAtt GetFontAtt(); 64 virtual int GetFontSize(); 65 virtual PILineAtt GetLineAtt(); 28 virtual void SetBackgroundColor(PIColors col=PI_White); 29 virtual PIColors GetBackgroundColor(); 66 30 virtual PIPointer GetPointerShape(); 67 virtual PIMarker GetMarker(); 68 virtual int GetMarkerSize(); 69 virtual int GetFontHeight(int& asc, int& desc); 70 31 virtual void AssignKeyboard() {} 71 32 72 33 protected: 73 34 friend class PIUpdAttachment; 74 35 virtual bool AdjustCursor(); 75 void LocalToMacPortPoint(int x, int y, int& xm, int& ym);76 36 CursPtr cursor; 77 37 78 PolyHandle MakePoly(int *x, int *y, int n);79 38 80 PIColors mFCol, mBCol;81 PIGOMode mGOm;82 39 PIPointer mPtrS; 83 PIFontAtt mFAtt; 84 PILineAtt mLAtt; 85 int mFSize; 86 PIMarker mMrk; 87 int mMrkSz; 40 PIColors mBCol; 88 41 }; 89 42 -
trunk/SophyaPI/PI/picons.cc
r81 r88 481 481 { 482 482 opmc->SetMsgParent((PIMsgHandler*)this); 483 opmc->Show( this, x, y);483 opmc->Show((PIWdg*)this, x, y); 484 484 } 485 485 -
trunk/SophyaPI/PI/pigraphgen.h
r71 r88 131 131 132 132 #endif 133 134 typedef PIGraphicGen PIGraphic; 135 136 // hierarchie apparente 137 // PIGraphic ( == Gen, mais pas visible de l'utilisateur). 138 // PIGraphicWin ( == X ou Mac) 139 // PIGraphicPS 140 // PIGraphicUC -
trunk/SophyaPI/PI/piimage.cc
r71 r88 386 386 387 387 /* --Methode-- */ 388 void PIImage::Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy)388 void PIImage::Draw(PIGraphic* g, int x0, int y0, int dx, int dy) 389 389 { 390 390 PIPixmap::Draw(g, x0, y0, dx, dy); -
trunk/SophyaPI/PI/piimage.h
r71 r88 66 66 67 67 virtual void Resize(); 68 virtual void Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy);68 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 69 69 70 70 virtual void But1Press(int x, int y); -
trunk/SophyaPI/PI/pimenumac.cc
r69 r88 191 191 } 192 192 193 void 194 PIPUMenuMac::Show(PIWdg *w, int px, int py) 195 { 196 int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),py,px,1); 197 ItemSelected(item); 198 } 199 193 200 /* --Methode-- */ 194 201 PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom) -
trunk/SophyaPI/PI/pimenumac.h
r69 r88 61 61 ~PIPUMenuMac(); 62 62 virtual void Show(); 63 virtual void Show(PIWdg *w, int px, int py); 63 64 }; 64 65 -
trunk/SophyaPI/PI/pipixmapmac.cc
r64 r88 76 76 77 77 void 78 PIPixmapMac::Draw( int,int,int,int)78 PIPixmapMac::Draw(PIGraphic* g,int,int,int,int) 79 79 { 80 Draw( );80 Draw(g); 81 81 } 82 82 83 83 void 84 PIPixmapMac::Draw( )84 PIPixmapMac::Draw(PIGraphic* g) 85 85 { 86 86 DrawOff(); -
trunk/SophyaPI/PI/pipixmapmac.h
r64 r88 12 12 13 13 virtual void SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true); 14 virtual void Draw( );15 virtual void Draw( int x0, int y0, int dx, int dy);14 virtual void Draw(PIGraphic* g); 15 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 16 16 virtual void Refresh(); 17 17 virtual void DrawOff(); -
trunk/SophyaPI/PI/piscdrawwdg.cc
r76 r88 158 158 159 159 void 160 PIScDrawWdg::Draw(PIGraphic Gen* g)160 PIScDrawWdg::Draw(PIGraphic* g) 161 161 { 162 162 EraseWindow(); … … 168 168 169 169 void 170 PIScDrawWdg::Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy)170 PIScDrawWdg::Draw(PIGraphic* g, int x0, int y0, int dx, int dy) 171 171 { 172 172 float xmin,xmax,ymin,ymax; … … 199 199 return((string)buff); 200 200 } 201 202 201 203 202 void -
trunk/SophyaPI/PI/piscdrawwdg.h
r76 r88 26 26 virtual void Resize(); 27 27 28 virtual void Draw(PIGraphic Gen* g);29 virtual void Draw(PIGraphic Gen* g, int x0, int y0, int dx, int dy);28 virtual void Draw(PIGraphic* g); 29 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 30 30 virtual void DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax); 31 31 -
trunk/SophyaPI/PI/pistdwdgmac.cc
r64 r88 74 74 75 75 /* --Methode-- */ 76 void PITextMac::SetMutiLineMode(bool mlm)76 void PITextMac::SetMutiLineMode(bool /*mlm*/) 77 77 { 78 78 return; … … 181 181 } 182 182 183 /************* PIScrollBarMac ************/ 184 static ControlActionUPP sSBarAction2 = nil; 185 186 187 PIScrollBarMac::PIScrollBarMac(PIContainerGen* par, char* nom, PIMessage msg, 188 bool vert, int sx, int sy, int px, int py) 189 : PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py) 190 { 191 delete mPane; 192 LStr255 titre(nom); 193 mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10, 194 scrollBarProc, 130, titre, (Int32) this); 195 ((LStdControl*)mPane)->AddListener(this); 196 197 if (sSBarAction2 == nil) { // Allocate UPP if necessary 198 sSBarAction2 = NewControlActionProc((ProcPtr) SBarAction); 199 } 200 ((LStdControl*)mPane)->SetActionProc(sSBarAction2); 201 } 202 203 PIScrollBarMac::~PIScrollBarMac() 204 {} 205 206 void 207 PIScrollBarMac::ListenToMessage(MessageT inMessage, void *) 208 { 209 if (inMessage == msg_ThumbDragged) 210 Send(myMsg, PIMsg_DataChanged); 211 } 212 213 void 214 PIScrollBarMac::SetMinMax(int min, int max) 215 { 216 ((LStdControl*)mPane)->SetMinValue(min); 217 ((LStdControl*)mPane)->SetMaxValue(max); 218 } 219 220 void 221 PIScrollBarMac::SetValue(int val) 222 { 223 StopListening(); 224 ((LStdControl*)mPane)->SetValue(val); 225 StartListening(); 226 } 227 228 int 229 PIScrollBarMac::GetValue() 230 { 231 return ((LStdControl*)mPane)->GetValue(); 232 } 233 234 pascal void 235 PIScrollBarMac::SBarAction( 236 ControlHandle inMacControl, 237 Int16 inPart) 238 { 239 PIScrollBarMac *theScroller = 240 (PIScrollBarMac *) GetControlReference(inMacControl); 241 theScroller->HandleScroll(inPart); 242 } 243 244 void 245 PIScrollBarMac::HandleScroll( 246 const Int16 inPart) 247 { 248 int delta; 249 switch (inPart) { // Determine how much to scroll 250 251 case kControlUpButtonPart: // Scroll left one unit 252 delta = -1; 253 break; 254 255 case kControlDownButtonPart: // Scroll right one unit 256 delta = 1; 257 break; 258 259 case kControlPageUpPart: // Scroll left by Frame width 260 // less one unit of overlap 261 delta = -10; 262 break; 263 264 case kControlPageDownPart: // Scroll right by Frame width 265 // less one unit of overlap 266 delta = 10; 267 break; 268 } 269 270 if (delta != 0) { 271 SetValue(GetValue()+delta); 272 } 273 } 274 183 275 /************* PICheckBoxMac ************/ 184 276 #include <LStdControl.h> -
trunk/SophyaPI/PI/pistdwdgmac.h
r34 r88 57 57 }; 58 58 59 class PIScrollBarMac : public PIScrollBarGen 60 { 61 public: 62 PIScrollBarMac(PIContainerGen* par, char* nom, 63 PIMessage msg=PIMsg_DataChanged, bool vert=true, 64 int sx=100, int sy=10, int px=0, int py=0); 65 ~PIScrollBarMac(); 66 67 virtual void ActivateDrag(bool /*acd*/=false) {}; 68 virtual void SetMinMax(int min, int max); 69 virtual void SetValue(int val); 70 virtual int GetValue(); 71 virtual void ListenToMessage(MessageT inMessage, void *ioParam); 72 virtual void HandleScroll(const Int16 inPart); 73 virtual void SetSize(int sz) {msz = sz;} 74 virtual int GetSize() {return msz;} 75 protected: 76 static pascal void SBarAction(ControlHandle inMacControl, 77 Int16 inPart); 78 int msz; 79 }; 80 81 59 82 class PICheckBoxMac : public PICheckBoxGen 60 83 { … … 75 98 typedef PITextMac PIText; 76 99 typedef PIScaleMac PIScale; 100 typedef PIScrollBarMac PIScrollBar; 77 101 typedef PICheckBoxMac PICheckBox; 78 102 -
trunk/SophyaPI/PI/piupdattachment.cc
r69 r88 9 9 : LAttachment(), myWdg(wdg) 10 10 { 11 11 myGraphic = (PIGraphicMac*) wdg->WindowGraphic(); 12 12 } 13 13 … … 15 15 { 16 16 if (lastCursPane == this) lastCursPane = NULL; 17 delete myGraphic; 17 18 } 18 19 … … 22 23 switch(msg) { 23 24 case msg_DrawOrPrint: 24 myWdg->Draw( );25 myWdg->Draw(myGraphic); 25 26 break; 26 27 case msg_Resize: -
trunk/SophyaPI/PI/piupdattachment.h
r66 r88 18 18 19 19 PIBaseWdgMac* myWdg; 20 PIGraphicMac* myGraphic; 20 21 21 22 friend class PIPPApplMac; -
trunk/SophyaPI/PI/piwdggen.h
r76 r88 74 74 virtual bool ClaimSelection(unsigned int typ=PICP_string) = 0; 75 75 virtual void SelectionLost() = 0; 76 virtual intRequestSelection(unsigned int typ=PICP_string) = 0;76 virtual unsigned int RequestSelection(unsigned int typ=PICP_string) = 0; 77 77 virtual void* ProvideSelection(unsigned int& typ, unsigned int& len) = 0; 78 78 virtual void SelectionTransferEnd() = 0; -
trunk/SophyaPI/PI/piwdgmac.cc
r64 r88 167 167 /* --Methode-- */ 168 168 // COPY 169 bool PIWdgMac::ClaimSelection( )169 bool PIWdgMac::ClaimSelection(unsigned int) 170 170 { 171 171 int l; … … 177 177 178 178 /* --Methode-- */ 179 void PIWdgMac:: LoseSelection()179 void PIWdgMac::SelectionLost() 180 180 { 181 181 } … … 183 183 /* --Methode-- */ 184 184 // PASTE 185 void PIWdgMac::RequestSelection()185 unsigned int PIWdgMac::RequestSelection(unsigned int) 186 186 { 187 187 Handle h = NewHandle(0); … … 190 190 CopyFromSelection(*h, l); 191 191 } 192 return 1; 192 193 } 193 194 … … 204 205 205 206 /* --Methode-- */ 207 void PIWdgMac::PasteSelection(unsigned int, void *buff, unsigned int l) 208 { 209 CopyFromSelection((char*) buff, l); 210 } 211 212 /* --Methode-- */ 206 213 char* PIWdgMac::SelectionString(int& len) 207 214 { … … 214 221 215 222 /* --Methode-- */ 223 void* PIWdgMac::ProvideSelection(unsigned int&, unsigned int& len) 224 { 225 return SelectionString(len); 226 } 227 228 /* --Methode-- */ 229 void PIWdgMac::SelectionTransferEnd() 230 { 231 } 232 233 /* --Methode-- */ 216 234 void PIWdgMac::Manage() 217 235 { -
trunk/SophyaPI/PI/piwdgmac.h
r64 r88 35 35 36 36 // Gestion de copier-coller 37 virtual bool ClaimSelection(); 38 virtual void LoseSelection(); 39 virtual void RequestSelection(); 37 // $$CHECK$$ Pourquoi les noms ont-ils change ??? 38 // En plus, pour des trucs tout aussi obscurs... 39 // Et c'est quoi, typ, qui en plus n'est pas utilise sous X ??? 40 virtual bool ClaimSelection(unsigned int typ=PICP_string); 41 virtual void SelectionLost(); 42 virtual unsigned int RequestSelection(unsigned int typ=PICP_string); 43 virtual void* ProvideSelection(unsigned int& typ, unsigned int& len); 44 virtual void PasteSelection(unsigned int typ, void *, unsigned int l); 40 45 virtual void CopyFromSelection(char *, int l); 41 46 virtual char* SelectionString(int& len); 47 virtual void SelectionTransferEnd(); 42 48 43 49 protected: … … 49 55 SViewInfo mViewInfo; 50 56 string mNom; 57 58 friend class PIGraphicMac; 51 59 }; 52 60
Note:
See TracChangeset
for help on using the changeset viewer.