Index: /trunk/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 14)
+++ /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 15)
@@ -54,4 +54,7 @@
      GrafPtr p = mPane->GetMacPort();
      if (p) EraseRgn(p->visRgn);
+//	   Rect r;
+//	   mPane->CalcPortFrameRect(r);
+//       EraseRect(&r);
   }
 }
@@ -61,7 +64,6 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y,x};
-    mPane->LocalToPortPoint(pt);
-    ::MoveTo(pt.h, pt.v);
+    LocalToMacPortPoint(x, y, x, y);
+    ::MoveTo(x, y);
     LStr255 ps = s;
     ::TextFont(applFont);
@@ -72,4 +74,73 @@
 
 /* --Methode-- */
+void PIBaseWdgMac::DrawMarker(int x0, int y0)
+{
+int hmsz = mMrkSz/2;
+int dmsz = mMrkSz-hmsz;
+int x[4],y[4];
+PILineAtt clatt;
+
+if (mMrk == PI_DotMarker) {
+    LocalToMacPortPoint(x0, y0, x0, y0);
+  ::MoveTo( x0, y0);
+  ::Line(0,0);
+}
+
+else
+  {
+  clatt = mLAtt;
+  SelLine(PI_ThinLine);
+  switch (mMrk)
+    {
+    case  PI_PlusMarker :
+      DrawLine(x0-hmsz, y0, x0+dmsz, y0);
+      DrawLine(x0, y0-hmsz, x0, y0+dmsz);
+      break;
+    case  PI_CrossMarker :
+      DrawLine(x0-hmsz, y0-hmsz, x0+dmsz, y0+dmsz);
+      DrawLine(x0-hmsz, y0+dmsz, x0+dmsz, y0-hmsz);
+      break;  
+    case PI_CircleMarker :
+      DrawCircle(x0, y0, hmsz);
+      break;
+    case PI_FCircleMarker :
+      DrawFCircle(x0, y0, hmsz);
+      break;
+    case PI_BoxMarker :
+      DrawBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case PI_FBoxMarker :
+      DrawFBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case  PI_TriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz;  
+      DrawPolygon(x, y, 4);
+      break;
+    case  PI_FTriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz;  
+      DrawFPolygon(x, y, 4);
+      break;
+    default :
+      ::MoveTo( x0, y0);
+      ::Line(0,0);
+      break;
+    }
+  SelLine(clatt);
+  }
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawMarkers(int *x, int *y, int n)
+{
+int i;
+
+if (n <= 0)  return;
+for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
+}
+
+/* --Methode-- */
 int PIBaseWdgMac::CalcStringWidth(char const* s)
 {
@@ -79,4 +150,16 @@
 }
 
+void PIBaseWdgMac::LocalToMacPortPoint(int x, int y, int& xm, int& ym)
+{
+    Point pt = {y,x};
+    //mPane->LocalToPortPoint(pt);
+//	SPoint32 loc;
+//	mPane->GetFrameLocation(loc);
+//    xm = pt.h + loc.h;
+//    ym = pt.v + loc.v;  // Ou bien ne pas utiliser de Pane, que des View ?
+    xm = pt.h;
+    ym = pt.v;
+}
+
 
 /* --Methode-- */
@@ -84,10 +167,9 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y1,x1};
-    mPane->LocalToPortPoint(pt);
-    ::MoveTo(pt.h, pt.v);
-	SetPt(&pt,x2,y2);
-    mPane->LocalToPortPoint(pt);
-    ::LineTo(pt.h, pt.v);
+    int x,y;
+    LocalToMacPortPoint(x1, y1, x, y);
+    ::MoveTo(x,y);
+    LocalToMacPortPoint(x2, y2, x, y);
+    ::LineTo(x,y);
   }
 }
@@ -97,7 +179,7 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y0,x0};
-    mPane->LocalToPortPoint(pt);
-    Rect r = {pt.v, pt.h, pt.v+dy, pt.h+dx};
+    int x,y;
+    LocalToMacPortPoint(x0, y0, x, y);
+    Rect r = {y, x, y+dy, x+dx};
     if (r.top  > r.bottom) swap(r.top,  r.bottom);
     if (r.left > r.right)  swap(r.left, r.right);
@@ -112,7 +194,7 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y0,x0};
-    mPane->LocalToPortPoint(pt);
-    Rect r = {pt.v, pt.h, pt.v+dy, pt.h+dx};
+    int x,y;
+    LocalToMacPortPoint(x0, y0, x, y);
+    Rect r = {y, x, y+dy, x+dx};
     if (r.top  > r.bottom) swap(r.top,  r.bottom);
     if (r.left > r.right)  swap(r.left, r.right);
@@ -126,7 +208,7 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y0,x0};
-    mPane->LocalToPortPoint(pt);
-    Rect rr = {pt.v-r, pt.h-r, pt.v+r, pt.h+r};
+    int x,y;
+    LocalToMacPortPoint(x0, y0, x, y);
+    Rect rr = {y-r, x-r, y+r, x+r};
     if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
     if (rr.left > rr.right)  swap(rr.left, rr.right);
@@ -139,7 +221,7 @@
 {
   if (mPane->FocusDraw()) {
-    Point pt = {y0,x0};
-    mPane->LocalToPortPoint(pt);
-    Rect rr = {pt.v-r, pt.h-r, pt.v+r, pt.h+r};
+    int x,y;
+    LocalToMacPortPoint(x0, y0, x, y);
+    Rect rr = {y-r, x-r, y+r, x+r};
     if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
     if (rr.left > rr.right)  swap(rr.left, rr.right);
@@ -147,4 +229,45 @@
   }
 }
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawPolygon(int *x, int *y, int n)
+{
+  PolyHandle h = MakePoly(x,y,n);
+  if (h) {
+    ::FramePoly(h);
+    ::KillPoly(h);
+  }
+}
+
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawFPolygon(int *x, int *y, int n)
+{
+  PolyHandle h = MakePoly(x,y,n);
+  if (h) {
+    ::PaintPoly(h);
+    ::KillPoly(h);
+  }
+}
+/* --Methode-- */
+PolyHandle PIBaseWdgMac::MakePoly(int *x, int *y, int n)
+{
+  if (mPane->FocusDraw()) {
+    PolyHandle h = ::OpenPoly();
+    int xx,yy;
+    LocalToMacPortPoint(x[0], y[0], xx, yy);
+    ::MoveTo(xx, yy);
+    for (int i=1; i<n; i++) {
+      LocalToMacPortPoint(x[i], y[i], xx, yy);
+      ::LineTo(xx, yy);
+    }
+    LocalToMacPortPoint(x[0], y[0], xx, yy);
+    ::MoveTo(xx, yy);
+    ClosePoly();
+    return h;
+  }
+  return NULL;
+}
+
 
 /* --Methode-- */
