Changeset 71 in Sophya


Ignore:
Timestamp:
Feb 12, 1998, 3:14:22 PM (28 years ago)
Author:
ansari
Message:

Version non completement debugge avec les PIGraphic Reza 12/02/98

Location:
trunk/SophyaPI/PI
Files:
8 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r62 r71  
    33 
    44all: $(LIB)libPI.a
    5 $(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)pidrawer.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)pintuple.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)psfile.o
     5$(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)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.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)pintuple.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)psfile.o
    66        $(AR) $(ARFLAGS)  $@ $?
    77ifeq ($(CXX),cxx)
     
    1717 pimenubargen.h pimenux.h pimenugen.h
    1818$(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
    19  pimsghandler.h picmap.h picmapx.h picmapgen.h pidrawer.h psfile.h \
    20  $(INC)defs.h pibwdgx.h
     19 pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
     20 psfile.h $(INC)defs.h pidrawer.h pigraphuc.h \
     21 pigraphps.h
    2122$(OBJ)pibwdgx.o: pibwdgx.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
    2223 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
    23  pixtbase.h pidrawer.h psfile.h $(INC)defs.h
     24 pigraphx.h pigraphgen.h psfile.h $(INC)defs.h \
     25 pigraphps.h pixtbase.h
    2426$(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h
    2527$(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h
     
    3133 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
    3234$(OBJ)pidrawer.o: pidrawer.cc pidrawer.h pibwdggen.h pisysdep.h piwdgx.h \
    33  piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h psfile.h \
    34  $(INC)defs.h pibwdgx.h
     35 piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h \
     36 pigraphgen.h psfile.h $(INC)defs.h \
     37 pigraphuc.h
    3538$(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h piwindowx.h \
    3639 piwindowgen.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \
    3740 pimsghandler.h piscdrawwdg.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
    38  picmapgen.h pistdwdgx.h pistdwdggen.h pidrawer.h
     41 picmapgen.h pigraphx.h pigraphgen.h psfile.h \
     42 $(INC)defs.h pigraphps.h pistdwdgx.h \
     43 pistdwdggen.h pidrawer.h pigraphuc.h
    3944$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
    4045 piwdggen.h pimsghandler.h
     
    4247 piwdgx.h piwdggen.h pimsghandler.h piwindowx.h piwindowgen.h \
    4348 picontainerx.h picontainergen.h
     49$(OBJ)pigraphgen.o: pigraphgen.cc pigraphgen.h pisysdep.h piwdgx.h \
     50 piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
     51$(OBJ)pigraphps.o: pigraphps.cc pigraphps.h pisysdep.h pigraphgen.h piwdgx.h \
     52 piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h psfile.h \
     53 $(INC)defs.h
     54$(OBJ)pigraphuc.o: pigraphuc.cc pigraphuc.h pisysdep.h pigraphgen.h piwdgx.h \
     55 piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
     56$(OBJ)pigraphx.o: pigraphx.cc pigraphx.h pisysdep.h pigraphgen.h piwdgx.h \
     57 piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
    4458$(OBJ)pihisto.o: pihisto.cc pihisto.h $(INC)histos.h \
    4559 $(INC)peida.h \
     
    5670 $(INC)pclassids.h piscdrawwdg.h pisysdep.h \
    5771 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    58  picmapx.h picmapgen.h pistdwdgx.h pistdwdggen.h piwindowx.h \
    59  piwindowgen.h picontainerx.h picontainergen.h pidrawer.h
     72 picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
     73 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
     74 picontainergen.h pidrawer.h pigraphuc.h
    6075$(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \
    6176 $(INC)rzimage.h \
     
    7388 $(INC)lut.h pisysdep.h pipixmapx.h \
    7489 pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h \
    75  pimsghandler.h picmap.h picmapx.h picmapgen.h pistdwdgx.h \
    76  pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
    77  picontainergen.h $(INC)imageop.h \
     90 pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
     91 psfile.h pigraphps.h pistdwdgx.h pistdwdggen.h piwindowx.h \
     92 piwindowgen.h picontainerx.h picontainergen.h \
     93 $(INC)imageop.h \
    7894 $(INC)fitsimage.h \
    7995 $(INC)fitsheader.h \
     
    119135 $(INC)pclassids.h piscdrawwdg.h pisysdep.h \
    120136 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    121  picmapx.h picmapgen.h pistdwdgx.h pistdwdggen.h piwindowx.h \
    122  piwindowgen.h picontainerx.h picontainergen.h pidrawer.h
     137 picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
     138 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
     139 picontainergen.h pidrawer.h pigraphuc.h
    123140$(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h \
    124141 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
     
    132149$(OBJ)pipixmapgen.o: pipixmapgen.cc pipixmapgen.h pisysdep.h pibwdgx.h \
    133150 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
    134  picmapgen.h
     151 picmapgen.h pigraphx.h pigraphgen.h psfile.h \
     152 $(INC)defs.h pigraphps.h
    135153$(OBJ)pipixmapx.o: pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \
    136154 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    137  picmapx.h picmapgen.h psfile.h $(INC)defs.h
     155 picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h \
     156 $(INC)defs.h pigraphps.h
    138157$(OBJ)piscdrawwdg.o: piscdrawwdg.cc \
    139158 $(INC)generalfit.h \
     
    151170 $(INC)cvector.h piscdrawwdg.h pisysdep.h \
    152171 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    153  picmapx.h picmapgen.h pistdwdgx.h pistdwdggen.h piwindowx.h \
    154  piwindowgen.h picontainerx.h picontainergen.h pidrawer.h
     172 picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
     173 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
     174 picontainergen.h pidrawer.h pigraphuc.h
    155175$(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
    156176 piwdggen.h pimsghandler.h
     
    190210 $(INC)zfidu.h piscdrawwdg.h pisysdep.h \
    191211 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    192  picmapx.h picmapgen.h pistdwdgx.h pistdwdggen.h piwindowx.h \
    193  piwindowgen.h picontainerx.h picontainergen.h pidrawer.h
     212 picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
     213 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
     214 picontainergen.h pidrawer.h pigraphuc.h
    194215$(OBJ)piup.o: piup.cc $(INC)ctimer.h \
    195216 $(INC)peida.h \
     
    227248$(OBJ)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \
    228249 pisysdep.h piwdgx.h psfile.h $(INC)defs.h \
    229  pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h
     250 pigraphgen.h picmap.h picmapx.h picmapgen.h
    230251$(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \
    231252 pisysdep.h picontainergen.h
    232253$(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \
    233254 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h psfile.h \
    234  $(INC)defs.h pibwdgx.h pibwdggen.h picmap.h \
    235  picmapx.h picmapgen.h
     255 $(INC)defs.h pigraphgen.h picmap.h picmapx.h \
     256 picmapgen.h
    236257$(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \
    237258 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
    238259$(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
    239260 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
    240  pixtbase.h
     261 pigraphx.h pigraphgen.h psfile.h $(INC)defs.h \
     262 pigraphps.h pixtbase.h
    241263$(OBJ)psfile.o: psfile.cc psfile.h $(INC)defs.h \
    242  pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
    243  picmap.h picmapx.h picmapgen.h
     264 pisysdep.h pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
     265 picmapx.h picmapgen.h
  • trunk/SophyaPI/PI/pibwdggen.cc

    r63 r71  
    33#include "pibwdggen.h"
    44#include "pidrawer.h"
    5 #include "psfile.h"
     5#include "pigraphps.h"
    66
    77// Les methodes de la classe  PIBWdgGen
     
    1212PIWdg(par, nom, sx, sy, px, py)
    1313{
    14 mPSOut=NULL;
    1514mDrwId=0;   // Compteur des numeros sequentiel des PIDrawer
    1615mAdfg=false;    // Pour controle d'appel de RemoveDrawer()
    17 }
    18 
     16mWGrC = NULL;   // PIGraphic (Contexte graphique) associe a la fenetre}
     17                // Doit etre cree par PIBaseWdgX/Mac/...
     18}
    1919
    2020/* --Methode-- */
    2121PIBaseWdgGen::~PIBaseWdgGen()
    2222{
     23delete mWGrC;
    2324DeleteDrawers();
    2425}
     
    2627
    2728/* --Methode-- */
    28 void PIBaseWdgGen::SaveGraphicAtt()
    29 {
    30   sFCol = GetForeground();
    31   sBCol = GetBackground();
    32   sGOm = GetGOMode();
    33   sFAtt = GetFontAtt();   
    34   sFSize = GetFontSize();
    35   sLAtt = GetLineAtt();
    36   sMrk = GetMarker();   
    37   sMrkSz = GetMarkerSize();
    38   return;
    39 }
    40 
    41 /* --Methode-- */
    42 void PIBaseWdgGen::RestoreGraphicAtt()
    43 {
    44   SelForeground(sFCol);
    45   SelBackground(sBCol);
    46   SelGOMode(sGOm);
    47   SelFontSzPt(sFSize, sFAtt);
    48   SelLine(sLAtt);
    49   SelMarker(sMrkSz, sMrk);
    50   return;
    51 }
    52 
    53 /* --Methode-- */
    5429void PIBaseWdgGen::Refresh()
    5530{
    5631if ( IsVisible() )  {
    57   Draw();
    58   CallDrawers();
    59 }
    60 return;
    61 }
    62 
    63 /* --Methode-- */
    64 void PIBaseWdgGen::Draw(int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
    65 {
    66 this->Draw();
    67 return;
    68 }
    69 
    70 /* --Methode-- */
    71 void PIBaseWdgGen::Draw()
     32  Draw(mWGrC);
     33  CallDrawers(mWGrC);
     34}
     35return;
     36}
     37
     38/* --Methode-- */
     39void PIBaseWdgGen::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
     40{
     41this->Draw(g);
     42return;
     43}
     44
     45/* --Methode-- */
     46void PIBaseWdgGen::Draw(PIGraphicGen* g)
    7247{
    7348#ifdef DEBUG_RZXB
     
    187162void PIBaseWdgGen::PSPrint(PSFile * psf, int ofx, int ofy)
    188163{
    189 if(!psf) return;
    190 mPSOut = psf;
    191 psf->NewBloc((float)(ofx+XPos()), (float)(ofy+YPos()),
    192              (float)XSize(),(float)YSize(),
    193              (float)XSize(),(float)YSize());
    194 Draw();
    195 psf->EndBloc();
    196 mPSOut=NULL;
     164if (!psf) return;
     165PIGraphicPS grpsf(psf, (PIWdg *)this, ofx, ofy);
     166Draw(&grpsf);
     167CallDrawers(&grpsf);
     168return;
    197169}
    198170
     
    209181did.drw = drw;
    210182mDrwList.push_back(did);
    211 drw->Attach((PIBaseWdg*)this, mDrwId);
     183drw->Attach(this, mDrwId);
    212184return(mDrwId);
    213185}
     
    233205for(it = mDrwList.begin(); it != mDrwList.end(); it++)
    234206  if ((*it).id == id)
    235     { (*it).drw->Detach((PIBaseWdg*)this, id); mDrwList.erase(it); break; }
     207    { (*it).drw->Detach(this, id); mDrwList.erase(it); break; }
    236208return;
    237209}
     
    251223
    252224/* --Methode-- */
    253 void PIBaseWdgGen::CallDrawers(int x0, int y0, int dx, int dy)
    254 {
    255 double xmin,ymin, xmax, ymax;
     225void PIBaseWdgGen::CallDrawers(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     226{
     227float xmin,ymin, xmax, ymax;
     228PIGraphicUC* guc;
    256229
    257230bool sxy = false;
     
    261234bool fgc=false;
    262235for(it = mDrwList.begin(); it != mDrwList.end(); it++) {
    263   SaveGraphicAtt();
    264   (*it).drw->SetDrwWdg(this, (*it).x0, (*it).y0, (*it).dx, (*it).dy);
    265   SetClipRectangle((*it).x0, (*it).y0, (*it).dx , (*it).dy);
     236  g->SaveGraphicAtt();
     237  guc = (*it).drw->SetDrwWdg(this, (*it).x0, (*it).y0, (*it).dx, (*it).dy, g);
     238  g->SetClipRectangle((*it).x0, (*it).y0, (*it).dx , (*it).dy);
    266239  fgc = true;
    267240  if (sxy) {
    268     (*it).drw->Local2Sc(x0, y0, xmin, ymin);
    269     (*it).drw->Local2Sc(x0+dx, y0+dy, xmax, ymax);
     241    guc->GrC2UC(x0, y0, xmin, ymin);
     242    guc->GrC2UC(x0+dx, y0+dy, xmax, ymax);
    270243    if (xmin > xmax)  swap(xmin,xmax);
    271244    if (ymin > ymax)  swap(ymin,ymax);
    272     (*it).drw->Draw(xmin, ymin, xmax, ymax);
    273   }
    274   else (*it).drw->Draw();
    275   RestoreGraphicAtt();
    276   }
    277 if (fgc)  ClearClipRectangle();
    278 
    279 return;
    280 }
    281 
    282 /* --Methode-- */
    283 void PIBaseWdgGen::CallDrawer(int id)
    284 {
     245    (*it).drw->Draw(guc, xmin, ymin, xmax, ymax);
     246  }
     247  else (*it).drw->Draw(guc);
     248  g->RestoreGraphicAtt();
     249  }
     250if (fgc)  g->ClearClipRectangle();
     251
     252return;
     253}
     254
     255/* --Methode-- */
     256void PIBaseWdgGen::CallDrawer(PIGraphicGen* g, int id)
     257{
     258PIGraphicUC* guc;
    285259list<BWDrwId>::iterator it;
    286260for(it = mDrwList.begin(); it != mDrwList.end(); it++)
    287261  if ((*it).id == id) {
    288     SaveGraphicAtt();
    289     (*it).drw->SetDrwWdg(this, (*it).x0, (*it).y0, (*it).dx, (*it).dy);
    290     SetClipRectangle((*it).x0, (*it).y0, (*it).dx , (*it).dy);
    291     (*it).drw->Draw();
    292     RestoreGraphicAtt();   
    293     ClearClipRectangle();
     262    g->SaveGraphicAtt();
     263    guc = (*it).drw->SetDrwWdg(this, (*it).x0, (*it).y0, (*it).dx, (*it).dy, g);
     264    g->SetClipRectangle((*it).x0, (*it).y0, (*it).dx , (*it).dy);
     265    (*it).drw->Draw(guc);
     266    g->RestoreGraphicAtt();   
     267    g->ClearClipRectangle();
    294268    break;
    295269  }
    296270return;
    297271}
     272
     273
     274/* --Methode-- */
     275PIGraphic* PIBaseWdgGen::WindowGraphic()
     276{
     277return(mWGrC);
     278}
  • trunk/SophyaPI/PI/pibwdggen.h

    r63 r71  
    66#include PIWDG_H
    77#include PICMAP_H
     8#include PIGRAPHIC_H
     9#include "psfile.h"
    810
    911// Mettre dans cet ordre, sinon g++ a des problemes   
     
    1921                   PIK_Previous = 21+0x2000, PIK_Next = 22+0x2000  } ;
    2022
    21 enum PIColors  { PI_ColorFromMap = -2, PI_NotDefColor = -1,
    22                  PI_Black = 0, PI_White = 1,  PI_Grey = 2,
    23                  PI_Red = 3, PI_Blue = 4, PI_Green = 5, 
    24                  PI_Yellow = 6, PI_Magenta = 7 };
    25 
    26 enum PIFontSize { PI_NotDefFontSize = -1,
    27                   PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 };
    28 
    29 enum PIFontAtt { PI_NotDefFontAtt = -1,
    30                  PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 };
    31 
    32 enum PIPaperSize { PI_A4 = 1, PI_A3 = 2, PI_A5 = 3, PI_NotDefPaperSize = 0};
    33 
    34 enum PIOrientation { PI_Landscape = 0, PI_Portrait = 1, PI_Auto = 2 } ;
    35 
    36 
    37 enum PILineAtt { PI_NotDefLineAtt = -1,
    38                  PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 };
    39 
    40 enum PIMarker  { PI_NotDefMarker = -1,
    41                  PI_DotMarker = 0, PI_PlusMarker=1, PI_CrossMarker=2, 
    42                  PI_CircleMarker=3, PI_FCircleMarker=4,
    43                  PI_BoxMarker=5, PI_FBoxMarker=6,
    44                  PI_TriangleMarker=7, PI_FTriangleMarker=8,
    45                  PI_StarMarker=9, PI_FStarMarker=10 };
    4623
    4724enum PIPointer { PI_ArrowPointer = 1, PI_CrossPointer = 2,
    4825                 PI_HandPointer = 3, PI_TDLRArrowPointer = 4 };
    4926
    50 enum PIGOMode { PI_GOCopy = 0, PI_GOXOR = 1 };
    5127
    5228class PIBaseWdgGen : public PIWdg
     
    6945  virtual void       ActivateKeyboard()        = 0;
    7046
    71 //  Trace graphiques
    72   virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0)   = 0;
    73   virtual void       DrawString(int x, int y, char* s, int pos = 0)        = 0;
    74   virtual void       DrawOpaqueString(int x, int y, char* s, int pos = 0)  = 0;
    75   virtual void       DrawLine(int x1, int y1, int x2, int y2)              = 0;
    76   virtual void       DrawBox(int x0, int y0, int dx, int dy)               = 0;
    77   virtual void       DrawFBox(int x0, int y0, int dx, int dy)              = 0;
    78   virtual void       DrawCircle(int x0, int y0, int r)                     = 0;
    79   virtual void       DrawFCircle(int x0, int y0, int r)                    = 0;
    80   virtual void       DrawPolygon(int *x, int *y, int n)                    = 0; 
    81   virtual void       DrawFPolygon(int *x, int *y, int n)                   = 0; 
    82   virtual void       DrawMarker(int x0, int y0)                            = 0;
    83   virtual void       DrawMarkers(int *x, int *y, int n)                    = 0;
    84   virtual void       DrawPixmap(int x, int y, unsigned char *pix,
    85                                 int sx, int sy, PIColorMap* cmap)          = 0;
    86 
    87   virtual int        CalcStringWidth(char const* s)                        = 0;
    88 
    89 // Modifications attributs graphiques
    90   virtual void       SelForeground(PIColors col=PI_Black)                  = 0;
    91   virtual void       SelBackground(PIColors col=PI_White)                  = 0;
    92 //  virtual void       SelForeground(PIColorMap* cmap, int cid)              = 0;
    93 //  virtual void       SelBackground(PIColorMap* cmap, int cid)              = 0;
    94   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy)                     = 0;
    95   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont,
    96                              PIFontAtt att=PI_RomanFont)                   = 0;
    97   virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)   = 0;
    98   virtual void       SelLine(PILineAtt att=PI_NormalLine)                  = 0;
    99   virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer)        = 0;
    100   virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker)       = 0;
    101 
    102 // Selection de zone de trace (clip)
    103   virtual void       SetClipRectangle(int x0, int y0, int dx, int dy)      = 0;
    104   virtual void       ClearClipRectangle() = 0;
    105 
    106 // Acces aux attributs graphiques
    107   virtual PIColors   GetForeground()    = 0;
    108   virtual PIColors   GetBackground()    = 0;
    109   virtual PIGOMode   GetGOMode()        = 0;
    110   virtual PIFontAtt  GetFontAtt()       = 0;
    111   virtual int        GetFontSize()      = 0;
    112   virtual PILineAtt  GetLineAtt()       = 0;
    113   virtual PIPointer  GetPointerShape()  = 0;
    114   virtual PIMarker   GetMarker()        = 0;
    115   virtual int        GetMarkerSize()    = 0;
    116   virtual int        GetFontHeight(int& asc, int& desc) = 0;
    117 
    118 // Sauvegarde des attributs graphiques
    119   virtual void       SaveGraphicAtt();
    120   virtual void       RestoreGraphicAtt();
    121 
     47//  Divers : couleur de fond, Effacement fenetre,  forme de la souris
     48  virtual void       SetBackgroundColor(PIColors col=PI_White)               = 0;
     49  virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0)     = 0;
     50  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer)          = 0;
     51  virtual PIColors   GetBackgroundColor()                                    = 0;
     52  virtual PIPointer  GetPointerShape()                                       = 0;
    12253
    12354//  Fonction qui doit etre appelee pour rafraichir la fenetre
     
    12556
    12657//  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
    127   virtual void       Draw();
    128   virtual void       Draw(int x0, int y0, int dx, int dy);
     58  virtual void       Draw(PIGraphicGen* g);
     59  virtual void       Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
    12960 
    13061// Traitement des evenements   
     
    14475
    14576// PostScript output
    146   virtual void       PSPrint(PSFile * psf, int ofx = 0, int ofy = 0);
     77  virtual void       PSPrint(PSFile* psf, int ofx = 0, int ofy = 0);
    14778
    14879// Gestion des Drawers
     
    15586
    15687//  Trace des Drawers ...         
    157   virtual void       CallDrawers(int x0=0, int y0=0, int dx=0, int dy=0);
    158   virtual void       CallDrawer(int id);
     88  virtual void       CallDrawers(PIGraphicGen* g, int x0=0, int y0=0, int dx=0, int dy=0);
     89  virtual void       CallDrawer(PIGraphicGen* g, int id);
    15990
    16091// Devrait etre protected - mis ici a cause de cxx  11/07/97  Reza
    16192  struct BWDrwId { int x0, y0; int dx, dy; int id; bool ad; PIDrawer* drw; };
    16293
     94  virtual PIGraphic*  WindowGraphic();
     95
    16396protected:
    164   PSFile * mPSOut;  /* Fichier PostScript eventuel */
    165 
     97  PIGraphic* mWGrC;  // PIGraphic (Contexte graphique) associe a la fenetre
    16698  bool mAdfg;
    16799  int mDrwId;
    168100  list<BWDrwId> mDrwList;
    169 // Pour Save/Restore des attributs graphiques
    170   PIColors  sFCol, sBCol;
    171   PIGOMode sGOm;
    172   PIFontAtt sFAtt;
    173   PILineAtt sLAtt;
    174   int sFSize;
    175   PIMarker sMrk;
    176   int sMrkSz;
    177101
    178102};
  • trunk/SophyaPI/PI/pibwdgx.cc

    r63 r71  
    1212
    1313#include "pibwdgx.h"
    14 #include "pidrawer.h"
    15 #include "psfile.h"
    16 
    17 
    18 /*  Variables globales pour modifier les GC  */
    19 #define NMAXFONTSZ  5
    20 static XFontStruct * fntst[NMAXFONTSZ][3];
    21 static int fntsz[NMAXFONTSZ] = {8,10,12,14,16};
    22 static  PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont };
    23 #define NMAXCOL  10
    24 static unsigned long colpix[NMAXCOL];
     14
     15
     16// #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
     17static unsigned long colpixwhite, colpixblack;
    2518#define NMAXCURS 5
    2619static Cursor curs[NMAXCURS];
    27 
    28 /*  GC pour DrawPixmap   */
    29 static GC dpxgc;
    30 
    31 // #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
    3220
    3321
     
    4533
    4634XtSetArg(wargs[0],PIXNobject,this);
    47 XtSetArg(wargs[1],XtNbackground, colpix[PI_White]); 
     35XtSetArg(wargs[1],XtNbackground, colpixwhite); 
    4836XtSetArg(wargs[2],XtNborderWidth, (Dimension)0); 
    4937XtSetValues(XtWdg(), wargs, 3);
     
    5139XtUninstallTranslations(XtWdg());
    5240
    53 mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL);
    54 mGOm = PI_GOCopy;
    55 
    56 mFCol = mBCol = PI_Grey;
    57 SelForeground(PI_Black);
    58 SelBackground(PI_White);
    59 mLAtt = PI_ThinLine;
    60 SelLine();
    61 mFAtt = PI_BoldFont;  mFSize = 0;
    62 SelFont();
    6341mPtrS = PI_CrossPointer;
    6442SelPointerShape();
    65 SelMarker(1, PI_DotMarker);
    6643
    6744Manage();
     45mWGrC = new PIGraphic(this);   // PIGraphic (Contexte graphique) associe a la fenetre
    6846}
    6947
     
    154132}
    155133
     134/* --Methode-- */
     135void PIBaseWdgX::SetBackgroundColor(PIColors col)
     136{
     137Arg  wargs[2];
     138XtSetArg(wargs[0],XtNbackground, mWGrC->GetPixelValueforColor(col) ); 
     139XtSetValues(XtWdg(), wargs, 1);
     140mBCol = col;
     141return;
     142}
    156143
    157144/* --Methode-- */
    158145void PIBaseWdgX::EraseWindow(int x0, int y0, int dx, int dy)
    159146{
    160 if(mPSOut) return;
    161147XClearArea (XtDisplay(XtWdg()),XtWindow(XtWdg()), x0, y0, dx, dy, False );
    162148return;
    163149}
    164 
    165 /* --Methode-- */
    166 void PIBaseWdgX::DrawString(int x, int y, char* s, int /*pos*/)
    167 {
    168 if(mPSOut){
    169 mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    170 }
    171 else
    172 XDrawString (XtDisplay (XtWdg()),XtWindow(XtWdg()),
    173                   DefGC(), x, y, s, strlen(s));
    174 return;
    175 }
    176 
    177 /* --Methode-- */
    178 void PIBaseWdgX::DrawOpaqueString(int x, int y, char* s, int /*pos*/)
    179 {
    180 if(mPSOut){
    181 mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    182 }
    183 else
    184 XDrawImageString (XtDisplay (XtWdg()),XtWindow(XtWdg()),
    185                   DefGC(), x, y, s, strlen(s));
    186 return;
    187 }
    188 
    189  
    190 /* --Methode-- */
    191 void PIBaseWdgX::DrawLine(int x1, int y1, int x2, int y2)
    192 {
    193 if(mPSOut){
    194 mPSOut->DrawLine((float)x1,(float)y1,(float)x2,(float)y2,
    195                  mFCol,mLAtt);
    196 }
    197 else
    198 XDrawLine(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), x1, y1, x2, y2);
    199 return;
    200 }
    201 
    202 
    203 /* --Methode-- */
    204 void PIBaseWdgX::DrawBox(int x0, int y0, int dx, int dy)
    205 {
    206 if(mPSOut)
    207 mPSOut->DrawBox((float)x0,(float)y0,(float)dx,(float)dy,mFCol,mLAtt);
    208 else{
    209 if (dx < 0)  { x0 += dx;  dx = -dx; }
    210 if (dy < 0)  { y0 += dy;  dy = -dy; }
    211 XDrawRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()),
    212                DefGC(), x0, y0, dx, dy);
    213 }
    214 return;
    215 }
    216 
    217 /* --Methode-- */
    218 void PIBaseWdgX::DrawFBox(int x0, int y0, int dx, int dy)
    219 {
    220 if(mPSOut)
    221 mPSOut->DrawFBox((float)x0,(float)y0,(float)dx,(float)dy, mFCol, mFCol, mLAtt);
    222 else{
    223 if (dx < 0)  { x0 += dx;  dx = -dx; }
    224 if (dy < 0)  { y0 += dy;  dy = -dy; }
    225 XFillRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()),
    226                DefGC(), x0, y0, dx, dy);
    227 }
    228 return;
    229 }
    230 
    231 /* --Methode-- */
    232 void PIBaseWdgX::DrawCircle(int x0, int y0, int r)
    233 {
    234 if(mPSOut)
    235 mPSOut->DrawCircle((float)x0,(float)y0,(float)r,mFCol,mLAtt);
    236 else
    237 XDrawArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(),
    238          x0-r, y0-r, 2*r, 2*r, 0, 360*64);
    239 return;
    240 }
    241 
    242 /* --Methode-- */
    243 void PIBaseWdgX::DrawFCircle(int x0, int y0, int r)
    244 {
    245 if(mPSOut)
    246 mPSOut->DrawFCircle((float)x0,(float)y0,(float)r,mFCol,mFCol,mLAtt);
    247 else
    248 XFillArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(),
    249          x0-r, y0-r, 2*r, 2*r, 0, 360*64);
    250 return;
    251 }
    252 
    253 // Pour les fonctions de trace avec un plusieurs coordonnees
    254 #define NMXXPOINTS  30
    255 
    256 /* --Methode-- */
    257 void PIBaseWdgX::DrawPolygon(int *x, int *y, int n)
    258 {
    259 XPoint multipoint[NMXXPOINTS];
    260 XPoint *pxp;
    261 int i;
    262 float *xtmp;
    263 float *ytmp;
    264 
    265 if(mPSOut)
    266 {
    267 xtmp = new float[n];
    268 ytmp = new float[n];
    269 for(i=0;i<n;i++){
    270   xtmp[i] = (float)x[i];
    271   ytmp[i] = (float)y[i];
    272 }
    273 mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt);
    274 delete[] xtmp;
    275 delete[] ytmp;
    276 }
    277 else {
    278 if (n <= 0)  return;
    279 if (n > NMXXPOINTS)  pxp = new XPoint[n];
    280 else pxp = multipoint;
    281 for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; }
    282 XDrawLines(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), pxp, n, CoordModePrevious);
    283 if (n > NMXXPOINTS)  delete[] pxp;
    284 }
    285 return;
    286 }
    287 
    288 
    289 /* --Methode-- */
    290 void PIBaseWdgX::DrawFPolygon(int *x, int *y, int n)
    291 {
    292 XPoint multipoint[NMXXPOINTS];
    293 XPoint *pxp;
    294 int i;
    295 float *xtmp;
    296 float *ytmp;
    297 
    298 if(mPSOut)
    299 {
    300 xtmp = new float[n];
    301 ytmp = new float[n];
    302 for(i=0;i<n;i++){
    303   xtmp[i] = (float)x[i];
    304   ytmp[i] = (float)y[i];
    305 }
    306 mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt);
    307 delete[] xtmp;
    308 delete[] ytmp;
    309 }
    310 else
    311 {
    312 if (n <= 0)  return;
    313 if (n > NMXXPOINTS)  pxp = new XPoint[n];
    314 else pxp = multipoint;
    315 for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; }
    316 XFillPolygon(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), pxp, n,
    317                         Complex, CoordModePrevious);
    318 if (n > NMXXPOINTS)  delete[] pxp;
    319 }
    320 return;
    321 }
    322 
    323 /* --Methode-- */
    324 void PIBaseWdgX::DrawMarker(int x0, int y0)
    325 {
    326 int hmsz = mMrkSz/2;
    327 int dmsz = mMrkSz-hmsz;
    328 int x[4],y[4];
    329 PILineAtt clatt;
    330 if(mPSOut)
    331 mPSOut->DrawMarker((float)x0,(float)y0,mMrk,mFCol,mMrkSz);
    332 else
    333 {
    334 if (mMrk == PI_DotMarker)
    335   XDrawPoint(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), x0, y0);
    336 
    337 else
    338   {
    339   clatt = mLAtt;
    340   SelLine(PI_ThinLine);
    341   switch (mMrk)
    342     {
    343     case  PI_PlusMarker :
    344       DrawLine(x0-hmsz, y0, x0+dmsz, y0);
    345       DrawLine(x0, y0-hmsz, x0, y0+dmsz);
    346       break;
    347     case  PI_CrossMarker :
    348       DrawLine(x0-hmsz, y0-hmsz, x0+dmsz, y0+dmsz);
    349       DrawLine(x0-hmsz, y0+dmsz, x0+dmsz, y0-hmsz);
    350       break; 
    351     case PI_CircleMarker :
    352       DrawCircle(x0, y0, hmsz);
    353       break;
    354     case PI_FCircleMarker :
    355       DrawFCircle(x0, y0, hmsz);
    356       break;
    357     case PI_BoxMarker :
    358       DrawBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
    359       break;
    360     case PI_FBoxMarker :
    361       DrawFBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
    362       break;
    363     case  PI_TriangleMarker :
    364       x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz;
    365       x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 
    366       DrawPolygon(x, y, 4);
    367       break;
    368     case  PI_FTriangleMarker :
    369       x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz;
    370       x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz; 
    371       DrawFPolygon(x, y, 4);
    372       break;
    373     default :
    374       XDrawPoint(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), x0, y0);
    375       break;
    376     }
    377   SelLine(clatt);
    378   }
    379 }
    380 return;
    381 }
    382 
    383 /* --Methode-- */
    384 void PIBaseWdgX::DrawMarkers(int *x, int *y, int n)
    385 {
    386 int i;
    387 float *xtmp;
    388 float *ytmp;
    389 
    390 if(mPSOut)
    391 {
    392 xtmp = new float[n];
    393 ytmp = new float[n];
    394 for(i=0;i<n;i++){
    395   xtmp[i] = (float)x[i];
    396   ytmp[i] = (float)y[i];
    397 }
    398 mPSOut->DrawMarkers(xtmp,ytmp,n,mMrk,mFCol, mMrkSz);
    399 delete[] xtmp;
    400 delete[] ytmp;
    401 }
    402 else
    403 {
    404 if (n <= 0)  return;
    405 if (mMrk == PI_DotMarker)
    406   {
    407   XPoint multipoint[NMXXPOINTS];
    408   XPoint *pxp;
    409   if (n > NMXXPOINTS)  pxp = new XPoint[n];
    410   else pxp = multipoint;
    411   for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; }
    412   XDrawPoints(XtDisplay(XtWdg()), XtWindow(XtWdg()), DefGC(), pxp, n, CoordModeOrigin);
    413   if (n > NMXXPOINTS)  delete[] pxp; 
    414   }
    415 else for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
    416 }
    417 }
    418 
    419 
    420 /* --Methode-- */
    421 void PIBaseWdgX::DrawPixmap(int x, int y, unsigned char *pix,
    422                             int sx, int sy, PIColorMap* cmap)
    423 {
    424 Window xw;
    425 Display * mdsp;
    426 int scr;
    427 int depth;
    428 int pad;
    429 int i,j;
    430 XImage * ximg;
    431 
    432 if ( (sx < 1) || (sy < 1) )  return;
    433 if ((pix == NULL) || (cmap == NULL)) return;
    434 
    435 if(mPSOut) {
    436   mPSOut->Image((float)x, (float)y, (float)sx, (float)sy, sx, sy, pix, cmap);
    437   return;
    438   }
    439  
    440 xw = XtWindow(XtWdg());
    441 mdsp = PIXDisplay();
    442 scr = PIXScreen();
    443 
    444 depth = DefaultDepth(mdsp,scr);
    445 pad = (depth > 8) ? 32 : 8;
    446 ximg = XCreateImage (mdsp,DefaultVisual(mdsp,scr),
    447                      depth,ZPixmap,0,NULL, sx, sy, pad,0);
    448 if (ximg == NULL)  return;
    449 ximg->data = new char [sy*ximg->bytes_per_line];
    450 if (ximg->data == NULL) 
    451   { XFree(ximg); return; }
    452 
    453 for(j=0; j<sy; j++)
    454   for(i=0; i<sx; i++)
    455     { XPutPixel(ximg, i, j, cmap->Color(*pix) );  pix++; }
    456 
    457 XPutImage(mdsp, xw, dpxgc, ximg, 0, 0, x, y, sx, sy);
    458 
    459 delete[] ximg->data;
    460 XFree(ximg);
    461 return;
    462 }
    463 
    464 
    465 /* --Methode-- */
    466 int PIBaseWdgX::CalcStringWidth(char const* s)
    467 {
    468 return(XTextWidth(mFSt, s, strlen(s)));
    469 }
    470 
    471 /* --Methode-- */
    472 void PIBaseWdgX::SelForeground(PIColors col)
    473 {
    474 if (col == mFCol)  return;
    475 if ( (col < 0) || (col >= NMAXCOL))  return;
    476 XSetForeground(XtDisplay(XtWdg()), DefGC(), colpix[col]);
    477 mFCol = col;
    478 return;
    479 }
    480 
    481 /* --Methode-- */
    482 void PIBaseWdgX::SelBackground(PIColors col)
    483 {
    484 if (col == mBCol)  return;
    485 if ( (col < 0) || (col >= NMAXCOL))  return;
    486 XSetBackground(XtDisplay(XtWdg()), DefGC(), colpix[col]);
    487 mBCol = col;
    488 return;
    489 }
    490 
    491 /* --Methode-- */
    492 void PIBaseWdgX::SelGOMode(PIGOMode mod)
    493 {
    494 if (mod == mGOm)  return;
    495 switch (mod)
    496   {
    497   case PI_GOCopy :
    498     XSetFunction(XtDisplay(XtWdg()), DefGC(), GXcopy);
    499     mGOm = mod;
    500     break;
    501   case PI_GOXOR :
    502     XSetFunction(XtDisplay(XtWdg()), DefGC(), GXxor);
    503     mGOm = mod;
    504     break;
    505   }
    506 return;
    507 }
    508 
    509 
    510 /* --Methode-- */
    511 void PIBaseWdgX::SelFontSzPt(int npt, PIFontAtt att)
    512 {
    513 int dsz,i,isel, j;
    514 
    515 if ((npt == mFSize) && (att == mFAtt))  return;
    516 isel = 0;
    517 dsz = 9999;
    518 for(i=0; i<NMAXFONTSZ; i++)
    519   {
    520   j = npt - fntsz[i];   if (j < 0)  j = -j;
    521   if (j < dsz)  {  isel = i; dsz = j; }
    522   }
    523 
    524 j = 0;
    525 if (att & PI_RomanFont) j = 0;
    526 if (att & PI_BoldFont) j = 1;
    527 if (att & PI_ItalicFont) j = 2;
    528 
    529 SelectFont(isel, j);
    530 
    531 }
    532 
    533 /* --Methode-- */
    534 void PIBaseWdgX::SelFont(PIFontSize sz, PIFontAtt att)
    535 {
    536 int i,j;
    537 switch (sz)
    538   {
    539   case PI_SmallSizeFont:
    540     i = 0;
    541     break;
    542   case PI_NormalSizeFont:
    543     i = 2;
    544     break;
    545   case PI_BigSizeFont:
    546     i = 4;
    547     break;
    548   default:
    549     i=2;
    550     break;
    551   }
    552 
    553 j = 0;
    554 if (att & PI_RomanFont) j = 0;
    555 if (att & PI_BoldFont) j = 1;
    556 if (att & PI_ItalicFont) j = 2;
    557 
    558 SelectFont(i, j);
    559 }
    560 
    561 
    562 
    563 /* --Methode-- */
    564 void PIBaseWdgX::SelLine(PILineAtt att)
    565 {
    566 unsigned int lt;
    567 
    568 if (att == mLAtt)  return;
    569 
    570 switch (att)
    571   {
    572   case PI_NormalLine :
    573     lt = 2;
    574     break;
    575   case PI_ThickLine :
    576     lt = 4;
    577     break;
    578   case  PI_ThinLine :
    579     lt = 0;
    580     break;
    581   default:
    582     lt = 0;
    583     break;
    584   }
    585    
    586 XSetLineAttributes(XtDisplay(XtWdg()), DefGC(), lt, LineSolid, CapButt, JoinMiter);
    587 mLAtt = att;
    588 return;
    589 }
    590 
    591150
    592151/* --Methode-- */
     
    602161
    603162/* --Methode-- */
    604 void PIBaseWdgX::SelMarker(int msz, PIMarker mrk)
    605 {
    606 if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
    607 else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
    608 return;
    609 }
    610 
    611 
    612 /* --Methode-- */
    613 void PIBaseWdgX::SetClipRectangle(int x0, int y0, int dx, int dy)
    614 {
    615 XRectangle xr;
    616 xr.x = x0;  xr.y = y0;
    617 xr.width = dx;  xr.height = dy;
    618 XSetClipRectangles(XtDisplay(XtWdg()), DefGC(), 0, 0, &xr, 1, Unsorted);
    619 XSetClipRectangles(XtDisplay(XtWdg()), dpxgc, 0, 0, &xr, 1, Unsorted);
    620 return;
    621 }
    622 
    623 /* --Methode-- */
    624 void PIBaseWdgX::ClearClipRectangle()
    625 {
    626 XSetClipMask(XtDisplay(XtWdg()), DefGC(), None);
    627 XSetClipMask(XtDisplay(XtWdg()), dpxgc, None);
    628 return;
    629 }
    630 
    631 /* --Methode-- */
    632 PIColors  PIBaseWdgX::GetForeground()
    633 {
    634 return (mFCol);
    635 }
    636 
    637 /* --Methode-- */
    638 PIColors  PIBaseWdgX::GetBackground()
    639 {
    640 return (mBCol);
    641 }
    642 
    643 
    644 /* --Methode-- */
    645 PIGOMode   PIBaseWdgX::GetGOMode()
    646 {
    647 return (mGOm);
    648 }
    649 
    650 /* --Methode-- */
    651 PIFontAtt  PIBaseWdgX::GetFontAtt()
    652 {
    653 return (mFAtt);
    654 }
    655 
    656 /* --Methode-- */
    657 int        PIBaseWdgX::GetFontSize()
    658 {
    659 return (mFSize);
    660 }
    661 
    662 /* --Methode-- */
    663 PILineAtt  PIBaseWdgX::GetLineAtt()
    664 {
    665 return (mLAtt);
     163PIColors   PIBaseWdgX::GetBackgroundColor()
     164{
     165return(mBCol);
    666166}
    667167
     
    672172}
    673173
    674 /* --Methode-- */
    675 PIMarker   PIBaseWdgX::GetMarker()
    676 {
    677 return (mMrk);
    678 }
    679 
    680 /* --Methode-- */
    681 int        PIBaseWdgX::GetMarkerSize()
    682 {
    683 return (mMrkSz);
    684 }
    685 
    686 /* --Methode-- */
    687 int        PIBaseWdgX::GetFontHeight(int& asc, int& desc)   
    688 {
    689 char a[2];
    690 XCharStruct  ovr;
    691 int hd, fa, fd;
    692 XTextExtents(mFSt, a, 0, &hd, &fa, &fd, &ovr);
    693 asc = fa; desc = fd;
    694 return(fa+fd);
    695 }
    696 
    697 
    698 /* --Methode-- */
    699 void PIBaseWdgX::SaveGraphicAtt()
    700 
    701 // Pour optimier l'implementation de PIBaseWdgGen
    702 sFCol = mFCol;    sBCol = mBCol;
    703 sGOm = mGOm;
    704 sFAtt = mFAtt;   sFSize = mFSize;
    705 sMrk = mMrk;   sMrkSz = mMrkSz;
    706 return;
    707 }
    708 
    709 
    710174
    711175static bool fgbwdg = false ;
    712176
    713 // Le bazar pour recuperer des resources de .Xdefault et autres
    714 typedef struct
    715   {
    716   String fntFam;
    717   } myAppData;
    718 static myAppData  apd;
    719 
    720 static XtResource resources[] = {
    721   { "fontFamilyName", "FontFamilyName", XtRString, sizeof(String),
    722     /*XtOffset(apdp, fntFam)*/ 0, XtRString, "*-helvetica" }
    723 };
    724  
    725 static char * fnbi_b[4] = { "medium-r-normal", "bold-r-normal",
    726                           "medium-o-normal", "medium-i-normal" };
    727 
    728 static XFontStruct * defnt = NULL;
    729 static char * fnbi[3];
    730 
    731 
    732177/* --Methode-- */
    733178void PIBaseWdgX::Init()
    734179{
    735 char buff[256];
    736 int i,j,k, count;
    737 char **list;
     180int i;
    738181
    739182if (fgbwdg)  return;
    740183fgbwdg = true;
    741184
    742 Display *mdsp;
    743 int scr;
    744 XColor exact,mycol;
    745 Colormap  cmap;
    746 
    747 mdsp = PIXDisplay();
    748 scr = XDefaultScreen(mdsp);
    749 
    750 XtGetApplicationResources(PIXtTopWdg(), &apd, resources,
    751                           XtNumber(resources), NULL, 0);
    752 sprintf(buff,"-%s-*-*-*-*-*-*-*-*-*-*-*-*", apd.fntFam);
    753 list = XListFonts(mdsp, buff, 15, &count);
    754 XFreeFontNames(list);
    755 if (count < 5)
    756   {
    757   printf("PIBaseWdgX::Init %d fonts found for %s , switching to helvetica\n",
    758          count, apd.fntFam);
    759   apd.fntFam = "*-helvetica";
    760   }
    761 sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[0]);
    762 list = XListFonts(mdsp, buff, 10, &count);
    763 XFreeFontNames(list);
    764 if (count < 2) fnbi[0] = "*-*-*";
    765 else  fnbi[0] = fnbi_b[0];
    766 sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[1]);
    767 list = XListFonts(mdsp, buff, 10, &count);
    768 XFreeFontNames(list);
    769 if (count < 2) fnbi[1] = "*-*-*";
    770 else  fnbi[1] = fnbi_b[1];
    771 sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[2]);
    772 list = XListFonts(mdsp, buff, 10, &count);
    773 XFreeFontNames(list);
    774 fnbi[2] = fnbi_b[2];
    775 if (count < 2)
    776   {
    777   sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[3]);
    778   list = XListFonts(mdsp, buff, 10, &count);
    779   XFreeFontNames(list);
    780   fnbi[2] = fnbi_b[3];
    781   }
    782 if (count < 2) fnbi[2] = "*-*-*";
    783 
    784 sprintf(buff,"-*-fixed-*-*-*-*-14-*-*-*-*-*-*-*");
    785 list = XListFonts(mdsp, buff, 10, &count);
    786 XFreeFontNames(list);
    787 if (count < 1)
    788   { 
    789   sprintf(buff,"fixed");
    790   list = XListFonts(mdsp, buff, 10, &count);
    791   XFreeFontNames(list);
    792   }
    793 if (count < 1)
    794   { 
    795   strcpy(buff,"");
    796   list = XListFonts(mdsp, buff, 10, &count);
    797   XFreeFontNames(list);
    798   printf("PIBaseWdgX::Init/ Erreur, no font found ... \n");
    799   defnt = NULL;
    800   }
    801 else defnt = XLoadQueryFont(mdsp, buff);
    802 
    803 for (i=0; i<NMAXFONTSZ; i++)
    804   for (j=0; j<3; j++)  fntst[i][j] = NULL;
    805 
    806  
    807 /*  Les couleurs  */
    808 cmap = XDefaultColormap (mdsp, scr);
    809 
    810 for(i=0; i<NMAXCOL; i++)  colpix[i] = XWhitePixel(mdsp, scr);
    811 colpix[PI_Black] = XBlackPixel(mdsp, scr);
    812 colpix[PI_White] = XWhitePixel(mdsp, scr);
    813 if ( XAllocNamedColor (mdsp, cmap, "LightGray", &mycol, &exact) )
    814   colpix[PI_Grey] = mycol.pixel;
    815 if ( XAllocNamedColor (mdsp, cmap, "red", &mycol, &exact) )
    816   colpix[PI_Red] = mycol.pixel;
    817 if ( XAllocNamedColor (mdsp, cmap, "blue", &mycol, &exact) )
    818   colpix[PI_Blue] = mycol.pixel;
    819 if ( XAllocNamedColor (mdsp, cmap, "green", &mycol, &exact) )
    820   colpix[PI_Green] = mycol.pixel;
    821 if ( XAllocNamedColor (mdsp, cmap, "yellow", &mycol, &exact) )
    822   colpix[PI_Yellow] = mycol.pixel;
    823 if ( XAllocNamedColor (mdsp, cmap, "magenta", &mycol, &exact) )
    824   colpix[PI_Magenta] = mycol.pixel;
     185Display *mdsp = PIXDisplay();
     186int scr = XDefaultScreen(mdsp);
     187
     188colpixwhite = XWhitePixel(mdsp, scr);
     189colpixblack = XBlackPixel(mdsp, scr);
    825190
    826191curs[0] = XCreateFontCursor(mdsp, XC_X_cursor);
     
    832197curs[PI_TDLRArrowPointer] =  XCreateFontCursor(mdsp, XC_fleur);
    833198
    834 /*  le GC pour DrawPixmap  */
    835 XGCValues  xgv;
    836 xgv.function = GXcopy;
    837 xgv.plane_mask = ~0;
    838 dpxgc = XCreateGC(mdsp, DefaultRootWindow(mdsp), GCFunction | GCPlaneMask, &xgv);
    839 
    840 return;
    841 }
    842 
    843 
    844 /* --Methode-- */
    845 void PIBaseWdgX::SelectFont(int isz, int jat)
    846 {
    847 
    848 if (!fntst[isz][jat])  // Il faut charger la fonte
    849   {
    850   char buff[256];
    851   int count,k;
    852   Display * mdsp = PIXDisplay();
    853   char **list;
    854 
    855   for (k=0; k<5; k++)    // Recherche de la fonte pour tailles croissantes
    856     {
    857     sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam, fnbi[jat], fntsz[isz]+k);
    858     list = XListFonts(mdsp, buff, 10, &count);
    859     XFreeFontNames(list);
    860     if (count > 0)  break;
    861     }
    862   if (count > 0)
    863     fntst[isz][jat] = XLoadQueryFont(mdsp, buff);
    864   else
    865     { printf("PIBaseWdgX::SelectFont/ Pb font %s - Using default \n", buff);   
    866     fntst[isz][jat] = defnt; }
    867   }
    868 
    869 mFAtt = fntatt[jat];
    870 mFSize = fntsz[isz];
    871 mFSt = fntst[isz][jat];
    872 XSetFont(XtDisplay(XtWdg()), DefGC(), fntst[isz][jat]->fid);
    873 return;
    874 }
    875 
    876 
     199return;
     200}
     201
     202/* --Methode-- */
     203void PIBaseWdgX::eXposeProcess(int x0, int y0, int dx, int dy)                                 
     204{
     205// Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt )
     206Draw(mWGrC, x0, y0, dx, dy);
     207CallDrawers(mWGrC, x0, y0, dx, dy);
     208return;
     209}
  • trunk/SophyaPI/PI/pibwdgx.h

    r63 r71  
    55#include "pibwdggen.h"
    66
     7#include "pigraphx.h"
     8#include "pigraphps.h"
    79
    810class PIBaseWdgX : public PIBaseWdgGen
     
    1214// Les methodes ...
    1315
    14                   PIBaseWdgX(PIContainerGen *par, char *nom,
    15                              int sx=10, int sy=10, int px=0, int py=0);
    16   virtual         ~PIBaseWdgX();
     16                     PIBaseWdgX(PIContainerGen *par, char *nom,
     17                                int sx=10, int sy=10, int px=0, int py=0);
     18  virtual            ~PIBaseWdgX();
    1719
    18   virtual void    FinishCreate(); // appele par la fenetre mere, apres XtRealize()
     20  virtual void       FinishCreate();  // appele par la fenetre mere, apres XtRealize()
    1921
    2022//  Activation des evenements   
    21   virtual void   ActivatePtrCross();
    22   virtual void   ActivateButton(int bid);
    23   virtual void   ActivateMove(int bid);
    24   virtual void   ActivateKeyboard();
     23  virtual void       ActivatePtrCross();
     24  virtual void       ActivateButton(int bid);
     25  virtual void       ActivateMove(int bid);
     26  virtual void       ActivateKeyboard();
    2527
    26 //  Trace graphiques
    27   virtual void   EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
    28   virtual void   DrawString(int x, int y, char* s, int pos = 0);
    29   virtual void   DrawOpaqueString(int x, int y, char* s, int pos = 0);
    30   virtual void   DrawLine(int x1, int y1, int x2, int y2);
    31   virtual void   DrawBox(int x0, int y0, int dx, int dy);
    32   virtual void   DrawFBox(int x0, int y0, int dx, int dy);
    33   virtual void   DrawCircle(int x0, int y0, int r);
    34   virtual void   DrawFCircle(int x0, int y0, int r);
    35   virtual void   DrawPolygon(int *x, int *y, int n); 
    36   virtual void   DrawFPolygon(int *x, int *y, int n); 
    37   virtual void   DrawMarker(int x0, int y0);
    38   virtual void   DrawMarkers(int *x, int *y, int n);
    39   virtual void   DrawPixmap(int x, int y, unsigned char *pix,
    40                             int sx, int sy, PIColorMap* cmap);
     28//  Divers : couleur de fond, Effacement fenetre,  forme de la souris
     29  virtual void       SetBackgroundColor(PIColors col=PI_White);
     30  virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
     31  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer);
     32  virtual PIColors   GetBackgroundColor();
     33  virtual PIPointer  GetPointerShape();
    4134
    42   virtual int    CalcStringWidth(char const* s);
    43 
    44 // Modifications attributs graphiques
    45   virtual void   SelForeground(PIColors col=PI_Black);
    46   virtual void   SelBackground(PIColors col=PI_White);
    47   virtual void   SelGOMode(PIGOMode mod=PI_GOCopy);
    48   virtual void   SelFont(PIFontSize sz=PI_NormalSizeFont,
    49                          PIFontAtt att=PI_RomanFont);
    50   virtual void   SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
    51   virtual void   SelLine(PILineAtt att=PI_NormalLine);
    52   virtual void   SelPointerShape(PIPointer ptr=PI_ArrowPointer);
    53   virtual void   SelMarker(int msz, PIMarker mrk=PI_DotMarker);
    54  
    55 // Selection de zone de trace (clip)
    56   virtual void       SetClipRectangle(int x0, int y0, int dx, int dy);
    57   virtual void       ClearClipRectangle();
    58 
    59 // Acces aux attributs graphiques
    60   virtual PIColors   GetForeground();
    61   virtual PIColors   GetBackground();
    62   virtual PIGOMode   GetGOMode();
    63   virtual PIFontAtt  GetFontAtt();
    64   virtual int        GetFontSize();
    65   virtual PILineAtt  GetLineAtt();
    66   virtual PIPointer  GetPointerShape();
    67   virtual PIMarker   GetMarker();
    68   virtual int        GetMarkerSize();
    69   virtual int        GetFontHeight(int& asc, int& desc);
    70 
    71 // Sauvegarde des attributs graphiques
    72   virtual void       SaveGraphicAtt();
    73 
    74 
     35//  Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt )
     36  virtual void       eXposeProcess(int x0, int y0, int dx, int dy);
     37 
    7538protected:
    76 
    77   void           Init();
    78   void           SelectFont(int isz, int jat);
    79   inline  GC     DefGC() { return mDefGC; }
    80 
    81   GC mDefGC;
    82   PIColors  mFCol, mBCol;
    83   PIGOMode mGOm;
     39  void               Init();
    8440  PIPointer mPtrS;
    85   PIFontAtt mFAtt;
    86   PILineAtt mLAtt;
    87   int mFSize;
    88   XFontStruct *mFSt;
    89   PIMarker mMrk;
    90   int mMrkSz;
     41  PIColors mBCol;
    9142};
    9243
  • trunk/SophyaPI/PI/pidrawer.cc

    r52 r71  
    55{
    66  mBWdg = NULL;
     7  mGrUC = NULL;
    78  xW0 = yW0 = 0; xWd = yWd = 100;
    89  aXdir = false;  // Vrai si Axe X de Droite vers Gauche
     
    1112  limitsFixed = 0;
    1213  SetAxesFlags(kAxesDflt);
    13   clip = true; 
    1414  mDndfg = false;  // Pour controle de l'appel de Detach() si delete
    1515}
     
    2121  for(it = mBWdgList.begin(); it != mBWdgList.end(); it++)
    2222         (*it).wdg->RemoveDrawer((*it).id);
    23 }
    24 
    25 
    26 void
    27 PIDrawer::SetLimits(double xmin, double xmax, double ymin, double ymax,
     23  if (mGrUC)  delete mGrUC;
     24}
     25
     26
     27void
     28PIDrawer::SetLimits(float xmin, float xmax, float ymin, float ymax,
    2829                    int axrl, int ayud)
    2930{
     
    3839  yMin = ymin;
    3940  yMax = ymax;
    40   SetDrwWdg(mBWdg, xW0, yW0, xWd, yWd);
     41  aXFlg = axrl;  aYFlg = ayud;
    4142  CalcTicks();
    4243  limitsFixed = 1;
    4344}
     45
    4446
    4547void
     
    6567
    6668
    67 void
    68 PIDrawer::SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy)
     69PIGraphicUC*
     70PIDrawer::SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g)
    6971{
    7072  mBWdg = drw;
    7173  xW0 = x0;   yW0 = y0;
    7274  xWd = dx;   yWd = dy;
    73   xScale = (double)dx/(xMax-xMin);
    74   if (aXdir)  {
    75     xScale = -xScale;
    76     xOrg   = -xMax * xScale;
    77   }
    78   else xOrg   = -xMin * xScale;
    79   xOrg += xW0;
    80 
    81   yScale = (double)dy/(yMax-yMin);
    82   if (!aYdir) {
    83     yScale = -yScale;
    84     yOrg   = -yMax  * yScale;
    85     }
    86   else yOrg   = -yMin * yScale;
    87   yOrg += yW0;
    88   return;
     75  if (mGrUC)  delete mGrUC;
     76  mGrUC = new PIGraphicUC(g, x0, y0, dx, dy);
     77  mGrUC->SetUCS(xMin, xMax, yMin, yMax, aXFlg, aYFlg);
     78  return(mGrUC);
    8979}
    9080
     
    9383PIDrawer::CalcTicks()
    9484{
    95         double xExt = xMax-xMin;
     85        float xExt = xMax-xMin;
    9686        int lx = (int) ceil(log10(xExt)-0.1);
    97         xExt = pow(10.0,lx);
     87        xExt = (float)pow(10.0,lx);
    9888        xMajTickStep = xExt/10;
    9989        xMinTickStep = xMajTickStep/10;
     
    10494   
    10595   
    106         double yExt = yMax-yMin;
     96        float yExt = yMax-yMin;
    10797        int ly = (int) ceil(log10(yExt)-0.1);
    108         yExt = pow(10.0,ly);
     98        yExt = (float)pow(10.0,ly);
    10999        yMajTickStep = yExt/10;
    110100        yMinTickStep = yMajTickStep/10;
     
    119109    xMinTickLen = (yMax-yMin)/250;
    120110
    121 }
    122 
    123 void
    124 PIDrawer::Sc2Local(double x, double y, int& xpix, int& ypix)
    125 {
    126   xpix = int(xOrg + x*xScale + .5);
    127   ypix = int(yOrg + y*yScale + .5);
    128 }
    129 
    130 void
    131 PIDrawer::Sc2LocalF(double x, double y, float& xpix, float& ypix)
    132 {
    133   xpix = (float)(xOrg + x*xScale + .5);
    134   ypix = (float)(yOrg + y*yScale + .5);
    135 }
    136 
    137 void
    138 PIDrawer::Local2Sc(int xpix, int ypix, double& x, double& y)
    139 {
    140   x = (xpix-xOrg)/xScale;
    141   y = (ypix-yOrg)/yScale;
    142 }
    143 
    144 
    145 void
    146 PIDrawer::DSc2Local(double dx, double dy, int& dxpix, int& dypix)
    147 {
    148   dxpix = int(dx*xScale + .5);
    149   if (dxpix < 0)  dxpix = -dxpix;
    150   dypix = int(dy*yScale + .5);
    151   if (dypix < 0)  dypix = -dxpix;
    152 }
    153 
    154 
    155 void
    156 PIDrawer::Erase()
    157 {
    158   if (!mBWdg) return;
    159   mBWdg->EraseWindow(xW0, yW0, xWd, yWd);
    160 }
    161 
    162 void
    163 PIDrawer::DrawString(double x, double y, char* s, int pos)
    164 {
    165   if (!mBWdg) return;
    166   if (mBWdg->mPSOut) {
    167     float xf, yf;
    168     Sc2LocalF(x, y, xf, yf);
    169     (mBWdg->mPSOut)->DrawString(xf,yf,s, mBWdg->GetForeground(), /* $CHECK$ PIFontSize ?? */
    170                                 mBWdg->GetFontAtt(),  mBWdg->GetFontSize());
    171   }
    172   else {
    173     int xPix, yPix;
    174     Sc2Local(x, y, xPix, yPix);
    175     mBWdg->DrawString(xPix, yPix, s, pos);
    176   }
    177 }
    178 
    179 void
    180 PIDrawer::DrawLine(double x1, double y1, double x2, double y2)
    181 {
    182  
    183   if (!mBWdg) return;
    184   if (clip) {
    185     if (x2 < xMin && x1 < xMin) return;
    186     if (x2 > xMax && x1 > xMax) return;
    187     if (y1 < yMin && y2 < yMin) return;
    188     if (y1 > yMax && y2 > yMax) return;
    189     if (x2 < x1) {
    190       swap(x1,x2);
    191       swap(y1,y2);
    192     }
    193     if (x2>xMax) {
    194       y2 = y1 + (y2-y1)/(x2-x1)*(xMax-x1);
    195       x2 = xMax;
    196     }
    197     if (x1<xMin) {
    198       y1 = y2 + (y1-y2)/(x1-x2)*(xMin-x2);
    199       x1 = xMin;
    200     }
    201     if (y2 < y1) {
    202       swap(x1,x2);
    203       swap(y1,y2);
    204     }
    205     if (y2>yMax) {
    206       x2 = x1 + (x2-x1)/(y2-y1)*(yMax-y1);
    207       y2 = yMax;
    208     }
    209     if (y1<yMin) {
    210       x1 = x2 + (x1-x2)/(y1-y2)*(yMin-y2);
    211       y1 = yMin;
    212     }
    213   }
    214 
    215   if (mBWdg->mPSOut) {
    216     float xf1, yf1, xf2, yf2;
    217     Sc2LocalF(x1, y1, xf1, yf1);
    218     Sc2LocalF(x2, y2, xf2, yf2);
    219     (mBWdg->mPSOut)->DrawLine(xf1, yf1, xf2, yf2, mBWdg->GetForeground(), mBWdg->GetLineAtt());
    220 
    221     return;
    222   }
    223  
    224   int x1Pix, y1Pix, x2Pix, y2Pix;
    225   Sc2Local(x1, y1, x1Pix, y1Pix);
    226   Sc2Local(x2, y2, x2Pix, y2Pix);
    227   mBWdg->DrawLine(x1Pix, y1Pix, x2Pix, y2Pix);
    228 
    229 
    230 
    231 void
    232 PIDrawer::DrawBox(double x, double y, double dx, double dy)
    233 {
    234   if (!mBWdg) return;
    235   if (clip) {
    236     if (dx < 0) {
    237       x = x+dx;
    238       dx = -dx;
    239     }
    240     if (dy < 0) {
    241       y = y+dy;
    242       dy = -dy;
    243     }
    244     if (x > xMax || x+dx < xMin || y > yMax || y+dy < yMin) return;
    245     if (x < xMin) {
    246       dx -= (xMin-x);
    247       x = xMin;
    248     }
    249     if (y < yMin) {
    250       dy -= (yMin-y);
    251       y = yMin;
    252     }
    253     if (x+dx > xMax)
    254       dx = (xMax-x);
    255     if (y+dy > yMax)
    256       dy = (yMax-y);
    257   }
    258 
    259   if (mBWdg->mPSOut) {
    260     float xf, yf, xf2, yf2;
    261     Sc2LocalF(x, y, xf, yf);
    262     Sc2LocalF(x+dx, y+dy, xf2, yf2);
    263     if (xf2 < xf)  swap(xf, xf2);
    264     if (yf2 < yf)  swap(yf, yf2);
    265     (mBWdg->mPSOut)->DrawBox(xf, yf, xf2-xf, yf2-yf, mBWdg->GetForeground(), mBWdg->GetLineAtt() );
    266     return;
    267   }
    268 
    269   int xPix, yPix, x2Pix, y2Pix;
    270   Sc2Local(x, y, xPix, yPix);
    271   Sc2Local(x+dx, y+dy, x2Pix, y2Pix);
    272   if (x2Pix < xPix)  swap(xPix, x2Pix);
    273   if (y2Pix < yPix)  swap(yPix, y2Pix);
    274   mBWdg->DrawBox(xPix, yPix, x2Pix-xPix, y2Pix-yPix);
    275 
    276 
    277 void
    278 PIDrawer::DrawFBox(double x, double y, double dx, double dy)
    279 {
    280 
    281   if (!mBWdg) return;
    282   if (clip) {
    283     if (dx < 0) {
    284       x = x+dx;
    285       dx = -dx;
    286     }
    287     if (dy < 0) {
    288       y = y+dy;
    289       dy = -dy;
    290     }
    291     if (x > xMax || x+dx < xMin || y > yMax || y+dy < yMin) return;
    292     if (x < xMin) {
    293       dx -= (xMin-x);
    294       x = xMin;
    295     }
    296     if (y < yMin) {
    297       dy -= (yMin-y);
    298       y = yMin;
    299     }
    300     if (x+dx > xMax)
    301       dx = (xMax-x);
    302     if (y+dy > yMax)
    303       dy = (yMax-y);
    304   }
    305 
    306   if (mBWdg->mPSOut) {
    307     float xf, yf, xf2, yf2;
    308     Sc2LocalF(x, y, xf, yf);
    309     Sc2LocalF(x+dx, y+dy, xf2, yf2);
    310     if (xf2 < xf)  swap(xf, xf2);
    311     if (yf2 < yf)  swap(yf, yf2);
    312     (mBWdg->mPSOut)->DrawFBox(xf, yf, xf2-xf, yf2-yf, mBWdg->GetForeground(),
    313                               mBWdg->GetForeground(), mBWdg->GetLineAtt());
    314     return;
    315   }
    316 
    317   int xPix, yPix, x2Pix, y2Pix;
    318   Sc2Local(x, y, xPix, yPix);
    319   Sc2Local(x+dx, y+dy, x2Pix, y2Pix);
    320   if (x2Pix < xPix)  swap(xPix, x2Pix);
    321   if (y2Pix < yPix)  swap(yPix, y2Pix);
    322   mBWdg->DrawFBox(xPix, yPix, x2Pix-xPix, y2Pix-yPix);
    323 
    324 
    325 void
    326 PIDrawer::DrawCircle(double x, double y, double r)
    327 {
    328   if (!mBWdg) return;
    329   if (mBWdg->mPSOut) {
    330     float xf, yf, rf;
    331     Sc2LocalF(x, y, xf, yf);
    332     rf = r * xScale;
    333     if (xScale < 0.)  rf = -rf;
    334     (mBWdg->mPSOut)->DrawCircle(xf, yf, rf,mBWdg->GetForeground(), mBWdg->GetLineAtt());
    335     return;
    336   }
    337 
    338   int xPix, yPix, rPix;
    339   Sc2Local(x, y, xPix, yPix);
    340   rPix = (int)(r * xScale);
    341   if (xScale < 0.)  rPix = -rPix;
    342   mBWdg->DrawCircle(xPix, yPix, rPix);
    343 
    344 
    345 void
    346 PIDrawer::DrawFCircle(double x, double y, double r)
    347 {
    348   if (!mBWdg) return;
    349   if (mBWdg->mPSOut) {
    350     float xf, yf, rf;
    351     Sc2LocalF(x, y, xf, yf);
    352     rf = r * xScale;
    353     if (xScale < 0.)  rf = -rf;
    354     (mBWdg->mPSOut)->DrawFCircle(xf, yf, rf, mBWdg->GetForeground(),
    355                                  mBWdg->GetForeground(), mBWdg->GetLineAtt());
    356     return;
    357   }
    358   int xPix, yPix, rPix;
    359   Sc2Local(x, y, xPix, yPix);
    360   rPix = (int)(r * xScale);
    361   if (xScale < 0.)  rPix = -rPix;
    362   mBWdg->DrawFCircle(xPix, yPix, rPix);
    363 }
    364 
    365 #define NMXMULTP  30   // Pour multipoint sans new
    366 
    367 void 
    368 PIDrawer::DrawPolygon(double *x, double *y, int n)
    369 {
    370 int ix[NMXMULTP], iy[NMXMULTP];
    371 int *pxi, *pyi;
    372 int i;
    373  
    374 if (!mBWdg) return;
    375 if (n <= 0)  return;
    376 
    377 if(mBWdg->mPSOut) {
    378   float *xf, *yf;
    379   xf = new float[n];
    380   yf = new float[n];
    381   for(i=0;i<n;i++)
    382     Sc2LocalF(x[i], y[i], xf[i], yf[i]);
    383     (mBWdg->mPSOut)->DrawPolygon(xf,yf,n, mBWdg->GetForeground(), mBWdg->GetLineAtt());
    384   delete[] xf;
    385   delete[] yf;
    386   return;
    387   }
    388 
    389 if (n > NMXMULTP) { pxi = new int[n];  pyi = new int[n]; }
    390 else { pxi = ix;  pyi = iy; }
    391 for(i=0; i<n; i++) 
    392   Sc2Local(x[i], y[i], pxi[i], pyi[i]);
    393 mBWdg->DrawPolygon(pxi, pyi, n);
    394 if (n > NMXMULTP) { delete[] pxi;  delete[] pyi; }
    395 return;
    396 }
    397  
    398 void 
    399 PIDrawer::DrawFPolygon(double *x, double *y, int n)
    400 {
    401 int xi[NMXMULTP], yi[NMXMULTP];
    402 int *pxi, *pyi;
    403 int i;
    404  
    405 if (!mBWdg) return;
    406 if (n <= 0)  return;
    407 
    408 if(mBWdg->mPSOut) {
    409   float *xf, *yf;
    410   xf = new float[n];
    411   yf = new float[n];
    412   for(i=0;i<n;i++)
    413     Sc2LocalF(x[i], y[i], xf[i], yf[i]);
    414     (mBWdg->mPSOut)->DrawFPolygon(xf, yf, n, mBWdg->GetForeground(),
    415                                   mBWdg->GetForeground(), mBWdg->GetLineAtt());
    416   delete[] xf;
    417   delete[] yf;
    418   return;
    419   }
    420 
    421 if (n > NMXMULTP) { pxi = new int[n];  pyi = new int[n]; }
    422 else { pxi = xi;  pyi = yi; }
    423 for(i=0; i<n; i++) 
    424   Sc2Local(x[i], y[i], pxi[i], pyi[i]);
    425 mBWdg->DrawFPolygon(pxi, pyi, n);
    426 if (n > NMXMULTP) { delete[] pxi;  delete[] pyi; }
    427 return;
    428 }
    429 
    430 void 
    431 PIDrawer::DrawMarker(double x0, double y0)
    432 {
    433   if (!mBWdg) return;
    434   if(mBWdg->mPSOut) {
    435     float xf, yf;
    436     Sc2LocalF(x0, y0, xf, yf);
    437     (mBWdg->mPSOut)->DrawMarker(xf, yf, mBWdg->GetMarker(),
    438                                 mBWdg->GetForeground(), mBWdg->GetMarkerSize() );
    439     return;   
    440   }
    441   int xPix, yPix;
    442   Sc2Local(x0, y0, xPix, yPix);
    443   mBWdg->DrawMarker(xPix, yPix);
    444   return;
    445 }
    446 
    447 void 
    448 PIDrawer::DrawMarkers(double *x, double *y, int n)
    449 {
    450 int xi[NMXMULTP], yi[NMXMULTP];
    451 int *pxi, *pyi;
    452 int i;
    453  
    454 if (!mBWdg) return;
    455 if (n <= 0)  return;
    456 
    457 if(mBWdg->mPSOut) {
    458   float *xf, *yf;
    459   xf = new float[n];
    460   yf = new float[n];
    461   for(i=0;i<n;i++)
    462     Sc2LocalF(x[i], y[i], xf[i], yf[i]);
    463 
    464   (mBWdg->mPSOut)->DrawMarkers(xf, yf, n, mBWdg->GetMarker(),
    465                                mBWdg->GetForeground(), mBWdg->GetMarkerSize() );
    466   delete[] xf;
    467   delete[] yf;
    468   return;
    469   }
    470 
    471 if (n > NMXMULTP) { pxi = new int[n];  pyi = new int[n]; }
    472 else { pxi = xi;  pyi = yi; }
    473 for(i=0; i<n; i++) 
    474   Sc2Local(x[i], y[i], pxi[i], pyi[i]);
    475 mBWdg->DrawMarkers(pxi, pyi, n);
    476 if (n > NMXMULTP) { delete[] pxi;  delete[] pyi; }
    477 return;
    478 }
    479 
    480 void 
    481 PIDrawer::DrawPixmap(double x, double y, unsigned char *pix,
    482                           int sx, int sy, PIColorMap* cmap)
    483 {
    484   if (!mBWdg) return;
    485   if ( (sx < 1) || (sy < 1) )  return;
    486   if ((pix == NULL) || (cmap == NULL)) return;
    487 
    488   if(mBWdg->mPSOut) {
    489     float xf,yf;
    490     Sc2LocalF(x, y, xf, yf);
    491     (mBWdg->mPSOut)->Image(xf, yf, (float)sx, (float)sy, sx, sy, pix, cmap);
    492     return;
    493     }
    494 
    495   int xPix, yPix;
    496   Sc2Local(x, y, xPix, yPix);
    497   mBWdg->DrawPixmap(xPix, yPix, pix, sx, sy, cmap);
    498 }
    499 
    500 double
    501 PIDrawer::StringWidth(char const* s)
    502 {
    503   if (!mBWdg) return(0.);
    504   return mBWdg->CalcStringWidth(s) / xScale;
    505 }
    506 
    507 double
    508 PIDrawer::FontHeight(double& asc, double& desc)
    509 {
    510   if (!mBWdg) return(0.);
    511   int h,a,d;
    512   h = mBWdg->GetFontHeight(a,d);
    513   asc = (double)a / yScale;
    514   desc = (double)d / yScale;
    515   return((double)h / yScale);
    516 }
    517 
    518 
    519 void
    520 PIDrawer::SelForeground(PIColors col)
    521 {
    522   if (!mBWdg) return;
    523   mBWdg->SelForeground(col);
    524   return; 
    525 }
    526 
    527 
    528 void
    529 PIDrawer::SelBackground(PIColors col)
    530 {
    531   if (!mBWdg) return;
    532   mBWdg->SelBackground(col);
    533   return; 
    534 }
    535 
    536 void
    537 PIDrawer::SelGOMode(PIGOMode mod)
    538 {
    539   if (!mBWdg) return;
    540   mBWdg->SelGOMode(mod);
    541   return; 
    542 }
    543 
    544 void
    545 PIDrawer::SelFont(PIFontSize sz, PIFontAtt att)
    546 {
    547   if (!mBWdg) return;
    548   mBWdg->SelFont(sz, att);
    549   return; 
    550 }
    551 
    552 void
    553 PIDrawer::SelLine(PILineAtt att)
    554 {
    555   if (!mBWdg) return;
    556   mBWdg->SelLine(att);
    557   return; 
    558 }
    559 
    560 
    561 void
    562 PIDrawer::SelFontSz(double size, PIFontAtt att)
    563 {
    564   if (!mBWdg) return;
    565   int npt = int(fabs(size * yScale)+.5);
    566   if (npt < 8) npt = 8;
    567   if (npt > 127) npt = 127;
    568   mBWdg->SelFontSzPt(npt, att);
    569 }
    570 
    571 void
    572 PIDrawer::SelMarker(double size, PIMarker mrk)
    573 {
    574   if (!mBWdg) return;
    575   int isz = int(fabs(size * xScale)+.5);
    576   mBWdg->SelMarker( isz, mrk);
    577 }
    578 
    579 void
    580 PIDrawer::SelMarker(int msz, PIMarker mrk)
    581 {
    582   if (!mBWdg) return;
    583   mBWdg->SelMarker( msz, mrk);
    584111}
    585112
     
    600127
    601128void
    602 PIDrawer::DrawAxes(int flags)
    603 {
    604   NoClip();
     129PIDrawer::DrawAxes(PIGraphicUC* g, int flags)
     130{
     131  g->NoClip();
    605132  if (flags == -1)
    606133    flags = axesFlags;
     
    611138    // Les axes
    612139   
    613     DrawLine(xMin, 0, xMax, 0);
    614     DrawLine(0, yMin, 0, yMax);
     140    g->DrawLine(xMin, 0, xMax, 0);
     141    g->DrawLine(0, yMin, 0, yMax);
    615142 
    616143    // Les ticks majeurs
    617144 
    618145    if (flags & kMajTicks) {
    619         DrawHTicks(0, xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
    620         DrawVTicks(0, yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
     146        DrawHTicks(g, 0, xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
     147        DrawVTicks(g, 0, yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
    621148    }
    622149   
     
    624151 
    625152    if (flags & kMinTicks) {
    626         DrawHTicks(0, xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
    627         DrawVTicks(0, yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
     153        DrawHTicks(g, 0, xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
     154        DrawVTicks(g, 0, yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
    628155    }
    629156   
     
    632159    if (flags & kLabels) {
    633160      if (!aYdir)
    634         DrawHLabels(-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     161        DrawHLabels(g, -xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    635162      else
    636         DrawHLabels(xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     163        DrawHLabels(g, xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    637164      if (!aXdir)
    638         DrawVLabels(-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     165        DrawVLabels(g, -yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    639166      else
    640         DrawVLabels(yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     167        DrawVLabels(g, yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    641168    }
    642169   
     
    647174    // La boite
    648175   
    649     DrawLine(xMin, yMin, xMax, yMin);
    650     DrawLine(xMax, yMin, xMax, yMax);
    651     DrawLine(xMax, yMax, xMin, yMax);
    652     DrawLine(xMin, yMax, xMin, yMin);
     176    g->DrawLine(xMin, yMin, xMax, yMin);
     177    g->DrawLine(xMax, yMin, xMax, yMax);
     178    g->DrawLine(xMax, yMax, xMin, yMax);
     179    g->DrawLine(xMin, yMax, xMin, yMin);
    653180
    654181    // Longueur des ticks
    655182   
    656     double extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
    657     double intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
    658     double extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
    659     double intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
    660     double extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
    661     double intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
    662     double extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
    663     double intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
     183    float extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
     184    float intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
     185    float extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
     186    float intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
     187    float extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
     188    float intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
     189    float extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
     190    float intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
    664191
    665192    // Les ticks majeurs
    666193 
    667194    if (flags & kMajTicks) {
    668         DrawHTicks(yMin, intXMajTickLen, extXMajTickLen, xFirstMajTick, xMajTickStep);
    669         DrawHTicks(yMax, extXMajTickLen, intXMajTickLen, xFirstMajTick, xMajTickStep);
    670         DrawVTicks(xMin, extYMajTickLen, intYMajTickLen, yFirstMajTick, yMajTickStep);
    671         DrawVTicks(xMax, intYMajTickLen, extYMajTickLen, yFirstMajTick, yMajTickStep);
     195        DrawHTicks(g, yMin, intXMajTickLen, extXMajTickLen, xFirstMajTick, xMajTickStep);
     196        DrawHTicks(g, yMax, extXMajTickLen, intXMajTickLen, xFirstMajTick, xMajTickStep);
     197        DrawVTicks(g, xMin, extYMajTickLen, intYMajTickLen, yFirstMajTick, yMajTickStep);
     198        DrawVTicks(g, xMax, intYMajTickLen, extYMajTickLen, yFirstMajTick, yMajTickStep);
    672199    }
    673200   
     
    675202 
    676203    if (flags & kMinTicks) {
    677         DrawHTicks(yMin, intXMinTickLen, extXMinTickLen, xFirstMinTick, xMinTickStep);
    678         DrawHTicks(yMax, extXMinTickLen, intXMinTickLen, xFirstMinTick, xMinTickStep);
    679         DrawVTicks(xMin, extYMinTickLen, intYMinTickLen, yFirstMinTick, yMinTickStep);
    680         DrawVTicks(xMax, intYMinTickLen, extYMinTickLen, yFirstMinTick, yMinTickStep);
     204        DrawHTicks(g, yMin, intXMinTickLen, extXMinTickLen, xFirstMinTick, xMinTickStep);
     205        DrawHTicks(g, yMax, extXMinTickLen, intXMinTickLen, xFirstMinTick, xMinTickStep);
     206        DrawVTicks(g, xMin, extYMinTickLen, intYMinTickLen, yFirstMinTick, yMinTickStep);
     207        DrawVTicks(g, xMax, intYMinTickLen, extYMinTickLen, yFirstMinTick, yMinTickStep);
    681208    }
    682209
     
    686213    if (flags & kLabels) {
    687214      if (!aYdir) {
    688         DrawHLabels(yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    689         DrawHLabels(yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
     215        DrawHLabels(g, yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     216        DrawHLabels(g, yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
    690217      }
    691218      else {
    692         DrawHLabels(yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
    693         DrawHLabels(yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     219        DrawHLabels(g, yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
     220        DrawHLabels(g, yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    694221      }
    695222      if (!aXdir) {
    696         DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    697         DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
     223        DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     224        DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
    698225      }
    699226      else {
    700         DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
    701         DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     227        DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
     228        DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    702229      }
    703230    }
    704231  }
    705   Clip();
    706 }
    707 
    708  
    709 void
    710 PIDrawer::Draw()
    711 {
    712 }
    713 
    714 void
    715 PIDrawer::Draw(double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
    716 {
    717 Draw();
    718 }
    719 
    720 
    721 void
    722 PIDrawer::DrawHTicks(double y, double tickUp, double tickDown, double xBeg, double xStep)
    723 {
    724   for (double x=xBeg; x<=xMax; x += xStep)
    725     DrawLine(x, y-tickDown, x, y+tickUp);
    726 }
    727 
    728 void
    729 PIDrawer::DrawVTicks(double x, double tickLeft, double tickRight, double yBeg, double yStep)
    730 {
    731   for (double y=yBeg; y<=yMax; y += yStep)
    732     DrawLine(x-tickLeft, y, x+tickRight, y);
    733 }
    734 
    735 void
    736 PIDrawer::DrawHLabels(double y, double xBeg, double xStep, int just)
    737 {
    738   double xOffset = 0;
     232  g->Clip();
     233}
     234
     235 
     236void
     237PIDrawer::Draw(PIGraphicUC*)
     238{
     239}
     240
     241void
     242PIDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
     243{
     244Draw(g);
     245}
     246
     247
     248void
     249PIDrawer::DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep)
     250{
     251  for (float x=xBeg; x<=xMax; x += xStep)
     252    g->DrawLine(x, y-tickDown, x, y+tickUp);
     253}
     254
     255void
     256PIDrawer::DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep)
     257{
     258  for (float y=yBeg; y<=yMax; y += yStep)
     259    g->DrawLine(x-tickLeft, y, x+tickRight, y);
     260}
     261
     262void
     263PIDrawer::DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just)
     264{
     265  float xOffset = 0;
    739266  int kk;
    740   SelFontSz(xMajTickLen*4.);
    741   for (double x=xBeg; x<=xMax; x += xStep) {
     267  g->SelFontSz(yMajTickLen*4.);
     268  for (float x=xBeg; x<=xMax; x += xStep) {
    742269      char label[20]; sprintf(label, "%-6g", x);
    743270      for(kk=0; kk<20; kk++)
    744271        if (label[kk] == ' ')   { label[kk] = '\0' ; break; }
    745       double largeur = StringWidth(label);
     272      float largeur = g->CalcStringWidth(label);
    746273      if (just == 1)
    747274        xOffset = -largeur;
     
    751278        xOffset = 0;
    752279      if (aXdir)  xOffset = -xOffset;
    753       DrawString(x+xOffset, y, label);
     280      g->DrawString(x+xOffset, y, label);
    754281  }
    755 }
    756 
    757 void
    758 PIDrawer::DrawVLabels(double x, double yBeg, double yStep, int just)
    759 {
    760   double xOffset = 0;
    761   SelFontSz(xMajTickLen*4.);
    762   for (double y=yBeg; y<=yMax; y += yStep) {
     282  printf(" DBGDBG Out of PIDrawer::DrawHLabels  \n");
     283}
     284
     285void
     286PIDrawer::DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just)
     287{
     288  float xOffset = 0;
     289  g->SelFontSz(yMajTickLen*4.);
     290  for (float y=yBeg; y<=yMax; y += yStep) {
    763291      char label[20]; sprintf(label, "%-6g", y);
    764       double largeur = StringWidth(label);
     292      float largeur = g->CalcStringWidth(label);
    765293      if (just == 1)
    766294        xOffset = -largeur;
     
    770298        xOffset = 0;
    771299      if (aXdir)  xOffset = -xOffset;
    772       DrawString(x+xOffset, y, label);
     300      g->DrawString(x+xOffset, y, label);
    773301  }
    774302}
  • trunk/SophyaPI/PI/pidrawer.h

    r52 r71  
    33
    44#include "pibwdggen.h"
     5#include "pigraphuc.h"
    56#include <list>
    67
     
    1718};
    1819
    19 enum {
    20   kAxeDirSame     = 0,
    21   kAxeDirLtoR     = 1,
    22   kAxeDirRtoL     = 2,
    23   kAxeDirDownUp   = 3,
    24   kAxeDirUpDown   = 4
    25 };
    26 
    2720
    2821class PIDrawer {
     
    3124  virtual           ~PIDrawer();
    3225
    33   virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax,
     26  virtual void       SetLimits(float xmin, float xmax, float ymin, float ymax,
    3427                               int axrl=kAxeDirSame, int ayud=kAxeDirSame);
    3528
    36 
    37   virtual void       Erase();
    38   virtual void       DrawString(double x, double y, char* s, int pos = 0);
    39   virtual void       DrawLine(double x1, double y1, double x2, double y2);
    40   virtual void       DrawBox(double x0, double y0, double dx, double dy);
    41   virtual void       DrawFBox(double x0, double y0, double dx, double dy);
    42   virtual void       DrawCircle(double x0, double y0, double r);
    43   virtual void       DrawFCircle(double x0, double y0, double r);
    44   virtual void       DrawPolygon(double *x, double *y, int n); 
    45   virtual void       DrawFPolygon(double *x, double *y, int n);
    46   virtual void       DrawMarker(double x0, double y0);
    47   virtual void       DrawMarkers(double *x0, double *y0, int n);
    48   virtual void       DrawPixmap(double x, double y, unsigned char *pix,
    49                                 int sx, int sy, PIColorMap* cmap);
    50 
    51   virtual double     StringWidth(char const*);
    52   virtual double     FontHeight(double& asc, double& desc);
    53 
    54   virtual void       SelForeground(PIColors col=PI_Black);
    55   virtual void       SelBackground(PIColors col=PI_White);
    56   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
    57   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont,
    58                              PIFontAtt att=PI_RomanFont);
    59   virtual void       SelLine(PILineAtt att=PI_NormalLine);
    60   virtual void       SelFontSz(double size, PIFontAtt att=PI_RomanFont);
    61   virtual void       SelMarker(double size=0, PIMarker mrk=PI_DotMarker);
    62   virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
    63 
    64   virtual void       DrawAxes(int flags = -1);
     29  virtual void       DrawAxes(PIGraphicUC* g, int flags = -1);
    6530  virtual void       SetAxesFlags(int flags=kAxesDflt);
    6631   
    67   virtual void       Draw();
    68   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     32  virtual void       Draw(PIGraphicUC* g);
     33  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);   
     34
     35  float XMin() const {return xMin;}
     36  float XMax() const {return xMax;}
     37  float YMin() const {return yMin;}
     38  float YMax() const {return yMax;}
    6939 
    70   virtual void       Sc2Local(double x, double y, int& xpix, int& ypix);
    71   virtual void       Sc2LocalF(double x, double y, float& xpix, float& ypix);
    72   virtual void       Local2Sc(int xpix, int ypix, double& x, double& y);
    73   virtual void       DSc2Local(double dx, double dy, int& dxpix, int& dypix);
    74  
    75 
    76 
    77   double XMin() const {return xMin;}
    78   double XMax() const {return xMax;}
    79   double YMin() const {return yMin;}
    80   double YMax() const {return yMax;}
     40  inline PIGraphicUC*    GetGraphicUC() { return(mGrUC); }
    8141
    8242  int    LimitsFixed() const {return limitsFixed;}
    8343  void   FreeLimits() {limitsFixed = 0;}
    84   void   NoClip() {clip = false;}
    85   void   Clip() {clip = true;}
    8644
    8745//  Les objets/methodes suivants devraient etre protected     
    8846//  Pb avec acces depuis PIBaseWdgGen (Reza 11/07/97)
    89   virtual void       SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy);
     47  virtual  PIGraphicUC*  SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g);
     48
    9049//  Je declare en public a cause de cxx - Reza 11/07/97
    9150  struct DrwBWId { int id; PIBaseWdgGen* wdg; };
     
    9857  void CalcTicks();
    9958
    100   void DrawHTicks(double y, double tickUp, double tickDown, double xBeg, double xStep);
    101   void DrawVTicks(double x, double tickLeft, double tickRight, double yBeg, double yStep);
    102   void DrawHLabels(double y, double xBeg, double xStep, int just=0);
    103   void DrawVLabels(double x, double yBeg, double yStep, int just=0);
     59  void DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep);
     60  void DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep);
     61  void DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just=0);
     62  void DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just=0);
    10463
    10564 
    106   double xMin, xMax, yMin, yMax; // Valeurs en unites user
    107   double xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
    108   double xScale, yScale;         // Pixels par unites graphiques
     65  float xMin, xMax, yMin, yMax;  // Valeurs en unites user
    10966  int xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
    11067  bool   aXdir, aYdir;           // Sens des axes horiz, vertical
     68  int aXFlg, aYFlg;
    11169
    112   double xFirstMajTick, xFirstMinTick;
    113   double yFirstMajTick, yFirstMinTick;
    114   double xMajTickStep, xMinTickStep;
    115   double yMajTickStep, yMinTickStep;
    116   double xMajTickLen,  xMinTickLen;
    117   double yMajTickLen,  yMinTickLen;
     70  float xFirstMajTick, xFirstMinTick;
     71  float yFirstMajTick, yFirstMinTick;
     72  float xMajTickStep, xMinTickStep;
     73  float yMajTickStep, yMinTickStep;
     74  float xMajTickLen,  xMinTickLen;
     75  float yMajTickLen,  yMinTickLen;
    11876 
    11977  int limitsFixed;
     
    12179 
    12280  PIBaseWdgGen* mBWdg;
    123   bool clip;
     81  PIGraphicUC* mGrUC;
    12482
    12583  list<DrwBWId>  mBWdgList;
  • trunk/SophyaPI/PI/pihisto.cc

    r52 r71  
    2323  // Commencer par trouver nos limites
    2424 
    25   double xmin = mHisto->XMin();
    26   double xmax = (mHisto->XMax());
     25  float xmin = mHisto->XMin();
     26  float xmax = (mHisto->XMax());
    2727
    28   double ymax = mHisto->VMax()*1.2;
    29   double ymin = mHisto->VMin();
     28  float ymax = mHisto->VMax()*1.2;
     29  float ymin = mHisto->VMin();
    3030 
    31   if (mDrawWdg)
     31  if (mDrawWdg) 
    3232    mDrawWdg->SetLimits(xmin, xmax, ymin, ymax);
    3333  else
     
    3939
    4040void
    41 PIHisto::Draw(double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
     41PIHisto::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
    4242{
    43   if (!mDrawer) return;
    4443  for (int i=0; i<mHisto->NBins(); i++) {
    45                 double left   = mHisto->BinLowEdge(i);
    46                 double width  = mHisto->BinWidth();
    47                 double bottom = 0;
    48                 double height = (*mHisto)(i);
    49                 mDrawer->DrawFBox(left,bottom,width,height);
    50                 mDrawer->DrawLine(left, bottom, left, bottom + height); // Au moins une ligne...
     44                float left   = mHisto->BinLowEdge(i);
     45                float width  = mHisto->BinWidth();
     46                float bottom = 0;
     47                float height = (*mHisto)(i);
     48                g->DrawFBox(left,bottom,width,height);
     49                g->DrawLine(left, bottom, left, bottom + height); // Au moins une ligne...
    5150        }
    52   DrawStats();
     51  DrawStats(g);
    5352}
    5453
    5554void
    56 PIHisto::DrawStats()
     55PIHisto::DrawStats(PIGraphicUC* g)
    5756{
     57  if (!mDrawWdg) return;
    5858  // Une boite dans le coin superieur droit
    59   if (!mDrawer) return;
    60   double cellHeight = (mDrawWdg->YMax() - mDrawWdg->YMin()) * 0.05;
    61   double cellWidth  = (mDrawWdg->XMax() - mDrawWdg->XMin()) * 0.23;
    62   mDrawer->DrawLine(mDrawWdg->XMax() - cellWidth, mDrawWdg->YMax(),
     59  float cellHeight = (mDrawWdg->YMax() - mDrawWdg->YMin()) * 0.05;
     60  float cellWidth  = (mDrawWdg->XMax() - mDrawWdg->XMin()) * 0.23;
     61  g->DrawLine(mDrawWdg->XMax() - cellWidth, mDrawWdg->YMax(),
    6362                       mDrawWdg->XMax() - cellWidth, mDrawWdg->YMax() - cellHeight);
    64   mDrawer->DrawLine(mDrawWdg->XMax() - cellWidth, mDrawWdg->YMax() - cellHeight,
     63  g->DrawLine(mDrawWdg->XMax() - cellWidth, mDrawWdg->YMax() - cellHeight,
    6564                       mDrawWdg->XMax()            , mDrawWdg->YMax() - cellHeight);
    6665  char label[50];
    6766  sprintf(label, "N = %.6g", mHisto->NData());
    68   mDrawer->SelFontSz((mDrawWdg->YMax() - mDrawWdg->YMin())/30);
    69   mDrawer->DrawString(mDrawWdg->XMax() - cellWidth*0.9, mDrawWdg->YMax() - cellHeight*0.8, label);
     67  g->SelFontSz((mDrawWdg->YMax() - mDrawWdg->YMin())/30);
     68  g->DrawString(mDrawWdg->XMax() - cellWidth*0.9, mDrawWdg->YMax() - cellHeight*0.8, label);
    7069                       
    7170}
  • trunk/SophyaPI/PI/pihisto.h

    r52 r71  
    99                     PIHisto(Histo* histo, bool ad=false);
    1010  virtual           ~PIHisto();
    11   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     11  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    1212  virtual void       UpdateSize();
    13   virtual void       DrawStats();
     13  virtual void       DrawStats(PIGraphicUC* g);
    1414  inline  Histo*     Histogram() { return(mHisto); }
    1515
  • trunk/SophyaPI/PI/piimage.cc

    r61 r71  
    5050SetColMap(CMAP_COLRJ32);
    5151
    52 SelForeground(PI_White);
    53 SelBackground(PI_Black);
     52SetBackgroundColor(PI_Black);
    5453
    5554ActivateButton(1);
     
    138137else { nbmrk = nm;  xpmrk = px, ypmrk = py; }
    139138admrk = ad;  mrkt = mrk;  mrkbsz = msz;
    140 if (refr)  DrawMarks(0, XSize(), 0, YSize());
     139if (refr)  DrawMarks(mWGrC, 0, XSize(), 0, YSize());
    141140return;
    142141}
     
    209208if (curshow == sc) return;
    210209curshow = sc;
    211 if (curshow)  DrawCursor();
    212 else DrawCursor(-1, -1);
     210if (curshow)  DrawCursor(mWGrC);
     211else DrawCursor(mWGrC, -1, -1);
    213212return;
    214213}
     
    335334  if (refr) Apply(true);  }
    336335else if (refr)
    337   { Apply(false);  if (curshow)  DrawCursor();  }
     336  { Apply(false);  if (curshow)  DrawCursor(mWGrC);  }
    338337
    339338return;
     
    387386
    388387/* --Methode-- */
    389 void PIImage::Draw(int x0, int y0, int dx, int dy)
    390 {
    391 PIPixmap::Draw(x0, y0, dx, dy);
     388void PIImage::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     389{
     390PIPixmap::Draw(g, x0, y0, dx, dy);
    392391winovis = false;    // $CHECK$ Reza A enlever si possible 17/6/96
    393392if (curshow)
     
    396395  PosImg2W(xpav, ypav, &xc, &yc);
    397396  if ((xc >= x0) && (xc < x0+dx) &&
    398       (yc >= y0) && (yc < y0+dy) )  DrawCursor(xc, yc);
    399   }
    400 
    401 DrawMarks(x0, x0+dx, y0, y0+dy);
     397      (yc >= y0) && (yc < y0+dy) )  DrawCursor(g, xc, yc);
     398  }
     399
     400DrawMarks(g, x0, x0+dx, y0, y0+dy);
    402401return;
    403402}
     
    415414ShowTrTxW();
    416415Apply(false);
    417 if (curshow)  DrawCursor(-1,-1);
     416if (curshow)  DrawCursor(mWGrC, -1,-1);
    418417return;
    419418}
     
    436435{
    437436SelPointerShape(PI_ArrowPointer);
    438 if (curshow)  DrawCursor();
     437if (curshow)  DrawCursor(mWGrC);
    439438if (trtw)  trtw->Hide();
    440439return;
     
    450449if ( PosW2Img(x, y, &xpv0, &ypv0) )  {  xmv0 = -1;  return; }
    451450xmv0 = x;  ymv0 = y;  dxmv = dymv = 0;
    452 if (curshow)  DrawCursor(-1,-1);
    453 SelGOMode(PI_GOXOR);
     451if (curshow)  DrawCursor(mWGrC,-1,-1);
     452mWGrC->SelGOMode(PI_GOXOR);
    454453if (GetColMapId() == CMAP_COLRJ32)
    455 SelForeground(PI_Yellow);
    456 else SelForeground(PI_Magenta);
    457 SelLine(PI_NormalLine);
     454mWGrC->SelForeground(PI_Yellow);
     455else mWGrC->SelForeground(PI_Magenta);
     456mWGrC->SelLine(PI_NormalLine);
    458457ShowTrTxW();
    459458return;
     
    467466if (xmv0 < 0)  return;
    468467if ( PosW2Img(x, y, &xp, &yp) )  return;
    469 DrawBox(xmv0, ymv0, dxmv, dymv);
     468mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
    470469dxmv = x-xmv0;  dymv = y-ymv0;
    471 DrawBox(xmv0, ymv0, dxmv, dymv);
     470mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
    472471if (txw || trtlb)
    473472  {
     
    488487if (img == NULL)  return;
    489488if (xmv0 < 0)  return;
    490 DrawBox(xmv0, ymv0, dxmv, dymv);
    491 SelGOMode(PI_GOCopy);
    492 SelForeground(PI_White);
     489mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
     490mWGrC->SelGOMode(PI_GOCopy);
     491mWGrC->SelForeground(PI_White);
    493492if ( PosW2Img(x, y, &xp2, &yp2) ) 
    494493  PosW2Img(xmv0+dxmv, ymv0+dymv, &xp2, &yp2);
     
    499498
    500499Apply(false);
    501 if (curshow)  DrawCursor();
     500if (curshow)  DrawCursor(mWGrC);
    502501if (trtw)  trtw->Hide();
    503502return;
     
    513512if (img == NULL)  return;
    514513if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
    515 if (curshow)  DrawCursor(-1,-1);
     514if (curshow)  DrawCursor(mWGrC,-1,-1);
    516515ShowTrTxW();
    517516SelPointerShape(PI_TDLRArrowPointer);
     
    743742dy =  (int) ( (float)YSize()/zm-1. ); 
    744743
     744
    745745gvw->ElDelAll();
    746 gvw->SelForeground(PI_Yellow);
    747 gvw->SelLine(PI_NormalLine);
     746gvw->WindowGraphic()->SelForeground(PI_Yellow);
     747gvw->WindowGraphic()->SelLine(PI_NormalLine);
    748748gvw->ElAddRect(x,y,dx,dy);
    749749gvw->SetColMap(GetColMapId(), false);
     
    757757
    758758/* --Methode-- */
    759 void PIImage::DrawCursor()
     759void PIImage::DrawCursor(PIGraphicGen* g)
    760760{
    761761int xc, yc;
    762 if (PosImg2W(xpav, ypav, &xc, &yc)) DrawCursor(-1, -1);
    763 else DrawCursor(xc, yc);
     762if (PosImg2W(xpav, ypav, &xc, &yc)) DrawCursor(g, -1, -1);
     763else DrawCursor(g, xc, yc);
    764764return;
    765765}
     
    768768 
    769769/* --Methode-- */
    770 void PIImage::DrawCursor(int xc, int yc)
     770void PIImage::DrawCursor(PIGraphicGen* g, int xc, int yc)
    771771{
    772772
    773773if ((xcurs>=0) && (ycurs>=0))
    774   PIPixmap::Draw(xcurs-CURSHSIZE, ycurs-CURSHSIZE, CURSHSIZE*2, CURSHSIZE*2);
     774  PIPixmap::Draw(g, xcurs-CURSHSIZE, ycurs-CURSHSIZE, CURSHSIZE*2, CURSHSIZE*2);
    775775
    776776if ((xc >= 0) && (yc >= 0))
     
    778778  xcurs = xc;   ycurs = yc;
    779779  if (winovis)  return;      // $CHECK$ Reza A enlever si possible 17/6/96
    780   if (zoom < 3)  SelLine(PI_NormalLine);
    781   else SelLine(PI_ThickLine);
     780  if (zoom < 3)  g->SelLine(PI_NormalLine);
     781  else g->SelLine(PI_ThickLine);
    782782  if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
    783     SelForeground(PI_Red);
    784   else SelForeground(PI_White);
    785   SelGOMode(PI_GOCopy);
    786   DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
    787   DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs);
    788   DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4);
    789   DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE);
     783    g->SelForeground(PI_Red);
     784  else g->SelForeground(PI_White);
     785  g->SelGOMode(PI_GOCopy);
     786  g->DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
     787  g->DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs);
     788  g->DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4);
     789  g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE);
    790790  }
    791791else { xcurs = ycurs = -1; }
     
    795795
    796796/* --Methode-- */
    797 void PIImage::DrawMarks(int x1, int x2, int y1, int y2)
     797void PIImage::DrawMarks(PIGraphicGen* g, int x1, int x2, int y1, int y2)
    798798{
    799799float fz;
     
    806806tofx += offx;  tofy += offy;
    807807fz = GetZoomF();
    808 SelGOMode(PI_GOCopy);
    809 SelMarker((int)(fz*mrkbsz), mrkt);
     808g->SelGOMode(PI_GOCopy);
     809g->SelMarker((int)(fz*mrkbsz), mrkt);
    810810if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
    811   SelForeground(PI_Red);
    812 else SelForeground(PI_White);
     811  g->SelForeground(PI_Red);
     812else g->SelForeground(PI_White);
    813813for(i=0; i<nbmrk; i++)
    814814  {
     
    816816  y = (int) ((ypmrk[i]-tofy)*fz);
    817817  if ((x < x1) || (x > x2) || (y < y1) || (y > y2))  continue;
    818   DrawMarker(x,y);
     818  g->DrawMarker(x,y);
    819819  }
    820820return;
  • trunk/SophyaPI/PI/piimage.h

    r37 r71  
    6666
    6767  virtual void Resize();
    68   virtual void Draw(int x0, int y0, int dx, int dy);
     68  virtual void Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
    6969
    7070  virtual void But1Press(int x, int y);
     
    8888  void SetGloVPixmap();
    8989
    90   void DrawCursor();
    91   void DrawCursor(int xc, int yc);
    92   void DrawMarks(int x1, int x2, int y1, int y2);
     90  void DrawCursor(PIGraphicGen* g);
     91  void DrawCursor(PIGraphicGen* g, int xc, int yc);
     92  void DrawMarks(PIGraphicGen* g, int x1, int x2, int y1, int y2);
    9393
    9494  void ShowTrTxW();
  • trunk/SophyaPI/PI/pintuple.cc

    r53 r71  
    7171
    7272/* --Methode-- */
    73 void PINTuple::Draw(double xmin, double ymin, double xmax, double ymax)
     73void PINTuple::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
    7474{
    75 double xp,yp,xer,yer;
     75float xp,yp,xer,yer;
    7676char buff[128];
    7777int nok, nl2;
     
    8787  if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
    8888  nok++;
    89   mDrawer->DrawMarker(xp, yp);
     89  g->DrawMarker(xp, yp);
    9090  if ( xebK >= 0 ) {
    9191    xer = mNT->GetVal(i, xebK);
    92     mDrawer->DrawLine(xp-xer, yp, xp+xer, yp);
     92    g->DrawLine(xp-xer, yp, xp+xer, yp);
    9393  }
    9494  if ( yebK >= 0 ) {
    9595    yer = mNT->GetVal(i, yebK);
    96     mDrawer->DrawLine(xp, yp-yer, xp, yp+yer);
     96    g->DrawLine(xp, yp-yer, xp, yp+yer);
    9797  }
    9898}
     
    101101if (!MainScDrawer())  return;
    102102sprintf(buff, "NTuple:  NEntry= %d  NDisp= %d", (int)mNT->NEntry(), nok);
    103 mDrawWdg->DrawString(15,15,buff);
     103g->BaseGraphic()->DrawString(15,15,buff);
    104104return;
    105105}
  • trunk/SophyaPI/PI/pintuple.h

    r53 r71  
    1010  virtual           ~PINTuple();
    1111 
    12   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     12  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    1313  virtual void       UpdateSize();
    1414 
  • trunk/SophyaPI/PI/pipixmapgen.cc

    r63 r71  
    100100
    101101/* --Methode-- */
    102 void  PIPixmapGen::DrawElements()
     102void  PIPixmapGen::DrawElements(PIGraphicGen* g)
    103103{
    104104char* txt;
     
    109109    {
    110110    case PIDEL_Line :
    111       DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     111      g->DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy );
    112112      break;
    113113    case PIDEL_Text :
    114114      txt = (char*) ((*it).es.c_str());
    115       DrawString((*it).ex, (*it).ey, txt );
     115      g->DrawString((*it).ex, (*it).ey, txt );
    116116      break;
    117117    case PIDEL_Rect :
    118       DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     118      g->DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
    119119      break;
    120120    case PIDEL_FRect :
    121       DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
     121      g->DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy );
    122122      break;
    123123    case PIDEL_Circ :
    124       DrawCircle((*it).ex, (*it).ey, (*it).edx );
     124      g->DrawCircle((*it).ex, (*it).ey, (*it).edx );
    125125      break;
    126126    case PIDEL_FCirc :
    127       DrawFCircle((*it).ex, (*it).ey, (*it).edx );
     127      g->DrawFCircle((*it).ex, (*it).ey, (*it).edx );
    128128      break;
    129129    default :
  • trunk/SophyaPI/PI/pipixmapgen.h

    r63 r71  
    5454protected:
    5555  int           ElAdd(int typ, int x, int y, int dx, int dy, char* s);
    56   virtual void  DrawElements();
     56  virtual void  DrawElements(PIGraphicGen* g);
    5757
    5858  unsigned char *pixmap;
  • trunk/SophyaPI/PI/pipixmapx.cc

    r52 r71  
    6161
    6262/* --Methode-- */
    63 void PIPixmapX::Draw()
     63void PIPixmapX::Draw(PIGraphicGen* g)
    6464{
    65 if(mPSOut)
    66   {
    67   if(pixmap)
    68     mPSOut->Image(0, 0, (float)XSize(), (float)YSize(), nx, ny, pixmap, cmap);
     65if (!pixmap)  return;
     66if (!g) return;
     67if (g->kind() == PI_PSFileGraphics ) {
     68    g->DrawPixmap(0, 0, pixmap, nx, ny, cmap);
    6969  /*  Il faut faire quelque chose Sinon ??! */
    70   DrawElements();
     70    DrawElements(g);
    7171  }
    72 else
    73   Draw(0, 0, XSize(), YSize());
     72else  Draw(g, 0, 0, XSize(), YSize());
    7473}
    7574
    7675/* --Methode-- */
    77 void PIPixmapX::Draw(int x0, int y0, int dx, int dy)
     76void PIPixmapX::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
    7877{
    7978int mx, my, ox, oy;
    8079Window xw;
    8180Display * mdsp;
     81if (!g) return;
     82if (g->kind() == PI_PSFileGraphics ) return;
    8283if ((myximg == NULL) || (cmap == NULL)) return;
    8384
     
    112113 
    113114XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy);
    114 DrawElements();
     115DrawElements(g);
    115116XFlush(mdsp);
    116 
    117117return;
    118118 
  • trunk/SophyaPI/PI/pipixmapx.h

    r9 r71  
    1313  virtual void  Refresh();
    1414  virtual void  Resize();
    15   virtual void  Draw();
    16   virtual void  Draw(int x0, int y0, int dx, int dy);
     15  virtual void  Draw(PIGraphicGen* g);
     16  virtual void  Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
    1717
    1818
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r63 r71  
    77{
    88  mBDrw = new PIDrawer;
    9   SetSpan();
    109  SetLimits(-1.,1.,-1.,1.);
    1110  FreeLimits();
    1211  xEndDrag = yEndDrag = xBegDrag = yBegDrag = 0;
    13 
    14   Clip();
    1512
    1613  padsup = false;
     
    3431
    3532void
    36 PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax,
     33PIScDrawWdg::SetLimits(float xmin, float xmax, float ymin, float ymax,
    3734                       int axrl, int ayud, bool tmp)
    3835{
     
    5350PIScDrawWdg::Resize()
    5451{
    55   SetSpan();
    56   Refresh();
    57 }
    58 
    59 void
    60 PIScDrawWdg::SetSpan()
     52  //  SetSpan();
     53  //  Refresh();  $CHECK$ Faut-il appeler ? Reza 08/02/98
     54}
     55
     56PIGraphicUC*
     57PIScDrawWdg::SetSpan(PIGraphicGen* g)
    6158{
    6259  int x0, y0, dx, dy;
     
    6562  dx = (int)(XSize()*0.76+0.5);
    6663  dy = (int)(YSize()*0.76+0.5);
    67   mBDrw->SetDrwWdg(this, x0, y0, dx, dy);
    68   return;
    69 }
    70 
    71 void
    72 PIScDrawWdg::DrawAxes(int flags)
    73 {
    74   mBDrw->DrawAxes(flags);
     64  return(mBDrw->SetDrwWdg(this, x0, y0, dx, dy, g));
     65}
     66
     67void
     68PIScDrawWdg::DrawAxes(PIGraphicUC* g, int flags)
     69{
     70  mBDrw->DrawAxes(g, flags);
    7571}
    7672
     
    9995  for(drw = mScDrawers.begin(); drw != mScDrawers.end(); drw++)
    10096    if (d == (*drw)) { mScDrawers.erase(drw);  break; }
    101   d->mDrawWdg = NULL;  d->mDrawer = NULL; 
     97  d->mDrawWdg = NULL;  d->mDrawer = NULL;
    10298}
    10399
     
    129125
    130126void
    131 PIScDrawWdg::CallScDrawers(double xmin, double ymin, double xmax, double ymax)
     127PIScDrawWdg::CallScDrawers(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
    132128{
    133129  vector<PIScDrawer*>::iterator drw;
    134130  for(drw = mScDrawers.begin(); drw != mScDrawers.end(); drw++) {
    135     SaveGraphicAtt();
    136     (*drw)->SelGraAtt();
    137     (*drw)->Draw(xmin, ymin, xmax, ymax);
    138     RestoreGraphicAtt();
     131    g->SaveGraphicAtt();
     132    (*drw)->SelGraAtt(g);
     133    (*drw)->Draw(g, xmin, ymin, xmax, ymax);
     134    g->RestoreGraphicAtt();
    139135  }
    140136}
     
    162158
    163159void
    164 PIScDrawWdg::Draw()
     160PIScDrawWdg::Draw(PIGraphicGen* g)
    165161{
    166162  EraseWindow();
    167   DrawAxes();
    168   DrawSelf(-9.e19, -9.e19, 9.e19, 9.e19);
    169   CallScDrawers(-9.e19, -9.e19, 9.e19, 9.e19);
    170 }
    171 
    172 void
    173 PIScDrawWdg::Draw(int x0, int y0, int dx, int dy)
    174 {
    175   double xmin,xmax,ymin,ymax;
    176   mBDrw->Local2Sc(x0, y0, xmin, ymin);
    177   mBDrw->Local2Sc(x0+dx, y0+dy, xmax, ymax);
     163  PIGraphicUC* guc = SetSpan(g);
     164  DrawAxes(guc);
     165  DrawSelf(guc, -9.e19, -9.e19, 9.e19, 9.e19);
     166  CallScDrawers(guc, -9.e19, -9.e19, 9.e19, 9.e19);
     167}
     168
     169void
     170PIScDrawWdg::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
     171{
     172  float xmin,xmax,ymin,ymax;
     173  PIGraphicUC* guc = SetSpan(g);
     174  guc->GrC2UC(x0, y0, xmin, ymin);
     175  guc->GrC2UC(x0+dx, y0+dy, xmax, ymax);
    178176  if (xmin > xmax) swap(xmin,xmax);
    179177  if (ymin > ymax) swap(ymin,ymax);
    180   DrawAxes();
    181   DrawSelf(xmin, ymin, xmax, ymax);
    182   CallScDrawers(xmin, ymin, xmax, ymax); 
    183   CallDrawers(x0, y0, dx, dy);
    184 }
    185 
    186 void
    187 PIScDrawWdg::DrawSelf()
     178  DrawAxes(guc);
     179  DrawSelf(guc, xmin, ymin, xmax, ymax);
     180  CallScDrawers(guc, xmin, ymin, xmax, ymax); 
     181}
     182
     183void
     184PIScDrawWdg::DrawSelf(PIGraphicUC*)
    188185{
    189186return;
     
    191188
    192189void
    193 PIScDrawWdg::DrawSelf(double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
     190PIScDrawWdg::DrawSelf(PIGraphicUC*, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
    194191{
    195192return;
     
    236233{
    237234
    238   double dx, dy;
    239   mBDrw->Local2Sc(xp, yp, dx, dy);
     235  float dx, dy;
     236  mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy);
    240237  mPPos[0] = dx;  mPPos[1] = dy;
    241238  if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
     
    257254  xEndDrag = xBegDrag = x;
    258255  yEndDrag = yBegDrag = y;
    259   cForCol = GetForeground();
    260   cGOmod  = GetGOMode();
     256  cForCol = mWGrC->GetForeground();
     257  cGOmod  = mWGrC->GetGOMode();
    261258  cPointer = GetPointerShape();
    262   cLatt = GetLineAtt();
     259  cLatt = mWGrC->GetLineAtt();
    263260  SelPointerShape(PI_CrossPointer);
    264   SelForeground(PI_Magenta);
    265   SelGOMode(PI_GOXOR);
    266   SelLine(PI_ThinLine);
     261  mWGrC->SelForeground(PI_Magenta);
     262  mWGrC->SelGOMode(PI_GOXOR);
     263  mWGrC->SelLine(PI_ThinLine);
    267264  Send(Msg(), PIMsg_Active);
    268265}
     
    272269{
    273270
    274   DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
    275 
    276   SelForeground(cForCol);
    277   SelGOMode(cGOmod);
     271  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     272
     273  mWGrC->SelForeground(cForCol);
     274  mWGrC->SelGOMode(cGOmod);
    278275  SelPointerShape(cPointer);
    279   SelLine(cLatt);
     276  mWGrC->SelLine(cLatt);
    280277 
    281278  if (xBegDrag == xEndDrag || yBegDrag == yEndDrag)
    282279    SetLimits(xMinS, xMaxS, yMinS, yMaxS, kAxeDirSame, kAxeDirSame );
    283280  else {
    284     double xl,yl,xh,yh;
    285     mBDrw->Local2Sc(xBegDrag, yBegDrag, xl, yl);
    286     mBDrw->Local2Sc(xEndDrag, yEndDrag, xh, yh);
     281    float xl,yl,xh,yh;
     282    mBDrw->GetGraphicUC()->GrC2UC(xBegDrag, yBegDrag, xl, yl);
     283    mBDrw->GetGraphicUC()->GrC2UC(xEndDrag, yEndDrag, xh, yh);
    287284    if (xl > xh) swap(xl, xh);
    288285    if (yl > yh) swap(yl, yh);
     
    296293PIScDrawWdg::Ptr2Move(int x, int y)
    297294{
    298   DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     295  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
    299296  xEndDrag = x;
    300297  yEndDrag = y;
    301   DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     298  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
    302299}
    303300
     
    337334{
    338335// Recalcule les limites, et reaffiche
    339   if (!mDrawer) return;
     336  if (!mDrawWdg) return;
    340337  mDrawWdg->FreeLimits();
    341338  UpdateSize();
     
    348345  if (mDrawWdg)
    349346    mDrawWdg->RemoveScDrawer(this);
    350   mDrawWdg = wdg; 
    351   mDrawer = wdg->BaseDrawer();
     347  mDrawWdg = wdg;  mDrawer = wdg->BaseDrawer();
    352348  UpdateSize();
    353349  mADbW = ad;
     
    360356                     PIScContDrw(PIScDrawer* d, bool ad=false);
    361357  virtual            ~PIScContDrw();
    362   virtual  void      Draw();
    363   virtual  void      Draw(double xmin, double ymin, double xmax, double ymax);
     358  virtual  void      Draw(PIGraphicUC* g);
     359  virtual  void      Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    364360private:
    365361  PIScDrawer* mScDrw;
     
    378374}
    379375
    380 void PIScContDrw::Draw()
     376void PIScContDrw::Draw(PIGraphicUC* g)
    381377{
    382   mScDrw->SelGraAtt();
    383   mScDrw->Draw(-9.e19, -9.e19, 9.e19, 9.e19);
    384 }
    385 
    386 void PIScContDrw::Draw(double xmin, double ymin, double xmax, double ymax)
     378  mScDrw->SelGraAtt(g);
     379  mScDrw->Draw(g, -9.e19, -9.e19, 9.e19, 9.e19);
     380}
     381
     382void PIScContDrw::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
    387383{
    388   mScDrw->SelGraAtt();
    389   mScDrw->Draw(xmin, ymin, xmax, ymax);
     384  mScDrw->SelGraAtt(g);
     385  mScDrw->Draw(g, xmin, ymin, xmax, ymax);
    390386}
    391387
     
    395391  PIScContDrw* rd;
    396392  if (mDrawWdg) mDrawWdg->RemoveScDrawer(this);
    397   mDrawWdg = NULL;
     393  mDrawWdg = NULL;  mDrawer = rd;
    398394  rd = new PIScContDrw(this);
    399   mDrawer = rd;
    400395  UpdateSize();
    401396  return((PIDrawer*)rd);
     
    430425
    431426void
    432 PIScDrawer::SelGraAtt()
    433 {
    434   if (mDrawer == NULL)   return;
    435   if (mFCol != PI_NotDefColor)    mDrawer->SelForeground(mFCol);
    436   if (mBCol != PI_NotDefColor)    mDrawer->SelBackground(mBCol);
    437   if (mLAtt != PI_NotDefLineAtt)  mDrawer->SelLine(mLAtt);
     427PIScDrawer::SelGraAtt(PIGraphicUC* g)
     428{
     429  if (mFCol != PI_NotDefColor)    g->SelForeground(mFCol);
     430  if (mBCol != PI_NotDefColor)    g->SelBackground(mBCol);
     431  if (mLAtt != PI_NotDefLineAtt)  g->SelLine(mLAtt);
    438432  if ( (mFSz != PI_NotDefFontSize) || (mFAtt != PI_NotDefFontAtt) )
    439                                   mDrawer->SelFont(mFSz, mFAtt);
     433                                  g->SelFont(mFSz, mFAtt);
    440434  if ( (mMrk != PI_NotDefMarker) || (mMSz >= 0) )
    441                                   mDrawer->SelMarker(mMSz, mMrk);
     435                                  g->SelMarker(mMSz, mMrk);
    442436}
    443437
     
    455449
    456450void
    457 PIScFuncDrawer::Draw(double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
    458 {
    459   if (!mDrawer) return;
    460   double xMax = mDrawer->XMax();
    461   double xMin = mDrawer->XMin();
    462   double yMax = mDrawer->YMax();
    463   double yMin = mDrawer->YMin();
    464   double xStep = (xMax - xMin)/100;
    465   double xOld = xMin;
    466   double yOld = mFunc(xMin);
    467   for (double x = xMin+xStep; x<xMax; x+=xStep) {
     451PIScFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
     452{
     453  PIGrCoord x1, x2, y1, y2;
     454  g->GetGrSpace(x1, x2, y1, y2);
     455  float xMax = x2;
     456  float xMin = x1;
     457  float yMax = y2;
     458  float yMin = y1;
     459  float xStep = (xMax - xMin)/100;
     460  float xOld = xMin;
     461  float yOld = mFunc(xMin);
     462  for (float x = xMin+xStep; x<xMax; x+=xStep) {
    468463    double y = mFunc(x);
    469464    if (y>yMin && yOld>yMin &&
    470465        y<yMax && yOld<yMax)
    471            mDrawer->DrawLine(xOld, yOld, x, y);
     466           g->DrawLine(xOld, yOld, x, y);
    472467    xOld = x;
    473468    yOld = y;
     
    499494
    500495void
    501 PIScGFFDrawer::Draw(double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
    502 {
    503   if (!mDrawer) return;
    504   double xMax = mDrawer->XMax();
    505   double xMin = mDrawer->XMin();
    506   double yMax = mDrawer->YMax();
    507   double yMin = mDrawer->YMin();
    508   double xStep = (xMax - xMin)/100;
    509   double xOld = xMin;
    510   double yOld = 0;
    511 //  double yOld = f->Value(&xMin, mParms);
    512   for (double x = xMin+xStep; x<xMax; x+=xStep) {
    513    double y = 0; // $CHECK$
    514 //    double y = f->Value(&x, mParms);
     496PIScGFFDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
     497{
     498  PIGrCoord x1, x2, y1, y2;
     499  g->GetGrSpace(x1, x2, y1, y2);
     500  float xMax = x2;
     501  float xMin = x1;
     502  float yMax = y2;
     503  float yMin = y1;
     504  float xStep = (xMax - xMin)/100;
     505  float xOld = xMin;
     506  float yOld = 0;
     507//  float yOld = f->Value(&xMin, mParms);
     508  for (float x = xMin+xStep; x<xMax; x+=xStep) {
     509   float y = 0; // $CHECK$
     510//    float y = f->Value(&x, mParms);
    515511    if (y>yMin && yOld>yMin &&
    516512        y<yMax && yOld<yMax)
    517            mDrawer->DrawLine(xOld, yOld, x, y);
     513           g->DrawLine(xOld, yOld, x, y);
    518514    xOld = x;
    519515    yOld = y;
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r54 r71  
    2626  virtual void       Resize();
    2727 
    28   virtual void       Draw();
    29   virtual void       Draw(int x0, int y0, int dx, int dy);
    30   virtual void       DrawSelf();
    31   virtual void       DrawSelf(double xmin, double ymin, double xmax, double ymax);
     28  virtual void       Draw(PIGraphicGen* g);
     29  virtual void       Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
     30  virtual void       DrawSelf(PIGraphicUC* g);
     31  virtual void       DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    3232 
    33   void               SetLimits(double xmin, double xmax, double ymin, double ymax,
     33  void               SetLimits(float xmin, float xmax, float ymin, float ymax,
    3434                               int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false);
    3535
    3636  void               SetAxesFlags(int flags=kAxesDflt);
    37   void               DrawAxes(int flags = -1);
     37  void               DrawAxes(PIGraphicUC* g, int flags = -1);
    3838
    3939  void               AddScDrawer(PIScDrawer*, bool ad=false);   // Ajoute un ScDrawer
     
    4444  PIDrawer*          BaseDrawer() { return mBDrw; };
    4545
    46   double XMin() const {return mBDrw->XMin();}
    47   double XMax() const {return mBDrw->XMax();}
    48   double YMin() const {return mBDrw->YMin();}
    49   double YMax() const {return mBDrw->YMax();}
    50   double XPPos() const { return mPPos[0]; }
    51   double YPPos() const { return mPPos[1]; }
     46  float XMin() const {return mBDrw->XMin();}
     47  float XMax() const {return mBDrw->XMax();}
     48  float YMin() const {return mBDrw->YMin();}
     49  float YMax() const {return mBDrw->YMax();}
     50  float XPPos() const { return mPPos[0]; }
     51  float YPPos() const { return mPPos[1]; }
    5252  int    LimitsFixed() const {return mBDrw->LimitsFixed();}
    5353  void   FreeLimits() { mBDrw->FreeLimits(); }
    54   void   NoClip() { mBDrw->NoClip(); }
    55   void   Clip() { mBDrw->NoClip(); }
    5654   
    5755
     
    6866protected:
    6967          void       DeleteScDrawers();    // Ote et detruit tous les ScDrawers
    70           void       CallScDrawers(double xmin, double ymin, double xmax, double ymax);
    71           void       SetSpan();
     68          void       CallScDrawers(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     69       PIGraphicUC*  SetSpan(PIGraphicGen* g);
    7270
    73   double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
    74   double mPPos[2];               // Position click souris X,Y
     71  float xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
     72  float mPPos[2];               // Position click souris X,Y
    7573
    7674  PIDrawer* mBDrw;
     
    9997  virtual           ~PIScDrawer();
    10098
    101   virtual void       Draw(double xmin, double ymin, double xmax, double ymax) = 0;
     99  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax) = 0;
    102100  virtual void       UpdateSize();   // Calcule et change les limites si non fixees
    103101  virtual void       Refresh();      // Recalcule les limites et reaffiche
     
    112110  void               SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
    113111
    114   void               SelGraAtt();
     112  void               SelGraAtt(PIGraphicUC* g);
    115113
    116114  inline void        SetAutoDelDataObj(bool ad=false) { mAdDO = ad; }
     
    139137  virtual           ~PIScFuncDrawer();
    140138 
    141   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     139  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    142140protected:
    143141  FUNC               mFunc;
     
    150148  virtual           ~PIScGFFDrawer();
    151149 
    152   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     150  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    153151  virtual void       SetParms(double const*);
    154152protected:
  • trunk/SophyaPI/PI/pistlist.cc

    r52 r71  
    8080
    8181/* --Methode-- */
    82 void PIStarList::Draw(double xmin, double ymin, double xmax, double ymax)
     82void PIStarList::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
    8383{
    8484BStar *sti;
    8585float xp,yp,flx;
    86 int sz,ixp, iyp;
     86int sz;
    8787char buff[128];
    8888int nok, nl2;
     
    9191if (!mDrawer) return;
    9292
    93 mDrawer->SelFont();
     93g->SelFont();
    9494nok = 0;  nl2 = mNLev*2-1;
    9595for (int i=0; i<mStL->NbStars(); i++) {
     
    103103  nok++;
    104104  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + mMSz0;
    105   if (sz < 2)  mDrawer->SelMarker(sz, PI_DotMarker);
    106   else mDrawer->SelMarker(sz, PI_FCircleMarker);
    107   mDrawer->DrawMarker((double)xp,(double)yp );
     105  if (sz < 2)  g->SelMarker(sz, PI_DotMarker);
     106  else g->SelMarker(sz, PI_FCircleMarker);
     107  g->DrawMarker((double)xp,(double)yp );
    108108  if (mDspFV) { 
    109109    sprintf(buff," F=%g", flx);
    110     mDrawer->Sc2Local(xp, yp, ixp, iyp);
    111     mDrawer->DrawString( ixp+sz/2+1, iyp-4, buff);
     110    float dx,dy;
     111    g->DGrC2UC(sz, 4, dx, dy);
     112    g->DrawString(xp+dx, yp-dy, buff);
    112113    }
    113114  }
    114115
     116if (!mDrawWdg)  return;
    115117if (!MainScDrawer()) return;
    116 if (!mDrawWdg)  return;
    117118
    118119sprintf(buff, "StarList:  NbStars= %d  NDisp= %d", (int)mStL->NbStars(), nok);
    119 mDrawWdg->DrawString(15,15,buff);
     120g->BaseGraphic()->DrawString(15,15,buff);
    120121sprintf(buff, "FMin= %g  FMax= %g Nl= %d Sz0= %d", mFmin, mFmax, mNLev, mMSz0);
    121 mDrawWdg->DrawString(15,30,buff);
     122g->BaseGraphic()->DrawString(15,30,buff);
    122123
    123124}
  • trunk/SophyaPI/PI/pistlist.h

    r52 r71  
    1010  virtual           ~PIStarList();
    1111 
    12   virtual void       Draw(double xmin, double ymin, double xmax, double ymax);
     12  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    1313  virtual void       UpdateSize();
    1414 
  • trunk/SophyaPI/PI/pisysdep.h

    r30 r71  
    1717 
    1818  #define PIBWDG_H "pibwdgmac.h"
     19  #define PIGRAPHIC_H "pigraphmac.h"
    1920
    2021  #define PICMAPNTV_H "picmapmac.h"
     
    3738
    3839  #define PIBWDG_H "pibwdgx.h"
     40  #define PIGRAPHIC_H "pigraphx.h"
    3941
    4042  #define PICMAPNTV_H "picmapx.h"
  • trunk/SophyaPI/PI/pixtbase.cc

    r63 r71  
    179179(long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
    180180#endif
    181 
     181if (!(wdgp->core.visible))  return;
    182182if ( ((PIXtBaseWidget)wdgp)->pixtbase.objet )
    183183  {
     
    187187  x0 = xrec.x;  y0 = xrec.y;
    188188  dx = xrec.width;  dy = xrec.height;
    189   (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Draw(x0, y0, dx, dy);
    190   (((PIXtBaseWidget)wdgp)->pixtbase.objet)->CallDrawers(x0, y0, dx, dy);
     189  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->eXposeProcess(x0, y0, dx, dy);
    191190  }
    192191return;
  • trunk/SophyaPI/PI/psfile.h

    r54 r71  
    2525#endif
    2626#include "pisysdep.h"
    27 //#include "piinclude.h"
    28 
    29 #include PIBWDG_H      // Types enumeres repris de Peida:PIFontSize...
     27
     28
     29#include "pigraphgen.h"      // Types enumeres repris de Peida:PIFontSize...
    3030#include PICMAP_H
    3131
    3232#include <list>
    3333
     34enum PIPaperSize { PI_A4 = 1, PI_A3 = 2, PI_A5 = 3, PI_NotDefPaperSize = 0};
     35
     36enum PIOrientation { PI_Landscape = 0, PI_Portrait = 1, PI_Auto = 2 } ;
    3437
    3538
Note: See TracChangeset for help on using the changeset viewer.