Changeset 126 in Sophya for trunk/SophyaPI
- Timestamp:
- Jul 22, 1998, 1:15:49 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Makefile
r119 r126 84 84 pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \ 85 85 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 87 88 $(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \ 88 89 piwdggen.h pimsghandler.h … … 185 186 $(EROSDEVREP)/Include/exceptions.h \ 186 187 $(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 192 191 $(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h pimenux.h \ 193 192 pimenugen.h piwdgx.h piwdggen.h pimsghandler.h … … 212 211 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \ 213 212 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 \ 220 220 $(EROSDEVREP)/Include/ppersist.h \ 221 221 $(EROSDEVREP)/Include/pclassids.h \ 222 $(EROSDEVREP)/Include/ cvector.h222 $(EROSDEVREP)/Include/generalfit.h 223 223 $(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \ 224 224 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \ … … 227 227 piwindowx.h piwindowgen.h picontainerx.h picontainergen.h pidrawer.h \ 228 228 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 230 231 $(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \ 231 232 piwdggen.h pimsghandler.h -
trunk/SophyaPI/PI/piapplx.cc
r114 r126 20 20 static PIApplication* cur_piapp = NULL; 21 21 PIApplication* PIApplicationGetApp() { return cur_piapp; } 22 23 22 24 23 25 /* --Methode-- */ -
trunk/SophyaPI/PI/picons.cc
r110 r126 28 28 { 29 29 mNL = (nl > 10) ? nl : 10; 30 mNC = (nc > 40) ? nc : 40;30 mNC = (nc > 30) ? nc : 30; 31 31 mText = new char[mNL*mNC]; 32 32 mAtt = new unsigned char[mNL*mNC]; … … 76 76 opmc->AppendItem("NormalFont", 3102); 77 77 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); 78 81 opmc->AppendItem("White-Black", 3201); 79 82 opmc->AppendItem("Black-White", 3202); … … 174 177 mScb->SetMinMax(0, NbLines()-1); 175 178 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-- */ 185 void PIConsole::AutoSize(int nl, int nc) 186 { 187 if ( (nl < 1) || (nc < 1) ) { 188 nl = mWSzL; nc = mNC; 189 } 190 if (nc > mNC) nc = mNC; 183 191 int dsz[2]; 184 dsz[0] = ( mNC+2)*mFLarg - XSize();185 dsz[1] = ( mWSzL+1)*mFHaut - YSize();192 dsz[0] = (nc+2)*mFLarg - XSize(); 193 dsz[1] = (nl+1)*mFHaut - YSize(); 186 194 Send(Msg(), PIMsg_ResizeRequest, dsz); 187 SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut); 195 196 mWSzL = YSize()/mFHaut - 1; 197 mWSzC = XSize()/mFLarg - 2; 198 /* 199 if (mScb) { 200 mScb->SetMinMax(0, NbLines()-1); 201 mScb->SetSlSize(WindNbLines()); 202 mScb->SetValue(0); 203 } 204 */ 205 mOffL = 0; 188 206 } 189 207 … … 239 257 { 240 258 if (ldeb < 0) { 241 if (mScb) mScb->SetValue( NbLines()-WindNbLines()-1);259 if (mScb) mScb->SetValue(0); 242 260 mOffL = 0; 243 261 } 244 else if (ldeb >= mNL-mWSzL-1) mOffL = 0; 245 else mOffL = (mNL-mWSzL-1)-ldeb; 246 if (mOffL < 0) mOffL = 0; 262 mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1; 247 263 } 248 264 … … 256 272 mScb->SetMinMax(0, NbLines()-1); 257 273 mScb->SetSlSize(WindNbLines()); 258 mScb->SetValue( NbLines()-WindNbLines()-1);274 mScb->SetValue(0); 259 275 } 260 276 mOffL = 0; … … 315 331 case PIK_Enter : 316 332 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) ); 318 334 319 335 // Gestion de rappel des commandes … … 334 350 mCmdStr[mCLC-1] = ' '; mCCP--; mCLC--; 335 351 } 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, 337 353 // mCmdStr, strlen(mCmdStr)); 338 354 break; … … 340 356 case PIK_Up : 341 357 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); 343 359 if (mNComm > 0) { 344 360 int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall; … … 359 375 case PIK_Left : 360 376 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); 362 378 break; 363 379 case PIK_Right : 364 380 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); 366 382 break; 367 383 default : … … 579 595 strncat(name, nom, 127); 580 596 msgScb = Msg()+55; 581 mScb = new PIScrollBar (par, name, msgScb, true, Scb_Width, sy, px+sx, py);597 mScb = new PIScrollBar (par, name, msgScb, kSDirDownUp, Scb_Width, sy, px+sx, py); 582 598 mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed); 583 599 … … 585 601 mScb->SetMinMax(0, NbLines()-1); 586 602 mScb->SetSlSize(WindNbLines()); 587 mScb->SetValue( NbLines()-WindNbLines()-1);603 mScb->SetValue(0); 588 604 } 589 605 … … 870 886 SelFgBgCol(PI_Yellow, PI_Black); 871 887 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; 872 897 default : 873 898 fgr = false; -
trunk/SophyaPI/PI/picons.h
r80 r126 26 26 27 27 void SelectFont(PIFontSize sz=PI_NormalSizeFont); 28 void AutoSize( );28 void AutoSize(int nl=-1, int nc=-1); 29 29 void PreferedSize(int& sx, int& sy); 30 30 void AcceptCmd(bool acc=true, int nrecmx=20); -
trunk/SophyaPI/PI/picontainerx.cc
r110 r126 11 11 CreateXtWdg(nom, xmFormWidgetClass , NULL, sx, sy, px, py); 12 12 // CreateXtWdg(nom, xmBulletinBoardWidgetClass , NULL, sx, sy, px, py); 13 mTopWdg = NULL; 13 14 } 14 15 16 // constructeur special a utiliser par PIApplicationX ... 15 17 PIContainerX::PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom, 16 18 int sx, int sy, int px, int py) … … 20 22 if ((sx > 0) && (sy > 0)) 21 23 CreateXtWdg(nom, xmFormWidgetClass , parwdg->XtWdg(), sx, sy, px, py); 24 mTopWdg = parwdg; 22 25 } 23 26 … … 31 34 int k; 32 35 for(k=0; k<mNCh; k++) mChilds[k]->FinishCreate(); 36 } 37 38 /* --Methode-- */ 39 void PIContainerX::Process(PIMessage msg, PIMsgHandler* sender, void* data) 40 { 41 // Traitement specifique pour le top-container de PIApplicationX 42 if ((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 } 49 else ReSend(msg, sender, data); 33 50 } 34 51 -
trunk/SophyaPI/PI/picontainerx.h
r110 r126 9 9 { 10 10 public: 11 PIContainerX(PIContainerGen *par, char *nom,11 PIContainerX(PIContainerGen *par, char *nom, 12 12 int sx=10, int sy=10, int px=0, int py=0); 13 13 14 14 // Ce constructeur est a utiliser par PIApplicationX ... 15 PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom,15 PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom, 16 16 int sx=10, int sy=10, int px=0, int py=0); 17 17 18 virtual void FinishCreate(); // apelle FinishCreate() pour les descendants18 virtual void FinishCreate(); // appelle FinishCreate() pour les descendants 19 19 20 virtual ~PIContainerX();20 virtual ~PIContainerX(); 21 21 22 // Pour traiter les Resize-Request si TopContainer de PIApplicationX 23 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 24 25 protected : 26 PIWdgX* mTopWdg; 22 27 }; 23 28 -
trunk/SophyaPI/PI/pihisto2d.cc
r120 r126 535 535 // Labels et curseur mobile 536 536 mLab[3] = new PILabel(this, " PerPt: ",60,30,10,215); 537 mPScal = new PIScale(this,"FracPoints",6401, true,150,20,80,215);537 mPScal = new PIScale(this,"FracPoints",6401,kSDirLtoR,150,20,80,215); 538 538 mPScal->SetMinMax(0,100); 539 539 int imfp = mFPoints*100.f; -
trunk/SophyaPI/PI/piimgtools.cc
r119 r126 93 93 cpx = 4*spx+2.75*bsx; 94 94 cpy = 2*spy; 95 mSc[0] = new PIScale(this, "sc-offset-lut", 2700, false, bsy*0.75, 4.5*bsy, cpx, cpy);95 mSc[0] = new PIScale(this, "sc-offset-lut", 2700, kSDirDownUp, bsy*0.75, 4.5*bsy, cpx, cpy); 96 96 cpx += 1.5*bsy; 97 mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, false, bsy*0.75, 4.5*bsy, cpx, cpy);97 mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, kSDirDownUp, bsy*0.75, 4.5*bsy, cpx, cpy); 98 98 mSc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 99 99 mSc[0]->SetMinMax(-50, 50); -
trunk/SophyaPI/PI/pistdwdggen.cc
r111 r126 196 196 //-- 197 197 //++ 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). 201 202 // void SetMinMax(int min, int max) 202 203 // 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. 203 206 // void SetValue(int v) 204 207 // Modifie la valeur courante de l'échelle. … … 209 212 210 213 PIScaleGen::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) 212 215 : PIWdg(par, nom, sx, sy, px, py) 213 216 { … … 244 247 //-- 245 248 //++ 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). 249 253 // void ActivateDrag(bool acd=false) 250 254 // Active ("acd=true") ou désactive ("mlm=false") l'envoi de messages lors du mouvement du curseur. 251 255 // void SetMinMax(int min, int max) 252 256 // 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. 253 260 // void SetValue(int v) 254 261 // Modifie la position courante de l'ascenseur. … … 262 269 263 270 PIScrollBarGen::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) 265 272 : PIWdg(par, nom, sx, sy, px, py) 266 273 { -
trunk/SophyaPI/PI/pistdwdggen.h
r98 r126 79 79 }; 80 80 81 // Definition choix de la direction et sens pour Scale et Scroll-bar 82 enum { 83 kSDirLtoR = 1, 84 kSDirRtoL = 2, 85 kSDirDownUp = 4, 86 kSDirUpDown = 8, 87 }; 81 88 82 89 class PIScaleGen : public PIWdg … … 86 93 87 94 PIScaleGen(PIContainerGen* par, char* nom, 88 PIMessage msg = PIMsg_DataChanged, bool horiz=true,95 PIMessage msg = PIMsg_DataChanged, int dir=kSDirLtoR, 89 96 int sx=100, int sy=10, int px=0, int py=0); 90 97 virtual ~PIScaleGen(); 91 98 92 99 virtual void SetMinMax(int min, int max) = 0; 100 virtual void GetMinMax(int& min, int& max) = 0; 93 101 virtual void SetValue(int val) = 0; 94 102 virtual int GetValue() = 0; … … 106 114 107 115 PIScrollBarGen(PIContainerGen* par, char* nom, 108 PIMessage msg=PIMsg_DataChanged, bool vert=true,116 PIMessage msg=PIMsg_DataChanged, int dir=kSDirUpDown, 109 117 int sx=10, int sy=100, int px=0, int py=0); 110 118 virtual ~PIScrollBarGen(); … … 112 120 virtual void ActivateDrag(bool acd=false) = 0; 113 121 virtual void SetMinMax(int min, int max) = 0; 122 virtual void GetMinMax(int& min, int& max) = 0; 114 123 virtual void SetValue(int val) = 0; 115 124 virtual int GetValue() = 0; -
trunk/SophyaPI/PI/pistdwdgx.cc
r120 r126 332 332 /* --Methode-- */ 333 333 PIScaleX::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) 336 336 { 337 337 int n=0; … … 340 340 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 341 341 XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 342 if (horiz) 343 { 342 if (dir == kSDirLtoR) { 344 343 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 345 344 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; 346 345 } 347 else 348 { 346 else if (dir == kSDirRtoL) { 347 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 348 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_LEFT); n++; 349 } 350 else if (dir == kSDirDownUp) { 349 351 XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++; 350 352 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++; 351 353 } 354 else { // kSDirUpDown 355 XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++; 356 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++; 357 } 352 358 XtSetArg(warg[n], XmNscaleWidth, sx); n++; 353 359 XtSetArg(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++; 355 361 CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py, warg, n); 356 // XtSetValues(XtWdg(), warg, n); 362 357 363 SetMinMax(1, 100); 358 364 SetValue(1); 365 359 366 XtAddCallback(XtWdg(), XmNvalueChangedCallback, 360 367 (XtCallbackProc) scale_action, (XtPointer)this); … … 382 389 } 383 390 391 /* --Methode-- */ 392 void PIScaleX::GetMinMax(int& min, int& max) 393 { 394 min = mMin; max = mMax; 395 return; 396 } 384 397 385 398 /* --Methode-- */ … … 435 448 pis = (PIScrollBar *) usd ; 436 449 pis->CBSetVal(calld->value); 437 scroll_value = calld->value;438 450 pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)(&scroll_value)); 439 451 return; … … 447 459 pis = (PIScrollBar *) usd ; 448 460 pis->CBSetVal(calld->value); 449 scroll_value = calld->value;450 461 pis->Send(pis->Msg(), PIMsg_Drag, (void *)(&scroll_value)); 451 462 return; … … 454 465 /* --Methode-- */ 455 466 PIScrollBarX::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) 458 469 { 459 470 int n=0; 460 471 Arg warg[6]; 461 472 462 CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py);463 473 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 464 474 XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 465 if (vert) 466 { 475 if (dir == kSDirLtoR) { 476 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 477 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; 478 } 479 else if (dir == kSDirRtoL) { 480 XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++; 481 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_LEFT); n++; 482 } 483 else if (dir == kSDirDownUp) { 484 XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++; 485 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++; 486 } 487 else { // kSDirUpDown 467 488 XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++; 468 489 XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++; 469 490 } 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); 491 CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py, warg, n); 476 492 mAcD = false; 477 493 mVal = -1; 478 494 mMin = mMax = 0; 479 mSz = 0; 480 SetMinMax(0, 100); 495 mSz = 10; 496 mDir = dir; 497 SetMinMax(1, 100); 481 498 SetSlSize(10); 482 SetValue( 0);499 SetValue(1); 483 500 XtAddCallback(XtWdg(), XmNvalueChangedCallback, 484 501 (XtCallbackProc) scrollbar_action, (XtPointer)this); … … 512 529 if (mVal < min) mVal = min; 513 530 if (mVal > max-mSz) mVal = max-mSz; 531 //DBG printf("PIScrollBarX::SetMinMax(%d %d ) %d Sz=%d \n", min, max, mVal, mSz); 514 532 int n=0; 515 533 Arg warg[3]; … … 519 537 XtSetValues(XtWdg(), warg, n); 520 538 mMin = min; mMax = max; 521 return; 522 } 523 539 //DBG printf("--OUT-OF-- PIScrollBarX::SetMinMax(%d %d ) %d Sz=%d \n", min, max, mVal, mSz); 540 return; 541 } 542 543 /* --Methode-- */ 544 void PIScrollBarX::GetMinMax(int& min, int& max) 545 { 546 min = mMin; max = mMax; 547 return; 548 } 524 549 525 550 /* --Methode-- */ … … 530 555 if (val > mMax-mSz) val = mMax-mSz; 531 556 Arg warg[2]; 557 //DBG printf("PIScrollBarX::SetValue(%d -> %d) \n", val, val0); 532 558 XtSetArg(warg[n], XmNvalue, val); n++; 533 559 XtSetValues(this->sdw, warg, n); 534 560 mVal = val; 561 //DBG printf("--OUT-OF---PIScrollBarX::SetValue(%d -> %d) \n", val, val0); 535 562 return; 536 563 } … … 562 589 szl = sz/10; 563 590 if (szl < 1) szl = 1; 591 //DBG printf("PIScrollBarX::SetSlSize(%d ) \n", sz); 564 592 XtSetArg(warg[n], XmNsliderSize, sz); n++; 565 593 XtSetArg(warg[n], XmNpageIncrement, sz); n++; 566 594 XtSetArg(warg[n], XmNincrement, szl); n++; 567 if (mVal > mMax-sz) { 568 mVal = mMax-sz; 569 XtSetArg(warg[n], XmNvalue, mVal); n++; 570 } 595 if (mVal < mMin) mVal = mMin; 596 if (mVal > mMax-sz) mVal = mMax-sz; 597 XtSetArg(warg[n], XmNvalue, mVal); n++; 571 598 XtSetValues(this->sdw, warg, n); 599 //DBG printf("---OUT-OF---PIScrollBarX::SetSlSize(%d ) -> mVal= %d (cv1,2=%d %d)\n", sz,mVal, cv1, cv2); 572 600 mSz = sz; 573 601 return; … … 591 619 { 592 620 mVal = val; 593 return; 594 } 595 621 scroll_value = mVal; 622 //DBG printf("PIScrollBarX::CBSetVal(%d) %d -> %d \n", mDir, val, mVal); 623 return; 624 } 625 -
trunk/SophyaPI/PI/pistdwdgx.h
r98 r126 70 70 public: 71 71 PIScaleX(PIContainerGen* par, char* nom, 72 PIMessage msg=PIMsg_DataChanged, bool horiz=true,72 PIMessage msg=PIMsg_DataChanged, int dir=kSDirLtoR, 73 73 int sx=100, int sy=10, int px=0, int py=0); 74 74 virtual ~PIScaleX(); 75 75 76 76 virtual void SetMinMax(int min, int max); 77 virtual void GetMinMax(int& min, int& max); 77 78 virtual void SetValue(int val); 78 79 virtual int GetValue(); … … 89 90 public: 90 91 PIScrollBarX(PIContainerGen* par, char* nom, 91 PIMessage msg = PIMsg_DataChanged, bool vert=true,92 PIMessage msg = PIMsg_DataChanged, int dir=kSDirUpDown, 92 93 int sx=10, int sy=100, int px=0, int py=0); 93 94 ~PIScrollBarX(); … … 95 96 virtual void ActivateDrag(bool acd=false); 96 97 virtual void SetMinMax(int min, int max); 98 virtual void GetMinMax(int& min, int& max); 97 99 virtual void SetValue(int val); 98 100 virtual int GetValue(); … … 103 105 104 106 protected: 105 int mVal, mMin, mMax, mSz ;107 int mVal, mMin, mMax, mSz, mDir; 106 108 bool mAcD; 107 109 };
Note:
See TracChangeset
for help on using the changeset viewer.