Changeset 126 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Jul 22, 1998, 1:15:49 PM (27 years ago)
Author:
ercodmgr
Message:

Les presques dernieres modifs des drawers et Tools associes -
Pour copie sur PC-Linux , Reza 22/07/98

Location:
trunk/SophyaPI/PI
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r119 r126  
    8484 pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
    8585 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    86  $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h pidrawer.h
     86 $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h pidrawer.h \
     87 pi3ddrw.h pigraph3d.h
    8788$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
    8889 piwdggen.h pimsghandler.h
     
    185186 $(EROSDEVREP)/Include/exceptions.h \
    186187 $(EROSDEVREP)/Include/peidainit.h \
    187  $(EROSDEVREP)/Include/pclassids.h piscdrawwdg.h pisysdep.h \
    188  pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
    189  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    190  pigraphps.h pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h \
    191  picontainerx.h picontainergen.h pidrawer.h
     188 $(EROSDEVREP)/Include/pclassids.h pidrawer.h pibwdggen.h \
     189 pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
     190 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h
    192191$(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h pimenux.h \
    193192 pimenugen.h piwdgx.h piwdggen.h pimsghandler.h
     
    212211 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
    213212 pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    214  $(EROSDEVREP)/Include/defs.h $(EROSDEVREP)/Include/generalfit.h \
    215  $(EROSDEVREP)/Include/exceptions.h \
    216  $(EROSDEVREP)/Include/peidainit.h \
    217  $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/peida.h \
    218  $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \
    219  $(EROSDEVREP)/Include/perrors.h $(EROSDEVREP)/Include/fmath.h \
     213 $(EROSDEVREP)/Include/defs.h parradapter.h \
     214 $(EROSDEVREP)/Include/machine.h lut.h \
     215 $(EROSDEVREP)/Include/cvector.h $(EROSDEVREP)/Include/matrix.h \
     216 $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/utils.h \
     217 $(EROSDEVREP)/Include/perrors.h \
     218 $(EROSDEVREP)/Include/exceptions.h \
     219 $(EROSDEVREP)/Include/peidainit.h $(EROSDEVREP)/Include/fmath.h \
    220220 $(EROSDEVREP)/Include/ppersist.h \
    221221 $(EROSDEVREP)/Include/pclassids.h \
    222  $(EROSDEVREP)/Include/cvector.h
     222 $(EROSDEVREP)/Include/generalfit.h
    223223$(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
    224224 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
     
    227227 piwindowx.h piwindowgen.h picontainerx.h picontainergen.h pidrawer.h \
    228228 pidrwtools.h pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h \
    229  piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h
     229 piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h \
     230 parradapter.h $(EROSDEVREP)/Include/machine.h lut.h
    230231$(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
    231232 piwdggen.h pimsghandler.h
  • trunk/SophyaPI/PI/piapplx.cc

    r114 r126  
    2020static PIApplication* cur_piapp = NULL;
    2121PIApplication* PIApplicationGetApp() { return cur_piapp; }
     22
     23
    2224
    2325/* --Methode-- */
  • trunk/SophyaPI/PI/picons.cc

    r110 r126  
    2828{
    2929mNL = (nl > 10) ? nl : 10;
    30 mNC = (nc > 40) ? nc : 40;
     30mNC = (nc > 30) ? nc : 30;
    3131mText = new char[mNL*mNC];
    3232mAtt = new unsigned char[mNL*mNC];
     
    7676  opmc->AppendItem("NormalFont", 3102);
    7777  opmc->AppendItem("LargeFont", 3103);
     78  opmc->AppendItem("25L x 80C", 3301);
     79  opmc->AppendItem("25L x 132C", 3302);
     80  opmc->AppendItem("5L x 80C", 3303);
    7881  opmc->AppendItem("White-Black", 3201);
    7982  opmc->AppendItem("Black-White", 3202);
     
    174177  mScb->SetMinMax(0, NbLines()-1);
    175178  mScb->SetSlSize(WindNbLines());
    176   mScb->SetValue(NbLines()-WindNbLines()-1);
    177   }
    178 }
    179 
    180 /* --Methode-- */
    181 void PIConsole::AutoSize()
    182 {
     179  mScb->SetValue(0);
     180  }
     181}
     182
     183
     184/* --Methode-- */
     185void PIConsole::AutoSize(int nl, int nc)
     186{
     187if ( (nl < 1) || (nc < 1) ) {
     188  nl = mWSzL;   nc = mNC;
     189  }
     190if (nc > mNC) nc = mNC;
    183191int dsz[2];
    184 dsz[0] = (mNC+2)*mFLarg - XSize();
    185 dsz[1] = (mWSzL+1)*mFHaut - YSize();
     192dsz[0] = (nc+2)*mFLarg - XSize();
     193dsz[1] = (nl+1)*mFHaut - YSize();
    186194Send(Msg(), PIMsg_ResizeRequest, dsz);
    187 SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut);
     195
     196mWSzL = YSize()/mFHaut - 1;
     197mWSzC = XSize()/mFLarg - 2;
     198/*
     199if (mScb) {
     200  mScb->SetMinMax(0, NbLines()-1);
     201  mScb->SetSlSize(WindNbLines());
     202  mScb->SetValue(0);
     203  }
     204  */
     205mOffL = 0;
    188206}
    189207
     
    239257{
    240258if (ldeb < 0)    {
    241   if (mScb) mScb->SetValue(NbLines()-WindNbLines()-1);
     259  if (mScb) mScb->SetValue(0);
    242260  mOffL = 0;
    243261}
    244 else if (ldeb >= mNL-mWSzL-1)  mOffL = 0;
    245 else mOffL = (mNL-mWSzL-1)-ldeb;
    246 if (mOffL < 0)  mOffL = 0;
     262mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;
    247263}
    248264
     
    256272  mScb->SetMinMax(0, NbLines()-1);
    257273  mScb->SetSlSize(WindNbLines());
    258   mScb->SetValue(NbLines()-WindNbLines()-1);
     274  mScb->SetValue(0);
    259275  }
    260276mOffL = 0;
     
    315331    case PIK_Enter :
    316332      mCmdStr[mCLC] = '\0';
    317 //      printf("Process()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
     333//      printf("Keyb()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
    318334
    319335// Gestion de rappel des commandes
     
    334350        mCmdStr[mCLC-1] = ' ';   mCCP--;  mCLC--;
    335351      }
    336       //      printf("Process()-Debug- Backspace CCP,CLC= %d %d CmdStr= %s (L=%d) \n", mCCP, mCLC,
     352      //      printf("Keyb()-Debug- Backspace CCP,CLC= %d %d CmdStr= %s (L=%d) \n", mCCP, mCLC,
    337353      //      mCmdStr, strlen(mCmdStr));
    338354      break;
     
    340356    case PIK_Up :
    341357    case PIK_Down :
    342 //      printf("Process()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
     358//      printf("Keyb()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
    343359      if (mNComm > 0) {
    344360        int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall;
     
    359375    case PIK_Left :
    360376      if (mCCP > 0)  mCCP--;
    361       //      printf("Process()-Debug- Left CCP,CLC= %d %d  \n", mCCP, mCLC);
     377      //      printf("Keyb()-Debug- Left CCP,CLC= %d %d  \n", mCCP, mCLC);
    362378      break;
    363379    case PIK_Right :
    364380      if (mCCP < mCLC)  mCCP++;
    365       //      printf("Process()-Debug- Right CCP,CLC= %d %d  \n", mCCP, mCLC);
     381      //      printf("Keyb()-Debug- Right CCP,CLC= %d %d  \n", mCCP, mCLC);
    366382      break;
    367383    default :
     
    579595strncat(name, nom, 127);
    580596msgScb = Msg()+55;
    581 mScb = new PIScrollBar (par, name, msgScb, true, Scb_Width, sy, px+sx, py);
     597mScb = new PIScrollBar (par, name, msgScb, kSDirDownUp, Scb_Width, sy, px+sx, py);
    582598mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed);
    583599 
     
    585601mScb->SetMinMax(0, NbLines()-1);
    586602mScb->SetSlSize(WindNbLines());
    587 mScb->SetValue(NbLines()-WindNbLines()-1);
     603mScb->SetValue(0);
    588604}
    589605
     
    870886      SelFgBgCol(PI_Yellow, PI_Black);
    871887      break;
     888    case 3301 :
     889      AutoSize(25, 80);
     890      break;
     891    case 3302 :
     892      AutoSize(25, 132);
     893      break;
     894    case 3303 :
     895      AutoSize(5, 80);
     896      break;     
    872897    default :
    873898      fgr = false;
  • trunk/SophyaPI/PI/picons.h

    r80 r126  
    2626
    2727          void       SelectFont(PIFontSize sz=PI_NormalSizeFont);
    28           void       AutoSize();
     28          void       AutoSize(int nl=-1, int nc=-1);
    2929          void       PreferedSize(int& sx, int& sy);
    3030          void       AcceptCmd(bool acc=true, int nrecmx=20);
  • trunk/SophyaPI/PI/picontainerx.cc

    r110 r126  
    1111  CreateXtWdg(nom, xmFormWidgetClass , NULL, sx, sy, px, py);
    1212//  CreateXtWdg(nom, xmBulletinBoardWidgetClass , NULL, sx, sy, px, py);
     13mTopWdg = NULL;
    1314}
    1415
     16// constructeur special a utiliser par PIApplicationX ...
    1517PIContainerX::PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom, 
    1618                           int sx, int sy, int px, int py)
     
    2022if ((sx > 0) && (sy > 0))
    2123  CreateXtWdg(nom, xmFormWidgetClass , parwdg->XtWdg(), sx, sy, px, py);
     24mTopWdg = parwdg;
    2225}
    2326
     
    3134int k;
    3235for(k=0; k<mNCh; k++)  mChilds[k]->FinishCreate();
     36}
     37
     38/* --Methode-- */
     39void PIContainerX::Process(PIMessage msg, PIMsgHandler* sender, void* data)
     40{
     41// Traitement specifique pour le top-container de PIApplicationX
     42if ((mTopWdg != NULL) && (ModMsg(msg) == PIMsg_ResizeRequest)) {
     43  // On change la taille de la fenetre - data est un pointeur sur entier
     44  // data[0] represente l'increment (positif ou negatif) en X, data[1] en Y
     45  int* nsz = (int*) data;
     46  mTopWdg->SetSize(mTopWdg->XSize()+nsz[0], mTopWdg->YSize()+nsz[1]);
     47  return;
     48  } 
     49else ReSend(msg, sender, data);
    3350}
    3451
  • trunk/SophyaPI/PI/picontainerx.h

    r110 r126  
    99{
    1010public:
    11               PIContainerX(PIContainerGen *par, char *nom,
     11                      PIContainerX(PIContainerGen *par, char *nom,
    1212                           int sx=10, int sy=10, int px=0, int py=0);
    1313
    1414// Ce constructeur est a utiliser par PIApplicationX ...
    15               PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom,
     15                      PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom,
    1616                           int sx=10, int sy=10, int px=0, int py=0);
    1717
    18   virtual void   FinishCreate(); // apelle FinishCreate() pour les descendants
     18  virtual void        FinishCreate(); // appelle FinishCreate() pour les descendants
    1919
    20   virtual     ~PIContainerX();
     20  virtual             ~PIContainerX();
    2121
     22// Pour traiter les Resize-Request si TopContainer de PIApplicationX
     23  virtual void        Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
     24
     25protected :
     26  PIWdgX* mTopWdg;
    2227};
    2328
  • trunk/SophyaPI/PI/pihisto2d.cc

    r120 r126  
    535535// Labels et curseur mobile
    536536mLab[3] = new PILabel(this, "   PerPt: ",60,30,10,215);
    537 mPScal = new PIScale(this,"FracPoints",6401,true,150,20,80,215);
     537mPScal = new PIScale(this,"FracPoints",6401,kSDirLtoR,150,20,80,215);
    538538mPScal->SetMinMax(0,100);
    539539int imfp = mFPoints*100.f;
  • trunk/SophyaPI/PI/piimgtools.cc

    r119 r126  
    9393cpx = 4*spx+2.75*bsx;
    9494cpy = 2*spy;
    95 mSc[0] = new PIScale(this, "sc-offset-lut", 2700, false, bsy*0.75, 4.5*bsy, cpx, cpy);
     95mSc[0] = new PIScale(this, "sc-offset-lut", 2700, kSDirDownUp, bsy*0.75, 4.5*bsy, cpx, cpy);
    9696cpx += 1.5*bsy;
    97 mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, false, bsy*0.75, 4.5*bsy, cpx, cpy);
     97mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, kSDirDownUp, bsy*0.75, 4.5*bsy, cpx, cpy);
    9898mSc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    9999mSc[0]->SetMinMax(-50, 50);
  • trunk/SophyaPI/PI/pistdwdggen.cc

    r111 r126  
    196196//--
    197197//++
    198 // PIScale(PIContainerGen* par, char* nom, PIMessage msg, bool horiz=true, int sx=100, int sy=10, int px=0, int py=0)
    199 //      Création d'un objet PIScale. si "horiz==true", l'objet scale est affiché dans le sens horizontal,
    200 //      sinon dans le sens vertical.
     198// PIScale(PIContainerGen* par, char* nom, PIMessage msg, int dir=kSDirLtoR, int sx=100, int sy=10, int px=0, int py=0)
     199//      Création d'un objet PIScale. "dir" indique la direction et le sens d'affichage et peut
     200//      prendre les valeurs "kSDirLtoR" (gauche à droite), "kSDirRtoL" (droite à gauche),
     201//      "kSDirDownUp" (bas vers haut) et "kSDirUpDown" (de haut en bas).
    201202// void  SetMinMax(int min, int max)
    202203//      Modifie les valeurs extrêmes de l'échelle. L'objet est créé avec des bornes par défaut de 1 à 100.
     204// void GetMinMax(int& min, int& max)
     205//      Renvoie les valeurs extrêmes de l'échelle.
    203206// void SetValue(int v)
    204207//      Modifie la valeur courante de l'échelle.
     
    209212
    210213PIScaleGen::PIScaleGen(PIContainerGen *par, char *nom, PIMessage msg,
    211                        bool /*horiz*/, int sx, int sy, int px, int py)
     214                       int /*dir*/, int sx, int sy, int px, int py)
    212215: PIWdg(par, nom, sx, sy, px, py)
    213216{
     
    244247//--
    245248//++
    246 // PIScrollBar(PIContainerGen* par, char* nom, PIMessage msg, bool vert=true, int sx=10, int sy=100, int px=0, int py=0)
    247 //      Création d'un objet PIScrollBar. si "vert==true", l'objet est affiché dans le sens vertical,
    248 //      sinon dans le sens horizontal.
     249// PIScrollBar(PIContainerGen* par, char* nom, PIMessage msg, int dir=kSDirUpDown, int sx=10, int sy=100, int px=0, int py=0)
     250//      Création d'un objet PIScrollBar. "dir" indique la direction et le sens d'affichage et peut
     251//      prendre les valeurs "kSDirLtoR" (gauche à droite), "kSDirRtoL" (droite à gauche),
     252//      "kSDirDownUp" (bas vers haut) et "kSDirUpDown" (de haut en bas).
    249253// void  ActivateDrag(bool acd=false)
    250254//      Active ("acd=true") ou désactive ("mlm=false") l'envoi de messages lors du mouvement du curseur.
    251255// void SetMinMax(int min, int max)
    252256//      Modifie les valeurs extrêmes de l'ascenseur. L'objet est créé avec des bornes par défaut de 1 à 100.
     257//      La valeur "max" correspond à la position extrême taille du curseur comprise ("max=posmax+taille").
     258// void GetMinMax(int& min, int& max)
     259//      Renvoie les valeurs extrêmes de l'ascenseur.
    253260// void SetValue(int v)
    254261//      Modifie la position courante de l'ascenseur.
     
    262269
    263270PIScrollBarGen::PIScrollBarGen(PIContainerGen *par, char *nom, PIMessage msg,
    264                        bool /*horiz*/, int sx, int sy, int px, int py)
     271                       int /*dir*/, int sx, int sy, int px, int py)
    265272: PIWdg(par, nom, sx, sy, px, py)
    266273{
  • trunk/SophyaPI/PI/pistdwdggen.h

    r98 r126  
    7979};
    8080
     81// Definition choix de la direction et sens pour Scale et Scroll-bar
     82enum {
     83  kSDirLtoR     = 1,
     84  kSDirRtoL     = 2,
     85  kSDirDownUp   = 4,
     86  kSDirUpDown   = 8,
     87};
    8188
    8289class PIScaleGen : public PIWdg
     
    8693
    8794                     PIScaleGen(PIContainerGen* par, char* nom,
    88                                 PIMessage msg = PIMsg_DataChanged, bool horiz=true,
     95                                PIMessage msg = PIMsg_DataChanged, int dir=kSDirLtoR,
    8996                                int sx=100, int sy=10, int px=0, int py=0);
    9097  virtual            ~PIScaleGen();
    9198
    9299  virtual void       SetMinMax(int min, int max) = 0;
     100  virtual void       GetMinMax(int& min, int& max) = 0;
    93101  virtual void       SetValue(int val) = 0;
    94102  virtual int        GetValue() = 0;
     
    106114
    107115                     PIScrollBarGen(PIContainerGen* par, char* nom,
    108                                     PIMessage msg=PIMsg_DataChanged, bool vert=true,
     116                                    PIMessage msg=PIMsg_DataChanged, int dir=kSDirUpDown,
    109117                                    int sx=10, int sy=100, int px=0, int py=0);
    110118  virtual            ~PIScrollBarGen();
     
    112120  virtual void       ActivateDrag(bool acd=false) = 0;
    113121  virtual void       SetMinMax(int min, int max) = 0;
     122  virtual void       GetMinMax(int& min, int& max) = 0;
    114123  virtual void       SetValue(int val) = 0;
    115124  virtual int        GetValue() = 0;
  • trunk/SophyaPI/PI/pistdwdgx.cc

    r120 r126  
    332332/* --Methode-- */
    333333PIScaleX::PIScaleX(PIContainerGen *par, char *nom, PIMessage msg,
    334                    bool horiz, int sx, int sy, int px, int py)
    335 : PIScaleGen(par, nom, msg, horiz, sx, sy, px, py)
     334                   int dir, int sx, int sy, int px, int py)
     335: PIScaleGen(par, nom, msg, dir, sx, sy, px, py)
    336336{
    337337int n=0;
     
    340340XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
    341341XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
    342 if (horiz)
    343   {
     342if (dir == kSDirLtoR) {
    344343  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
    345344  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
    346345  }
    347 else
    348   {
     346else if (dir == kSDirRtoL) {
     347  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
     348  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_LEFT); n++;
     349  }
     350else if (dir == kSDirDownUp) {
    349351  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
    350352  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++;
    351353  }
     354else { // kSDirUpDown
     355  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
     356  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++;
     357  }
    352358XtSetArg(warg[n], XmNscaleWidth, sx); n++;
    353359XtSetArg(warg[n], XmNscaleHeight, sy); n++;
    354 XtSetArg(warg[n], XmNstringDirection, XmSTRING_DIRECTION_R_TO_L); n++;
     360// XtSetArg(warg[n], XmNstringDirection, XmSTRING_DIRECTION_R_TO_L); n++;
    355361CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py, warg, n);
    356 // XtSetValues(XtWdg(), warg, n);
     362
    357363SetMinMax(1, 100);
    358364SetValue(1);
     365
    359366XtAddCallback(XtWdg(), XmNvalueChangedCallback,
    360367             (XtCallbackProc) scale_action, (XtPointer)this);
     
    382389}
    383390
     391/* --Methode-- */
     392void PIScaleX::GetMinMax(int& min, int& max)
     393{
     394min = mMin;   max = mMax;
     395return;
     396}
    384397
    385398/* --Methode-- */
     
    435448pis = (PIScrollBar *) usd ;
    436449pis->CBSetVal(calld->value);
    437 scroll_value = calld->value;
    438450pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)(&scroll_value));
    439451return;
     
    447459pis = (PIScrollBar *) usd ;
    448460pis->CBSetVal(calld->value);
    449 scroll_value = calld->value;
    450461pis->Send(pis->Msg(), PIMsg_Drag, (void *)(&scroll_value));
    451462return;
     
    454465/* --Methode-- */
    455466PIScrollBarX::PIScrollBarX(PIContainerGen *par, char *nom, PIMessage msg,
    456                            bool vert, int sx, int sy, int px, int py)
    457 : PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py)
     467                           int dir, int sx, int sy, int px, int py)
     468: PIScrollBarGen(par, nom, msg, dir, sx, sy, px, py)
    458469{
    459470int n=0;
    460471Arg warg[6];
    461472
    462 CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py);
    463473XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
    464474XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
    465 if (vert)
    466   {
     475if (dir == kSDirLtoR) {
     476  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
     477  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
     478  }
     479else if (dir == kSDirRtoL) {
     480  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
     481  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_LEFT); n++;
     482  }
     483else if (dir == kSDirDownUp) {
     484  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
     485  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++;
     486  }
     487else { // kSDirUpDown
    467488  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
    468489  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++;
    469490  }
    470 else
    471   {
    472   XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
    473   XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
    474   }
    475 XtSetValues(XtWdg(), warg, n);
     491CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py, warg, n);
    476492mAcD = false;
    477493mVal = -1;
    478494mMin = mMax = 0;
    479 mSz = 0;
    480 SetMinMax(0, 100);
     495mSz = 10;
     496mDir = dir;
     497SetMinMax(1, 100);
    481498SetSlSize(10);
    482 SetValue(0);
     499SetValue(1);
    483500XtAddCallback(XtWdg(), XmNvalueChangedCallback,
    484501             (XtCallbackProc) scrollbar_action, (XtPointer)this);
     
    512529if (mVal < min)  mVal = min;
    513530if (mVal > max-mSz)  mVal = max-mSz;
     531//DBG printf("PIScrollBarX::SetMinMax(%d %d )  %d  Sz=%d \n", min, max, mVal, mSz);
    514532int n=0;
    515533Arg warg[3];
     
    519537XtSetValues(XtWdg(), warg, n);
    520538mMin = min;   mMax = max;
    521 return;
    522 }
    523 
     539//DBG printf("--OUT-OF-- PIScrollBarX::SetMinMax(%d %d )  %d  Sz=%d \n", min, max, mVal, mSz);
     540return;
     541}
     542
     543/* --Methode-- */
     544void PIScrollBarX::GetMinMax(int& min, int& max)
     545{
     546min = mMin;   max = mMax;
     547return;
     548}
    524549
    525550/* --Methode-- */
     
    530555if (val > mMax-mSz)  val = mMax-mSz;
    531556Arg warg[2];
     557//DBG printf("PIScrollBarX::SetValue(%d -> %d) \n", val, val0);
    532558XtSetArg(warg[n], XmNvalue, val); n++;
    533559XtSetValues(this->sdw, warg, n);
    534560mVal = val;
     561//DBG printf("--OUT-OF---PIScrollBarX::SetValue(%d -> %d) \n", val, val0);
    535562return;
    536563}
     
    562589szl = sz/10;
    563590if (szl < 1)  szl = 1;
     591//DBG printf("PIScrollBarX::SetSlSize(%d ) \n", sz);
    564592XtSetArg(warg[n], XmNsliderSize, sz); n++;
    565593XtSetArg(warg[n], XmNpageIncrement, sz); n++;
    566594XtSetArg(warg[n], XmNincrement, szl); n++;
    567 if (mVal > mMax-sz) {
    568   mVal = mMax-sz;
    569   XtSetArg(warg[n], XmNvalue, mVal); n++;
    570   }
     595if (mVal < mMin)  mVal = mMin;
     596if (mVal > mMax-sz)  mVal = mMax-sz;
     597XtSetArg(warg[n], XmNvalue, mVal); n++;
    571598XtSetValues(this->sdw, warg, n);
     599//DBG printf("---OUT-OF---PIScrollBarX::SetSlSize(%d ) -> mVal= %d (cv1,2=%d %d)\n", sz,mVal, cv1, cv2);
    572600mSz = sz;
    573601return;
     
    591619{
    592620mVal = val;
    593 return;
    594 }
    595 
     621scroll_value = mVal;
     622//DBG printf("PIScrollBarX::CBSetVal(%d) %d -> %d \n", mDir, val, mVal);
     623return;
     624}
     625
  • trunk/SophyaPI/PI/pistdwdgx.h

    r98 r126  
    7070public:
    7171                     PIScaleX(PIContainerGen* par, char* nom,
    72                               PIMessage msg=PIMsg_DataChanged, bool horiz=true,
     72                              PIMessage msg=PIMsg_DataChanged, int dir=kSDirLtoR,
    7373                              int sx=100, int sy=10, int px=0, int py=0);
    7474  virtual            ~PIScaleX();
    7575
    7676  virtual void       SetMinMax(int min, int max);
     77  virtual void       GetMinMax(int& min, int& max);
    7778  virtual void       SetValue(int val);
    7879  virtual int        GetValue();
     
    8990public:
    9091                     PIScrollBarX(PIContainerGen* par, char* nom,
    91                                   PIMessage msg = PIMsg_DataChanged, bool vert=true,
     92                                  PIMessage msg = PIMsg_DataChanged, int dir=kSDirUpDown,
    9293                                  int sx=10, int sy=100, int px=0, int py=0);
    9394                     ~PIScrollBarX();
     
    9596  virtual void       ActivateDrag(bool acd=false);
    9697  virtual void       SetMinMax(int min, int max);
     98  virtual void       GetMinMax(int& min, int& max);
    9799  virtual void       SetValue(int val);
    98100  virtual int        GetValue();
     
    103105
    104106protected:
    105   int mVal, mMin, mMax, mSz;
     107  int mVal, mMin, mMax, mSz, mDir;
    106108  bool mAcD;
    107109};
Note: See TracChangeset for help on using the changeset viewer.