Changeset 127 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Jul 31, 1998, 5:22:21 PM (27 years ago)
Author:
ercodmgr
Message:

Modifs depuis le PC - (PICMapView , coller depuis PIImage, ... Reza 31/07/98

Location:
trunk/SophyaPI/PI
Files:
17 edited

Legend:

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

    r72 r127  
    4040
    4141/* --Methode-- */
    42 void ExBWdg::Draw(PIGraphicGen* g)
     42void ExBWdg::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    4343{
    4444EraseWindow();
  • trunk/SophyaPI/PI/ex_dessin.h

    r72 r127  
    2222
    2323  virtual void   Resize();
    24   virtual void   Draw(PIGraphicGen* g);
     24  virtual void   Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    2525
    2626  virtual void   But1Press(int x, int y);
  • trunk/SophyaPI/PI/lut.h

    r106 r127  
    2828    if (x < Min())  return(0);
    2929    if (x >= Max() )  return(nLevel+1); 
    30     int k = (x-Min())/tablebinwidth;
     30    int k = (int)((x-Min())/tablebinwidth);
    3131    return(table[k]);
    3232    }
  • trunk/SophyaPI/PI/pibwdggen.cc

    r119 r127  
    3535{
    3636if ( IsVisible() )  {
    37   Draw(mWGrC);
     37  Draw(mWGrC, 0, 0, XSize(), YSize());
    3838  CallDrawers(mWGrC);
    3939}
     
    4141}
    4242
    43 // On met une variable pour eviter des boucles infinies entre les deux methodes
    44 // Draw(PIGraphic* g, int, int, int, int) et Draw(PIGraphic* g)
    45 static int fgdrawloop = 0;
    46 
    47 /* --Methode-- */
    48 void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    49 {
    50 if (fgdrawloop == 0)
    51   { fgdrawloop=1;  Draw(g); }
    52 fgdrawloop = 0;
    53 return;
    54 }
    55 
    56 /* --Methode-- */
    57 void PIBaseWdgGen::Draw(PIGraphic* g)
     43
     44/* --Methode-- */
     45void PIBaseWdgGen::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
    5846{
    5947#ifdef DEBUG_RZXB
    6048puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! ");
    6149#endif
    62 if (g->kind() != PI_PSFileGraphics) EraseWindow(0, 0, XSize(), YSize());
    63 if (fgdrawloop == 0)
    64   { fgdrawloop=2;  Draw(g, 0, 0, XSize(), YSize()); }
    65 fgdrawloop = 0;
    66 return;
    67 }
    68 
     50if (g->kind() != PI_PSFileGraphics) EraseWindow(x0, y0, dx, dy);
     51return;
     52}
    6953
    7054/* --Methode-- */
     
    178162if (!psf) return;
    179163PIGraphicPS grpsf(psf, (PIWdg *)this, ofx, ofy);
    180 Draw(&grpsf);
     164Draw(&grpsf, 0, 0, XSize(), YSize());
    181165CallDrawers(&grpsf);
    182166return;
     
    298282
    299283/* --Methode-- */
    300 void PIBaseWdgGen::CallDrawers(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     284void PIBaseWdgGen::CallDrawers(PIGraphic* g, int x0, int y0, int dx, int dy)
    301285{
    302286float xmin,ymin, xmax, ymax;
  • trunk/SophyaPI/PI/pibwdggen.h

    r120 r127  
    5858
    5959//  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
    60   virtual void       Draw(PIGraphic* g);
    6160  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    6261 
     
    9998
    10099//  Trace des Drawers ...         
    101   virtual void       CallDrawers(PIGraphicGen* g, int x0=0, int y0=0, int dx=0, int dy=0);
     100  virtual void       CallDrawers(PIGraphic* g, int x0=0, int y0=0, int dx=0, int dy=0);
    102101  virtual void       CallDrawer(int id);
    103102
  • trunk/SophyaPI/PI/picmapview.cc

    r113 r127  
    1 #include <stdio.h>
    2 #include <string.h>
     1// Module PI : Peida Interactive     PICMapView
     2// Visualisation de table de couleur     R. Ansari  07/98
     3// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    34
    45#include "picmapview.h"
     
    1213
    1314{
    14 
     15  cmap = NULL;
    1516}
    1617
     
    1920PICMapView::~PICMapView()
    2021{
     22  if (cmap) delete cmap;
    2123}
    2224
    2325 
    24 
     26/* --Methode-- */
     27void PICMapView::SetColMap(PIColorMap* cmp, bool refr)
     28{
     29  if (cmap) delete cmap;
     30  if (cmp == NULL)   cmap = NULL;
     31  else cmap = new PIColorMap(*cmp);
     32  if (refr)  Refresh(); 
     33  return;
     34}
    2535
    2636/* --Methode-- */
    27 void PICMapView::Resize()
     37void PICMapView::SetColMapId(CMapId cmapid, bool refr)
    2838{
    29 
     39  if (cmap && (cmap->Type() == cmapid) && (cmapid != CMAP_OTHER) )  return;
     40  if (cmap) delete cmap;
     41  cmap = new PIColorMap(cmapid);
     42  if (refr)  Refresh(); 
     43  return;
    3044}
    3145
    3246
    3347/* --Methode-- */
    34 void PICMapView::Draw(PIGraphicGen* g)
     48void PICMapView::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    3549{
    36 EraseWindow();
    37 g->SelLine(PI_NormalLine);
    38 g->DrawBox(10,10, XSize()-20, YSize()-20);
     50  if (!cmap) {
     51    EraseWindow(0, 0, XSize(), YSize());
     52    return;
     53    }
     54  // On presente la table de couleur verticalement si SizeY > SizeX
     55  // ou horizontale  si SizeX > SizeY
    3956
    40 g->SelLine(PI_ThinLine);
    41 g->DrawFBox(20, 20, 20, 20);
    42 g->DrawCircle(30, 30, 15);
     57  int sx = XSize();
     58  int sy = YSize();
    4359
    44 g->SelForeground(PI_Red);
    45 g->DrawFCircle(70, 30, 15);
    46 
    47 g->SelForeground(PI_Yellow);
    48 g->DrawFBox(10, 60, 100, 15);
    49 
    50 g->SelForeground(PI_Black);
    51 
    52 g->SelLine(PI_ThinLine);
    53 g->DrawLine(10, 120, 40, 120);
    54 g->SelLine(PI_NormalLine);
    55 g->DrawLine(40, 120, 70, 120);
    56 g->SelLine(PI_ThickLine);
    57 g->DrawLine(70, 120, 100, 120);
    58 
    59 g->SelForeground(PI_Magenta);
    60 g->DrawFCircle(120, 30, 15);
    61 g->SelForeground(PI_Grey);
    62 g->DrawFCircle(120, 60, 15);
    63 
    64 PIGrCoord x[5] = { 20, 35, 50, 65, 80 };
    65 PIGrCoord y[5] = { 130, 130, 130, 130, 130 };
    66 
    67 g->SelForeground(PI_Black);
    68 g->DrawMarkers(x, y, 5);
    69 return;
     60  int k;
     61  if (sx > sy) {    // horizontal
     62    int xc, dx;
     63    xc = 0;
     64    for(k=0; k<cmap->NCol(); k++) {
     65      dx = (sx-xc)/(cmap->NCol()-k);
     66      g->SelForeground((*cmap), k);
     67      g->DrawFBox(xc, 0, dx, sy);
     68      xc += dx;
     69    }
     70  }
     71  else  {    // vertical
     72    int yc, dy;
     73    yc = sy;
     74    for(k=0; k<cmap->NCol(); k++) {
     75      dy = yc/(cmap->NCol()-k);
     76      yc -= dy;
     77      g->SelForeground((*cmap), k);
     78      g->DrawFBox(0, yc, sx, dy);
     79    }
     80  }
     81 
     82  return;
    7083}
    7184
  • trunk/SophyaPI/PI/picmapview.h

    r113 r127  
     1// This may look like C code, but it is really -*- C++ -*-
     2// Module PI : Peida Interactive     PICMapView
     3// Visualisation de table de couleur     R. Ansari  07/98
     4// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
     5
    16#ifndef PICMAPVIEW_H_SEEN
    27#define PICMAPVIEW_H_SEEN
     
    510
    611#include PIBWDG_H
     12#include PICMAP_H
    713
    814class PICMapView : public PIBaseWdg
    915{
    1016public:
     17  enum {ClassId = 5150};
     18
    1119                  PICMapView(PIContainerGen *par, char *nom,
    12                          int sx=10, int sy=10, int px=0, int py=0);
     20                             int sx=256, int sy=10, int px=0, int py=0);
    1321  virtual         ~PICMapView();
    1422
     23  virtual long    kind() {return ClassId; }
     24
     25  void            SetColMap(PIColorMap* cmp=NULL, bool refr=true);
     26  void            SetColMapId(CMapId cmapid, bool refr=true);
    1527
    1628// Traitement des evenements   
    1729
    18   virtual void   Resize();
    19   virtual void   Draw(PIGraphicGen* g);
     30  virtual void   Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    2031
    2132
    2233protected:
     34  PIColorMap* cmap;
    2335};
    2436
  • trunk/SophyaPI/PI/picons.cc

    r126 r127  
    228228  if (nmxrec > 0) {
    229229    NMxRecall = (nmxrec > 5) ? nmxrec : 5;
     230    if (mRStr)  delete[] mRStr;
    230231    mRStr = new string[NMxRecall];
    231232    mNComm = mRCindx = mRindx = 0;
     233    mRStr[0] = "";
    232234    }
    233235  }
     
    259261  if (mScb) mScb->SetValue(0);
    260262  mOffL = 0;
    261 }
    262 mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;
     263  }
     264else mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;
    263265}
    264266
     
    278280
    279281/* --Methode-- */
    280 void PIConsole::Draw(PIGraphicGen* g)
     282void PIConsole::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    281283{
    282284EraseWindow();
     
    332334      mCmdStr[mCLC] = '\0';
    333335//      printf("Keyb()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
    334 
    335336// Gestion de rappel des commandes
    336       mRStr[mRCindx] = mCmdStr;
    337       mRCindx++;  mNComm++;
    338       if (mRCindx >= NMxRecall)  mRCindx = 0;
    339       mRindx = mRCindx;
    340      
     337      if (mCLC > 0) {
     338        mRStr[mRCindx] = mCmdStr;
     339        mRCindx++;  mNComm++;
     340        if (mRCindx >= NMxRecall)  mRCindx = 0;
     341        mRindx = mRCindx;
     342        }
    341343      Send( Msg(), PIMsg_OK, mCmdStr);
    342344      ClrCmd();
     
    358360//      printf("Keyb()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
    359361      if (mNComm > 0) {
    360         int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall;
     362        int nmxrec = ((mNComm+1) < NMxRecall) ? mNComm+1 : NMxRecall;
    361363        if (key == PIK_Up)  {
    362364          mRindx--;
     
    392394}
    393395
    394 /*   Pour debugger le code - Reza 23/02/98
    395 #ifdef DEBUG_PICONS
    396 static int lines = 0;
    397 if ( (kmod == PIKM_Alt) ) {
    398   char buff[128];
    399   int l = 0;
    400   switch (toupper(key)) {
    401   case 'P' :
    402     DebugPrint(1);
    403     break;
    404   case 'H' :
    405     DebugPrint(0);
    406     break;
    407   case 'J' :
    408      AddChar('\n');
    409     DebugPrint(0);
    410      break;     
    411   case 'R' :
    412     for(l=0; l<1; l++) {
    413       sprintf(buff, "Line type Reverse No %d ", lines);
    414       AddStr(buff, PIVA_Reverse, false);
    415       sprintf(buff, "Normal  ");
    416       AddStr(buff, PIVA_Def, false);
    417       sprintf(buff, "Bold  ");
    418       AddStr(buff, PIVA_Bold, false);
    419       lines++;
    420     }   
    421     Refresh();
    422     break;
    423  
    424   case 'B' :
    425     for(l=0; l<3; l++) {
    426       sprintf(buff, "Line type Bold No %d \n", lines);
    427       AddStr(buff, PIVA_Bold, false);
    428       lines++;
    429     }   
    430     Refresh();
    431     break;
    432  
    433   case 'I' :
    434     for(l=0; l<3; l++) {
    435       sprintf(buff, "Line type Italique No %d \n", lines);
    436       AddStr(buff, PIVA_Ital, false);
    437       lines++;
    438     }   
    439     Refresh();
    440     break;
    441  
    442   case 'N' :
    443     for(l=0; l<3; l++) {
    444       sprintf(buff, "Line type Normal No %d \n", lines);
    445       AddStr(buff, PIVA_Def, false);
    446       lines++;
    447     }   
    448     Refresh();
    449     break;
    450   }
    451 }
    452 #endif
    453 */
    454396
    455397/* --Methode-- */
  • trunk/SophyaPI/PI/picons.h

    r126 r127  
     1// This may look like C code, but it is really -*- C++ -*-
     2// composant graphique de type console (terminal)
     3//                    R. Ansari   12/97
     4// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
     5
    16#ifndef PICONSOLE_H
    27#define PICONSOLE_H
     
    3641
    3742// Gestion des evenements input/draw
    38   virtual void       Draw(PIGraphicGen* g);
     43  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    3944  virtual void       Resize();
    4045  virtual void       Keyboard(int key, PIKeyModifier kmod);
  • trunk/SophyaPI/PI/pidrawer.h

    r120 r127  
     1// This may look like C code, but it is really -*- C++ -*-
     2// Objets traceur qui peuvent etre attaches a un PIBaseWidget
     3//                             R. Ansari  97-98
     4// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    15#ifndef PIDRAWER_H
    26#define PIDRAWER_H
  • trunk/SophyaPI/PI/pidrwtools.cc

    r120 r127  
    2323void PIDrwTools::SetCurrentBaseWdg(PIBaseWdgGen* cbw)
    2424{
     25if (mCurBW == cbw) return;
    2526mCurBW = cbw;
    2627if (cwdrwt)  {
    27   cwdrwt->mNlb->SetLabel("0"); 
    28   cwdrwt->mNDr = 0;
     28  if (mCurBW != NULL)  {
     29    cwdrwt->mNDr = mCurBW->NbDrawers()-1;
     30    if (cwdrwt->mNDr < 0)  cwdrwt->mNDr = 0;
     31    }
     32  else cwdrwt->mNDr = 0;
     33  char buff[32];
     34  sprintf(buff,"%d", cwdrwt->mNDr);
     35  cwdrwt->mNlb->SetLabel(buff); 
    2936  }
    3037}
     
    234241char buff[92];
    235242mNDr = 0;
     243if (mCurBW != NULL)  {
     244  mNDr = mCurBW->NbDrawers()-1;
     245  if (mNDr < 0)  mNDr = 0;
     246  }
    236247if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) {
    237248  PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW;
     
    240251  sprintf(buff, "%g  %g", scd->YMin(), scd->YMax());
    241252  mText[1]->SetText(buff);
    242   if (scd->NbDrawers() > 1)  mNDr = 1;
    243253  }
    244254else {
  • trunk/SophyaPI/PI/piimage.cc

    r119 r127  
    1313#include "piimgtools.h"
    1414#include "pidrwtools.h"
     15#include PIAPP_H
    1516
    1617// --------------------------------------------------------------------------------
     
    4344
    4445
    45 zow = NULL;
    46 gvw = NULL;
    47 trtw = NULL;
    48 trtlb = txw = NULL;
    49 SetTextWin(NULL);
     46zow = NULL;   // Widget zoom
     47gvw = NULL;   // widget vue globale
     48cmvw = NULL;  // widget ColorMapView
     49// Fenetre transient et Label pour affichage de l'info (texte PixVal)
     50int tx, ty;
     51PIApplicationPrefCompSize(tx, ty);
     52tx *= 5;    ty = (int)(ty*0.8);
     53trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0);
     54trtw->SetAutoDelChilds(true);
     55trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0);
     56trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
     57ustrtw = atrtw = false;
     58if ((sx < 300) || (sy < 150) ) atrtw = true;
     59showinfo = false;
     60
    5061gpixm = zpixm = pixm = NULL;
    5162xsgpxm = xszpxm = xspxm = 0;
     
    6879SetColMap(CMAP_COLRJ32);
    6980
     81// pour le copier-coller
     82cpbuffer = NULL;
     83cpbuflen = 0;
     84
    7085SetBackgroundColor(PI_Black);
    7186
     
    86101if (pixm) delete pixm;
    87102if (zpixm) delete zpixm;
    88 if (txw)  txw->SetLabel("");
    89103if (zow)
    90104  {
     
    100114  gvw->SetUserData(NULL, 0);
    101115  }
     116if (cmvw)  cmvw->SetColMap(NULL, true);
    102117if (lut) delete lut;
    103118delete mdrw;
    104119delete gvdrw;
    105120if (aisup && img)  delete img;   // Suppression automatique d'image
    106 if (trtw)  delete trtw;
     121delete trtw;
     122if (cpbuffer)  delete[] cpbuffer;
    107123if (this == cur_piimage)  cur_piimage = NULL;
    108124}
     
    181197}
    182198
    183 
    184 /* --Methode-- */
    185 void PIImage::SetTextWin(PILabel * tw, bool trw, int tx, int ty)
    186 {
    187 txw = tw;
    188 if (trw)
    189   {
    190   if (trtw)  trtw->SetSize(tx, ty);
    191   else
    192     {
    193     trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0);
    194     trtw->SetAutoDelChilds(true);
    195     trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0);
    196     trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
    197     }
    198   }
    199 else
    200   if (trtw) { delete trtw; trtw = NULL;  trtlb = NULL; }
    201 
    202 return;
     199/* --Methode-- */
     200void PIImage::SetCMapWin(PICMapView * cw, bool refr)
     201{
     202cmvw = cw;
     203if (cmvw && refr) cmvw->SetColMapId(GetColMapId(),true);
     204}
     205
     206
     207/* --Methode-- */
     208void PIImage::UseInfoWin(bool trw)
     209{
     210ustrtw = trw;
     211}
     212
     213/* --Methode-- */
     214void PIImage::ShowInfo(bool si)
     215{
     216if (showinfo == si) return;
     217showinfo = si;
     218if (showinfo && img)  {
     219  char buff[256];
     220  float x,y;
     221  img->XYCoord(xpav, ypav, x, y);
     222  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     223          x, y , (*img)(xpav, ypav), xpav, ypav );
     224  DrawInfo(mWGrC, buff);
     225  }
     226else DrawInfo(mWGrC, NULL);
    203227}
    204228
     
    326350if (zow)  zow->SetColMap(cmap, refr);
    327351if (gvw)  gvw->SetColMap(cmap, refr);
     352if (cmvw) cmvw->SetColMapId(cmap, true);
    328353return;
    329354}
     
    334359{
    335360if (img == NULL)  return;
    336 if (mw)
    337   { 
     361if (mw)  { 
    338362  ComputePixmap();
    339363  Send(Msg(), PIMsg_Active);
     
    341365  PIDrwTools::SetCurrentBaseWdg(this);
    342366  }
     367else {
     368  char buff[256];
     369  float x,y;
     370  img->XYCoord(xpav, ypav, x, y);
     371  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     372          x, y , (*img)(xpav, ypav), xpav, ypav );
     373  if (ustrtw || atrtw)  trtlb->SetLabel((string)buff);
     374  else DrawInfo(mWGrC, buff);
     375  }
    343376if (zow != NULL)   ComputeZoomPixmap();
    344377if (gvw != NULL)
    345378  if ( (gvw->UserData() != this) || (mw) )  SetGloVPixmap();
    346 
    347 if (txw || trtlb)
    348   {
    349   char buff[256];
    350   float x,y;
    351   img->XYCoord(xpav, ypav, x, y);
    352   sprintf(buff,"X= %g , Y= %g  PixVal= %g (%d,%d)",
    353           x, y , (*img)(xpav, ypav), xpav, ypav );
    354   if (txw)  txw->SetLabel((string)buff);
    355   if (trtlb)  trtlb->SetLabel((string)buff);
    356   }
    357 
     379if (cmvw) cmvw->SetColMapId(GetColMapId(),true);
     380 
    358381return;
    359382}
     
    363386{
    364387// printf("PIImage::Resize\n");
     388// On bascule sur la fenetre transient pour l'affichage des valeurs si fenetre trop petite
     389if ((XSize() < 300) || (YSize() < 150) ) atrtw = true; 
     390else atrtw = false;
    365391PIPixmap::Resize();
    366392CenterPave();
     
    374400PIPixmap::Draw(g, x0, y0, dx, dy);
    375401winovis = false;    // $CHECK$ Reza A enlever si possible 17/6/96
    376 if (curshow)
    377   {
     402if (curshow) {
    378403  int xc,yc;
    379404  PosImg2W(xpav, ypav, &xc, &yc);
    380405  if ((xc >= x0) && (xc < x0+dx) &&
    381406      (yc >= y0) && (yc < y0+dy) )  DrawCursor(g, xc, yc);
     407  }
     408
     409if (showinfo) {
     410  char buff[256];
     411  float x,y;
     412  img->XYCoord(xpav, ypav, x, y);
     413  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     414        x, y , (*img)(xpav, ypav), xpav, ypav );
     415  DrawInfo(mWGrC, buff);
    382416  }
    383417
     
    393427  if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
    394428  if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options
    395   }
     429
     430// ----  Le copier ----
     431  if (key == 'C' || key == 'c') {
     432    // On limite la taille a 48x48
     433    int i1 = XPave(); 
     434    int i2 = ( XSzPave() < 48 ) ? i1+XSzPave() : i1+48;
     435    int j1 = YPave(); 
     436    int j2 = ( YSzPave() < 48 ) ? j1+YSzPave() : i1+48;
     437    if ( ( (i2-i1) < 1 ) || ((j2-j1) < 1) ) return;
     438    if (!ClaimSelection())  return;  // On n'a pas pu prendre possession de la zone d'echange
     439    if (cpbuffer)  delete[] cpbuffer;
     440    cpbuflen = (j2-j1)*(i2-i1+2)*12+(j2-j1)+128;
     441    cpbuffer = new char[cpbuflen];
     442    sprintf(cpbuffer,"PIImage: Pave(%dx%d) en (%d, %d) MaxCopie= 48x48 \n",
     443            XSzPave(), YSzPave(), i1, j1);
     444    int i,j;
     445    int l = strlen(cpbuffer);
     446    for(j=j1; j<j2; j++) {
     447      sprintf(cpbuffer+l,"L %3d:",j);
     448      l += 6;
     449      for(i=i1; i<i2; i++) { sprintf(cpbuffer+l," %10g", (*img)(i, j));  l += 11; }
     450      cpbuffer[l] = '\n';  l++;
     451      }
     452    cpbuffer[l] = '\0';
     453    cpbuflen = l+1;
     454    }
     455  }
     456
    396457
    397458else if (kmod == PIKM_Blank) {
     
    429490SelPointerShape(PI_CrossPointer);
    430491xpav = xp;  ypav = yp;
    431 ShowTrTxW();
     492if (ustrtw || atrtw) ShowTrTxW();
    432493Apply(false);
    433494if (curshow)  DrawCursor(mWGrC, -1,-1);
     
    453514SelPointerShape(PI_ArrowPointer);
    454515if (curshow)  DrawCursor(mWGrC);
    455 if (trtw)  trtw->Hide();
     516if (ustrtw || atrtw) trtw->Hide();
     517else if (!showinfo) DrawInfo(mWGrC, NULL);
    456518return;
    457519}
     
    474536else mWGrC->SelForeground(PI_Magenta);
    475537mWGrC->SelLine(PI_NormalLine);
    476 ShowTrTxW();
     538if (ustrtw || atrtw) ShowTrTxW();
    477539return;
    478540}
     
    488550dxmv = x-xmv0;  dymv = y-ymv0;
    489551mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
    490 if (txw || trtlb)
    491   {
    492   char buff[256]; 
    493   float x,y;
    494   img->XYCoord(xp, yp, x, y);
    495   sprintf(buff,"X= %g , Y= %g  PixVal= %g  (C= %d,%d)",
    496           x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
    497   if (txw)  txw->SetLabel((string)buff);
    498   if (trtlb)  trtlb->SetLabel((string)buff);
    499   }
     552
     553 {
     554 char buff[256]; 
     555 float x,y;
     556 img->XYCoord(xp, yp, x, y);
     557 sprintf(buff," X= %g , Y= %g  Pix= %g  (C= %d,%d)   ",
     558         x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
     559 if (ustrtw || atrtw) trtlb->SetLabel((string)buff);
     560 else DrawInfo(mWGrC, buff);
     561 }
     562
    500563return;
    501564}
     
    520583Apply(false);
    521584if (curshow)  DrawCursor(mWGrC);
    522 if (trtw)  trtw->Hide();
     585if (ustrtw || atrtw) trtw->Hide();
     586else if (!showinfo) DrawInfo(mWGrC, NULL);
    523587return;
    524588}
     
    536600if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
    537601if (curshow)  DrawCursor(mWGrC,-1,-1);
    538 ShowTrTxW();
     602if (ustrtw || atrtw) ShowTrTxW();
    539603SelPointerShape(PI_TDLRArrowPointer);
    540604xmv0 = xp;
     
    551615if (xmv0 < 0)  return;
    552616if ( PosW2Img(x, y, &xp, &yp) )  return;
    553 if (txw || trtlb)
    554   {
    555   char buff[256];
    556   sprintf(buff,"DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0);
    557   if (txw) txw->SetLabel((string)buff);
    558   if (trtlb) trtlb->SetLabel((string)buff);
    559   }
     617
     618char buff[256];
     619sprintf(buff," DelX= %d , DelY= %d    ", xp-xmv0, yp-ymv0);
     620if (ustrtw || atrtw) trtlb->SetLabel((string)buff);
     621else DrawInfo(mWGrC, buff);
    560622}
    561623
     
    566628
    567629SelPointerShape(PI_ArrowPointer);
    568 if (trtw) trtw->Hide();
     630if (ustrtw || atrtw) trtw->Hide();
    569631if (img == NULL)  return;
    570632if (xmv0 < 0)  return;
     
    597659mdrw->Refresh();
    598660}
     661
     662/* --Methode-- */
     663void * PIImage::ProvideSelection(unsigned int& typ, unsigned int& len)
     664{
     665typ = PICP_string;
     666len = cpbuflen;
     667return(cpbuffer);
     668}
     669
     670/* --Methode-- */
     671void PIImage::SelectionLost()
     672{
     673if (cpbuffer)  delete[] cpbuffer;
     674cpbuffer = NULL;
     675cpbuflen = 0;
     676return;
     677}
     678
     679
    599680
    600681/* --Methode-- */
     
    733814
    734815/* --Methode-- */
    735 void PIImage::DrawCursor(PIGraphicGen* g)
     816void PIImage::DrawCursor(PIGraphic* g)
    736817{
    737818int xc, yc;
     
    744825 
    745826/* --Methode-- */
    746 void PIImage::DrawCursor(PIGraphicGen* g, int xc, int yc)
     827void PIImage::DrawCursor(PIGraphic* g, int xc, int yc)
    747828{
    748829
     
    776857}
    777858
     859 
     860/* --Methode-- */
     861void PIImage::DrawInfo(PIGraphic* g, char* txt)
     862{
     863g->SelFont(PI_NormalSizeFont, PI_RomanFont);
     864if (txt) {
     865  PIColors fgc = g->GetForeground();
     866  PIGOMode gm = g->GetGOMode();
     867  g->SelGOMode(PI_GOCopy);
     868  g->SelForeground(PI_White);
     869  g->SelBackground(PI_Black);
     870  g->DrawOpaqueString(20, YSize()-5, txt);
     871  g->SelGOMode(gm);
     872  g->SelForeground(fgc);
     873  }
     874else {
     875  int a,d,h;
     876  h = g->GetFontHeight(a, d);
     877  PIPixmap::Draw(g, 0, YSize()-10-h, XSize(), h+10);
     878  }
     879return;
     880}
    778881
    779882/* --Methode-- */
  • trunk/SophyaPI/PI/piimage.h

    r118 r127  
     1// This may look like C code, but it is really -*- C++ -*-
    12// Module PI : Peida Interactive     PIImage
    23// Affichage d image            R. Ansari  05/95
     
    1415#include PISTDWDG_H
    1516#include PIWIN_H
     17#include "picmapview.h"
    1618
    1719class PIImage : public PIPixmap
     
    3537                       { mdrw->SetAxesFlags(flags); mdrw->Refresh(); }
    3638
    37 // Fenetre de Zoom, text, ...
    38   void SetZoomWin(PIPixmap * zw, bool refr=true);
    39   void SetGloVWin(PIPixmap * zw, bool refr=true);
    40   void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30);
     39// Fenetre de Zoom, Vue global, ColorMap, text, ...
     40  void SetZoomWin(PIPixmap * zw, bool refr=false);
     41  void SetGloVWin(PIPixmap * zw, bool refr=false);
     42  void SetCMapWin(PICMapView * cw, bool refr=false);
     43
     44  void UseInfoWin(bool trw=false);
     45  void ShowInfo(bool si=true);
    4146  void ShowCursor(bool sc=true);
    4247
     
    6772  void Apply(bool mw=true);
    6873
     74// Gestion du trace et des evenements
    6975  virtual void Resize();
    7076  virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
     
    8187  virtual void Ptr3Move(int x, int y);
    8288
    83   virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l);
     89// Gestion du copier-coller
     90  virtual void   PasteSelection(unsigned int typ, void *pdata, unsigned int l);
     91  virtual void*  ProvideSelection(unsigned int& typ, unsigned int& len);
     92  virtual void   SelectionLost();
    8493
    8594//  Pour acces par les ImgTools (LutWind, ...)
     
    94103  void SetGloVPixmap();
    95104
    96   void DrawCursor(PIGraphicGen* g);
    97   void DrawCursor(PIGraphicGen* g, int xc, int yc);
     105  void DrawCursor(PIGraphic* g);
     106  void DrawCursor(PIGraphic* g, int xc, int yc);
     107  void DrawInfo(PIGraphic* g, char* txt);
    98108
    99109  void ShowTrTxW();
     
    127137  int xsgpxm, ysgpxm;
    128138  PIElDrawer* gvdrw;
     139// Fenetre d'affichage du ColMap
     140  PICMapView* cmvw;
    129141// Fenetre/champ de texte
    130   PILabel * txw;
    131142  PILabel * trtlb;
    132143  PIWindow * trtw;
     144  bool ustrtw, atrtw;
     145  bool showinfo;
    133146// Le pave et le curseur
    134147  int xpav, ypav;
     
    138151  int xcurs, ycurs;
    139152  int xszpav, yszpav;
     153// buffer pour copier-coller
     154  char* cpbuffer;
     155  int cpbuflen;
    140156
    141157//  PIImage courante
  • trunk/SophyaPI/PI/piimgtools.cc

    r126 r127  
    346346    break;
    347347
     348  case 5311 :
     349    mpii->ShowInfo(true);
     350    break;
     351
     352  case 5312 :
     353    mpii->ShowInfo(false);
     354    break;
     355
    348356  case 5321 :
    349357    mpii->ShowCursor(true);
  • trunk/SophyaPI/PI/pipixmapx.cc

    r120 r127  
    6060}
    6161
    62 /* --Methode-- */
     62/*DEL07 --Methode--
    6363void PIPixmapX::Draw(PIGraphicGen* g)
    6464{
     
    6767if (g->kind() == PI_PSFileGraphics ) {
    6868    g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
    69   /*  Il faut faire quelque chose Sinon ??! */
     69    //  Il faut faire quelque chose Sinon ??!
    7070  }
    7171else  Draw(g, 0, 0, XSize(), YSize());
    7272}
     73*/
    7374
    7475/* --Methode-- */
    75 void PIPixmapX::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     76void PIPixmapX::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
    7677{
    77 int mx, my, ox, oy;
    78 Window xw;
    79 Display * mdsp;
     78
    8079if (!g) return;
    81 if (g->kind() == PI_PSFileGraphics ) return;
    8280if ((myximg == NULL) || (cmap == NULL)) return;
    8381
    84 xw = XtWindow(XtWdg());
    85 mdsp = PIXDisplay();
     82if (g->kind() == PI_PSFileGraphics ) {
     83  if (pixmap) g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
     84  return;
     85  }
     86
     87Window xw = XtWindow(XtWdg());
     88Display * mdsp = PIXDisplay();
     89
     90int mx, my, ox, oy;
    8691
    8792if (x0 < 0)  x0 = 0;
  • trunk/SophyaPI/PI/pipixmapx.h

    r71 r127  
    1313  virtual void  Refresh();
    1414  virtual void  Resize();
    15   virtual void  Draw(PIGraphicGen* g);
    16   virtual void  Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
     15  virtual void  Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
    1716
    1817
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r120 r127  
    55#ifndef PISCDRAWWDG_H
    66#define PISCDRAWWDG_H
    7 
    8 #include <vector>
    97
    108#include "pisysdep.h"
Note: See TracChangeset for help on using the changeset viewer.