Changeset 8 in Sophya


Ignore:
Timestamp:
Mar 1, 1996, 5:54:25 PM (30 years ago)
Author:
eros
Message:

Version X OK apres PIOptmenu, et modif ds pibwdgx.cc - Ajout de pidraw

et pihisto - Nettoyage et ajout de pidemo. Reza

Location:
trunk/SophyaPI/PI
Files:
13 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r6 r8  
    7777#------------------------------------------------- End of Makefile.h -------
    7878 
    79 all: $(LIB)libPI.a $(SLB)libPI.so $(EXE)pitest
    80 $(LIB)libPI.a : $(OBJ)ex_dessin.o $(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)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwdgxt.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
     79all: $(LIB)libPI.a $(SLB)libPI.so
     80$(LIB)libPI.a : $(OBJ)ex_dessin.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwdgxt.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)sc_sample.o
    8181        ar -rs $@ $?
    8282 
    8383$(SLB)libPI.so : $(LIB)libPI.a
    8484        ld -S -shared -o $(SLB)libPI.so -all -L$(LIB) $(LIB)libPI.a 2>/dev/null
    85 
    86 $(EXE)pitest : $(OBJ)pitestapp.o
    87         g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm
    88 
    8985$(OBJ)ex_dessin.o: ex_dessin.cc ex_dessin.h pisysdep.h pibwdgx.h pibwdggen.h \
    9086 piwdgx.h piwdggen.h pimsghandler.h
     
    107103$(OBJ)picontainerx.o: picontainerx.cc picontainerx.h pisysdep.h \
    108104 picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
     105$(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h piwindowx.h \
     106 piwindowgen.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \
     107 pimsghandler.h piscdrawwdg.h pibwdgx.h pibwdggen.h
    109108$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
    110109 piwdggen.h pimsghandler.h
     
    112111 piwdgx.h piwdggen.h pimsghandler.h piwindowx.h piwindowgen.h \
    113112 picontainerx.h picontainergen.h
     113$(OBJ)pihisto.o: pihisto.cc pihisto.h piscdrawwdg.h pisysdep.h pibwdgx.h \
     114 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
     115 $(INC)histos.h $(INC)peida.h \
     116 $(INC)defs.h $(INC)utils.h \
     117 $(INC)machine.h \
     118 $(INC)perrors.h \
     119 $(INC)exceptions.h
    114120$(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \
    115121 $(INC)rzimage.h \
     
    133139 piwdggen.h pimsghandler.h
    134140$(OBJ)pimsghandler.o: pimsghandler.cc pimsghandler.h
    135 $(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h piwdgx.h \
    136  piwdggen.h pimsghandler.h pimenux.h pimenugen.h
     141$(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h \
     142 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
     143 pimenux.h pimenugen.h
    137144$(OBJ)pioptmenux.o: pioptmenux.cc pisysdep.h pioptmenux.h pioptmenugen.h \
    138  piwdgx.h piwdggen.h pimsghandler.h pimenux.h pimenugen.h \
    139  picontainerx.h picontainergen.h
     145 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
     146 pimenux.h pimenugen.h pistdwdgx.h pistdwdggen.h
    140147$(OBJ)pipixmapgen.o: pipixmapgen.cc pipixmapgen.h pisysdep.h pibwdgx.h \
    141148 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
     
    144151 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    145152 picmapx.h picmapgen.h
     153$(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
     154 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
     155 $(INC)generalfit.h \
     156 $(INC)exceptions.h \
     157 $(INC)defs.h $(INC)matrix.h \
     158 $(INC)peida.h $(INC)utils.h \
     159 $(INC)machine.h \
     160 $(INC)perrors.h \
     161 $(INC)ppersist.h \
     162 $(INC)pclassids.h \
     163 $(INC)cvector.h
    146164$(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
    147165 piwdggen.h pimsghandler.h
     
    160178$(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
    161179 piwdgx.h piwdggen.h pimsghandler.h pixtbase.h
     180$(OBJ)sc_sample.o: sc_sample.cc sc_sample.h pisysdep.h piscdrawwdg.h \
     181 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h
     182$(OBJ)pidemo.o: pidemo.cc pidemo.h pidemoup.h \
     183 $(INC)perrors.h \
     184 $(INC)exceptions.h \
     185 $(INC)defs.h \
     186 $(INC)fitsimage.h \
     187 $(INC)cimage.h \
     188 $(INC)rzimage.h \
     189 $(INC)rzvect.h \
     190 $(INC)machine.h \
     191 $(INC)datatypes.h \
     192 $(INC)fitsheader.h \
     193 $(INC)fitskeys.h pisysdep.h piapplx.h piapplgen.h \
     194 pimsghandler.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \
     195 pimenubarx.h pimenubargen.h pimenux.h pimenugen.h piwindowx.h \
     196 piwindowgen.h pioptmenux.h pioptmenugen.h pistdwdgx.h pistdwdggen.h \
     197 pifilechox.h pifilechogen.h piimage.h $(INC)lut.h \
     198 pipixmapx.h pipixmapgen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
     199 picmapgen.h pihisto.h piscdrawwdg.h \
     200 $(INC)histos.h $(INC)peida.h \
     201 $(INC)utils.h pidrawwin.h
     202$(OBJ)pidemoup.o: pidemoup.cc  pidemoup.h \
     203 $(INC)perrors.h \
     204 $(INC)exceptions.h \
     205 $(INC)defs.h \
     206 $(INC)fitsimage.h \
     207 $(INC)cimage.h \
     208 $(INC)rzimage.h \
     209 $(INC)rzvect.h \
     210 $(INC)machine.h \
     211 $(INC)datatypes.h \
     212 $(INC)fitsheader.h \
     213 $(INC)fitskeys.h \
     214 $(INC)utils.h $(INC)peida.h
     215piapp : $(EXE)piapp
     216       
     217$(EXE)piapp  : $(OBJ)pidemo.o $(OBJ)pidemoup.o $(LIB)libPI.a
     218        g++ -o $(EXE)piapp $(OBJ)pidemo.o $(OBJ)pidemoup.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm
    162219
    163220$(OBJ)pitestapp.o: pitestapp.cc pisysdep.h piapplx.h piapplgen.h \
     
    166223 piwindowgen.h pioptmenux.h pioptmenugen.h pistdwdgx.h pistdwdggen.h \
    167224 pibwdgx.h pibwdggen.h pipixmapx.h pipixmapgen.h picmap.h picmapx.h \
    168  picmapgen.h pifilechox.h pifilechogen.h piimage.h ex_dessin.h
     225 picmapgen.h pifilechox.h pifilechogen.h ex_dessin.h piimage.h \
     226 $(INC)cimage.h \
     227 $(INC)rzimage.h \
     228 $(INC)rzvect.h \
     229 $(INC)machine.h $(INC)defs.h \
     230 $(INC)exceptions.h \
     231 $(INC)perrors.h \
     232 $(INC)datatypes.h $(INC)lut.h
     233
     234pitest : $(EXE)pitest
     235       
     236$(EXE)pitest  : $(OBJ)pitestapp.o $(LIB)libPI.a
     237        g++ -o $(EXE)pitest $(OBJ)pitestapp.o -L$(LIB) -lPI -lImages -lOutils -lmath -lXm -lXt -lX11 -lm
  • trunk/SophyaPI/PI/pibwdggen.h

    r6 r8  
    5151  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont,
    5252                             PIFontAtt att=PI_RomanFont)                   = 0;
     53  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)   = 0;
    5354  virtual void       SelLine(PILineAtt att=PI_NormalLine)                  = 0;
    5455  virtual void       SelPointerShape(PIPointer ptr)                        = 0;
  • trunk/SophyaPI/PI/pibwdgx.cc

    r6 r8  
    1515
    1616/*  Variables globales pour modifier les GC  */
    17 static Font fnt[3][3];
     17#define NMAXFONTSZ  5
     18static Font fnt[NMAXFONTSZ][3];
     19static int fntsz[NMAXFONTSZ] = {9,10,12,14,16};
     20static  PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont };
    1821#define NMAXCOL  10
    1922static unsigned long colpix[NMAXCOL];
     
    146149void PIBaseWdgX::DrawBox(int x0, int y0, int dx, int dy)
    147150{
     151if (dx < 0)  { x0 += dx;  dx = -dx; }
     152if (dy < 0)  { y0 += dy;  dy = -dy; }
    148153XDrawRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()),
    149154               DefGC(), x0, y0, dx, dy);
     
    154159void PIBaseWdgX::DrawFBox(int x0, int y0, int dx, int dy)
    155160{
     161if (dx < 0)  { x0 += dx;  dx = -dx; }
     162if (dy < 0)  { y0 += dy;  dy = -dy; }
    156163XFillRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()),
    157164               DefGC(), x0, y0, dx, dy);
     
    190197XSetBackground(XtDisplay(XtWdg()), DefGC(), colpix[col]);
    191198return;
     199}
     200
     201/* --Methode-- */
     202void PIBaseWdgX::SelFontSzPt(int npt, PIFontAtt att)
     203{
     204int dsz,i,isel, j;
     205
     206isel = 0;
     207dsz = 9999;
     208for(i=0; i<NMAXFONTSZ; i++)
     209  {
     210  j = npt - fntsz[i];   if (j < 0)  j = -j;
     211  if (j < dsz)  {  isel = i; dsz = j; }
     212  }
     213
     214j = 0;
     215if (att & PI_RomanFont) j = 0;
     216if (att & PI_BoldFont) j = 1;
     217if (att & PI_ItalicFont) j = 2;
     218
     219SelectFont(isel, j);
    192220}
    193221
     
    202230    break;
    203231  case PI_NormalSizeFont:
    204     i = 1;
     232    i = 2;
    205233    break;
    206234  case PI_BigSizeFont:
    207     i = 2;
     235    i = 4;
    208236    break;
    209237  default:
    210     i=0;
     238    i=2;
    211239    break;
    212240  }
     
    217245if (att & PI_ItalicFont) j = 2;
    218246
    219 XSetFont(XtDisplay(XtWdg()), DefGC(), fnt[i][j]);
     247SelectFont(i, j);
     248}
     249
     250
     251/* --Methode-- */
     252void PIBaseWdgX::SelectFont(int isz, int jat)
     253{
     254mFAtt = fntatt[jat];
     255mFSize = fntsz[isz];
     256XSetFont(XtDisplay(XtWdg()), DefGC(), fnt[isz][jat]);
    220257return;
    221258}
     
    402439char buff[200];
    403440int i,j;
    404 int fsz[3]={10,12,14};
    405441
    406442if (fgbwdg)  return;
     
    417453
    418454/* Allocation des fonts */
    419 for (i=0; i<3; i++)
     455for (i=0; i<NMAXFONTSZ; i++)
    420456  {
    421   sprintf(buff,"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
     457  sprintf(buff,"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]);
    422458  fnt[i][0] = XLoadFont(mdsp, buff);
    423459  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
    424   sprintf(buff,"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
     460  sprintf(buff,"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]);
    425461  fnt[i][1] = XLoadFont(mdsp, buff);
    426462  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
    427   sprintf(buff,"-*-helvetica-medium-o-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
     463  sprintf(buff,"-*-helvetica-medium-o-normal-*-%d-*-*-*-*-*-ISO8859-1", fntsz[i]);
    428464  fnt[i][2] = XLoadFont(mdsp, buff);
    429465  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
    430466  }
    431467
    432 for(i=0; i<3; i++)
     468for(i=0; i<NMAXFONTSZ; i++)
    433469  for(j=0; j<3; j++)
    434     if (fnt[i][0] == 0) XLoadFont(mdsp, "fixed");
     470    if (fnt[i][j] == 0) XLoadFont(mdsp, "fixed");
    435471
    436472 
  • trunk/SophyaPI/PI/pibwdgx.h

    r2 r8  
    3636  virtual void   SelFont(PIFontSize sz=PI_NormalSizeFont,
    3737                         PIFontAtt att=PI_RomanFont);
     38  virtual void   SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
    3839  virtual void   SelLine(PILineAtt att=PI_NormalLine);
    3940  virtual void   SelPointerShape(PIPointer ptr);
     
    6566protected:
    6667  void           Init();
     68  void           SelectFont(int isz, int jat);
    6769
    6870  GC mDefGC;
     71  PIFontAtt mFAtt;
     72  int mFSize;
    6973};
    7074
  • trunk/SophyaPI/PI/pifilechox.h

    r2 r8  
    3434typedef PIFileChooserX     PIFileChooser ;
    3535
     36#define FILESEP '/'
     37
     38
    3639#endif
    3740
  • trunk/SophyaPI/PI/piimage.cc

    r7 r8  
    128128}
    129129
     130/* --Methode-- */
     131void PIImage::SetOffset(int ox, int oy)
     132{
     133if (img == NULL)  {offx = offy = 0;  return; }
     134if (ox < 0)  ox = 0;
     135if (ox >= (img->XSize()-1))  ox = img->XSize()-2;
     136if (oy < 0)  oy = 0;
     137if (oy >= (img->YSize()-1))  oy = img->YSize()-2;
     138offx = ox;  offy = oy;
     139return;
     140}
    130141
    131142/* --Methode-- */
  • trunk/SophyaPI/PI/piimage.h

    r6 r8  
    5050  void SetZoom(int zm);
    5151
     52  void SetOffset(int ox, int oy);
     53
    5254  virtual void SetColMap(CMapId cmap);
    5355
  • trunk/SophyaPI/PI/pimenugen.h

    r2 r8  
    2525
    2626  virtual void    Show()=0;
     27  virtual void    Show(PIWdg *w, int px, int py)=0;
    2728  virtual void    Hide()=0;
    2829
  • trunk/SophyaPI/PI/pimenux.cc

    r6 r8  
    2424pim = (PIMenuX *) (cusd->pmen);
    2525
    26 // pim->Unmanage();
     26// pim->Hide();
    2727pim->Send(cusd->msg, (void *)pim->ItemNameWdg(cusd->itb).c_str());
    2828#ifdef DEBUG_PIMenuX
    29 printf("%%%Debug_menub_action: Msg= %d  \n", (int)cusd->msg);
     29printf("%%%Debug_menub_action: Msg= %d  %lx\n", (int)cusd->msg, (long)pim);
    3030#endif
    3131return;
     
    144144
    145145/* --Methode-- */
     146void PIMenuX::Show(PIWdg *w, int px, int py)
     147{
     148Manage();
     149}
     150
     151
     152/* --Methode-- */
    146153void PIMenuX::Hide()
    147154{
    148 Unmanage();
     155// Unmanage();
    149156}
    150157
     
    318325void PIPUMenuX::Show()
    319326{
     327// XEvent  mevt;
    320328XButtonEvent evt;
    321329
     330// XPeekEvent(PIXDisplay(), &mevt);
     331// evt = mevt.xbutton;
    322332evt.type = ButtonPress;
    323 evt.serial = 55998877;
    324 evt.send_event = False;
    325333evt.display = PIXDisplay();
    326334evt.window = XtWindow(PIXtTopWdg());
    327335evt.root = DefaultRootWindow(evt.display);
     336evt.serial = 8866559909;
     337evt.send_event = False;
    328338evt.same_screen = XQueryPointer(evt.display, evt.window, &(evt.root),
    329339                    &(evt.subwindow), &(evt.x_root), &(evt.y_root),
     
    340350
    341351/* --Methode-- */
     352void PIPUMenuX::Show(PIWdg *w, int px, int py)
     353{
     354// This method should only be used by a button press ...
     355int xr, yr;
     356Window cw, sw, rw;
     357SysDWdg xtw;
     358Display *dsp;
     359XButtonEvent evt;
     360
     361xtw =  w->XtWdg();
     362dsp = XtDisplay(xtw);
     363sw = XtWindow(xtw);
     364rw = DefaultRootWindow(dsp);
     365XTranslateCoordinates(dsp, sw, rw, px, py, &xr, &yr, &cw);
     366
     367evt.type = ButtonPress;
     368evt.display = dsp;
     369evt.window = sw;
     370evt.root = rw;
     371evt.x_root = xr;
     372evt.y_root = yr;
     373evt.x = px;
     374evt.y = py;
     375evt.serial = 8866559909;
     376evt.send_event = False;
     377evt.same_screen = True;
     378XmMenuPosition(XtWdg(), &evt);
     379// SetPos(xr, yr);
     380Manage();
     381return;   
     382}
     383
     384
     385/* --Methode-- */
    342386PIPDMenuX::PIPDMenuX(PIMsgHandler* par, char* nom)
    343387: PIMenuX(par, nom, k_PulldownMenu)
  • trunk/SophyaPI/PI/pimenux.h

    r6 r8  
    3333
    3434  virtual void    Show();
     35  virtual void   Show(PIWdg *w, int px, int py);
    3536  virtual void    Hide();
    3637
     
    5556{
    5657public:
    57                PIPUMenuX(PIMsgHandler* par, char* nom);
    58                ~PIPUMenuX();
     58                 PIPUMenuX(PIMsgHandler* par, char* nom);
     59                 ~PIPUMenuX();
    5960
    60 virtual void   Show();
     61  virtual void   Show();
     62  virtual void   Show(PIWdg *w, int px, int py);
    6163
    6264protected:
     
    6769{
    6870public:
    69                PIPDMenuX(PIMsgHandler* par, char* nom);
    70                ~PIPDMenuX();
     71                 PIPDMenuX(PIMsgHandler* par, char* nom);
     72                 ~PIPDMenuX();
    7173
    7274protected:
  • trunk/SophyaPI/PI/pimsghandler.h

    r6 r8  
    1313        PIMsg_Help          = 4,
    1414        PIMsg_DataChanged   = 5,
    15         PIMsg_Click         = 6
     15        PIMsg_Click         = 6,
     16        PIMsg_Press         = 7
    1617};
    1718
  • trunk/SophyaPI/PI/pioptmenugen.cc

    r2 r8  
    22
    33
    4 PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPDMenu *pdm,
     4PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm,
    55                         int sx, int sy, int px, int py)
    6 : PIWdg(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !
     6: PIContainer(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !
    77{
    88}
  • trunk/SophyaPI/PI/pioptmenugen.h

    r6 r8  
    44#include <string>
    55#include "pisysdep.h"
    6 #include PIWDG_H
     6#include PICONT_H
    77#include PIMENU_H
    88
    9 class PIOptMenuGen : public PIWdg {
     9class PIOptMenuGen : public PIContainer {
    1010public:
    1111  enum {ClassId = 1100};
    1212
    13                      PIOptMenuGen(PIContainerGen* par, PIPDMenu *pdm,
     13                     PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm,
    1414                                  int sx=10, int sy=10, int px=0, int py=0);
    1515                     ~PIOptMenuGen();
  • trunk/SophyaPI/PI/pioptmenux.cc

    r7 r8  
    44#include "pioptmenux.h"
    55#include PICONT_H
     6#include PISTDWDG_H
    67
    78#include <Xm/Xm.h>
     
    1213
    1314/* --Methode-- */
    14 PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPDMenu *pdm,
     15PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPUMenu *pum,
    1516                     int sx, int sy, int px, int py)
    16 : PIOptMenuGen(par, pdm, sx, sy, px, py)
     17: PIOptMenuGen(par, pum, sx-2, sy-2, px, py)
    1718{
    18 SysDWdg cb;
    19 
    20 XmString xmstr;
    21 xmstr = XmStringLtoRCreate(pdm->Nom().c_str(), XmSTRING_DEFAULT_CHARSET);
    22 
    23 Arg  warg[7];
    24 int n = 0;
    25 XtSetArg(warg[n], XmNsubMenuId, pdm->XtWdg());   n++;
    26 XtSetArg(warg[n],XmNlabelString, xmstr);    n++;
    27 XtSetArg(warg[n],XmNresizeWidth, FALSE);   n++;
    28 XtSetArg(warg[n],XmNresizeHeight, FALSE);   n++;
    29 if ((sx > 0) && (sy > 0))
    30   {
    31   XtSetArg(warg[n],XtNwidth,sx);   n++; 
    32   XtSetArg(warg[n],XtNheight,sy);   n++;
    33   }
    34 
    35 XtWdg() = XmCreateOptionMenu( par->XtWdg(), pdm->Nom().c_str(), warg, n);
    36 wmis == k_wmi_normal ;
    37 stmng = 0;
    38 mMen = pdm;
    39 
    40 cb = XmOptionButtonGadget (XtWdg());
    41 XtSetArg(warg[0],XmNhighlightThickness, 0);
    42 XtSetValues(cb, warg, 1);
    43 if ((sx > 0) && (sy > 0))
    44   {
    45   cb = XmOptionLabelGadget (XtWdg());
    46   XtSetArg(warg[0],XtNwidth,sx/2);   n++; 
    47   XtSetArg(warg[1],XtNheight,sy);   n++;
    48   XtSetValues(cb, warg, 2);
    49   }
    50 
    51 SetPos(px,py);
    52 SetSize(sx, sy);
    53 SetBinding(false, false, false, false);
    54 
    55 mMen->SetMsgParent(this);
     19sx -= 2;
     20sy -= 2;
     21SetBorderWidth(1);
     22// SetBinding(true, true, true, true);
     23mAB = new PIButton(this, "?", 0, sy-2, sy-2, 1, 1);
     24mAB->SetBinding(true, true, false, true);
     25mAB->SetPressMsg(PIMsg_Press);
     26mLab = new PILabel(this, "OptLabel", sx-sy-1, sy, sy+1, 0);
     27mLab->SetBinding(true, true, true, true);
     28mMen = pum;
     29SetValue(mMen->ItemMsg(0));
    5630Manage();
    5731}
     
    6135PIOptMenuX::~PIOptMenuX()
    6236{
     37delete mAB;
     38delete mLab;
    6339}
    6440
     
    6642void PIOptMenuX::Process(long msg, PIMsgHandler* sender, void* data)
    6743{
    68 printf("PIOptMenuX::Process Msg= %d \n", (int)msg);
    69 Select((char *)data, msg);
    70 ReSend(msg, sender, data);
     44// printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender);
     45if ((sender == mAB) && (msg == PIMsg_Press)) 
     46  {  mMen->SetMsgParent(this);    mMen->Show(this, 0, YSize()); }
     47else if (sender == mMen)
     48  {
     49  mAB->ReleaseButton();
     50  SetValue(msg);
     51  ReSend(msg, this, data);
     52  }
     53return;
    7154}
    7255
     
    8467mStext = s;
    8568mSmsg  = mMen->ItemMsg(n);
    86 
     69mLab->SetLabel(mStext);
    8770return;
    8871}
     
    10083mStext = mMen->ItemName(n);
    10184mSmsg  = msg;
    102 
     85mLab->SetLabel(mStext);
    10386return;
    10487}
  • trunk/SophyaPI/PI/pioptmenux.h

    r6 r8  
    22#define PIOPTMENX_H_SEEN
    33
     4#include "pisysdep.h"
    45#include "pioptmenugen.h"
     6#include PISTDWDG_H
    57
    68class PIOptMenuX : public PIOptMenuGen {
    79public:
    8                     PIOptMenuX(PIContainerGen* par, PIPDMenu *pdm, 
     10                    PIOptMenuX(PIContainerGen* par, PIPUMenu *pum, 
    911                               int sx=10, int sy=10, int px=0, int py=0);
    1012                    ~PIOptMenuX();
     
    1820 
    1921 
    20   inline void       Select(char *txt, long msg) { mStext = txt;  mSmsg = msg; }
    21 
    2222
    2323protected:
    24   PIPDMenu *mMen;
     24  PIButton *mAB;
     25  PILabel  *mLab;
     26  PIPUMenu *mMen;
    2527  string   mStext;
    2628  long     mSmsg;
  • trunk/SophyaPI/PI/pistdwdggen.cc

    r2 r8  
    1515
    1616PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, long msg,
    17                          int sx, int sy, int px, int py)
     17                         int sx, int sy, int px, int py, PIBtnSign bsgn)
    1818: PIWdg(par, nom, sx, sy, px, py)
    1919{
    2020SetMsg(msg);
     21mPressMsg = 0;
     22mSgn = bsgn;
    2123}
    2224
     
    2426{}
    2527
    26  
     28void PIButtonGen::SetPressMsg(long prmsg)
     29{
     30mPressMsg = prmsg;
     31}
     32
    2733/************* PIScaleGen ************/
    2834
  • trunk/SophyaPI/PI/pistdwdggen.h

    r2 r8  
    1717};
    1818
     19//  Les differents types de boutons avec un signe dessus ...
     20enum PIBtnSign {  PIBtn_Label=0, PIBtn_ArrowUp=1, PIBtn_ArrowDown=2, 
     21                                 PIBtn_ArrowLeft=3, PIBtn_ArrowRight=4 };
     22
    1923class PIButtonGen : public PIWdg
    2024{
    2125public:
    22   enum {ClassId = 1002};
     26  enum {ClassId = 1010};
    2327
    2428                     PIButtonGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click,
    25                                   int sx=10, int sy=10, int px=0, int py=0);
     29                                 int sx=10, int sy=10, int px=0, int py=0,
     30                                 PIBtnSign bsgn = PIBtn_Label);
    2631  virtual           ~PIButtonGen();
    2732
    2833  virtual long       kind() {return ClassId; }
    29  
     34
     35  virtual void       SetPressMsg(long prmsg);
     36  inline long        PressMsg() { return(mPressMsg); } 
     37
    3038protected:
     39  long mPressMsg;
     40  PIBtnSign mSgn;
     41};
    3142
    32 };
    3343
    3444class PITextGen : public PIWdg
     
    3646public:
    3747
    38   enum {ClassId = 1003};
     48  enum {ClassId = 1020};
    3949
    4050                     PITextGen(PIContainerGen* par, char* nom,
     
    5161{
    5262public:
    53   enum {ClassId = 1004};
     63  enum {ClassId = 1030};
    5464
    5565                     PIScaleGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click,
     
    7282public:
    7383
    74   enum {ClassId = 1005};
     84  enum {ClassId = 1040};
    7585
    7686                     PICheckBoxGen(PIContainerGen* par, char* nom,
  • trunk/SophyaPI/PI/pistdwdgx.cc

    r2 r8  
    1414: PILabelGen(par, nom, sx, sy, px, py)
    1515{
     16Arg warg[2];
     17
    1618CreateXtWdg(nom, xmLabelWidgetClass, NULL, sx, sy, px, py);
    1719SetBorderWidth(0);
     20XtSetArg(warg[0], XmNrecomputeSize, FALSE); 
     21XtSetValues(XtWdg(), warg, 1);
    1822Manage();
    1923}
     
    2630/************* PIButtonX ************/
    2731#include <Xm/PushB.h>
    28 
    29 // Fonction prive (CallBack)
     32#include <Xm/ArrowB.h>
     33
     34// Fonctions privees (CallBack)
    3035static void button_action(Widget w, XtPointer *usd, XtPointer *calld);
     36static void button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld);
    3137
    3238/* Nouvelle-Fonction */
     
    3945}
    4046
    41 /* --Methode-- */
    42 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, long msg,
    43                          int sx, int sy, int px, int py)
    44 : PIButtonGen(par, nom, msg, sx, sy, px, py)
    45 {
    46 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
     47/* Nouvelle-Fonction */
     48void  button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld)
     49{
     50PIButtonX *pib;
     51pib = (PIButtonX *) usd ;
     52pib->Send(pib->PressMsg());
     53pib->myevt = *(calld->event);
     54pib->myevt.type = pib->myevt.xbutton.type = ButtonRelease;
     55pib->myevt.xbutton.serial += 10;
     56
     57return;
     58}
     59
     60
     61/* --Methode-- */
     62PIButtonX::PIButtonX(PIContainerGen *par, char *nom, long msg,
     63                     int sx, int sy, int px, int py, PIBtnSign bsgn)
     64: PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn)
     65{
     66
     67Arg  warg[3];
     68int n = 0;
     69
     70XtSetArg(warg[n],XmNhighlightThickness, 0);  n++;
     71XtSetArg(warg[n], XmNrecomputeSize, FALSE);  n++;
     72
     73if (bsgn == PIBtn_Label)
     74  CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
     75else
     76  {
     77  CreateXtWdg(nom, xmArrowButtonWidgetClass, NULL, sx, sy, px, py);
     78  switch (bsgn)
     79    {
     80    case PIBtn_ArrowUp :
     81      XtSetArg(warg[n], XmNarrowDirection, XmARROW_UP);  n++;
     82      break;
     83    case PIBtn_ArrowDown :
     84      XtSetArg(warg[n], XmNarrowDirection, XmARROW_DOWN);  n++;
     85      break;
     86    case PIBtn_ArrowLeft :
     87      XtSetArg(warg[n], XmNarrowDirection, XmARROW_LEFT);  n++;
     88      break;
     89    case PIBtn_ArrowRight :
     90      XtSetArg(warg[n], XmNarrowDirection, XmARROW_RIGHT);  n++;
     91      break;
     92    }
     93  }
     94
     95XtSetValues(XtWdg(), warg, n);
    4796XtAddCallback(XtWdg(), XmNactivateCallback,
    4897              button_action, (XtPointer)this);
     98SetBorderWidth(0);
    4999Manage();
    50100}
     
    54104{}
    55105
     106/* --Methode-- */
     107void PIButtonX::SetPressMsg(long prmsg)
     108{
     109if (PressMsg() == prmsg)  return;
     110   
     111if ((PressMsg() != 0)  && (prmsg == 0) )   
     112  XtRemoveCallback(XtWdg(), XmNarmCallback,
     113                   button_press, (XtPointer)this);
     114else if (PressMsg() == 0)
     115  XtAddCallback(XtWdg(), XmNarmCallback,
     116                button_press, (XtPointer)this);
     117
     118PIButtonGen::SetPressMsg(prmsg);
     119
     120return;
     121}       
     122
     123/* --Methode-- */
     124void PIButtonX::ReleaseButton()
     125{
     126XPutBackEvent(myevt.xbutton.display, &myevt);
     127return;
     128}
    56129
    57130
  • trunk/SophyaPI/PI/pistdwdgx.h

    r2 r8  
    1717{
    1818public:
    19                      PIButtonX(PIContainerGen *par, char *nom, long msg=PIMsg_Click,
    20                                int sx=10, int sy=10, int px=0, int py=0);
     19                     PIButtonX(PIContainerGen *par, char *nom, long msg = PIMsg_Click,
     20                               int sx=10, int sy=10, int px=0, int py=0,
     21                               PIBtnSign bsgn = PIBtn_Label);
    2122  virtual           ~PIButtonX();
    2223
     24  virtual void       SetPressMsg(long prmsg);
     25
     26  void               ReleaseButton();   // Fonction a utiliser avec attention
     27
     28  XEvent myevt;   // Attention - Pour usage interne
    2329};
    2430
  • trunk/SophyaPI/PI/pitestapp.cc

    r6 r8  
    5858    PIScale * scl;
    5959    PIPUMenu  * menu;
    60     PIPDMenu * pdm;
    61     PIOptMenu * opt, * opt2;
     60    PIPUMenu * pum[2];
     61    PIOptMenu * opt, * opt2, *opt3;
    6262    PIPixmap * zoom;
    6363    PILabel  * labimg;
     
    118118  bouton = new PIButton(this->MainWin(), "OK", 66, 40, 25, 20, 120);
    119119  bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120);
    120   bouton3 = new PIButton(this->MainWin(), "Test", 233, 40, 25, 140, 120);
     120  bouton3 = new PIButton(this->MainWin(), "Test",  233, 40, 25, 140, 120);
    121121  bouton4 = new PIButton(this->MainWin(), "Menu", 555, 40, 25, 200, 120);
    122122  scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150);
     
    133133  menu->AppendItem("Check-33", 4433);
    134134
    135   pdm = new PIPDMenu((PIMsgHandler *)this, "myMenu");
    136   pdm->AppendItem("Linear", 5601);
    137   pdm->AppendItem("Log.", 5602);
    138   pdm->AppendItem("Sqrt", 5603);
    139   pdm->AppendItem("Expon", 5604);
    140   pdm->AppendItem("Polyn", 5605);
    141 
    142   opt = new PIOptMenu(this->MainWin(), pdm, 80, 20, 110, 150);
     135  pum[1] = new PIPUMenu((PIMsgHandler *)this,"Edit");
     136  pum[1]->AppendItem("Copier", 80201);
     137  pum[1]->AppendItem("Coller", 80202);
     138  pum[1]->AppendItem("Couper", 80203);
     139  pum[1]->AppendItem("Undo", 80204);
     140  pum[1]->AppendItem("Select-All", 80205);
     141
     142  pum[0] = new PIPUMenu((PIMsgHandler *)this, "myMenu");
     143  pum[0]->AppendItem("Linear", 5601);
     144  pum[0]->AppendItem("Log.", 5602);
     145  pum[0]->AppendItem("Sqrt", 5603);
     146  pum[0]->AppendItem("Expon", 5604);
     147  pum[0]->AppendItem("Polyn", 5605);
     148
     149  opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150);
    143150  opt->SetValueStr("Sqrt");
    144   opt2 = new PIOptMenu(this->MainWin(), m[1], 80, 20, 150, 200);
     151  opt2 = new PIOptMenu(this->MainWin(), pum[1], 90, 25, 150, 200);
     152
     153  opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250);
     154  opt3->SetValueStr("Linear");
    145155
    146156}
     
    160170  delete opt;
    161171  delete opt2;
    162   delete pdm;
     172  delete opt3;
     173  delete pum[0];  delete pum[1];
    163174  delete zoom;
    164175  delete labimg;
  • trunk/SophyaPI/PI/piwdggen.h

    r6 r8  
    5656
    5757
    58  
     58void PIBeep(); 
    5959
    6060#endif/* PIWDG_H_SEEN */
  • trunk/SophyaPI/PI/piwdgx.cc

    r7 r8  
    3333{
    3434return(dpy);
     35}
     36
     37/* Nouvelle-Fonction */
     38void PIBeep()
     39{
     40XBell(dpy, 0);
     41return;
    3542}
    3643
  • trunk/SophyaPI/PI/piwindowx.cc

    r2 r8  
    3939
    4040/* --Methode-- */
     41void PIWindowX::SetSize(int sx, int sy)
     42{
     43pwm->SetSize(sx, sy);
     44return;
     45}
     46
     47/* --Methode-- */
     48void PIWindowX::SetPos(int px, int py)
     49{
     50pwm->SetPos(px, py);
     51return;
     52}
     53
     54
     55/* --Methode-- */
    4156void PIWindowX::Show()
    4257{
  • trunk/SophyaPI/PI/piwindowx.h

    r2 r8  
    1414  virtual void           SetBinding(bool left, bool top, bool right, bool bottom);
    1515
    16   virtual void  Show();
    17   virtual void  Hide();
     16  virtual void           SetSize(int sx, int sy);
     17  virtual void           SetPos(int px, int py); 
     18
     19  virtual void           Show();
     20  virtual void           Hide();
    1821
    1922protected:
  • trunk/SophyaPI/PI/so_locations

    r2 r8  
    44
    55libPI.so \
    6                 :st = .text 0x000003ffbffc0000, 0x0000000000020000:\
     6                :st = .text 0x000003ffbffb0000, 0x0000000000030000:\
    77                :st = .data 0x000003fffffe0000, 0x0000000000010000:\
    88
Note: See TracChangeset for help on using the changeset viewer.