Changeset 323 in Sophya
- Timestamp:
- Jun 23, 1999, 10:27:50 AM (26 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Tests/pit1.cc
r181 r323 378 378 379 379 // Creation d' zone texte multiligne 380 txt = new PIText(MainWin(), "mltext", 290, 90, 5, 5);380 txt = new PIText(MainWin(), "mltext", true, true, 290, 90, 5, 5); 381 381 txt->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic); 382 txt->SetMutiLineMode(true);382 // txt->SetMutiLineMode(true); 383 383 txt->SetTextEditable(false); 384 384 txt->SetText(""); -
trunk/SophyaPI/PI/pigraphx.cc
r316 r323 4 4 5 5 #include <stdio.h> 6 #include <math.h> 6 7 7 8 #include <X11/Intrinsic.h> … … 247 248 } 248 249 250 // Coordonnees pour tracer une etoile a 5 branches 251 static float starcoordx[10], starcoordy[10]; 252 249 253 /* --Methode-- */ 250 254 void PIGraphicX::DrawMarker(PIGrCoord x0, PIGrCoord y0) … … 252 256 float hmsz = mMrkSz/2; 253 257 float dmsz = mMrkSz-hmsz; 254 PIGrCoord x[4],y[4]; 258 PIGrCoord x[11],y[11]; 259 int k; 255 260 PILineAtt clatt; 256 261 … … 291 296 x[3] = -dmsz; y[3] = +mMrkSz; x[0] = (float)x0-hmsz; y[0] = (float)y0+hmsz; 292 297 DrawFPolygon(x, y, 4); 298 break; 299 case PI_StarMarker : 300 case PI_FStarMarker : 301 for(k=0; k<10; k++) { 302 x[k] = (int)(starcoordx[k]*(float)mMrkSz+(float)x0+0.5); 303 y[k] = (int)(starcoordy[k]*(float)mMrkSz+(float)y0+0.5); 304 } 305 x[10] = x[0]; y[10] = y[0]; 306 if (mMrk == PI_StarMarker) DrawPolygon(x, y, 11, false); 307 else DrawFPolygon(x, y, 11, false); 293 308 break; 294 309 default : … … 691 706 dpxgc = XCreateGC(mdsp, DefaultRootWindow(mdsp), GCFunction | GCPlaneMask, &xgv); 692 707 693 return; 694 } 695 696 697 698 708 /* Coordonnees pour une etoile a 5 branches */ 709 double pio5 = M_PI/2.5; 710 double pio52 = pio5/2.; 711 double cpi2 = M_PI/2.-pio5; 712 double re = 1.2; // Rayon externe 713 double ri = 0.5; // rayon interne pour rext=1.2 714 for(int k=0; k<5; k++) { 715 starcoordx[2*k] = cos(k*pio5+cpi2)*re; 716 starcoordy[2*k] = -sin(k*pio5+cpi2)*re; 717 starcoordx[2*k+1] = cos(k*pio5+pio52+cpi2)*ri; 718 starcoordy[2*k+1] = -sin(k*pio5+pio52+cpi2)*ri; 719 } 720 721 } 722 723 724 725 -
trunk/SophyaPI/PI/pistdwdggen.cc
r126 r323 70 70 71 71 PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, PIMessage msg, 72 int sx, int sy, int px, int py, PIBtnSign bsgn) 73 : PIWdg(par, nom, sx, sy, px, py) 74 { 75 SetMsg(msg); 76 mSgn = bsgn; 72 int sx, int sy, int px, int py) 73 : PIWdg(par, nom, sx, sy, px, py) 74 { 75 SetMsg(msg); 77 76 } 78 77 … … 108 107 // PIText(PIContainerGen* par, char* nom, int sx=10, int sy=10, int px=0, int py=0) 109 108 // Création d'un objet PIText. 109 // PIText(PIContainerGen* par, char* nom, bool vsb, bool hsb, - 110 // int sx=10, int sy=10, int px=0, int py=0) 111 // Création d'un objet PIText multiligne, muni d'ascenseurs 112 // Vertical si "vsb == true", horizontal si "hsb == true". 110 113 // void SetText(string const& txt) 111 114 // Modifie le contenu du champ texte. … … 119 122 120 123 PITextGen::PITextGen(PIContainerGen *par, char *nom, 124 int sx, int sy, int px, int py) 125 : PIWdg(par, nom, sx, sy, px, py) 126 {} 127 128 PITextGen::PITextGen(PIContainerGen *par, char *nom, bool vsb, bool hsb, 121 129 int sx, int sy, int px, int py) 122 130 : PIWdg(par, nom, sx, sy, px, py) -
trunk/SophyaPI/PI/pistdwdggen.h
r163 r323 18 18 19 19 // Les differents types de boutons avec un signe dessus ... 20 enum PIBtnSign { PIBtn_Label=0, PIBtn_ArrowUp=1, PIBtn_ArrowDown=2,21 PIBtn_ArrowLeft=3, PIBtn_ArrowRight=4 };20 // enum PIBtnSign { PIBtn_Label=0, PIBtn_ArrowUp=1, PIBtn_ArrowDown=2, 21 // PIBtn_ArrowLeft=3, PIBtn_ArrowRight=4 }; 22 22 23 23 class PIButtonGen : public PIWdg … … 28 28 PIButtonGen(PIContainerGen* par, char* nom, 29 29 PIMessage msg = PIMsg_Click, 30 int sx=10, int sy=10, int px=0, int py=0, 31 PIBtnSign bsgn = PIBtn_Label); 30 int sx=10, int sy=10, int px=0, int py=0); 32 31 virtual ~PIButtonGen(); 33 32 … … 35 34 virtual void ActivatePress(bool acp=false)=0; 36 35 37 protected:38 PIBtnSign mSgn;39 36 }; 40 37 … … 48 45 PITextGen(PIContainerGen* par, char* nom, 49 46 int sx=10, int sy=10, int px=0, int py=0); 47 PITextGen(PIContainerGen* par, char* nom, bool vsb, bool hsb, 48 int sx=100, int sy=100, int px=0, int py=0); 50 49 virtual ~PITextGen(); 51 50 virtual void SetText(string const&) = 0; -
trunk/SophyaPI/PI/pistdwdgx.cc
r157 r323 79 79 /* --Methode-- */ 80 80 PIButtonX::PIButtonX(PIContainerGen *par, char *nom, PIMessage msg, 81 int sx, int sy, int px, int py , PIBtnSign bsgn)82 : PIButtonGen(par, nom, msg, sx, sy, px, py , bsgn)81 int sx, int sy, int px, int py) 82 : PIButtonGen(par, nom, msg, sx, sy, px, py) 83 83 { 84 84 … … 90 90 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 91 91 XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 92 92 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py); 93 94 /* 93 95 if (bsgn == PIBtn_Label) 94 96 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py); … … 112 114 } 113 115 } 114 116 */ 115 117 XtSetValues(XtWdg(), warg, n); 116 118 XtAddCallback(XtWdg(), XmNactivateCallback, … … 160 162 int n = 0; 161 163 CreateXtWdg(nom, xmTextWidgetClass, NULL, sx, sy, px, py); 164 mtext = XtWdg(); 162 165 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 163 166 // XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 164 XtSetValues( XtWdg(), warg, n);167 XtSetValues(mtext, warg, n); 165 168 SetMutiLineMode(false); 166 169 SetTextEditable(true); … … 169 172 170 173 /* --Methode-- */ 174 PITextX::PITextX(PIContainerGen *par, char *nom, bool vsb, bool hsb, 175 int sx, int sy, int px, int py) 176 : PITextGen(par, nom, vsb, hsb, sx, sy, px, py) 177 { 178 Arg warg[6]; 179 int n = 0; 180 XtSetArg(warg[n],XmNeditMode, XmMULTI_LINE_EDIT); n++; 181 XtSetArg(warg[n],XmNscrollBarDisplayPolicy, XmSTATIC); n++; 182 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 183 if (vsb) 184 XtSetArg(warg[n],XmNscrollHorizontal, True); n++; 185 if (hsb) 186 XtSetArg(warg[n],XmNscrollVertical, True); n++; 187 mtext = XmCreateScrolledText(((PIWdgX *)par)->XtWdg(), nom, warg, n); 188 XtManageChild(mtext); 189 XtWdg() = XtParent(mtext); 190 SetSize(sx, sy); 191 SetPos(px, py); 192 wmis = k_wmi_normal ; 193 stmng = 0; 194 // XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 195 SetTextEditable(true); 196 Manage(); 197 } 198 199 /* --Methode-- */ 171 200 PITextX::~PITextX() 172 201 {} … … 175 204 void PITextX::SetText(string const& s) 176 205 { 177 XmTextSetString( XtWdg(), (char *)s.c_str());206 XmTextSetString(mtext, (char *)s.c_str()); 178 207 return; 179 208 } … … 183 212 { 184 213 char *txtb; 185 txtb = XmTextGetString( XtWdg());214 txtb = XmTextGetString(mtext); 186 215 string s(txtb); 187 216 XtFree(txtb); … … 200 229 { XtSetArg(warg[n],XmNeditMode, XmSINGLE_LINE_EDIT); n++; } 201 230 202 XtSetValues( XtWdg(), warg, n);231 XtSetValues(mtext, warg, n); 203 232 return; 204 233 } … … 215 244 { XtSetArg(warg[n],XmNeditable, FALSE); n++; } 216 245 217 XtSetValues( XtWdg(), warg, n);246 XtSetValues(mtext, warg, n); 218 247 return; 219 248 } … … 236 265 237 266 if (Msg() && !msg) 238 XtRemoveCallback( XtWdg(), XmNactivateCallback,267 XtRemoveCallback(mtext, XmNactivateCallback, 239 268 (XtCallbackProc)text_action, (XtPointer)this); 240 269 if (!Msg() && msg) 241 XtAddCallback( XtWdg(), XmNactivateCallback,270 XtAddCallback(mtext, XmNactivateCallback, 242 271 (XtCallbackProc)text_action, (XtPointer)this); 243 272 -
trunk/SophyaPI/PI/pistdwdgx.h
r126 r323 19 19 PIButtonX(PIContainerGen *par, char *nom, 20 20 PIMessage msg = PIMsg_Click, 21 int sx=10, int sy=10, int px=0, int py=0, 22 PIBtnSign bsgn = PIBtn_Label); 21 int sx=10, int sy=10, int px=0, int py=0); 23 22 virtual ~PIButtonX(); 24 23 … … 39 38 PITextX(PIContainerGen *par, char *nom, 40 39 int sx=10, int sy=10, int px=0, int py=0); 40 PITextX(PIContainerGen* par, char* nom, bool vsb, bool hsb, 41 int sx=100, int sy=100, int px=0, int py=0); 41 42 virtual ~PITextX(); 42 43 virtual void SetText(string const&); … … 47 48 48 49 virtual void SetMsg(PIMessage msg=0); 50 51 protected: 52 53 SysDWdg mtext; 49 54 }; 50 55
Note:
See TracChangeset
for help on using the changeset viewer.