@@ -176,4 +299,5 @@
     }
     ::ForeColor(color);
+    mFCol = col;
   }
 }
@@ -206,4 +330,5 @@
         color = blackColor;
     }
+    mBCol = col;
     ::BackColor(color);
   }
@@ -211,30 +336,36 @@
 
 /* --Methode-- */
-void PIBaseWdgMac::SelFont(PIFontSize sz,PIFontAtt att)
-{
-  if (mPane->FocusDraw()) {
-    ::TextFont(applFont);
-    switch(sz) {
+void PIBaseWdgMac::SelGOMode(PIGOMode mod)
+{
+if (mod == mGOm)  return;
+  if (mPane->FocusDraw())
+    switch (mod)
+    {
+      case PI_GOCopy :
+        ::PenMode(patCopy);
+        mGOm = mod;
+        break;
+      case PI_GOXOR :
+        ::PenMode(patXor);
+        mGOm = mod;
+        break;
+    }
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgMac::SelFont(PIFontSize sz, PIFontAtt att)
+{
+  switch(sz) {
       case PI_SmallSizeFont:
-        ::TextSize(9);
+        SelFontSzPt(9, att);
         break;
       case PI_NormalSizeFont:
-        ::TextSize(12);
+        SelFontSzPt(12, att);
         break;
       case PI_BigSizeFont:
-        ::TextSize(14);
-        break;
-    }
-    switch(att) {
-      case PI_RomanFont:
-        ::TextFace(0);
-        break;
-      case PI_BoldFont:
-        ::TextFace(bold);
-        break;
-      case PI_ItalicFont:
-        ::TextFace(italic);
-        break;
-    }
+        SelFontSzPt(14, att);
+        break;
   }
 }
@@ -258,4 +389,6 @@
     }
   }
+  mFSize = npt;
+  mFAtt  = att;
 }
 
@@ -276,4 +409,5 @@
     }
   }
+  mLAtt = att;
 }
 
@@ -299,5 +433,71 @@
     }
   }
-}
+  mPtrS = ptr;
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::SelMarker(int msz, PIMarker mrk)
+{
+if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
+else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
+return;
+}
+
+/* --Methode-- */
+PIColors  PIBaseWdgMac::GetForeground() 
+{
+return (mFCol);
+}
+
+/* --Methode-- */
+PIColors  PIBaseWdgMac::GetBackground() 
+{
+return (mBCol);
+}
+
+
+/* --Methode-- */
+PIGOMode   PIBaseWdgMac::GetGOMode()
+{
+return (mGOm);
+}
+
+/* --Methode-- */
+PIFontAtt  PIBaseWdgMac::GetFontAtt()
+{
+return (mFAtt);
+}
+
+/* --Methode-- */
+int        PIBaseWdgMac::GetFontSize()
+{
+return (mFSize);
+}
+
+/* --Methode-- */
+PILineAtt  PIBaseWdgMac::GetLineAtt()
+{
+return (mLAtt);
+}
+
+/* --Methode-- */
+PIPointer  PIBaseWdgMac::GetPointerShape()
+{
+return (mPtrS);
+}
+
+/* --Methode-- */
+PIMarker   PIBaseWdgMac::GetMarker()
+{
+return (mMrk);
+}
+
+/* --Methode-- */
+int        PIBaseWdgMac::GetMarkerSize()
+{
+return (mMrkSz);
+}
+
+
 
 /* --Methode-- */
Index: /trunk/SophyaPI/PI/pibwdgmac.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.h	(revision 14)
+++ /trunk/SophyaPI/PI/pibwdgmac.h	(revision 15)
@@ -32,16 +32,37 @@
   virtual void       DrawCircle(int x0, int y0, int r);
   virtual void       DrawFCircle(int x0, int y0, int r);
+  virtual void       DrawPolygon(int *x, int *y, int n);  
+  virtual void       DrawFPolygon(int *x, int *y, int n);  
+  virtual void       DrawMarker(int x0, int y0);
+  virtual void       DrawMarkers(int *x, int *y, int n);
+
   virtual int        CalcStringWidth(char const* s);  
   
   virtual void       SelForeground(PIColors col=PI_White);
   virtual void       SelBackground(PIColors col=PI_Black);
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
                              PIFontAtt att=PI_RomanFont);
   virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont); 
   virtual void       SelLine(PILineAtt att=PI_NormalLine);
-  virtual void       SelPointerShape(PIPointer ptr);
+  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer);
+  virtual void       SelMarker(int msz, PIMarker mrk=PI_DotMarker);
 
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground();
+  virtual PIColors   GetBackground();
+  virtual PIGOMode   GetGOMode();
+  virtual PIFontAtt  GetFontAtt();
+  virtual int        GetFontSize();
+  virtual PILineAtt  GetLineAtt();
+  virtual PIPointer  GetPointerShape();
+  virtual PIMarker   GetMarker();
+  virtual int        GetMarkerSize();
+
+//  Fonction qui doit etre appelee pour rafraichir (retracer) tout 
   virtual void       Refresh();
 
+// Traitement des evenements   
   virtual void       Resize();
   virtual void       Draw();
@@ -52,5 +73,17 @@
   friend class       PIUpdAttachment;
   virtual bool       AdjustCursor();
+  void               LocalToMacPortPoint(int x, int y, int& xm, int& ym);
   CursPtr            cursor;
+  
+  PolyHandle         MakePoly(int *x, int *y, int n);
+
+  PIColors  mFCol, mBCol;
+  PIGOMode  mGOm;
+  PIPointer mPtrS;
+  PIFontAtt mFAtt;
+  PILineAtt mLAtt;
+  int       mFSize;
+  PIMarker  mMrk;
+  int       mMrkSz;
 };
 
Index: /trunk/SophyaPI/PI/picontainermac.cc
===================================================================
--- /trunk/SophyaPI/PI/picontainermac.cc	(revision 14)
+++ /trunk/SophyaPI/PI/picontainermac.cc	(revision 15)
@@ -5,14 +5,4 @@
 : PIContainerGen(par, nom, sx, sy, px, py)
 {
-  delete mPane;
-  mViewInfo.imageSize.width = sx;
-  mViewInfo.imageSize.height = sy;
-  mViewInfo.scrollPos.h = 
-    mViewInfo.scrollPos.v = 
-    mViewInfo.scrollUnit.h = 
-    mViewInfo.scrollUnit.v = 0;
-  mViewInfo.reconcileOverhang = 0;
-  
-  mPane = new LView(mPaneInfo, mViewInfo);
 }
 
