Changeset 88 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Mar 5, 1998, 1:58:53 PM (28 years ago)
Author:
aubourg
Message:

Mac 050398

Location:
trunk/SophyaPI/PI
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/piapplmac.cc

    r64 r88  
    9595}
    9696
     97/* --Methode-- */
     98int PIApplicationMac::PrefXSize()
     99{
     100  return(10);  // $CHECK$ A remplacer Reza 13/02/98
     101}
     102
     103/* --Methode-- */
     104int PIApplicationMac::PrefYSize()
     105{
     106  return(18);  // $CHECK$ A remplacer Reza 13/02/98
     107}
     108
     109void PIApplicationMac::RedirectOutStream(PIConsole* cons, unsigned char va)
     110{}
     111void PIApplicationMac::RedirectErrStream(PIConsole* cons, unsigned char va)
     112{}
  • trunk/SophyaPI/PI/piapplmac.h

    r2 r88  
    1313        virtual void    Stop();
    1414       
     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);
    1520//protected:
    1621        LApplication* macAppli;
  • trunk/SophyaPI/PI/pibwdggen.cc

    r71 r88  
    3737
    3838/* --Methode-- */
    39 void PIBaseWdgGen::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
     39void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    4040{
    4141this->Draw(g);
     
    4444
    4545/* --Methode-- */
    46 void PIBaseWdgGen::Draw(PIGraphicGen* g)
     46void PIBaseWdgGen::Draw(PIGraphic* g)
    4747{
    4848#ifdef DEBUG_RZXB
  • trunk/SophyaPI/PI/pibwdggen.h

    r80 r88  
    5757
    5858//  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
    59   virtual void       Draw(PIGraphicGen* g);
    60   virtual void       Draw(PIGraphicGen* 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);
    6161 
    6262// Traitement des evenements   
  • trunk/SophyaPI/PI/pibwdgmac.cc

    r69 r88  
    77#include <string.h>
    88
     9#define mGraphic mWGrC 
     10
    911// Les methodes de la classe  PIBWdgGen
    1012 
     
    1214PIBaseWdgMac::PIBaseWdgMac(PIContainerGen *par, char *nom,
    1315                       int sx, int sy, int px, int py) :
    14 PIBaseWdgGen(par, nom, sx, sy, px, py),
    15 mFCol(PI_Black), mBCol(PI_White)
     16PIBaseWdgGen(par, nom, sx, sy, px, py)
    1617{
     18    mGraphic = new PIGraphicMac(this);
     19
    1720    mAdapter->AddAttachment(new PIUpdAttachment(this));
    1821    mPane->AddAttachment(new PIUpdAttachment(this));
    1922    cursor = NULL;
     23   
     24
    2025}
    2126
     
    5964}
    6065
    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
    7267
    7368/* --Methode-- */
    74 void PIBaseWdgMac::DrawOpaqueString(int x, int y, char* s, int /*pos*/)
     69void PIBaseWdgMac::SelPointerShape(PIPointer ptr)
    7570{
     71  CursHandle c;
    7672  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    }
    8988  }
    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;
    17990}
    18091
    18192
    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 }
    19393
    19494/* --Methode-- */
    195 void PIBaseWdgMac::DrawBox(int x0, int y0, int dx, int dy)
     95PIPointer  PIBaseWdgMac::GetPointerShape()
    19696{
    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   }
     97return (mPtrS);
    20698}
    20799
    208100
     101
    209102/* --Methode-- */
    210 void PIBaseWdgMac::DrawFBox(int x0, int y0, int dx, int dy)
     103bool PIBaseWdgMac::AdjustCursor()
    211104{
    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;
    220108  }
     109  return false;
    221110}
    222111
    223 /* --Methode-- */
    224 void PIBaseWdgMac::DrawCircle(int x0, int y0, int r)
     112/* --Methode--
     113void PIBaseWdgMac::Refresh()
    225114{
    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   }
     115if (mPane->IsVisible())
     116  Draw();
    234117}
    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*/
    258120
    259121
    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 }
    288122
    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)
     123void PIBaseWdgMac::SetBackgroundColor(PIColors col)
    324124{
    325125  if (mPane->FocusDraw()) {
     
    352152}
    353153
    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()
     154PIColors  PIBaseWdgMac::GetBackgroundColor()
    471155{
    472156return (mBCol);
    473157}
    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/97
    537 */
    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  
    2424  virtual void       ActivateKeyboard();
    2525
    26 //  Trace graphiques
    2726  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);
    5227  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();
    6630  virtual PIPointer  GetPointerShape();
    67   virtual PIMarker   GetMarker();
    68   virtual int        GetMarkerSize();
    69   virtual int        GetFontHeight(int& asc, int& desc);
    70 
     31  virtual void       AssignKeyboard() {}
    7132
    7233protected:
    7334  friend class       PIUpdAttachment;
    7435  virtual bool       AdjustCursor();
    75   void               LocalToMacPortPoint(int x, int y, int& xm, int& ym);
    7636  CursPtr            cursor;
    7737 
    78   PolyHandle         MakePoly(int *x, int *y, int n);
    7938
    80   PIColors  mFCol, mBCol;
    81   PIGOMode  mGOm;
    8239  PIPointer mPtrS;
    83   PIFontAtt mFAtt;
    84   PILineAtt mLAtt;
    85   int       mFSize;
    86   PIMarker  mMrk;
    87   int       mMrkSz;
     40  PIColors  mBCol;
    8841};
    8942
  • trunk/SophyaPI/PI/picons.cc

    r81 r88  
    481481{
    482482opmc->SetMsgParent((PIMsgHandler*)this);
    483 opmc->Show(this, x, y);
     483opmc->Show((PIWdg*)this, x, y);
    484484}
    485485
  • trunk/SophyaPI/PI/pigraphgen.h

    r71 r88  
    131131
    132132#endif
     133
     134typedef 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  
    386386
    387387/* --Methode-- */
    388 void PIImage::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     388void PIImage::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
    389389{
    390390PIPixmap::Draw(g, x0, y0, dx, dy);
  • trunk/SophyaPI/PI/piimage.h

    r71 r88  
    6666
    6767  virtual void Resize();
    68   virtual void Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
     68  virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    6969
    7070  virtual void But1Press(int x, int y);
  • trunk/SophyaPI/PI/pimenumac.cc

    r69 r88  
    191191}
    192192
     193void
     194PIPUMenuMac::Show(PIWdg *w, int px, int py)
     195{
     196  int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),py,px,1);
     197  ItemSelected(item);
     198}
     199
    193200/* --Methode-- */
    194201PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom)
  • trunk/SophyaPI/PI/pimenumac.h

    r69 r88  
    6161               ~PIPUMenuMac();
    6262virtual void   Show();
     63virtual void   Show(PIWdg *w, int px, int py);
    6364};
    6465
  • trunk/SophyaPI/PI/pipixmapmac.cc

    r64 r88  
    7676
    7777void
    78 PIPixmapMac::Draw(int,int,int,int)
     78PIPixmapMac::Draw(PIGraphic* g,int,int,int,int)
    7979{
    80   Draw();
     80  Draw(g);
    8181}
    8282
    8383void
    84 PIPixmapMac::Draw()
     84PIPixmapMac::Draw(PIGraphic* g)
    8585{
    8686  DrawOff();
  • trunk/SophyaPI/PI/pipixmapmac.h

    r64 r88  
    1212
    1313  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);
    1616  virtual void  Refresh();
    1717  virtual void  DrawOff();
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r76 r88  
    158158
    159159void
    160 PIScDrawWdg::Draw(PIGraphicGen* g)
     160PIScDrawWdg::Draw(PIGraphic* g)
    161161{
    162162  EraseWindow();
     
    168168
    169169void
    170 PIScDrawWdg::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     170PIScDrawWdg::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
    171171{
    172172  float xmin,xmax,ymin,ymax;
     
    199199  return((string)buff);
    200200}
    201 
    202201
    203202void
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r76 r88  
    2626  virtual void       Resize();
    2727 
    28   virtual void       Draw(PIGraphicGen* g);
    29   virtual void       Draw(PIGraphicGen* 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);
    3030  virtual void       DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    3131 
  • trunk/SophyaPI/PI/pistdwdgmac.cc

    r64 r88  
    7474
    7575/* --Methode-- */
    76 void PITextMac::SetMutiLineMode(bool mlm)
     76void PITextMac::SetMutiLineMode(bool /*mlm*/)
    7777{
    7878return;
     
    181181}
    182182
     183/************* PIScrollBarMac ************/
     184static ControlActionUPP sSBarAction2 = nil;
     185
     186
     187PIScrollBarMac::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
     203PIScrollBarMac::~PIScrollBarMac()
     204{}
     205
     206void
     207PIScrollBarMac::ListenToMessage(MessageT inMessage, void *)
     208{
     209  if (inMessage == msg_ThumbDragged)
     210    Send(myMsg, PIMsg_DataChanged);
     211}
     212
     213void
     214PIScrollBarMac::SetMinMax(int min, int max)
     215{
     216  ((LStdControl*)mPane)->SetMinValue(min);
     217  ((LStdControl*)mPane)->SetMaxValue(max);
     218}
     219
     220void
     221PIScrollBarMac::SetValue(int val)
     222{
     223  StopListening();
     224  ((LStdControl*)mPane)->SetValue(val);
     225  StartListening();
     226}
     227
     228int
     229PIScrollBarMac::GetValue()
     230{
     231  return ((LStdControl*)mPane)->GetValue();
     232}
     233
     234pascal void
     235PIScrollBarMac::SBarAction(
     236        ControlHandle   inMacControl,
     237        Int16                   inPart)
     238{
     239        PIScrollBarMac          *theScroller =
     240                                                        (PIScrollBarMac *) GetControlReference(inMacControl);
     241        theScroller->HandleScroll(inPart);
     242}
     243
     244void
     245PIScrollBarMac::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
    183275/************* PICheckBoxMac ************/
    184276#include <LStdControl.h>
  • trunk/SophyaPI/PI/pistdwdgmac.h

    r34 r88  
    5757};
    5858
     59class PIScrollBarMac : public PIScrollBarGen
     60{
     61public:
     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;}
     75protected:
     76  static pascal void SBarAction(ControlHandle inMacControl,
     77                                                                Int16 inPart);
     78  int msz;
     79};
     80
     81
    5982class PICheckBoxMac : public PICheckBoxGen
    6083{
     
    7598typedef PITextMac    PIText;
    7699typedef PIScaleMac   PIScale;
     100typedef PIScrollBarMac PIScrollBar;
    77101typedef PICheckBoxMac PICheckBox;
    78102
  • trunk/SophyaPI/PI/piupdattachment.cc

    r69 r88  
    99: LAttachment(), myWdg(wdg)
    1010{
    11 
     11  myGraphic = (PIGraphicMac*) wdg->WindowGraphic();
    1212}
    1313
     
    1515{
    1616  if (lastCursPane == this) lastCursPane = NULL;
     17  delete myGraphic;
    1718}
    1819
     
    2223    switch(msg) {
    2324      case msg_DrawOrPrint:
    24         myWdg->Draw();
     25        myWdg->Draw(myGraphic);
    2526                break;
    2627      case msg_Resize:
  • trunk/SophyaPI/PI/piupdattachment.h

    r66 r88  
    1818
    1919 PIBaseWdgMac* myWdg;
     20 PIGraphicMac* myGraphic;
    2021 
    2122 friend class PIPPApplMac;
  • trunk/SophyaPI/PI/piwdggen.h

    r76 r88  
    7474  virtual bool           ClaimSelection(unsigned int typ=PICP_string)                     = 0;
    7575  virtual void           SelectionLost()                                                  = 0;
    76   virtual int            RequestSelection(unsigned int typ=PICP_string)                   = 0;
     76  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string)                   = 0;
    7777  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len)           = 0;
    7878  virtual void           SelectionTransferEnd()                                           = 0;
  • trunk/SophyaPI/PI/piwdgmac.cc

    r64 r88  
    167167/* --Methode-- */
    168168// COPY
    169 bool PIWdgMac::ClaimSelection()
     169bool PIWdgMac::ClaimSelection(unsigned int)
    170170{
    171171  int l;
     
    177177
    178178/* --Methode-- */
    179 void PIWdgMac::LoseSelection()
     179void PIWdgMac::SelectionLost()
    180180{
    181181}
     
    183183/* --Methode-- */
    184184// PASTE
    185 void PIWdgMac::RequestSelection()
     185unsigned int PIWdgMac::RequestSelection(unsigned int)
    186186{
    187187  Handle h = NewHandle(0);
     
    190190    CopyFromSelection(*h, l);
    191191  }
     192  return 1;
    192193}
    193194
     
    204205
    205206/* --Methode-- */
     207void PIWdgMac::PasteSelection(unsigned int, void *buff, unsigned int l)
     208{
     209  CopyFromSelection((char*) buff, l);
     210}
     211
     212/* --Methode-- */
    206213char* PIWdgMac::SelectionString(int& len)
    207214{
     
    214221
    215222/* --Methode-- */
     223void* PIWdgMac::ProvideSelection(unsigned int&, unsigned int& len)
     224{
     225  return SelectionString(len);
     226}
     227
     228/* --Methode-- */
     229void PIWdgMac::SelectionTransferEnd()
     230{
     231}
     232
     233/* --Methode-- */
    216234void PIWdgMac::Manage()
    217235{
  • trunk/SophyaPI/PI/piwdgmac.h

    r64 r88  
    3535 
    3636//  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);
    4045  virtual void           CopyFromSelection(char *, int l);
    4146  virtual char*          SelectionString(int& len);
     47  virtual void           SelectionTransferEnd();
    4248
    4349protected:
     
    4955  SViewInfo                              mViewInfo;
    5056  string                 mNom;
     57 
     58  friend class PIGraphicMac;
    5159};
    5260
Note: See TracChangeset for help on using the changeset viewer.