Changeset 37 in Sophya


Ignore:
Timestamp:
Feb 24, 1997, 4:34:49 PM (29 years ago)
Author:
ansari
Message:
  • Amelioration gestion couleurs ds picmapx.cc + Gestion d'Elts graphique ds

pipixmapgen.cc,.h , remplacement de GetXmString par fonction CStrFrXmStr()

  • Gestion de fenetre d'image totale ds piimage.cc piimage.h
  • Raccourci clavier pour les menus - PIMsg_Resize et PIMsg_Drop (pimsghandler.h)
  • Gestion de sens d'axe (X ou Y) et Position Click ds piscdrawwdg.cc,.h
  • + Petites corrections de bug, amelioration Reza 24/02/97
Location:
trunk/SophyaPI/PI
Files:
2 added
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r30 r37  
    44 
    55all: $(LIB)libPI.a
    6 $(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
     6$(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psdict.o $(OBJ)psfile.o
    77        $(AR) $(ARFLAGS)  $@ $?
    88 
     
    1414 pimenubargen.h pimenux.h pimenugen.h
    1515$(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
    16  pimsghandler.h
     16 pimsghandler.h psfile.h $(INC)defs.h \
     17 pibwdgx.h picmap.h picmapx.h picmapgen.h
    1718$(OBJ)pibwdgx.o: pibwdgx.cc pibwdgx.h pisysdep.h pibwdggen.h piwdgx.h \
    18  piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h
     19 piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h psfile.h \
     20 $(INC)defs.h picmap.h picmapx.h picmapgen.h
    1921$(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h
    2022$(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h
     
    4446 $(INC)perrors.h \
    4547 $(INC)exceptions.h \
    46  $(INC)peidainit.h
     48 $(INC)peidainit.h \
     49 $(INC)fmath.h
    4750$(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \
    4851 $(INC)rzimage.h \
     
    5558 $(INC)imaginit.h \
    5659 $(INC)datatypes.h \
     60 $(INC)ppersist.h \
     61 $(INC)pclassids.h \
     62 $(INC)dvlist.h \
    5763 $(INC)lut.h pisysdep.h pipixmapx.h \
    5864 pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h \
     
    7177 $(INC)peida.h \
    7278 $(INC)utils.h \
     79 $(INC)fmath.h \
    7380 $(INC)array.h \
    7481 $(INC)lockfile.h \
     
    104111$(OBJ)pipixmapx.o: pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \
    105112 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    106  picmapx.h picmapgen.h
     113 picmapx.h picmapgen.h psfile.h $(INC)defs.h
    107114$(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
    108115 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \
     
    117124 $(INC)machine.h \
    118125 $(INC)perrors.h \
     126 $(INC)fmath.h \
    119127 $(INC)ppersist.h \
    120128 $(INC)pclassids.h \
     
    124132$(OBJ)pistdwdgx.o: pistdwdgx.cc pisysdep.h pistdwdgx.h pistdwdggen.h \
    125133 piwdgx.h piwdggen.h pimsghandler.h
     134$(OBJ)pistlist.o: pistlist.cc pistlist.h piscdrawwdg.h pisysdep.h pibwdgx.h \
     135 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \
     136 pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
     137 picontainergen.h $(INC)stlist.h \
     138 $(INC)machine.h \
     139 $(INC)defs.h \
     140 $(INC)exceptions.h \
     141 $(INC)peidainit.h \
     142 $(INC)perrors.h \
     143 $(INC)dynccd.h \
     144 $(INC)ppersist.h \
     145 $(INC)pclassids.h \
     146 $(INC)imaginit.h \
     147 $(INC)star.h \
     148 $(INC)strecinit.h \
     149 $(INC)starmacro.h \
     150 $(INC)psf.h \
     151 $(INC)peida.h \
     152 $(INC)utils.h \
     153 $(INC)fmath.h \
     154 $(INC)cimage.h \
     155 $(INC)rzimage.h \
     156 $(INC)rzvect.h \
     157 $(INC)datatypes.h \
     158 $(INC)dvlist.h \
     159 $(INC)generalfit.h \
     160 $(INC)matrix.h \
     161 $(INC)cvector.h \
     162 $(INC)transfo.h \
     163 $(INC)poly.h \
     164 $(INC)zfidu.h
    126165$(OBJ)piup.o: piup.cc $(INC)ctimer.h \
    127166 $(INC)peida.h \
     
    132171 $(INC)exceptions.h \
    133172 $(INC)peidainit.h \
     173 $(INC)fmath.h \
    134174 $(INC)imageop.h \
    135175 $(INC)cimage.h \
     
    138178 $(INC)imaginit.h \
    139179 $(INC)datatypes.h \
     180 $(INC)ppersist.h \
     181 $(INC)pclassids.h \
     182 $(INC)dvlist.h \
    140183 $(INC)fitsimage.h \
    141184 $(INC)fitsheader.h \
     
    153196 $(INC)tarlib.h piup.h
    154197$(OBJ)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \
    155  pisysdep.h piwdgx.h
     198 pisysdep.h piwdgx.h psfile.h $(INC)defs.h \
     199 pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h
    156200$(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \
    157201 pisysdep.h picontainergen.h
    158202$(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \
    159  picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
     203 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h psfile.h \
     204 $(INC)defs.h pibwdgx.h pibwdggen.h picmap.h \
     205 picmapx.h picmapgen.h
    160206$(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \
    161207 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
    162208$(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
    163209 piwdgx.h piwdggen.h pimsghandler.h pixtbase.h
     210$(OBJ)psdict.o: psdict.cc psfile.h $(INC)defs.h \
     211 pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
     212 picmap.h picmapx.h picmapgen.h
     213$(OBJ)psfile.o: psfile.cc psfile.h $(INC)defs.h \
     214 pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
     215 picmap.h picmapx.h picmapgen.h
  • trunk/SophyaPI/PI/pibwdggen.h

    r32 r37  
    5757//  Trace graphiques
    5858  virtual void       EraseWindow()             = 0;
    59   virtual void       DrawString(int x, int y, char* s, int pos = 0)        = 0;
     59  virtual void       DrawString(int x, int y, char* s, int pos = 0)  = 0;
    6060  virtual void       DrawLine(int x1, int y1, int x2, int y2)              = 0;
    6161  virtual void       DrawBox(int x0, int y0, int dx, int dy)               = 0;
  • trunk/SophyaPI/PI/picmapx.cc

    r30 r37  
    9595
    9696if ( (index < 0) || (index > mNCol) )  return;
     97
     98if ( (col.red == 0) && (col.green == 0) && (col.blue == 0) )
     99  {
     100  mColors[index] = BlackPixel(PIXDisplay(), PIXScreen());
     101  mColRGB[index] = col;
     102  return;
     103  }
     104
    97105myxcol.red = col.red;
    98106myxcol.blue = col.blue;
    99107myxcol.green = col.green;
     108
    100109
    101110if ( XAllocColor(PIXDisplay(), defxcmap, &myxcol) )
     
    121130void PIColorMapX::FreeColors()
    122131{
     132PIXColor bpix;
     133PIColor blc;
     134
    123135if (!xinicmap) 
    124136  {
     
    127139  }
    128140
    129 XFreeColors(PIXDisplay(), defxcmap, mColors,  mNCol, 0);
     141for (int i=0; i<mNCol; i++)
     142  if ( (mColRGB[i].red != 0) && (mColRGB[i].blue != 0) &&  (mColRGB[i].green != 0) )
     143    XFreeColors(PIXDisplay(), defxcmap, mColors+i, 1, 0);
    130144
     145bpix = BlackPixel(PIXDisplay(), PIXScreen());
     146blc.red = blc.green = blc.blue = 0;
    131147for (int i=0; i<mNCol; i++) 
    132   { mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
    133   mColRGB[i].red = mColRGB[i].green = mColRGB[i].blue = 0; }
     148  { mColors[i] = bpix;   mColRGB[i] = blc; }
    134149
    135150printf("PIColorMapX::FreeColors()  Type= %d mNCol= %d \n",
  • trunk/SophyaPI/PI/pifilechox.cc

    r23 r37  
    1010#include <X11/Shell.h>
    1111#include <Xm/FileSB.h>
     12
     13// Pour ces sal... de XmString  (ds piwdgx.cc)
     14int CStrFrXmStr(XmString xms, char* buff, int nmx);
    1215
    1316// Fonctions privees (CallBack)
     
    2427pif->MWin()->Unmanage();
    2528//pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str()));
    26 char *flnm;
    27 XmStringGetLtoR(calld->value, XmSTRING_DEFAULT_CHARSET, &flnm);
    28 strncpy(pif->mFName, flnm, 511);
     29CStrFrXmStr(calld->value, pif->mFName, 512);
    2930pif->Send( pif->Msg(), PIMsg_OK, (void *) pif->mFName);
    3031return;
     
    142143if (mSt)
    143144  {
    144   char *buff;
    145145  XmString xmstr;
    146146  Arg warg[2];
     
    148148  XtSetArg(warg[0], XmNtextString, &xmstr);
    149149  XtGetValues(XtWdg(), warg, 1);
    150   XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);
    151   string s(buff);
     150  CStrFrXmStr(xmstr, mFName, 512);
     151  string s(mFName);
    152152  XmStringFree(xmstr);
    153153  return(s);
     
    155155else
    156156  {
    157   string s("");
     157  mFName[0] = '\0';
     158  string s(mFName);
    158159  return(s);
    159160  }
  • trunk/SophyaPI/PI/pihisto.cc

    r18 r37  
    1212  if (ahisup)
    1313    delete mHisto;
    14 }
    15 
    16 void
    17 PIHisto::SetAutoDelHisto(bool ad)
    18 {
    19   ahisup = ad;
    2014}
    2115
  • trunk/SophyaPI/PI/pihisto.h

    r18 r37  
    1313  virtual void       DrawStats();
    1414  virtual void       Refresh();  // Recalcule les limites, et reaffiche
    15   void               SetAutoDelHisto(bool ad=false);
     15  inline  void       SetAutoDelHisto(bool ad=false) {  ahisup = ad; }
     16  inline  Histo*     Histogram() { return(mHisto); }
     17
    1618protected:
    1719  Histo* mHisto;
  • trunk/SophyaPI/PI/piimage.cc

    r36 r37  
    2424curshow = true;
    2525winovis = true;     // $CHECK$ Reza A enlever si possible 17/6/96
    26 zow = NULL;
     26
     27admrk = true;
     28xpmrk = ypmrk = NULL;   nbmrk = 0;
     29mrkt = PI_PlusMarker;   mrkbsz = 3;
     30
     31zow = NULL;
     32gvw = NULL;
    2733trtw = NULL;
    2834trtlb = txw = NULL;
    2935SetTextWin(NULL);
    30 zpixm = pixm = NULL;
    31 xszpxm = xspxm = 0;
    32 yszpxm = yspxm = 0;
     36gpixm = zpixm = pixm = NULL;
     37xsgpxm = xszpxm = xspxm = 0;
     38ysgpxm = yszpxm = yspxm = 0;
    3339lut = NULL;
    3440offx = offy = 0;
     
    4046xcurs = ycurs = -1;
    4147zoom = 1;
     48zmgv = 1;
    4249
    4350SetColMap(CMAP_COLRJ32);
     
    6067if (pixm) delete pixm;
    6168if (zpixm) delete zpixm;
     69if (txw)  txw->SetLabel("");
     70if (zow)
     71  {
     72  zow->SetPixmap(NULL,0,0);
     73  zow->EraseWindow();
     74  }
     75if (gpixm) delete gpixm;
     76if (gvw)
     77  {
     78  gvw->SetPixmap(NULL,0,0);
     79  gvw->EraseWindow();
     80  gvw->SetMsg(0); gvw->SetMsgParent(NULL);
     81  gvw->SetUserData(NULL, 0);
     82  }
    6283if (lut) delete lut;
    6384if (aisup)  delete img;   // Suppression automatique d'image
     85if (admrk)
     86  {
     87  if (xpmrk)  delete xpmrk;
     88  if (ypmrk)  delete ypmrk;
     89  }
    6490if (trtw)  delete trtw;
     91}
     92
     93/* --Methode-- */
     94void PIImage::Process(PIMessage msg, PIMsgHandler* sender, void* data)
     95{
     96if (UserMsg(msg) == (Msg()+626))
     97  {
     98  if (ModMsg(msg) == PIMsg_Click)
     99    { int* pxy=(int *)data;   SetPave(pxy[0]*zmgv, pxy[1]*zmgv); }
     100  if (ModMsg(msg) == PIMsg_Resize)
     101    { ComputeGloVPixmap();   SetGloVPixmap(); }
     102  }
     103else ReSend(msg, sender, data);
     104return;
    65105}
    66106
     
    73113xszpav = yszpav = 1;
    74114img = pim;
     115if (gpixm) delete gpixm;
     116gpixm = NULL;
     117xsgpxm = ysgpxm = 0;
     118zmgv = 1;
     119
    75120if (img)
    76121  {
     
    83128}
    84129
     130/* --Methode-- */
     131void PIImage::AddMarks(int nm, float* px, float* py, bool refr, bool ad, PIMarker mrk, int msz)
     132{
     133if ( (nbmrk > 0) && admrk ) {
     134  if (xpmrk)  delete xpmrk;
     135  if (ypmrk)  delete ypmrk;
     136}
     137if (nm <= 0) { nbmrk = 0; xpmrk = ypmrk = NULL; }
     138else { nbmrk = nm;  xpmrk = px, ypmrk = py; }
     139admrk = ad;  mrkt = mrk;  mrkbsz = msz;
     140if (refr)  DrawMarks(0, XSize(), 0, YSize());
     141return;
     142}
     143
     144/* --Methode-- */
     145void PIImage::RemoveMarks(bool refr)
     146{
     147if (nbmrk < 1)  return;
     148if (admrk ) {
     149  if (xpmrk)  delete xpmrk;
     150  if (ypmrk)  delete ypmrk;
     151}
     152nbmrk = 0; xpmrk = ypmrk = NULL;
     153if (refr)  Refresh();
     154}
    85155
    86156/* --Methode-- */
     
    89159zow = zw;
    90160if (zow && refr && img)
    91   {
    92   zow->SetColMap(GetColMapId(), false);
    93161  ComputeZoomPixmap();
    94   }
    95 return;
    96 }
     162return;
     163}
     164
     165/* --Methode-- */
     166void PIImage::SetGloVWin(PIPixmap * zw, bool refr)
     167{
     168gvw = zw;
     169if (gvw && img) 
     170  { ComputeGloVPixmap();
     171  if (refr) SetGloVPixmap(); }
     172return;
     173}
     174
     175
    97176
    98177/* --Methode-- */
     
    170249lut = new LUT(min, max, NbCol(), typlut);
    171250
     251ComputeGloVPixmap();
    172252if (refr) Apply();
    173253return;
     
    182262if (olut) delete olut;
    183263
     264ComputeGloVPixmap();
    184265if (refr) Apply();
    185266return;
     
    202283{
    203284if ((zm == 0) || (zm == -1) )  zoom = 1;
    204 else if (zm > 10)  zoom = 10;
    205 else if (zm < -10) zoom = -10;
     285else if (zm > 20)  zoom = 20;
     286else if (zm < -20) zoom = -20;
    206287else zoom = zm;
    207288if (img)
     
    235316
    236317/* --Methode-- */
    237 void PIImage::SetPave(int x, int y, bool refr)
     318void PIImage::SetPave(int x, int y, bool refr, bool cent)
    238319{
    239320int xc, yc;
     
    247328     (y >= (img->YSize()-1)) || ( y < 0)  ) return;
    248329
     330if ( (x == xpav) && (y == ypav) )  return;
    249331xpav = x;  ypav = y;
    250 if (PosImg2W(xpav,ypav,&xc, &yc))  // Il faut recenter l'image
     332
     333if ( PosImg2W(xpav,ypav,&xc, &yc) || cent)  // Il faut recenter l'image
    251334  { SetOffsetFromPave(); 
    252335  if (refr) Apply(true);  }
     
    263346PIPixmap::SetColMap(cmap, refr);
    264347if (zow)  zow->SetColMap(cmap, refr);
     348if (gvw)  gvw->SetColMap(cmap, refr);
    265349return;
    266350}
     
    272356if (img == NULL)  return;
    273357if (mw)
    274   {
     358  {  
    275359  ComputePixmap();
    276360  Send(Msg(), PIMsg_Active);
    277361  }
    278 if (zow != NULL)
    279   {
    280   zow->SetColMap(GetColMapId(), false);
    281   ComputeZoomPixmap();
    282   }
     362if (zow != NULL)   ComputeZoomPixmap();
     363if (gvw != NULL)
     364  if ( (gvw->UserData() != this) || (mw) )  SetGloVPixmap();
     365
    283366if (txw || trtlb)
    284367  {
     
    315398      (yc >= y0) && (yc < y0+dy) )  DrawCursor(xc, yc);
    316399  }
     400
     401DrawMarks(x0, x0+dx, y0, y0+dy);
    317402return;
    318403}
     
    360445void PIImage::But2Press(int x, int y)
    361446{
    362 int xp, yp;
    363447
    364448Send(Msg(), PIMsg_Active);
     
    614698
    615699zpixm = ComputePixmap(ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);
     700zow->SetColMap(GetColMapId(), false);
    616701zow->SetPixmap(zpixm, xszpxm, yszpxm);
    617702zow->SetUserData((void *)this, 0);
     
    621706}
    622707
     708
     709/* --Methode-- */
     710void PIImage::ComputeGloVPixmap()
     711{
     712unsigned int xwsz, ywsz;
     713int zmx,zmy;
     714
     715if (gvw == NULL)  return;
     716if (img == NULL)  return;
     717
     718xwsz = gvw->XSize();
     719ywsz = gvw->YSize();
     720
     721zmx = img->XSize()/xwsz;
     722zmy = img->YSize()/ywsz;
     723
     724if (zmx < zmy)   zmx = zmy;
     725if (zmx < 1)  zmx = 1;
     726zmgv = zmx;
     727if (zmx > 1)  zmx = -zmx;
     728gpixm = ComputePixmap(0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm);
     729return;
     730}
     731
     732/* --Methode-- */
     733void PIImage::SetGloVPixmap()
     734{
     735float zm;
     736int x,y, dx,dy;
     737
     738if (zoom > 0) zm = zmgv*zoom;
     739else zm = (float)zmgv/(float)(-zoom);
     740x = offx/zmgv+1;
     741y = offy/zmgv+1;
     742dx =  (int) ( (float)XSize()/zm-1. ); 
     743dy =  (int) ( (float)YSize()/zm-1. ); 
     744
     745gvw->ElDelAll();
     746gvw->SelForeground(PI_Yellow);
     747gvw->SelLine(PI_NormalLine);
     748gvw->ElAddRect(x,y,dx,dy);
     749gvw->SetColMap(GetColMapId(), false);
     750gvw->SetPixmap(gpixm, xsgpxm, ysgpxm);
     751gvw->SetUserData((void *)this, 0);
     752gvw->SetMsg(Msg()+626);
     753gvw->SetMsgParent(this);
     754
     755return;
     756}
     757
    623758/* --Methode-- */
    624759void PIImage::DrawCursor()
     
    645780  if (zoom < 3)  SelLine(PI_NormalLine);
    646781  else SelLine(PI_ThickLine);
     782  if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
     783    SelForeground(PI_Red);
     784  else SelForeground(PI_White);
    647785  SelGOMode(PI_GOCopy);
    648786  DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
     
    653791else { xcurs = ycurs = -1; }
    654792
     793return;
     794}
     795
     796/* --Methode-- */
     797void PIImage::DrawMarks(int x1, int x2, int y1, int y2)
     798{
     799float fz;
     800float tofx, tofy;
     801int i,x,y;
     802
     803if ( (winovis || (nbmrk < 1) ) ) return;
     804tofx = tofy = 0;
     805if ( img ) { tofx = img->XOrg(); tofy = img->YOrg(); } 
     806tofx += offx;  tofy += offy;
     807fz = GetZoomF();
     808SelGOMode(PI_GOCopy);
     809SelMarker((int)(fz*mrkbsz), mrkt);
     810if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
     811  SelForeground(PI_Red);
     812else SelForeground(PI_White);
     813for(i=0; i<nbmrk; i++)
     814  {
     815  x = (int) ((xpmrk[i]-tofx)*fz);
     816  y = (int) ((ypmrk[i]-tofy)*fz);
     817  if ((x < x1) || (x > x2) || (y < y1) || (y > y2))  continue;
     818  DrawMarker(x,y);
     819  }
    655820return;
    656821}
  • trunk/SophyaPI/PI/piimage.h

    r23 r37  
    1919
    2020public:
     21  enum {ClassId = 5150};
     22
    2123//  Les methodes
    2224
     
    2527  ~PIImage();
    2628
    27   void SetImage(RzImage *pim, bool refr=true);
     29  virtual long    kind() {return ClassId; }
     30  virtual void    Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
     31
     32  void SetImage(RzImage* pim, bool refr=true);
    2833  void SetAutoDelImage(bool ad = false);
    2934
     35  void AddMarks(int nm, float* px, float* py, bool refr=true,
     36                bool ad=true, PIMarker mrk=PI_PlusMarker, int msz=3);
     37  void RemoveMarks(bool refr=true);               
     38
    3039  void SetZoomWin(PIPixmap * zw, bool refr=true);
     40  void SetGloVWin(PIPixmap * zw, bool refr=true);
    3141  void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30);
    3242  void ShowCursor(bool sc=true);
     
    4151
    4252  void SetOffset(int ox, int oy, bool refr=true);
    43   void SetPave(int x, int y, bool refr=true);
     53  void SetPave(int x, int y, bool refr=true, bool cent=true);
    4454
    4555  virtual void SetColMap(CMapId cmap, bool refr=true);
     
    7585  void ComputePixmap();
    7686  void ComputeZoomPixmap();
     87  void ComputeGloVPixmap();
     88  void SetGloVPixmap();
    7789
    7890  void DrawCursor();
    7991  void DrawCursor(int xc, int yc);
     92  void DrawMarks(int x1, int x2, int y1, int y2);
    8093
    8194  void ShowTrTxW();
     
    94107  bool winovis;   // $CHECK$ Reza A enlever si possible 17/6/96
    95108
     109// Pour gerer les marques ajoutees
     110  bool admrk;
     111  int nbmrk, mrkbsz;
     112  float * xpmrk, * ypmrk;
     113  PIMarker mrkt;
     114// Tableau des pixels principal 
    96115  unsigned char * pixm;
    97116  int xspxm, yspxm;
    98 
    99117  LUT * lut;
    100118  int offx, offy;
    101 
     119// Fenetre de zoom
    102120  int zoom;
    103121  PIPixmap * zow;
    104122  unsigned char * zpixm;
    105123  int xszpxm, yszpxm;
    106 
     124// Fenetre pour l'image entiere 
     125  int zmgv;
     126  PIPixmap * gvw;
     127  unsigned char * gpixm;
     128  int xsgpxm, ysgpxm;
     129// Fenetre/champ de texte
    107130  PILabel * txw;
    108131  PILabel * trtlb;
    109132  PIWindow * trtw;
    110 
     133// Le pave et le curseur
    111134  int xpav, ypav;
    112135  int xpv0, ypv0;
  • trunk/SophyaPI/PI/pilistx.cc

    r30 r37  
    77#include <Xm/List.h>
    88
     9
    910/************* PIListX ************/
    1011
     12// Pour ces sal... de XmString  (ds piwdgx.cc)
     13int CStrFrXmStr(XmString xms, char* buff, int nmx);
    1114
    1215// Fonction prive (CallBack)
     
    228231{
    229232Arg  warg[2];
    230 char *buff;
    231233XmString *xmst;
    232234
    233 if ( (n < 0) || (n >= mNItem))  return("");
     235if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
    234236
    235237XtSetArg(warg[0], XmNitems, &xmst); 
    236238XtGetValues(mlist, warg, 1);
    237 XmStringGetLtoR(xmst[n], XmSTRING_DEFAULT_CHARSET, &buff);
    238 return(buff);
     239CStrFrXmStr(xmst[n], mSItem, 320);
     240return(mSItem);
    239241}
    240242
  • trunk/SophyaPI/PI/pilistx.h

    r30 r37  
    4343int * mSelNum;
    4444bool mMultSel;
     45char mSItem[320];
    4546
    4647SysDWdg mlist;
  • trunk/SophyaPI/PI/pimenugen.h

    r23 r37  
    1414                  ~PIMenuGen();
    1515                                   
    16   virtual void    AppendItem(char* nom, PIMessage msg)=0;
     16  virtual void    AppendItem(char* nom, PIMessage msg, char* sc=NULL)=0;
    1717
    1818  virtual void    DeleteItem(char *nom)=0;
  • trunk/SophyaPI/PI/pimenumac.cc

    r23 r37  
    4343
    4444void
    45 PIMenuMac::AppendItem(char* nom, PIMessage msg)
     45PIMenuMac::AppendItem(char* nom, PIMessage msg, char* sc)  // sc = short-cut , raccourci clavier
    4646{
    4747  LStr255 titre(nom);
  • trunk/SophyaPI/PI/pimenumac.h

    r23 r37  
    1313                                   ~PIMenuMac();
    1414                                   
    15         virtual void    AppendItem(char* nom, PIMessage msg);
     15    virtual void    AppendItem(char* nom, PIMessage msg, char* sc=NULL);
    1616
    1717    virtual void    DeleteItem(char *nom);
  • trunk/SophyaPI/PI/pimenux.cc

    r23 r37  
    1111/************* PIMenuX ************/
    1212
     13// Pour ces sal... de XmString  (ds piwdgx.cc)
     14int CStrFrXmStr(XmString xms, char* buff, int nmx);
    1315
    1416// Fonction prive (CallBack)
     
    2527
    2628// pim->Hide();
    27 pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb).c_str());
     29pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb));
    2830#ifdef DEBUG_PIMenuX
    2931printf("%%%Debug_menub_action: Msg= %d  %lx\n", (int)cusd->msg, (long)pim);
     
    6062
    6163/* --Methode-- */
    62 void PIMenuX::AppendItem(char* nom, PIMessage msg)
    63 {
    64 AddItem(nom, msg, false);
     64void PIMenuX::AppendItem(char* nom, PIMessage msg, char* sc)
     65{
     66AddItem(nom, msg, false, sc);
    6567}
    6668
     
    6870void PIMenuX::DeleteItem(char *nom)
    6971{
    70 string s(nom);
    71 
    72 for(int i=0; i<mNItem; i++)
    73   if (ItemName(i) == s) 
     72
     73for(int i=0; i<mNItem; i++)
     74  if (strcmp(ItemName(i), nom) == 0) 
    7475    { DeleteItemNum(i);  break; }
    7576
     
    111112void PIMenuX::CheckItem(char *nom, bool st)
    112113{
    113 string s(nom);
    114 
    115 for(int i=0; i<mNItem; i++)
    116   if (ItemName(i) == s) 
     114
     115for(int i=0; i<mNItem; i++)
     116  if (strcmp(ItemName(i), nom) == 0) 
    117117    { CheckItemNum(i, st);  break; }
    118118
     
    159159
    160160/* --Methode-- */
    161 string PIMenuX::ItemName(int n)
    162 {
    163 if ( (n < 0) || (n >= mNItem))  return("");
    164 return (ItemNameWdg(mBut[n].itb));
    165 }
    166 
    167 
    168 /* --Methode-- */
    169 string PIMenuX::ItemNameWdg(SysDWdg itw)
    170 {
    171 string s;
    172 char *buff;
     161char* PIMenuX::ItemName(int n)
     162{
     163if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
     164else return (ItemNameWdg(mBut[n].itb));
     165}
     166
     167
     168/* --Methode-- */
     169char* PIMenuX::ItemNameWdg(SysDWdg itw)
     170{
    173171XmString xmstr;
    174172Arg warg[2];
     
    178176if (xmstr)
    179177  {
    180   XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);
    181   s=buff;
     178  CStrFrXmStr(xmstr, mSItem, 96);
    182179  XmStringFree(xmstr);
    183180  }
    184 else s = "";
    185 
    186 return(s);
     181else mSItem[0] = '\0';
     182
     183return(mSItem);
    187184}
    188185
     
    200197int PIMenuX::GetNumItem(char *nom)
    201198{
    202 string s(nom);
    203 
    204 for(int i=0; i<mNItem; i++)
    205   if (ItemName(i) == s)  return(i);
     199
     200for(int i=0; i<mNItem; i++)
     201  if (strcmp(ItemName(i),nom) == 0)  return(i);
    206202return(-1);
    207203}
     
    224220
    225221/* --Methode-- */
    226 void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog)
     222void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog, char* sc)
    227223{
    228224_pimxit_ *buto;
     
    264260XtAddCallback(mBut[mNItem].itb, cbckn,
    265261              menub_action, (XtPointer)(mBut+mNItem));
     262if (sc)  // Raccourci clavier
     263  {
     264  char acc[16];
     265  int n=0;
     266  Arg warg[2];
     267  XmString xmstr;
     268
     269  sprintf(acc,"Ctrl/%c", sc[0]);
     270  xmstr = XmStringLtoRCreate(acc, XmSTRING_DEFAULT_CHARSET);
     271  XtSetArg(warg[n], XmNacceleratorText, xmstr); n++;
     272  sprintf(acc,"Ctrl<Key>%c", sc[0]);
     273  XtSetArg(warg[n], XmNaccelerator, acc); n++;
     274  XtSetValues(mBut[mNItem].itb, warg, n); 
     275  XmStringFree(xmstr);
     276  }
     277
    266278#ifdef DEBUG_PIMenuX
    267279printf("DBG>> %d (%d) %lx \n", mNItem, mNItemMax, (long)(mBut+mNItem));
     
    394406}
    395407
     408
  • trunk/SophyaPI/PI/pimenux.h

    r23 r37  
    2222                  ~PIMenuX();
    2323                                   
    24   virtual void    AppendItem(char* nom, PIMessage msg);
     24  virtual void    AppendItem(char* nom, PIMessage msg, char* sc=NULL);
    2525
    2626  virtual void    DeleteItem(char *nom);
     
    4141  int             GetNumItemMsg(PIMessage msg);
    4242  SysDWdg         GetItemWdg(int n);
    43   string          ItemName(int n);
    44   string          ItemNameWdg(SysDWdg itw);
     43  char*           ItemName(int n);
     44  char*           ItemNameWdg(SysDWdg itw);
    4545
    4646protected:
    47         void      AddItem(char* nom, PIMessage msg, bool tog);
     47        void      AddItem(char* nom, PIMessage msg, bool tog, char* sc=NULL);
    4848        void      Check();
    4949
    5050int mNItem, mNItemMax;
    5151_pimxit_  * mBut;
    52 
     52char mSItem[96];
    5353};
    5454
  • trunk/SophyaPI/PI/pimsghandler.h

    r30 r37  
    1111        PIMsg_Active        = 1,
    1212        PIMsg_Close         = 2,
     13        PIMsg_Resize        = 3,
    1314
    1415        PIMsg_OK            = 11,
     
    2021        PIMsg_Press         = 23,
    2122        PIMsg_Drag          = 24,
     23        PIMsg_Drop          = 25,
    2224
    2325        PIMsg_Select        = 31,
  • trunk/SophyaPI/PI/pipixmapgen.cc

    r10 r37  
    1818pixmap = NULL;
    1919nx = ny = 0;
     20ofx = ofy = 0;
     21mPpos[0] = mPpos[0] = 0;
    2022cmap = new PIColorMap(CMAP_GREY32);
     23mEn = 0;
     24ActivateButton(1);
    2125}
    2226
     
    2933
    3034/* --Methode-- */
    31 void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
     35void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy)
    3236{
    33 pixmap = pix; nx = sx; ny = sy;
     37pixmap = pix;
     38if (pixmap)
     39  {
     40  if (sx < 0)  sx = 0;
     41  if (sy < 0)  sy = 0;
     42  if (ox < 0)  ox = 0;
     43  if (oy < 0)  oy = 0;
     44  nx = sx; ny = sy;
     45  ofx = ox;  ofy = oy;
     46  }
     47else { ofx = ofy = nx = ny = 0; }
    3448if (refr) Refresh();   
    3549}
     
    4559
    4660
     61/* --Methode-- */
     62void  PIPixmapGen::But1Press(int x, int y)
     63{
     64mPpos[0] = x;  mPpos[1] = y; 
     65if (Msg())  Send(Msg(), PIMsg_Click, mPpos);
     66return;
     67}
     68
     69
     70/* --Methode-- */
     71int PIPixmapGen::ElAdd(int typ, int x, int y, int dx, int dy, char* s)
     72{
     73DrwEl dre;
     74mEn++;
     75dre.eid = mEn;  dre.etyp = typ;
     76dre.ex = x;   dre.ey = y;
     77dre.edx = dx;  dre.edy = dy;
     78if (s)  dre.es = s;
     79mElist.push_back(dre);
     80return(mEn);
     81}
     82
     83/* --Methode-- */
     84void  PIPixmapGen::ElDel(int id)
     85{
     86DrwElList::iterator it;
     87for (it = mElist.begin(); it != mElist.end(); it++)
     88  if ( (*it).eid == id) { mElist.erase(it);   break; }
     89return;
     90}
     91
     92/* --Methode-- */
     93void  PIPixmapGen::ElDelAll()
     94{
     95mElist.erase(mElist.begin(), mElist.end());
     96return;
     97}
     98
     99/* --Methode-- */
     100void  PIPixmapGen::DrawElements()
     101{
     102char* txt;
     103DrwElList::iterator it;
     104for (it = mElist.begin(); it != mElist.end(); it++)
     105  {
     106  switch ( (*it).etyp )
     107    {
     108    case PIDEL_Line :
     109      DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     110      break;
     111    case PIDEL_Text :
     112      txt = (*it).es.c_str();
     113      DrawString((*it).ex, (*it).ey, txt );
     114      break;
     115    case PIDEL_Rect :
     116      DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     117      break;
     118    case PIDEL_FRect :
     119      DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     120      break;
     121    case PIDEL_Circ :
     122      DrawCircle((*it).ex, (*it).ey, (*it).edx );
     123      break;
     124    case PIDEL_FCirc :
     125      DrawFCircle((*it).ex, (*it).ey, (*it).edx );
     126      break;
     127    default :
     128      break;
     129    }
     130  }
     131return;
     132}
     133
    47134
    48135// Fin des methodes de la classe
  • trunk/SophyaPI/PI/pipixmapgen.h

    r10 r37  
    99#include PICMAP_H
    1010
     11#include <list.h>
     12
    1113class PIPixmapGen : public PIBaseWdg
    1214{
     
    1416  enum {ClassId = 5100};
    1517
     18  enum { PIDEL_Line = 1, PIDEL_Text = 2,
     19         PIDEL_Rect = 3, PIDEL_FRect = 4,
     20         PIDEL_Circ = 5, PIDEL_FCirc = 6 } ;
     21
    1622                PIPixmapGen(PIContainerGen *par, char *nom,
    1723                         int sx=10, int sy=10, int px=0, int py=0);
    18   virtual      ~PIPixmapGen();
     24  virtual       ~PIPixmapGen();
    1925
    20   virtual long    kind() {return ClassId; }
     26  virtual long  kind() {return ClassId; }
    2127
    22   virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
     28  virtual void  SetPixmap(unsigned char *pix, int sx, int sy,
     29                          bool refr=true, int ox=0, int oy=0);
    2330  void          SetColMap(CMapId cmapid, bool refr=true);
    2431  inline CMapId GetColMapId() { return (cmap->Type()); };
    2532  inline int    NbCol() { return(cmap->NCol()); };
    2633
     34  virtual void  But1Press(int x, int y);
     35  inline  int   XPPos() { return mPpos[0]; }
     36  inline  int   YPPos() { return mPpos[1]; }
     37
     38  inline int    ElAddLine(int x1, int y1, int x2, int y2)
     39    { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL) ); } 
     40  inline int    ElAddText(int x, int y, char* s)
     41    { return( ElAdd(PIDEL_Text, x, y, 0, 0, s) ); } 
     42  inline int    ElAddRect(int x, int y, int dx, int dy)
     43    { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL) ); } 
     44  inline int    ElAddFRect(int x, int y, int dx, int dy)
     45    { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL) ); } 
     46  inline int    ElAddCirc(int x, int y, int r)
     47    { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL) ); } 
     48  inline int    ElAddFCirc(int x, int y, int r)
     49    { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL) ); } 
     50
     51  void          ElDel(int id);
     52  void          ElDelAll();
     53
    2754protected:
     55  int           ElAdd(int typ, int x, int y, int dx, int dy, char* s);
     56  virtual void  DrawElements();
     57
    2858  unsigned char *pixmap;
    2959  int nx, ny;
     60  int ofx, ofy;
    3061  PIColorMap* cmap;
     62
     63  typedef struct {
     64    int eid, etyp;
     65    int ex,ey;
     66    int edx,edy;
     67    string es;
     68  } DrwEl;
     69  typedef list<DrwEl> DrwElList;
     70
     71  DrwElList mElist;
     72  int mEn;
     73  int mPpos[2];
    3174}; 
    3275 
  • trunk/SophyaPI/PI/pipixmapx.cc

    r32 r37  
    4141      { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
    4242    }
     43  }
    4344
    44   for(j=ny; j<YSize(); j++)
    45     for(i=nx; i<XSize(); i++)
    46       XPutPixel(myximg, i, j, 0 );
    47   }
     45for(j=ny; j<YSize(); j++)
     46  for(i=nx; i<XSize(); i++)
     47     XPutPixel(myximg, i, j, 0 );
     48
    4849PIBaseWdgX::Refresh();
    4950}
     
    5657XFree(myximg);
    5758AllocXImg();
     59if (Msg())  Send(Msg(), PIMsg_Resize, mPpos);
    5860}
     61
    5962/* --Methode-- */
    6063void PIPixmapX::Draw()
    6164{
    6265if(mPSOut)
     66  {
    6367  if(pixmap)
    6468    mPSOut->Image(0, 0, (float)XSize(), (float)YSize(), nx, ny, pixmap, cmap);
    65   else
    66     return; /* pour l'instant */
     69  /*  Il faut faire quelque chose Sinon ??! */
     70  DrawElements();
     71  }
    6772else
    6873  Draw(0, 0, XSize(), YSize());
     
    7277void PIPixmapX::Draw(int x0, int y0, int dx, int dy)
    7378{
     79int mx, my, ox, oy;
    7480Window xw;
    7581Display * mdsp;
     
    8187if (x0 < 0)  x0 = 0;
    8288if (y0 < 0)  y0 = 0;
    83 
     89mx = nx+ofx;   my = ny+ofy;
    8490if (dx > (XSize()-x0)) dx = XSize()-x0;
    8591if (dy > (YSize()-y0)) dy = YSize()-y0;
    8692if ((dx <= 0) || (dy <= 0))  return;
    8793
    88 if ( (nx < x0 ) || (ny < y0) )
     94if ( (mx < x0 ) || (my < y0) )
    8995  { XClearArea(mdsp, xw, x0, y0, dx, dy, False);  return; }
    9096
    91 if (nx < (x0+dx))
    92   { XClearArea(mdsp, xw, nx, y0, x0+dx-nx, dy, False);  dx = nx-x0; }
    93 if (ny < (y0+dy))
    94   { XClearArea(mdsp, xw, x0, ny, dx, y0+dy-ny, False);  dy = ny-y0; }
    95  
    96 XPutImage(mdsp, xw, mygc, myximg, x0, y0, x0, y0, dx, dy);
     97ox = oy = 0; 
     98
     99if (ofx > x0)
     100  { XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False);   
     101  dx -= (ofx-x0);  x0 = ofx;  ox = 0; }
     102else  ox = x0-ofx;
     103if (ofy > y0)
     104  { XClearArea(mdsp, xw, x0, y0, dx, ofy-y0, False); 
     105  dy -= (ofy-y0);  y0 = ofy;  oy = 0; }
     106else  oy = y0-ofy;
     107 
     108if (mx < (x0+dx))
     109  { XClearArea(mdsp, xw, mx, y0, x0+dx-mx, dy, False);  dx = mx-x0; }
     110if (my < (y0+dy))
     111  { XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False);  dy = my-y0; }
     112 
     113XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy);
     114DrawElements();
    97115XFlush(mdsp);
    98116
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r23 r37  
    3232
    3333void
    34 PIScDrawWdg::SetLimits(double xmin, double xmax,
    35                        double ymin, double ymax, bool tmp)
     34PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax,
     35                       bool axrl, bool ayud, bool tmp)
    3636{
    3737  if (xmax <= xmin || ymax <= ymin)
    3838    return; // $CHECK$ exception ?
     39  aXdir = axrl;      // Vrai si Axe X de Droite vers Gauche
     40  aYdir = ayud;      // Vrai si Axe Y de Haut vers Bas
    3941  xMin = xmin;
    4042  xMax = xmax;
    4143  yMin = ymin;
    4244  yMax = ymax;
     45  mPPos[0] = 0.5*(xMin+xMax);
     46  mPPos[1] = 0.5*(yMin+yMax);
    4347  if (!tmp) {
    4448    xMinS = xmin;
     
    6367PIScDrawWdg::CalcScale()
    6468{
    65   double margeH = (xMax-xMin)*0.2;
    66   double margeV = (yMax-yMin)*0.2;
     69  double margeH = (xMax-xMin)*0.15;
     70  double margeV = (yMax-yMin)*0.15;
    6771  xScale = XSize() / (xMax-xMin + 2*margeH);
    68   yScale = -YSize() / (yMax-yMin + 2*margeV);
    69   xOrg   = (-xMin + margeH) * xScale;// + XPos();
    70   yOrg   = (-yMax - margeV) * yScale;// + YPos();
     72  if (aXdir)  {
     73    xScale = -xScale;
     74    xOrg   = (-xMax - margeH) * xScale;// + XPos();
     75  }
     76  else xOrg   = (-xMin + margeH) * xScale;// + XPos();
     77  yScale = YSize() / (yMax-yMin + 2*margeV);
     78  if (!aYdir) {
     79    yScale = -yScale;
     80    yOrg   = (-yMax - margeV) * yScale;// + YPos();
     81  }
     82  else yOrg   = (-yMin + margeV) * yScale;// + YPos();
     83return;
    7184}
    7285
     
    361374{
    362375  double xOffset = 0;
    363  
     376  int kk;
    364377  ScSelFontSz(xMajTickLen*4);
    365378  for (double x=xBeg; x<=xMax; x += xStep) {
    366379      char label[20]; sprintf(label, "%-6g", x);
     380      for(kk=0; kk<20; kk++)
     381        if (label[kk] == ' ')   { label[kk] = '\0' ; break; }
    367382      double largeur = ScStringWidth(label);
    368383      if (just == 1)
     
    372387      else
    373388        xOffset = 0;
     389      if (aXdir)  xOffset = -xOffset;
    374390      ScDrawString(x+xOffset, y, label);
    375391  }
     
    390406      else
    391407        xOffset = 0;
     408      if (aXdir)  xOffset = -xOffset;
    392409      ScDrawString(x+xOffset, y, label);
    393410  }
     
    427444   
    428445    if (flags & kLabels) {
     446      if (!aYdir)
    429447        DrawHLabels(-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     448      else
     449        DrawHLabels(xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     450      if (!aXdir)
    430451        DrawVLabels(-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     452      else
     453        DrawVLabels(yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    431454    }
    432455   
     
    475498   
    476499    if (flags & kLabels) {
     500      if (!aYdir) {
    477501        DrawHLabels(yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    478502        DrawHLabels(yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
     503      }
     504      else {
     505        DrawHLabels(yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
     506        DrawHLabels(yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     507      }
     508      if (!aXdir) {
    479509        DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    480510        DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
     511      }
     512      else {
     513        DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
     514        DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     515      }
    481516    }
    482517  }
     
    604639PIScDrawWdg::UpdateText(int xp, int yp)
    605640{
    606   if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
    607 
    608   char buff[128];
     641
    609642  double dx, dy;
    610643  Local2Sc(xp, yp, dx, dy);
     644  mPPos[0] = dx;  mPPos[1] = dy;
     645  if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
     646
     647  char buff[128];
    611648  sprintf(buff, "X= %g  Y= %g",  dx, dy);
    612649  if (mTxw)
     
    647684 
    648685  if (xBegDrag == xEndDrag || yBegDrag == yEndDrag)
    649     SetLimits(xMinS, xMaxS, yMinS, yMaxS);
     686    SetLimits(xMinS, xMaxS, yMinS, yMaxS, aXdir, aYdir );
    650687  else {
    651688    double xl,yl,xh,yh;
     
    654691    if (xl > xh) swap(xl, xh);
    655692    if (yl > yh) swap(yl, yh);
    656     SetLimits(xl,xh,yl,yh, true);
     693    SetLimits(xl,xh,yl,yh, aXdir, aYdir, true);
    657694  }
    658695 
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r23 r37  
    2929  virtual           ~PIScDrawWdg();
    3030
    31   virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax, bool tmp=false);
     31  virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax,
     32                               bool axrl=false, bool ayud=false, bool tmp=false);
    3233 
    3334  virtual void       ScDrawString(double x, double y, char* s, int pos = 0);
     
    7576  double YMin() const {return yMin;}
    7677  double YMax() const {return yMax;}
     78  double XPPos() const { return mPPos[0]; }
     79  double YPPos() const { return mPPos[1]; }
    7780  int    LimitsFixed() const {return limitsFixed;}
    7881  void   FreeLimits() {limitsFixed = 0;}
     
    9497  double xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
    9598  double xScale, yScale;         // Pixels par unites graphiques
     99  bool   aXdir, aYdir;           // Sens des axes horiz, vertical
     100  double mPPos[2];               // Position click souris X,Y
    96101  double xFirstMajTick, xFirstMinTick;
    97102  double yFirstMajTick, yFirstMinTick;
  • trunk/SophyaPI/PI/pistdwdgx.cc

    r30 r37  
    225225
    226226// Fonction prive (CallBack)
    227 static void toggb_action(Widget w, XtPointer *usd, XtPointer *calld);
     227static void toggb_action(Widget w, XtPointer *usd, XmToggleButtonCallbackStruct* calld);
    228228
    229229/* Nouvelle-Fonction */
    230 void  toggb_action(Widget , XtPointer *usd, XtPointer *)
     230void  toggb_action(Widget , XtPointer *usd, XmToggleButtonCallbackStruct* calld)
    231231{
    232232PICheckBoxX *picb;
    233233picb = (PICheckBoxX *) usd ;
    234 picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState());
     234if (calld->set == True)   picb->mSt = true;
     235else picb->mSt = false;
     236picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)(picb->mSt));
    235237return;
    236238}
     
    247249XtSetArg(warg[0],XmNhighlightThickness, 0);
    248250XtSetValues(XtWdg(), warg, 1);
     251SetState(false);
    249252Manage();
    250253}
     
    260263{
    261264Arg warg[2];
    262 XtSetArg(warg[0],XmNset, st);
     265mSt = st;
     266XtSetArg(warg[0],XmNset, mSt);
    263267XtSetValues(XtWdg(), warg, 1);
    264268return;
     
    268272bool PICheckBoxX::GetState()
    269273{
    270 int val;
    271 Arg warg[2];
    272 XtSetArg(warg[0], XmNset, &val);
    273 XtGetValues(XtWdg(), warg, 1);
    274 return ((bool)val);
     274return(mSt);
    275275}
    276276
  • trunk/SophyaPI/PI/pistdwdgx.h

    r30 r37  
    6060  virtual void       SetState(bool st=false);
    6161  virtual bool       GetState();
     62
     63  bool mSt;          // Etat du bouton, en public a cause du Callback
    6264};
    6365
  • trunk/SophyaPI/PI/piup.cc

    r18 r37  
    88#include "piup.h"
    99
    10 ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     10RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
    1111                       char * arg1, char * arg2)
    1212{
     
    2323
    2424filt.PrintImage();
    25 out = new ImageR4(myimg->XSize(), myimg->YSize());
     25out = new ImageR4(myimg.XSize(), myimg.YSize());
    2626TIMEF ;
    27 FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt);
    28 return(out);
     27FilterImage(&myimg, out, &filt);
     28return((RzImage*)out);
    2929}
    3030 
    31 ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     31RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
    3232                       char * arg1, char * arg2)
    3333{
     
    4646filt(2,0) = 2.;
    4747filt.PrintImage();
    48 out = new ImageR4(myimg->XSize(), myimg->YSize());
     48out = new ImageR4(myimg.XSize(), myimg.YSize());
    4949TIMEF ;
    50 FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt);
    51 return(out);
     50FilterImage(&myimg, out, &filt);
     51return((RzImage*)out);
    5252}
    5353
    5454 
    55 ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
     55RzImage * PIUserProc_3(ImageR4& , int xp, int yp, int dx, int dy,
    5656                       char * arg1, char * arg2)
    5757{
  • trunk/SophyaPI/PI/piup.h

    r18 r37  
    11#include "cimage.h"
    22
    3 ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     3RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
    44                       char * arg1, char * arg2);
    5 ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     5RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
    66                       char * arg1, char * arg2);
    7 ImageR4 * PIUserProc_3(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     7RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy,
    88                       char * arg1, char * arg2);
  • trunk/SophyaPI/PI/piup_def.cc

    r18 r37  
    88#include "piup.h"
    99
    10 ImageR4 * PIUserProc_1(ImageR4 * , int xp, int yp, int dx, int dy,
     10RzImage * PIUserProc_1(ImageR4 & , int xp, int yp, int dx, int dy,
    1111                       char * arg1, char * arg2)
    1212{
     
    1616}
    1717 
    18 ImageR4 * PIUserProc_2(ImageR4 * , int xp, int yp, int dx, int dy,
     18RzImage * PIUserProc_2(ImageR4 & , int xp, int yp, int dx, int dy,
    1919                       char * arg1, char * arg2)
    2020{
     
    2424}
    2525 
    26 ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
     26RzImage * PIUserProc_3(ImageR4 & , int xp, int yp, int dx, int dy,
    2727                       char * arg1, char * arg2)
    2828{
  • trunk/SophyaPI/PI/piwdggen.cc

    r32 r37  
    1313parent = par;
    1414SetMsg(0);
     15SetUserData(NULL, 0);
    1516if (par)  par->ChildAdd(this);   //  On previent le container parent 
    1617return;
  • trunk/SophyaPI/PI/piwdgx.cc

    r23 r37  
    4242}
    4343
     44/* Nouvelle-Fonction */
     45int CStrFrXmStr(XmString xms, char* buff, int nmx)
     46/*  Pour recuperer le contenu d'un string Motif  */
     47{
     48int n,l,m;
     49XmStringContext cntx;
     50char *txs;
     51XmStringDirection dir;
     52XmStringCharSet cset;
     53Boolean sep;
     54
     55if (nmx < 2)  return(0);
     56n = 0;  m = nmx-1;  buff[0] = buff[m] = '\0';
     57XmStringInitContext (&cntx, xms);
     58while (m > 0)
     59  {
     60  if (XmStringGetNextSegment( cntx, &txs, &cset, &dir, &sep) )
     61    {
     62    l = strlen(txs);
     63    if (m < l)  txs[m] = '\0';
     64    strcpy(buff+n, txs);
     65    n += l;   m -= l;
     66    if (sep)  m = -2;
     67    XtFree(txs);
     68    }
     69  else m = -1;
     70  }
     71
     72return(n);
     73}
     74
    4475
    4576/* --Methode-- */
    4677PIWdgX::PIWdgX(int narg, char *arg[])
    47 :PIWdgGen(NULL, "PITopLevel"), mNom("PITopLevel")
     78:PIWdgGen(NULL, "PITopLevel") 
    4879{
    4980if (top == NULL)  InitXt(narg, arg);
     
    6192PIWdgX::PIWdgX(PIContainerGen *par, char *nom,
    6293               int sx, int sy, int px, int py)
    63 :PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
     94:PIWdgGen(par, nom, sx, sy, px, py) 
    6495{
    6596sdw = NULL;
     
    378409XtGetValues(this->sdw, wargs, 1);
    379410return(bw);
     411}
     412
     413/* --Methode-- */
     414string PIWdgX::Nom()
     415{
     416return(XtName(this->sdw));
    380417}
    381418
  • trunk/SophyaPI/PI/piwdgx.h

    r23 r37  
    5050  virtual int    BorderWidth();
    5151
    52   virtual string Nom()  { return mNom; }
     52  virtual string Nom()
    5353  virtual void   GetScreenPos(int & spx, int & spy);
    5454
     
    6767  WmIntState wmis;
    6868  int stmng;
    69   string mNom;
    7069 
    7170};
  • trunk/SophyaPI/PI/psdict.cc

    r34 r37  
    7272$BlocEnteredState restore} bind def\n\
    7373\
    74 %% Trace\
     74%% Trace\n\
    7575/n  {newpath} bind def    /c  {closepath} bind def\n\
    7676/gs {gsave}  bind def     /gr {grestore} bind def\n\
Note: See TracChangeset for help on using the changeset viewer.