Index: /trunk/SophyaPI/PI/picontainermac.h
===================================================================
--- /trunk/SophyaPI/PI/picontainermac.h	(revision 14)
+++ /trunk/SophyaPI/PI/picontainermac.h	(revision 15)
@@ -16,5 +16,4 @@
 
 protected:
-  SViewInfo				 mViewInfo;
 
 };
Index: /trunk/SophyaPI/PI/pidrawwin.h
===================================================================
--- /trunk/SophyaPI/PI/pidrawwin.h	(revision 14)
+++ /trunk/SophyaPI/PI/pidrawwin.h	(revision 15)
@@ -22,4 +22,4 @@
 
 
+
 #endif
-
Index: /trunk/SophyaPI/PI/pierrdisp.cc
===================================================================
--- /trunk/SophyaPI/PI/pierrdisp.cc	(revision 15)
+++ /trunk/SophyaPI/PI/pierrdisp.cc	(revision 15)
@@ -0,0 +1,103 @@
+#include "pierrdisp.h"
+#include "utils.h"
+
+
+PIErrorBox::PIErrorBox(PIContainerGen* par, int sx, int sy,
+	     int px, int py)
+: PIBaseWdg(par, "Error Message", sx, sy, px, py)
+{
+  currErrText = "";
+  state = 0;
+}
+
+PIErrorBox::~PIErrorBox()
+{
+}
+
+void
+PIErrorBox::Draw()
+{
+  if (currErrText == "") {
+    SelBackground();
+    EraseWindow();
+  } else {
+    switch(state) {
+    case 0:
+      EraseWindow();
+      SelForeground(PI_Red);
+      DrawFBox(0,0,1000,1000);
+      SelForeground(PI_Black);
+      break;
+    default:
+      SelBackground();
+      SelForeground();
+    }
+    SelFont(PI_BigSizeFont, PI_BoldFont);
+    DrawString(20,30,(char*)currErrText.c_str());
+  }
+}
+
+void
+PIErrorBox::Cycle()
+{
+  state = (state + 1) % 2;
+}
+
+
+
+
+PIErrorDisplay::PIErrorDisplay(PIContainerGen* par, int sx, int sy,
+			       int px, int py)
+: PIContainer(par, "Error Display", sx, sy, px, py), PIPeriodX(1)
+{
+  currErrId = 0;
+
+  errorBox  = new PIErrorBox(this, 150, 80, 0, 0);
+  ackButton = new PIButton(this, "OK", 5000, 40, 20, 155, 20);
+  updButton = new PIButton(this, "Upd", 5001, 40, 20, 155, 50);
+}
+
+PIErrorDisplay::~PIErrorDisplay()
+{
+  delete updButton;
+  delete ackButton;
+  delete errorBox;
+}
+
+void
+PIErrorDisplay::Process(long msg, PIMsgHandler *sender, void *data)
+{
+  switch(msg) {
+  case 5000:
+    // On valide
+    if (currErrId) 
+      AcqAckError(currErrId);
+    UpdData();
+    break;
+  case 5001:
+    UpdData();
+    break;
+    
+  default:
+    PIContainer::Process(msg, sender, data);
+  }
+}
+
+void
+PIErrorDisplay::UpdData()
+{
+  currErrId = 0;
+  char tache[80];
+  char msg[200];
+  int code;
+  int severite;
+  int rc = AcqGetNextError(&currErrId, tache, &code, &severite, msg);
+  if (rc)
+    errorBox->SetText("");
+  else
+    errorBox->SetText(string(tache) + " : (" + itos(code) + "/" +
+		     itos(severite) +") " + msg);
+  errorBox->Draw();
+}
+
+
Index: /trunk/SophyaPI/PI/pierrdisp.h
===================================================================
--- /trunk/SophyaPI/PI/pierrdisp.h	(revision 15)
+++ /trunk/SophyaPI/PI/pierrdisp.h	(revision 15)
@@ -0,0 +1,49 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIERRDISP_H_SEEN
+#define PIERRDISP_H_SEEN
+
+#include "pisysdep.h"
+#include PIBWDG_H
+#include PISTDWDG_H
+#include PICONT_H
+#include PIPERIOD_H
+#include <string>
+
+#include "errorhandlerc.h"
+
+class PIErrorBox : public PIBaseWdg {
+public:
+  PIErrorBox(PIContainerGen* par, int sx=100, int sy = 50,
+	     int px=0, int py=0);
+  ~PIErrorBox();
+
+  void Draw();
+  
+  void SetText(string const& txt) {currErrText = txt;}
+  void Cycle();
+
+protected:
+  string currErrText;
+  int           state;     // Cycle decoratif en couleurs violentes...  
+};
+
+class PIErrorDisplay : public PIContainer, public PIPeriodic {
+public:
+  
+  PIErrorDisplay(PIContainerGen* par, int sx=150, int sy=50,
+		 int px=0, int py=0);
+  virtual      ~PIErrorDisplay();
+  
+  void          UpdData();
+  void          Process(long msg, PIMsgHandler *sender, void *data);
+  void          DoPeriodic() {UpdData();}
+protected:
+  int           currErrId;
+
+  PIErrorBox*   errorBox;
+  PIButton*     ackButton;
+  PIButton*     updButton;   // TEMPORAIRE
+};
+
+
+#endif
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 14)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 15)
@@ -6,4 +6,5 @@
 #include <stdlib.h>
 #include <stdio.h>
+#include <string>
 #include <string.h>
 
