Changeset 15 in Sophya


Ignore:
Timestamp:
May 15, 1996, 4:34:53 PM (29 years ago)
Author:
macho
Message:

Fusion avec version Saclay, EA 15/05/96

Location:
trunk/SophyaPI/PI
Files:
9 added
16 edited

Legend:

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

    r9 r15  
    5454     GrafPtr p = mPane->GetMacPort();
    5555     if (p) EraseRgn(p->visRgn);
     56//         Rect r;
     57//         mPane->CalcPortFrameRect(r);
     58//       EraseRect(&r);
    5659  }
    5760}
     
    6164{
    6265  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);
    6668    LStr255 ps = s;
    6769    ::TextFont(applFont);
     
    7274
    7375/* --Methode-- */
     76void PIBaseWdgMac::DrawMarker(int x0, int y0)
     77{
     78int hmsz = mMrkSz/2;
     79int dmsz = mMrkSz-hmsz;
     80int x[4],y[4];
     81PILineAtt clatt;
     82
     83if (mMrk == PI_DotMarker) {
     84    LocalToMacPortPoint(x0, y0, x0, y0);
     85  ::MoveTo( x0, y0);
     86  ::Line(0,0);
     87}
     88
     89else
     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  }
     132return;
     133}
     134
     135/* --Methode-- */
     136void PIBaseWdgMac::DrawMarkers(int *x, int *y, int n)
     137{
     138int i;
     139
     140if (n <= 0)  return;
     141for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
     142}
     143
     144/* --Methode-- */
    74145int PIBaseWdgMac::CalcStringWidth(char const* s)
    75146{
     
    79150}
    80151
     152void 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
    81164
    82165/* --Methode-- */
     
    84167{
    85168  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);
    92174  }
    93175}
     
    97179{
    98180  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};
    102184    if (r.top  > r.bottom) swap(r.top,  r.bottom);
    103185    if (r.left > r.right)  swap(r.left, r.right);
     
    112194{
    113195  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};
    117199    if (r.top  > r.bottom) swap(r.top,  r.bottom);
    118200    if (r.left > r.right)  swap(r.left, r.right);
     
    126208{
    127209  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};
    131213    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
    132214    if (rr.left > rr.right)  swap(rr.left, rr.right);
     
    139221{
    140222  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};
    144226    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
    145227    if (rr.left > rr.right)  swap(rr.left, rr.right);
     
    147229  }
    148230}
     231
     232/* --Methode-- */
     233void 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-- */
     244void 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-- */
     253PolyHandle 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
    149272
    150273/* --Methode-- */
     
    176299    }
    177300    ::ForeColor(color);
     301    mFCol = col;
    178302  }
    179303}
     
    206330        color = blackColor;
    207331    }
     332    mBCol = col;
    208333    ::BackColor(color);
    209334  }
     
    211336
    212337/* --Methode-- */
    213 void PIBaseWdgMac::SelFont(PIFontSize sz,PIFontAtt att)
    214 {
    215   if (mPane->FocusDraw()) {
    216     ::TextFont(applFont);
    217     switch(sz) {
     338void PIBaseWdgMac::SelGOMode(PIGOMode mod)
     339{
     340if (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    }
     353return;
     354}
     355
     356
     357/* --Methode-- */
     358void PIBaseWdgMac::SelFont(PIFontSize sz, PIFontAtt att)
     359{
     360  switch(sz) {
    218361      case PI_SmallSizeFont:
    219         ::TextSize(9);
     362        SelFontSzPt(9, att);
    220363        break;
    221364      case PI_NormalSizeFont:
    222         ::TextSize(12);
     365        SelFontSzPt(12, att);
    223366        break;
    224367      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;
    239370  }
    240371}
     
    258389    }
    259390  }
     391  mFSize = npt;
     392  mFAtt  = att;
    260393}
    261394
     
    276409    }
    277410  }
     411  mLAtt = att;
    278412}
    279413
     
    299433    }
    300434  }
    301 }
     435  mPtrS = ptr;
     436}
     437
     438/* --Methode-- */
     439void PIBaseWdgMac::SelMarker(int msz, PIMarker mrk)
     440{
     441if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
     442else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
     443return;
     444}
     445
     446/* --Methode-- */
     447PIColors  PIBaseWdgMac::GetForeground()
     448{
     449return (mFCol);
     450}
     451
     452/* --Methode-- */
     453PIColors  PIBaseWdgMac::GetBackground()
     454{
     455return (mBCol);
     456}
     457
     458
     459/* --Methode-- */
     460PIGOMode   PIBaseWdgMac::GetGOMode()
     461{
     462return (mGOm);
     463}
     464
     465/* --Methode-- */
     466PIFontAtt  PIBaseWdgMac::GetFontAtt()
     467{
     468return (mFAtt);
     469}
     470
     471/* --Methode-- */
     472int        PIBaseWdgMac::GetFontSize()
     473{
     474return (mFSize);
     475}
     476
     477/* --Methode-- */
     478PILineAtt  PIBaseWdgMac::GetLineAtt()
     479{
     480return (mLAtt);
     481}
     482
     483/* --Methode-- */
     484PIPointer  PIBaseWdgMac::GetPointerShape()
     485{
     486return (mPtrS);
     487}
     488
     489/* --Methode-- */
     490PIMarker   PIBaseWdgMac::GetMarker()
     491{
     492return (mMrk);
     493}
     494
     495/* --Methode-- */
     496int        PIBaseWdgMac::GetMarkerSize()
     497{
     498return (mMrkSz);
     499}
     500
     501
    302502
    303503/* --Methode-- */
  • trunk/SophyaPI/PI/pibwdgmac.h

    r9 r15  
    3232  virtual void       DrawCircle(int x0, int y0, int r);
    3333  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
    3439  virtual int        CalcStringWidth(char const* s); 
    3540 
    3641  virtual void       SelForeground(PIColors col=PI_White);
    3742  virtual void       SelBackground(PIColors col=PI_Black);
     43  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
    3844  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont,
    3945                             PIFontAtt att=PI_RomanFont);
    4046  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
    4147  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);
    4350
     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
    4464  virtual void       Refresh();
    4565
     66// Traitement des evenements   
    4667  virtual void       Resize();
    4768  virtual void       Draw();
     
    5273  friend class       PIUpdAttachment;
    5374  virtual bool       AdjustCursor();
     75  void               LocalToMacPortPoint(int x, int y, int& xm, int& ym);
    5476  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;
    5588};
    5689
  • trunk/SophyaPI/PI/picontainermac.cc

    r2 r15  
    55: PIContainerGen(par, nom, sx, sy, px, py)
    66{
    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);
    177}
    188
  • trunk/SophyaPI/PI/picontainermac.h

    r2 r15  
    1616
    1717protected:
    18   SViewInfo                              mViewInfo;
    1918
    2019};
  • trunk/SophyaPI/PI/pidrawwin.h

    r9 r15  
    2222
    2323
     24
    2425#endif
    25 
  • trunk/SophyaPI/PI/piimage.cc

    r11 r15  
    66#include <stdlib.h>
    77#include <stdio.h>
     8#include <string>
    89#include <string.h>
    910
     
    187188{
    188189// printf("PIImage::Resize\n");
    189 PIPixmapX::Resize();
     190PIPixmap::Resize();
    190191SetPave();
    191192Apply();
  • trunk/SophyaPI/PI/pipixmapmac.cc

    r2 r15  
    1212
    1313/* --Methode-- */
    14 void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy)
     14void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
    1515{
    1616  if (nx != sx || ny != sy)
     
    1919      mGWorld = NULL;
    2020    }
    21   PIPixmapGen::SetPixmap(pix, sx, sy);
     21  PIPixmapGen::SetPixmap(pix, sx, sy, refr);
    2222}
    2323
  • trunk/SophyaPI/PI/pipixmapmac.h

    r2 r15  
    1111  virtual      ~PIPixmapMac();
    1212
    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);
    1414  virtual void  Draw();
    1515  virtual void  Refresh();
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r13 r15  
    5959  xScale = XSize() / (xMax-xMin + 2*margeH);
    6060  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();
    6363}
    6464
     
    159159    if (x2 > xMax && x1 > xMax) return;
    160160    if (y1 < yMin && y2 < yMin) return;
    161     if (y2 > yMax && y2 > yMax) return;
     161    if (y1 > yMax && y2 > yMax) return;
    162162    if (x2 < x1) {
    163163      swap(x1,x2);
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r13 r15  
    144144  virtual void       SetParms(double const*);
    145145protected:
    146   GeneralFunction* mFunc;
     146  GeneralFunction*    mFunc;
    147147  int                 mNParms;
    148148  double*             mParms;
  • trunk/SophyaPI/PI/pisysdep.h

    r2 r15  
    1212  #define PIOPTMENU_H "pioptmenumac.h"
    1313  #define PIFILECHO_H "pifilechomac.h"
    14 
     14  #define PIPERIOD_H "piperiodmac.h"
    1515  #define PIAPP_H "piapplmac.h"
    1616 
     
    3131  #define PIOPTMENU_H "pioptmenux.h"
    3232  #define PIFILECHO_H "pifilechox.h"
    33 
     33  #define PIPERIOD_H "piperiodx.h"
    3434  #define PIAPP_H "piapplx.h"
    3535
  • trunk/SophyaPI/PI/pitestapp.cc

    r11 r15  
    216216    {
    217217    if (!fgpxm)  { wp3->Show();  fgpxm = true; }
    218     for (int i=0; i<25000; i++)  pixels[i] = random()%32;
     218    for (int i=0; i<25000; i++)  pixels[i] = rand()%32;
    219219    if ((x % 3) == 0)  pxm->SetColMap(CMAP_GREY32);
    220220    if ((x % 3) == 1)  pxm->SetColMap(CMAP_COLRJ32);
  • trunk/SophyaPI/PI/piupdattachment.cc

    r9 r15  
    1616PIUpdAttachment::~PIUpdAttachment()
    1717{
    18   SysBeep(1);
     18 // SysBeep(1);
    1919}
    2020
  • trunk/SophyaPI/PI/piwdgmac.cc

    r9 r15  
    3131        mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
    3232
    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();
    3443}
    3544
  • trunk/SophyaPI/PI/piwdgmac.h

    r9 r15  
    2929  LPane*                                 mPane;
    3030  SPaneInfo                              mPaneInfo;
     31  SViewInfo                              mViewInfo;
    3132  string                 mNom;
    3233};
  • trunk/SophyaPI/PI/sc_sample.cc

    r11 r15  
    3838SelForeground(PI_Black);
    3939
     40ScDrawLine(-4, -4, 4, 4);
     41ScDrawLine(-2, -5, 5, 2);
     42ScDrawLine(-5, -4, -2, -2);
     43ScDrawLine(1, -10, 1, 10);
    4044return; 
    4145}
Note: See TracChangeset for help on using the changeset viewer.