@@ -187,5 +188,5 @@
 {
 // printf("PIImage::Resize\n");
-PIPixmapX::Resize();
+PIPixmap::Resize();
 SetPave();
 Apply();
Index: /trunk/SophyaPI/PI/piperiodgen.h
===================================================================
--- /trunk/SophyaPI/PI/piperiodgen.h	(revision 15)
+++ /trunk/SophyaPI/PI/piperiodgen.h	(revision 15)
@@ -0,0 +1,26 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIPERIODGEN_H
+#define PIPERIODGEN_H
+
+#include <list.h>
+
+class PIPeriodGen;
+typedef list<PIPeriodGen*> PIPeriodList;
+
+class PIPeriodGen {
+public:
+  PIPeriodGen(int dT) : dt(dT) {} // dt en secondes
+  virtual ~PIPeriodGen() {}
+
+  virtual void DoPeriodic()=0;
+
+  virtual void Start()=0;
+  virtual void Stop()=0;
+
+protected:
+  int dt;
+};
+
+
+
+#endif
Index: /trunk/SophyaPI/PI/piperiodx.cc
===================================================================
--- /trunk/SophyaPI/PI/piperiodx.cc	(revision 15)
+++ /trunk/SophyaPI/PI/piperiodx.cc	(revision 15)
@@ -0,0 +1,56 @@
+#include "piperiodx.h"
+#include <algo.h>
+#include <signal.h>
+
+PIPeriodX::PIPeriodX(int d)
+: PIPeriodGen(d), it(-1)
+{}
+
+PIPeriodX::~PIPeriodX()
+{}
+
+void
+PIPeriodX::Start()
+{
+  if (it < 0) {
+    if (!actifs) actifs = new PIPeriodList;
+    it = 0;
+    if (actifs->size() == 0) {
+      signal(SIGALRM, CallBack);
+      alarm(1);
+    }
+    actifs->push_back(this);
+  }
+}
+
+void
+PIPeriodX::Stop()
+{
+  if (it >= 0) {
+    it = -1;
+    remove(actifs->begin(), actifs->end(), this);
+    if (actifs->size() == 0) {
+      signal(SIGALRM, NULL);
+      delete actifs;
+      actifs = NULL;
+    }
+  }
+}
+
+PIPeriodList* PIPeriodX::actifs = NULL;
+
+void PIPeriodX::CallBack(int)
+{
+  if (!actifs) return;
+
+  for (PIPeriodList::iterator i = actifs->begin(); i != actifs->end(); i++) {
+    PIPeriodX* p = (PIPeriodX*) *i;
+    p->it ++;
+    if (p->it >= p->dt) {
+      p->it = 0;
+      p->DoPeriodic();
+    }
+  }
+  alarm(1);
+}
+
Index: /trunk/SophyaPI/PI/piperiodx.h
===================================================================
--- /trunk/SophyaPI/PI/piperiodx.h	(revision 15)
+++ /trunk/SophyaPI/PI/piperiodx.h	(revision 15)
@@ -0,0 +1,24 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIPERIODX_H
+#define PIPERIODX_H
+
+#include "piperiodgen.h"
+
+class PIPeriodX : public PIPeriodGen {
+public:
+  PIPeriodX(int dt);
+  ~PIPeriodX();
+
+  void Start();
+  void Stop();
+
+  static PIPeriodList* actifs;
+  static void CallBack(int);
+
+protected:
+  int it;
+};
+
+typedef PIPeriodX PIPeriodic;
+
+#endif
Index: /trunk/SophyaPI/PI/pipixmapmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapmac.cc	(revision 14)
+++ /trunk/SophyaPI/PI/pipixmapmac.cc	(revision 15)
@@ -12,5 +12,5 @@
 
 /* --Methode-- */
-void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy)
+void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
 {
   if (nx != sx || ny != sy)
@@ -19,5 +19,5 @@
       mGWorld = NULL;
     }
-  PIPixmapGen::SetPixmap(pix, sx, sy);
+  PIPixmapGen::SetPixmap(pix, sx, sy, refr);
 }
 
Index: /trunk/SophyaPI/PI/pipixmapmac.h
===================================================================
--- /trunk/SophyaPI/PI/pipixmapmac.h	(revision 14)
+++ /trunk/SophyaPI/PI/pipixmapmac.h	(revision 15)
@@ -11,5 +11,5 @@
   virtual      ~PIPixmapMac();
 
-  virtual void  SetPixmap(unsigned char *pix, int sx, int sy);
+  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
   virtual void  Draw();
   virtual void	Refresh();
Index: /trunk/SophyaPI/PI/piqualmon.cc
===================================================================
--- /trunk/SophyaPI/PI/piqualmon.cc	(revision 15)
+++ /trunk/SophyaPI/PI/piqualmon.cc	(revision 15)
@@ -0,0 +1,268 @@
+//===========================================================================//
+//================================= piqualmon.cc ============================//
+//===========================================================================//
+
+#include <stdio.h>
+#include "piqualmon.h"
+#include "qualite.h"
+
+//========================= classe PIQualiteWin =============================//
+PIQualiteWin::PIQualiteWin(PIMsgHandler *par)
+:PIWindow(par, "Qualite Suivi", PIWK_normal, 660, 280, 160, 0)
+{
+  ccd = 0;
+  var1 = "FOND";
+  var2 = "FOND";
+  monitoring1    = new PIQualiteMon(this, "Fond", 300, 200, 20, 40);
+  monitoring2    = new PIQualiteMon(this, "Fond", 300, 200, 340,40);
+  menuccd        = new PIPUMenu(this, "CCD");
+  menuccd->AppendItem("tous", 80000);
+  menuccd->AppendItem("1", 80001);
+  menuccd->AppendItem("2", 80002);
+  menuccd->AppendItem("3", 80003);
+  menuccd->AppendItem("4", 80004);
+  menuccd->AppendItem("5", 80005);
+  menuccd->AppendItem("6", 80006);
+  menuccd->AppendItem("7", 80007);
+  menuccd->AppendItem("8", 80008);
+
+  menudata[0]    = new PIPUMenu(this, "Data");
+  menudata[0]->AppendItem("FOND" , 90001);
+  menudata[0]->AppendItem("SIGMA", 90002);
+  menudata[0]->AppendItem("NSTAR", 90003);
+
+  menudata[1]    = new PIPUMenu(this, "Data");
+  menudata[1]->AppendItem("FOND" , 90011);
+  menudata[1]->AppendItem("SIGMA", 90012);
+  menudata[1]->AppendItem("NSTAR", 90013);
+
+  optMenuccd     = new PIOptMenu    (this, menuccd, 80, 20, 290, 15); 
+  optMenudata[0] = new PIOptMenu    (this, menudata[0], 80, 20, 130, 250); 
+  optMenudata[1] = new PIOptMenu    (this, menudata[1], 80, 20, 450, 250); 
+  labccd         = new PILabel      (this, "CCD :", 50, 20, 240, 15);
+  labR           = new PILabel      (this, "Log R : ", 50, 20, 20, 3);
+  labB           = new PILabel      (this, "Log B : ", 50, 20, 20, 20);
+  labfileR       = new PILabel      (this, "FileR", 70, 20, 75, 3);
+  labfileB       = new PILabel      (this, "FileB", 70, 20, 75, 20);
+}
+
+PIQualiteWin::~PIQualiteWin()
+{
+  delete labfileB;
+  delete labfileR;
+  delete labB;
+  delete labR;
+  delete labccd;
+  delete optMenudata[0];
+  delete optMenudata[1];
+  delete menudata[0];
+  delete menudata[1];
+  delete optMenuccd;
+  delete menuccd;
+  delete monitoring1;
+  delete monitoring2;
+}
+
+void PIQualiteWin::UpdateInfo(LImageInfo linfo, char color, string labflnm)
+{  
+  if (color == 'r') {
+    linfoR = linfo;
+    labfileR->SetLabel(labflnm);
+  }
+  else if (color == 'b') {
+    linfoB = linfo;
+    labfileB->SetLabel(labflnm);
+  }
+  monitoring1->SetData(linfoR, linfoB, var1, ccd);
+  monitoring2->SetData(linfoR, linfoB, var2, ccd);
+}
+
+void PIQualiteWin::Process(long msg, PIMsgHandler *, void *)
+{
+  switch (msg) {
+  case 80000:
+  case 80001: case 80002: case 80003: case 80004: 
+  case 80005: case 80006: case 80007: case 80008:
+    ccd = msg - 80000;
+    monitoring1->SetData(linfoR, linfoB, var1, ccd);
+    monitoring2->SetData(linfoR, linfoB, var2, ccd);
+    break;
+  case 90001:
+    var1 = "FOND";
+    monitoring1->SetData(linfoR, linfoB, var1, ccd);
+    break;
+  case 90002:
+    var1 = "SIGMA";
+    monitoring1->SetData(linfoR, linfoB, var1, ccd);
+    break;
+  case 90003:
+    var1 = "NSTAR";
+    monitoring1->SetData(linfoR, linfoB, var1, ccd);
+    break;
+  case 90011:
+    var2 = "FOND";
+    monitoring2->SetData(linfoR, linfoB, var2, ccd);
+    break;
+  case 90012:
+    var2 = "SIGMA";
+    monitoring2->SetData(linfoR, linfoB, var2, ccd);
+    break;
+  case 90013:
+    var2 = "NSTAR";
+    monitoring2->SetData(linfoR, linfoB, var2, ccd);
+    break;
+
+  default:
+    cout << "Message " << msg << " non interprete" << endl;    
+  }   
+}
+
+//========================== classe PIQualiteMon ============================//
+
+PIQualiteMon::PIQualiteMon(PIContainerGen *par, char *nom, 
+			   int sx, int sy, int px, int py)
+: PIScDrawWdg(par, nom, sx, sy, px, py)
+{
+  SetAxesFlags(kBoxAxes | kTicks | kLabels);
+  ndataR = ndataB = 0;
+  xR = xB = NULL;
+  y1R = y1B = NULL;
+  y2R = y2B = NULL;
+}
+
+PIQualiteMon::~PIQualiteMon()
+{
+ if (xR != NULL) delete[] xR;
+ if (xB != NULL) delete[] xB;
+ if (y1R != NULL) delete[] y1R;
+ if (y1B != NULL) delete[] y1B;
+ if (y2R != NULL) delete[] y2R;
+ if (y2B != NULL) delete[] y2B;
+}
+
+void PIQualiteMon::SetData(LImageInfo linfoR, LImageInfo linfoB, string var, 
+			   int ccd)
+{
+  ndataR = (int)linfoR.size();
+  ndataB = (int)linfoB.size();
+  
+  // mise a zero des donnees deja existantes
+
+  if (xR  != NULL) { delete[] xR;  xR  = NULL; }
+  if (y1R != NULL) { delete[] y1R; y1R = NULL; }
+  if (y2R != NULL) { delete[] y2R; y2R = NULL; }
+  if (ndataR > 0) {
+    if((xR = new double[ndataR]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour xR\n");
+      return;
+    }
+    if((y1R = new double[ndataR]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour y1R\n");
+      return;
+    }
+    if (var == "SIGMA") if((y2R = new double[ndataR]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour y2R\n");
+      return;
+    }
+  }
+   
+  if (xB  != NULL) { delete[] xB;  xB  = NULL; }
+  if (y1B != NULL) { delete[] y1B; y1B = NULL; }
+  if (y2B != NULL) { delete[] y2B; y2B = NULL; }
+  if (ndataB >0) {
+    if((xB = new double[ndataB]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour xB\n");
+      return;
+    }
+    if((y1B = new double[ndataB]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour y1B\n");
+      return;
+    }
+    if (var == "SIGMA") if((y2B = new double[ndataB]) == NULL) {
+      printf("PIQualiteMon::SetData_Error memoire insuffisante pour y2B\n");
+      return;
+    }
+  }
+
+  // remplissage avec nouvelles valeurs 
+
+  ndataR = ndataB = 0;
+  float valmin=100000, valmax=0, heuremin=36, heuremax=-36;
+  char time[10];
+  float heure,min,sec;
+  for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+    if ((*i).nomimg.ccd == ccd || ccd == 0) {
+      (*i).date.GetTimeStr(time);
+      sscanf(time, "%f:%f:%f", &heure, &min, &sec);
+      heure = heure + min/60 + sec/3600;
+      if (heure > 12) heure -= 24; 
+      xR[ndataR] = heure;
+      if (heure > heuremax) heuremax = heure;
+      if (heure < heuremin) heuremin = heure;
+      if (var == "FOND") {
+	if((y1R[ndataR] = (*i).fond) == -1) continue;
+      }
+      else if (var == "SIGMA") {
+ 	if((y1R[ndataR] = (*i).sigmaX) == -1) continue;
+	if((y2R[ndataR] = (*i).sigmaY) == -1) continue;
+	if (y2R[ndataR] > valmax) valmax = y2R[ndataR];
+	if (y2R[ndataR] < valmin) valmin = y2R[ndataR] ;
+      }
+      else if (var == "NSTAR") {
+	if((y1R[ndataR] = (*i).nStars) == -1) continue;
+      }
+      if (y1R[ndataR] > valmax) valmax = y1R[ndataR];
+      if (y1R[ndataR] < valmin) valmin = y1R[ndataR];
+      ndataR++;
+    }
+  }
+  for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+    if ((*i).nomimg.ccd == ccd || ccd == 0) {
+      (*i).date.GetTimeStr(time);
+      sscanf(time, "%f:%f:%f", &heure, &min, &sec);
+      heure = heure + min/60 + sec/3600;
+      xB[ndataB] = heure;
+      if (heure > 12) heure -= 24; 
+      if (heure > heuremax) heuremax = heure;
+      if (heure < heuremin) heuremin = heure;
+      if (var == "FOND") {
+	if((y1B[ndataB] = (*i).fond) == -1) continue;
+      }
+      else if (var == "SIGMA") {
+	if((y1B[ndataB] = (*i).sigmaX) == -1) continue;
+	if((y2B[ndataB] = (*i).sigmaY) == -1) continue;
+	if (y2B[ndataB] > valmax) valmax = y2B[ndataB];
+	if (y2B[ndataB] < valmin) valmin = y2B[ndataB];
+      }
+      else if (var == "NSTAR") {
+ 	if((y1B[ndataB] = (*i).nStars) == -1) continue;
+     }
+      if (y1B[ndataB] > valmax) valmax = y1B[ndataB];
+      if (y1B[ndataB] < valmin) valmin = y1B[ndataB];
+      ndataB++;
+    }
+  }
+  float scale = heuremax-heuremin;
+  if (scale == 0) scale = 10;
+  SetLimits(heuremin-scale/10, heuremax+scale/10, valmin*.9, valmax*1.1);
+
+  Refresh();
+}
+
+void PIQualiteMon::DrawSelf()
+{
+  SelMarker(5,PI_FCircleMarker);
+  SelForeground(PI_Red);
+  if(ndataR) for (int i=0;i<ndataR;i++) {
+    ScDrawMarker(xR[i],y1R[i]);
+    if(y2R != NULL) ScDrawFCircle(xR[i],y2R[i],0.2);
+  }
+  SelMarker(5,PI_FCircleMarker);
+  SelForeground(PI_Blue);
+  if(ndataB) for (int i=0;i<ndataB;i++) {
+    ScDrawMarker(xB[i],y1B[i]);
+    if(y2B != NULL) ScDrawFCircle(xB[i],y2B[i],0.2);
+  }
+
+  SelForeground(PI_Black);
+}
Index: /trunk/SophyaPI/PI/piqualmon.h
===================================================================
--- /trunk/SophyaPI/PI/piqualmon.h	(revision 15)
+++ /trunk/SophyaPI/PI/piqualmon.h	(revision 15)
@@ -0,0 +1,65 @@
+// This may look like C code, but it is really -*- C++ -*-
+//===========================================================================//
+//================================= piqualmon.h =============================//
+//===========================================================================//
+
+
+#include "pisysdep.h"
+#include "piscdrawwdg.h"
+#include PISTDWDG_H
+#include PIOPTMENU_H
+#include PIWIN_H
+#include PIBWDG_H
+
+#include "qualite.h"
+
+class PIQualiteWin;
+class PIQualiteMon;
+
+class PIQualiteWin : public PIWindow {
+public:
+                      PIQualiteWin(PIMsgHandler* par);
+  virtual             ~PIQualiteWin();
+  virtual void        UpdateInfo(LImageInfo linfo, char color, string labflnm);
+  virtual void        Process(long msg, PIMsgHandler *sender, void *data);
+
+protected:
+  PIQualiteMon*       monitoring1;
+  PIQualiteMon*       monitoring2;
+  PIOptMenu*          optMenuccd;
+  PIPUMenu*           menuccd;
+  PIOptMenu*          optMenudata[2];
+  PIPUMenu*           menudata[2];
+  PILabel*            labccd;
+  PILabel*            labR;
+  PILabel*            labB;
+  PILabel*            labfileR;
+  PILabel*            labfileB;
+  LImageInfo          linfoR;
+  LImageInfo          linfoB;
+  int                 ccd;  // 0 pour tous
+  string              var1;
+  string              var2;
+};
+
+class PIQualiteMon : public PIScDrawWdg {
+public:
+                   PIQualiteMon(PIContainerGen *par, char *nom, 
+				int sx=10, int sy=10, int px=0, int py=0);
+  virtual          ~PIQualiteMon();
+
+  virtual void     DrawSelf();
+  void             SetData(LImageInfo linfoR, LImageInfo linfoB, string var, 
+			   int ccd);
+  
+protected:
+  int             ndataR;
+  int             ndataB;
+  double*         xR;
+  double*         xB;
+  double*         y1R;
+  double*         y2R;
+  double*         y1B;
+  double*         y2B;
+};
+
Index: /trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 14)
+++ /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 15)
@@ -59,6 +59,6 @@
   xScale = XSize() / (xMax-xMin + 2*margeH);
   yScale = -YSize() / (yMax-yMin + 2*margeV);
-  xOrg   = (-xMin + margeH) * xScale /* + XPos() */;  // $CHECK$ Reza Pourquoi + X,YPos() ?
-  yOrg   = (-yMax - margeV) * yScale /* + YPos() */;
+  xOrg   = (-xMin + margeH) * xScale;// + XPos();
+  yOrg   = (-yMax - margeV) * yScale;// + YPos();
 }
 
@@ -159,5 +159,5 @@
     if (x2 > xMax && x1 > xMax) return;
     if (y1 < yMin && y2 < yMin) return;
-    if (y2 > yMax && y2 > yMax) return;
+    if (y1 > yMax && y2 > yMax) return;
     if (x2 < x1) {
       swap(x1,x2);
Index: /trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 14)
+++ /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 15)
@@ -144,5 +144,5 @@
   virtual void       SetParms(double const*);
 protected:
-  GeneralFunction* mFunc;
+  GeneralFunction*    mFunc;
   int                 mNParms;
   double*             mParms;
Index: /trunk/SophyaPI/PI/pistatmon.cc
===================================================================
--- /trunk/SophyaPI/PI/pistatmon.cc	(revision 15)
+++ /trunk/SophyaPI/PI/pistatmon.cc	(revision 15)
@@ -0,0 +1,262 @@
+//===========================================================================//
+//=========================== pistatmon.cc ==================================//
+//===========================================================================//
+
+#include "pistatmon.h"
+#include "qualite.h"
+
+//=========================== classe PIStatWin ==============================//
+
+PIStatWin::PIStatWin(PIMsgHandler *par, char* nom, 
+		     int sx, int sy, int px, int py)
+:PIWindow(par, nom, PIWK_normal, sx, sy, px, py)
+{
+  monitoring1 = new PIStatMon  (this, "Dead", 235, 160, 10, 30);
+  monitoring2 = new PIStatMon  (this, "Sat", 235, 160, 255, 30);
+  butquit     = new PIButton   (this, "QUIT", 1010, 45,20,10,5);
+  string Nom = nom;
+  if (Nom.substr(Nom.rfind(" ")+1,3) == "pix") {
+    label1      = new PILabel    (this, "Pix. nuls (%)", 235,20,10,5);
+    label2      = new PILabel    (this, "Pix. sat. (%)", 235,20,255,5);
+  }
+  else if (Nom.substr(Nom.rfind(" ")+1,3) == "col") {
+    label1      = new PILabel   (this, "Nb colonnes nulles", 235,20,10,5);
+    label2      = new PILabel   (this, "Nb colonnes saturees", 235,20,255,5);
+    label3      = new PILabel   (this, "Nb discontinuites haut",235,20,10,205);
+    label4      = new PILabel   (this, "Nb discontinuites bas",235,20,255,205);
+    monitoring3 = new PIStatMon (this, "Up", 235, 160, 10, 230);
+    monitoring4 = new PIStatMon (this, "Down", 235, 160, 255, 230);
+  }
+  else cout << "PROBLEME : " << Nom.substr(Nom.rfind(" ")+1,3) 
+            << "ni pix ni col" << endl;
+
+  ShowWin = 0;
+}
+
+PIStatWin::~PIStatWin()
+{
+  delete butquit;
+  delete label1;
+  delete label2;
+  if (label3 != NULL) delete label3;
+  if (label4 != NULL) delete label4;
+  delete monitoring1;
+  delete monitoring2;
+  if (monitoring3 != NULL) delete monitoring3;
+  if (monitoring4 != NULL) delete monitoring4;
+}
+
+void PIStatWin::UpdateInfo(LImageInfo linfoR, LImageInfo linfoB, string var)
+{
+  int choix;
+  if(var == "pixels") choix = 10;
+  else if(var == "colonnes") {
+    choix = 100;
+    monitoring3->SetData(linfoR, linfoB, choix+3);
+    monitoring4->SetData(linfoR, linfoB, choix+4);
+  }
+  else cout << "Variable " << var << " non reconnue" << endl;
+  monitoring1->SetData(linfoR, linfoB, choix+1);
+  monitoring2->SetData(linfoR, linfoB, choix+2);
+  if (ShowWin) {
+    monitoring1->Refresh();
+    monitoring2->Refresh();
+    if(var == "colonnes") {
+      monitoring3->Refresh();
+      monitoring4->Refresh();
+    }
+  }
+}
+
+void PIStatWin::Process(long msg, PIMsgHandler *, void *)
+{
+  switch (msg) {
+  case 1010:
+    this->Hide();
+    ShowWin = 0;
+    break;
+
+  default:
+    cout << "Message " << msg << " non interprete" << endl;
+  }
+}
+
+//=========================== classe PIStatMon ==============================//
+
+PIStatMon::PIStatMon(PIContainerGen *par, char *nom, int sx, int sy, 
+		     int px, int py)
+: PIScDrawWdg(par, nom, sx, sy, px, py)
+{
+  SetAxesFlags(kBoxAxes | kTicks | kLabels);
+  for (int i=0;i<8;i++) {
+    ndataR[i] = ndataB[i] = 0;
+    yR[i] = yB[i] = NULL;
+  }
+  for (int i=0;i<16;i++) x[i] = i;
+}
+
+PIStatMon::~PIStatMon()
+{
+  for(int i=0; i<8; i++) {
+    if (yR[i] != NULL) delete[] yR[i];
+    if (yB[i] != NULL) delete[] yB[i];
+  }
+}
+
+void PIStatMon::SetData(LImageInfo linfoR, LImageInfo linfoB, int choix)
+{
+  for (int i=0;i<8;i++) {
+    ndataR[i] = (int)linfoR.size();
+    ndataB[i] = (int)linfoB.size();
+    if((yR[i] = new double[ndataR[i]]) == NULL) {
+      printf("PIStatMon::SetData_Error memoire insuffisante pour yR\n");
+      return;
+    }
+    if((yB[i] = new double[ndataB[i]]) == NULL) {
+      printf("PIStatMon::SetData_Error memoire insuffisante pour yB\n");
+      return;
+    }
+  }
+
+  for(int i=0;i<8;i++) ndataR[i] = ndataB[i] = 0;
+  int ccd;
+
+  float valmin=100000, valmax=0;
+  switch(choix) {
+  case 11:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).fracNul != -1) yR[ccd][ndataR[ccd]] = (*i).fracNul * 100;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+    }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).fracNul != -1) yB[ccd][ndataB[ccd]] = (*i).fracNul * 100;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+  case 12:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).fracSat != -1) yR[ccd][ndataR[ccd]] = (*i).fracSat * 100;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+    }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).fracSat != -1) yB[ccd][ndataB[ccd]] = (*i).fracSat * 100;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+  case 101:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nDeadCol != -1) yR[ccd][ndataR[ccd]] = (*i).nDeadCol;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+    }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nDeadCol != -1) yB[ccd][ndataB[ccd]] = (*i).nDeadCol;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+  case 102:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nSatCol != -1) yR[ccd][ndataR[ccd]] = (*i).nSatCol;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+     }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nSatCol != -1) yB[ccd][ndataB[ccd]] = (*i).nSatCol;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+  case 103:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nUpCol != -1) yR[ccd][ndataR[ccd]] = (*i).nUpCol;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+    }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nUpCol != -1) yB[ccd][ndataB[ccd]] = (*i).nUpCol;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+  case 104:
+    for (LImageInfo::iterator i=linfoR.begin(); i!=linfoR.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nDownCol != -1) yR[ccd][ndataR[ccd]] = (*i).nDownCol;
+      if (yR[ccd][ndataR[ccd]] > valmax) valmax = yR[ccd][ndataR[ccd]];
+      if (yR[ccd][ndataR[ccd]] < valmin) valmin = yR[ccd][ndataR[ccd]] ;
+      ndataR[ccd]++;
+    }
+    for (LImageInfo::iterator i=linfoB.begin(); i!=linfoB.end(); i++) {
+      if ((ccd = (*i).nomimg.ccd) >=8) ccd -= 8;             //TEMPORAIRE
+      if((*i).nDownCol != -1) yB[ccd][ndataB[ccd]] = (*i).nDownCol;
+      if (yB[ccd][ndataB[ccd]] > valmax) valmax = yB[ccd][ndataB[ccd]];
+
+      if (yB[ccd][ndataB[ccd]] < valmin) valmin = yB[ccd][ndataB[ccd]] ;
+      ndataB[ccd]++;
+    }
+    SetLimits(0, 15, valmin*.9, valmax*1.1);
+    break;
+    
+  default:
+    cout << "Choix " << choix << " non interprete" << endl;      
+  }
+}
+
+void PIStatMon::DrawSelf()
+{
+  for(int i=0;i<8;i++) {
+    if(ndataR[i]) {    // on imprime donnees sur camera ROUGE
+      SelForeground(PI_Black);
+      SelMarker(5,PI_FCircleMarker);
+      for(int j=0;j<ndataR[i]-1;j++) ScDrawMarker(x[i],yR[i][j]);
+      SelForeground(PI_Red);
+      SelMarker(7,PI_FCircleMarker);
+      ScDrawMarker(x[i],yR[i][ndataR[i]-1]);
+    }
+    if(ndataB[i]) {    // on imprime donnees sur camera BLEU
+      SelForeground(PI_Black);
+      SelMarker(5,PI_FCircleMarker);
+      for(int j=0;j<ndataB[i]-1;j++) ScDrawMarker(x[i+8],yB[i][j]);
+      SelForeground(PI_Blue);
+      SelMarker(7,PI_FCircleMarker);
+      ScDrawMarker(x[i+8],yB[i][ndataB[i]-1]);
+    }
+  }
+  SelForeground(PI_Grey);
+  SelLine(PI_ThinLine);
+  ScDrawLine(7.5,-100,7.5,5000);
+  SelLine(PI_NormalLine);
+  SelForeground(PI_Black);
+  DrawString(190,155,"ccd");
+}
+
Index: /trunk/SophyaPI/PI/pistatmon.h
===================================================================
--- /trunk/SophyaPI/PI/pistatmon.h	(revision 15)
+++ /trunk/SophyaPI/PI/pistatmon.h	(revision 15)
@@ -0,0 +1,53 @@
+//===========================================================================//
+//=========================== pistatmon.h ===================================//
+//===========================================================================//
+
+#include "pisysdep.h"
+#include "piscdrawwdg.h"
+#include PIWIN_H
+#include PIBWDG_H
+#include PISTDWDG_H
+
+#include "qualite.h"
+
+class PIStatWin;
+class PIStatMon;
+
+class PIStatWin : public PIWindow {
+public:
+                     PIStatWin(PIMsgHandler* par, char* nom, 
+			       int sx, int sy, int px, int py);
+  virtual            ~PIStatWin();
+  virtual void       Process(long msg, PIMsgHandler *sender, void *data);
+  void               UpdateInfo(LImageInfo linfoR, LImageInfo linfoB, 
+				string var);
+  int                ShowWin;
+
+protected:
+  PIStatMon*         monitoring1;
+  PIStatMon*         monitoring2;
+  PIStatMon*         monitoring3;
+  PIStatMon*         monitoring4;
+  PIButton*          butquit;
+  PILabel*           label1;
+  PILabel*           label2;
+  PILabel*           label3;
+  PILabel*           label4;
+};
+
+class PIStatMon : public PIScDrawWdg {
+public:
+                     PIStatMon(PIContainerGen *par, char *nom, 
+		               int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PIStatMon();
+  void               SetData(LImageInfo linfoR, LImageInfo linfoB, int choix);
+  virtual void       DrawSelf();
+  
+protected:
+  int                ndataR[8];
+  int                ndataB[8];
+  int                x[16];
+  double*            yR[8];
+  double*            yB[8];
+};
+
Index: /trunk/SophyaPI/PI/pisysdep.h
===================================================================
--- /trunk/SophyaPI/PI/pisysdep.h	(revision 14)
+++ /trunk/SophyaPI/PI/pisysdep.h	(revision 15)
@@ -12,5 +12,5 @@
   #define PIOPTMENU_H "pioptmenumac.h"
   #define PIFILECHO_H "pifilechomac.h"
-
+  #define PIPERIOD_H "piperiodmac.h"
   #define PIAPP_H "piapplmac.h"
   
@@ -31,5 +31,5 @@
   #define PIOPTMENU_H "pioptmenux.h"
   #define PIFILECHO_H "pifilechox.h"
-
+  #define PIPERIOD_H "piperiodx.h"
   #define PIAPP_H "piapplx.h"
 
Index: /trunk/SophyaPI/PI/pitestapp.cc
===================================================================
--- /trunk/SophyaPI/PI/pitestapp.cc	(revision 14)
+++ /trunk/SophyaPI/PI/pitestapp.cc	(revision 15)
@@ -216,5 +216,5 @@
     {
     if (!fgpxm)  { wp3->Show();  fgpxm = true; }
-    for (int i=0; i<25000; i++)  pixels[i] = random()%32;
+    for (int i=0; i<25000; i++)  pixels[i] = rand()%32;
     if ((x % 3) == 0)  pxm->SetColMap(CMAP_GREY32);
     if ((x % 3) == 1)  pxm->SetColMap(CMAP_COLRJ32);
Index: /trunk/SophyaPI/PI/piupdattachment.cc
===================================================================
--- /trunk/SophyaPI/PI/piupdattachment.cc	(revision 14)
+++ /trunk/SophyaPI/PI/piupdattachment.cc	(revision 15)
@@ -16,5 +16,5 @@
 PIUpdAttachment::~PIUpdAttachment()
 {
-  SysBeep(1);
+ // SysBeep(1);
 }
 
Index: /trunk/SophyaPI/PI/piwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/piwdgmac.cc	(revision 14)
+++ /trunk/SophyaPI/PI/piwdgmac.cc	(revision 15)
@@ -31,5 +31,14 @@
 	mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
 
-    mPane = new LPane(mPaneInfo);
+  mViewInfo.imageSize.width = sx;
+  mViewInfo.imageSize.height = sy;
+  mViewInfo.scrollPos.h = 
+    mViewInfo.scrollPos.v = 
+    mViewInfo.scrollUnit.h = 
+    mViewInfo.scrollUnit.v = 0;
+  mViewInfo.reconcileOverhang = 0;
+  
+  mPane = new LView(mPaneInfo, mViewInfo);
+  ((LView*)mPane)->CalcPortOrigin();
 }
 
Index: /trunk/SophyaPI/PI/piwdgmac.h
===================================================================
--- /trunk/SophyaPI/PI/piwdgmac.h	(revision 14)
+++ /trunk/SophyaPI/PI/piwdgmac.h	(revision 15)
@@ -29,4 +29,5 @@
   LPane*				 mPane;
   SPaneInfo				 mPaneInfo;
+  SViewInfo				 mViewInfo;
   string                 mNom;
 };
Index: /trunk/SophyaPI/PI/sc_sample.cc
===================================================================
--- /trunk/SophyaPI/PI/sc_sample.cc	(revision 14)
+++ /trunk/SophyaPI/PI/sc_sample.cc	(revision 15)
@@ -38,4 +38,8 @@
 SelForeground(PI_Black);
 
+ScDrawLine(-4, -4, 4, 4);
+ScDrawLine(-2, -5, 5, 2);
+ScDrawLine(-5, -4, -2, -2);
+ScDrawLine(1, -10, 1, 10);
 return;  
 }
