Changeset 118 in Sophya for trunk/SophyaPI
- Timestamp:
- Jul 8, 1998, 7:47:58 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pibwdggen.cc
r113 r118 57 57 puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! "); 58 58 #endif 59 EraseWindow(0, 0, XSize(), YSize());59 if (g->kind() != PI_PSFileGraphics) EraseWindow(0, 0, XSize(), YSize()); 60 60 if (fgdrawloop == 0) 61 61 { fgdrawloop=2; Draw(g, 0, 0, XSize(), YSize()); } -
trunk/SophyaPI/PI/piimage.h
r113 r118 62 62 inline int XSzPave() { return(xszpav); } 63 63 inline int YSzPave() { return(yszpav); } 64 65 inline PIElDrawer* MyElDrawer() { return (mdrw); } 64 66 65 67 void Apply(bool mw=true); -
trunk/SophyaPI/PI/piimgtools.cc
r117 r118 33 33 34 34 int wszx = 8*spx+3*bsx+2*bsy; 35 int wszy = 10*spy+9*bsy;35 int wszy = 9*spy+9*bsy; 36 36 SetSize(wszx, wszy); 37 37 … … 84 84 cpy += 2*spy+bsy; 85 85 cpx = bsx/2; 86 mBut[0] = new PIButton(this, "Apply", 2500, bsx*1. 5, bsy, cpx, cpy);86 mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.75, bsy, cpx, cpy); 87 87 cpx += bsx*2; 88 mBut[1] = new PIButton(this, "Dismiss", 2600, bsx*1. 5, bsy, cpx, cpy);88 mBut[1] = new PIButton(this, "Dismiss", 2600, bsx*1.75, bsy, cpx, cpy); 89 89 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 90 90 mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 91 91 92 int offy = cpy+bsy+spy* 3;93 printf("-DBG- PIImgLutWind() SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);94 95 cpx = 6*spx+2.75*bsx;92 int offy = cpy+bsy+spy*2; 93 // printf("-DBG- PIImgLutWind() SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy); 94 95 cpx = 4*spx+2.75*bsx; 96 96 cpy = 2*spy; 97 97 mSc[0] = new PIScale(this, "sc-offset-lut", 2700, false, bsy*0.75, 4.5*bsy, cpx, cpy); … … 106 106 107 107 // Option-Menu Couleur/Zoom 108 cpx = 3*spx;108 cpx = bsx/2; 109 109 cpy = offy; 110 mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", 1.5*bsx, bsy, cpx, cpy);110 mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy); 111 111 mOptzc[0]->AppendItem("Grey32", 201); 112 112 mOptzc[0]->AppendItem("GreyInv32", 202); … … 122 122 mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 123 123 124 cpx += 1.5*bsx+3*spx;125 mOptzc[1] = new PIOptMenu(this, "imglut-opt-4", 1.5*bsx, bsy, cpx, cpy);124 cpx += bsx*2; 125 mOptzc[1] = new PIOptMenu(this, "imglut-opt-4", bsx*1.75, bsy, cpx, cpy); 126 126 mOptzc[1]->AppendItem("Agr. x10", 110); 127 127 mOptzc[1]->AppendItem("Agr. x 8", 108); … … 142 142 mOptzc[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 143 143 144 cpx = 2*spx; 145 cpy += bsy+spy; 146 mButsz[0] = new PIButton(this, "1x1", 3201, bsx/2, bsy, cpx, cpy); 144 int pbsx = bsy; 145 int pbsy = bsy; 146 int pspx = spy/2; 147 int pspy = spy; 148 149 cpx = 2*pspx; 150 cpy += pbsy+2*spy; 151 mButsz[0] = new PIButton(this, "1x1", 3201, pbsx, pbsy, cpx, cpy); 147 152 mButsz[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 148 cpx += bsx/2+spx;149 mButsz[1] = new PIButton(this, "1x2", 3202, bsx/2,bsy, cpx, cpy);153 cpx += pbsx+pspx; 154 mButsz[1] = new PIButton(this, "1x2", 3202, pbsx, pbsy, cpx, cpy); 150 155 mButsz[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 151 cpx += bsx/2+spx;152 mButsz[2] = new PIButton(this, "1x4", 3204, bsx/2,bsy, cpx, cpy);156 cpx += pbsx+pspx; 157 mButsz[2] = new PIButton(this, "1x4", 3204, pbsx, pbsy, cpx, cpy); 153 158 mButsz[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 154 cpx += bsx/2+spx;155 mButsz[3] = new PIButton(this, "1/2", 3198, bsx/2,bsy, cpx, cpy);159 cpx += pbsx+pspx; 160 mButsz[3] = new PIButton(this, "1/2", 3198, pbsx, pbsy, cpx, cpy); 156 161 mButsz[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 157 cpx += bsx/2+spx;158 mButsz[4] = new PIButton(this, "1/4", 3196, bsx/2,bsy, cpx, cpy);162 cpx += pbsx+pspx; 163 mButsz[4] = new PIButton(this, "1/4", 3196, pbsx, pbsy, cpx, cpy); 159 164 mButsz[4]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 160 165 161 cpx = 2*spx; 162 cpy += bsy+spy; 163 mButcax[0] = new PIButton(this, "- X", 5201, bsx/2, bsy, cpx, cpy); 166 cpx += pbsx+10*pspx; 167 mButoa[0] = new PIButton(this, "+Info", 5311, 1.5*pbsx, pbsy, cpx, cpy); 168 mButoa[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 169 cpx += 1.5*pbsx+pspx; 170 mButoa[1] = new PIButton(this, "-Info", 5312, 1.5*pbsx, pbsy, cpx, cpy); 171 mButoa[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 172 173 174 cpx = 2*pspx; 175 cpy += pbsy+pspy; 176 mButcax[0] = new PIButton(this, "-X", 5201, pbsx, pbsy, cpx, cpy); 164 177 mButcax[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 165 cpx += bsx/2+spx;166 mButcax[1] = new PIButton(this, "- Y", 5202, bsx/2,bsy, cpx, cpy);178 cpx += pbsx+pspx; 179 mButcax[1] = new PIButton(this, "-Y", 5202, pbsx, pbsy, cpx, cpy); 167 180 mButcax[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 168 cpx += bsx/2+spx;169 mButcax[2] = new PIButton(this, "X <>Y", 5203, bsx/2,bsy, cpx, cpy);181 cpx += pbsx+pspx; 182 mButcax[2] = new PIButton(this, "X-Y", 5203, pbsx, pbsy, cpx, cpy); 170 183 mButcax[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 184 185 cpx += 1.5*pbsx+pspx+10*pspx; 186 mButoa[2] = new PIButton(this, "-All", 5300, 1.5*pbsx, pbsy, cpx, cpy); 187 mButoa[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 188 cpx += 1.5*pbsx+pspx; 189 mButoa[3] = new PIButton(this, "+Curs", 5321, 1.5*pbsx, pbsy, cpx, cpy); 190 mButoa[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 191 cpx += 1.5*pbsx+pspx; 192 mButoa[4] = new PIButton(this, "+Axe", 5331, 1.5*pbsx, pbsy, cpx, cpy); 193 mButoa[4]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 171 194 172 195 curlutw = this; … … 190 213 for(int i=0; i<5; i++) delete mButsz[i]; 191 214 for(int i=0; i<3; i++) delete mButcax[i]; 215 for(int i=0; i<5; i++) delete mButoa[i]; 192 216 193 217 } … … 201 225 mpii = PIImage::CurrentPIImage(); 202 226 if (mpii == NULL) return; 203 sprintf(buff,"%g", (mpii->Lut())->Min()); 227 min_lut = mpii->Lut()->Min(); 228 max_lut = mpii->Lut()->Max(); 229 sprintf(buff,"%g", min_lut); 204 230 mText[0]->SetText(buff); 205 sprintf(buff,"%g", (mpii->Lut())->Max());231 sprintf(buff,"%g", max_lut); 206 232 mText[1]->SetText(buff); 207 233 if ( (mpii->Lut())->Type() == kLutType_Lin ) … … 212 238 mSc[0]->SetValue(0); 213 239 mSc[1]->SetValue(0); 240 mOptzc[0]->SetValue(203); 241 mOptzc[1]->SetValue(101); 214 242 return; 215 243 } … … 238 266 max = atof(mText[1]->GetText().c_str()); 239 267 if (msg == 2700) { 240 del = max -min;241 min +=(float)mSc[0]->GetValue()/100*del;242 max +=(float)mSc[0]->GetValue()/100*del;268 del = max_lut-min_lut; 269 min = min_lut+(float)mSc[0]->GetValue()/100*del; 270 max = max_lut+(float)mSc[0]->GetValue()/100*del; 243 271 } 244 272 if (msg == 2800) { 245 del = max -min;246 min -=(float)mSc[1]->GetValue()/100.*del*0.5;247 max +=(float)mSc[1]->GetValue()/100.*del*0.5;273 del = max_lut-min_lut; 274 min = min_lut-(float)mSc[1]->GetValue()/100.*del*0.5; 275 max = max_lut+(float)mSc[1]->GetValue()/100.*del*0.5; 248 276 } 249 277 if ( (msg == 2700) || (msg == 2800) ) { … … 253 281 sprintf(buff,"%g", max); 254 282 mText[1]->SetText(buff); 255 } 256 lauto = mOpt[1]->GetValue() - 1200; 283 lauto = 0; 284 } 285 else lauto = mOpt[1]->GetValue() - 1200; 257 286 typ = mOpt[0]->GetValue() - 1100; 258 287 if ( (typ < 0) || (typ > 1) ) typ = 0; 259 288 (PIImage::CurrentPIImage())->SetLut(min, max, typlut[typ], lauto); 260 mSc[0]->SetValue(0); 261 mSc[1]->SetValue(0); 289 if (msg == 2500) { 290 min_lut = min; max_lut = max; 291 mSc[0]->SetValue(0); 292 mSc[1]->SetValue(0); 293 } 262 294 // ((PIImage::CurrentPIImage())->Lut())->Print(); 263 295 } … … 271 303 { 272 304 PIImage* pimg = PIImage::CurrentPIImage(); 273 printf(" --DBG-- msg= %ld pimg= %lx \n", (long)msg, (long)pimg);274 305 int zm = msg-3200; 275 306 pimg->SetZoom(zm, false); … … 289 320 if ((snx != sx) || (sny != sy)) 290 321 { 322 int szinc[2]; 291 323 pimg->SetOffset(0, 0, false); 292 if (((PIContainer*)(pimg-Parent()))->NbChilds() == 1)293 ((PIContainer*)(pimg-Parent()))->SetSize(snx, sny);324 szinc[0] = snx-sx; szinc[1] = sny-sy; 325 pimg->Send(pimg->Msg(), PIMsg_ResizeRequest, szinc); 294 326 } 295 327 else pimg->SetOffset(0, 0); … … 306 338 case 5203 : 307 339 mpii->ChangeAxesConfiguration(false, false, true); 340 break; 341 342 343 case 5300 : 344 mpii->SetDrawAxesFlags(kAxesNone); 345 mpii->ShowCursor(false); 346 mpii->MyElDrawer()->ElDelAll(); 347 mpii->Refresh(); 348 break; 349 350 case 5321 : 351 mpii->ShowCursor(true); 352 break; 353 354 case 5331 : 355 mpii->SetDrawAxesFlags(); 308 356 break; 309 357 … … 324 372 PIImage::CurrentPIImage()->SetColMap(cmap[msg-201]); 325 373 326 }327 328 // --------------------------------------------------------------329 330 /* --Methode-- */331 PIImgMenu::PIImgMenu(PIApplication* par)332 : PIMenu(par->Menubar(), "ImgTools")333 {334 pdm[0] = new PIMenu(this, "AutoLut");335 pdm[0]->AppendItem("+3 Sig", 303);336 pdm[0]->AppendItem("+2 Sig", 302);337 pdm[0]->AppendItem("+1 Sig", 301);338 pdm[0]->AppendItem("-1 Sig", 299);339 pdm[0]->AppendItem("-2 Sig", 298);340 AppendPDMenu(pdm[0]);341 342 pdm[1] = new PIMenu(this, "Zoom");343 pdm[1]->AppendItem("Agr. x10", 110);344 pdm[1]->AppendItem("Agr. x 8", 108);345 pdm[1]->AppendItem("Agr. x 6", 106);346 pdm[1]->AppendItem("Agr. x 5", 105);347 pdm[1]->AppendItem("Agr. x 4", 104);348 pdm[1]->AppendItem("Agr. x 3", 103);349 pdm[1]->AppendItem("Agr. x 2", 102);350 pdm[1]->AppendItem("Zoom x1", 101);351 pdm[1]->AppendItem("Red. / 2", 98);352 pdm[1]->AppendItem("Red. / 3", 97);353 pdm[1]->AppendItem("Red. / 4", 96);354 pdm[1]->AppendItem("Red. / 5", 95);355 pdm[1]->AppendItem("Red. / 6", 94);356 pdm[1]->AppendItem("Red. / 8", 92);357 pdm[1]->AppendItem("Red. /10", 90);358 AppendPDMenu(pdm[1]);359 360 pdm[2] = new PIMenu(this, "ColMap");361 pdm[2]->AppendItem("Grey32", 201);362 pdm[2]->AppendItem("GreyInv32", 202);363 pdm[2]->AppendItem("ColRJ32", 203);364 pdm[2]->AppendItem("ColBR32", 204);365 pdm[2]->AppendItem("ColRV32", 205);366 AppendPDMenu(pdm[2]);367 368 AppendItem("Sz x 1", 5101);369 AppendCheckItem("Show Cursor", 5102);370 AppendCheckItem("Show Axes", 5103);371 pdm[3] = new PIMenu(this, "Conf. Axes");372 pdm[3]->AppendItem("Invert-X", 5201);373 pdm[3]->AppendItem("Invert-Y", 5202);374 pdm[3]->AppendItem("Exchange X-Y", 5203);375 AppendPDMenu(pdm[3]);376 377 AppendItem("Lut...", 5300);378 379 mLW = new PIImgLutWind(par);380 }381 382 /* --Methode-- */383 PIImgMenu::~PIImgMenu()384 {385 int i;386 for(i=0; i<4; i++) delete pdm[i];387 delete mLW;388 }389 390 /* --Methode-- */391 void PIImgMenu::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data)392 {393 CMapId cmap[5] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,394 CMAP_COLBR32, CMAP_COLRV32 } ;395 if (PIImage::CurrentPIImage() == NULL) return;396 msg = UserMsg(msg);397 if ((msg <= 110) && (msg >= 90)) // Zoom398 PIImage::CurrentPIImage()->SetZoom((int)(msg-100));399 else if ((msg > 200) && (msg < 206)) // Changement de couleur400 PIImage::CurrentPIImage()->SetColMap(cmap[msg-201]);401 else if ((msg > 290) && (msg < 310))402 PIImage::CurrentPIImage()->SetLut( PIImage::CurrentPIImage()->Lut()->Min(), PIImage::CurrentPIImage()->Lut()->Max(),403 kLutType_Lin, msg-300);404 else if ((msg > 500) && (msg < 505)) {405 PIImage* mpii = PIImage::CurrentPIImage();406 float x1 = (mpii->Lut())->Min();407 float x2 = (mpii->Lut())->Max();408 float dx = 0.1*(x2-x1);409 int typ = (mpii->Lut())->Type();410 switch (msg)411 {412 case 501 :413 mpii->SetLut(x1-dx, x2, typ);414 break;415 case 502 :416 mpii->SetLut(x1+dx, x2, typ);417 break;418 case 503 :419 mpii->SetLut(x1, x2-dx, typ);420 break;421 case 504 :422 mpii->SetLut(x1, x2+dx, typ);423 break;424 default :425 break;426 }427 428 }429 else {430 PIImage* mpii = PIImage::CurrentPIImage();431 switch (msg)432 {433 case 5101 :434 mpii->SetOffset(0, 0, false);435 mpii->SetZoom(1, true);436 break;437 438 case 5102 :439 if (*((bool *)data)) mpii->ShowCursor(true);440 else mpii->ShowCursor(false);441 break;442 443 case 5103 :444 if (*((bool *)data)) mpii->SetDrawAxesFlags();445 else mpii->SetDrawAxesFlags(kAxesNone);446 break;447 448 case 5201 :449 mpii->ChangeAxesConfiguration(true, false, false);450 break;451 case 5202 :452 mpii->ChangeAxesConfiguration(false, true, false);453 break;454 case 5203 :455 mpii->ChangeAxesConfiguration(false, false, true);456 break;457 458 case 5300 :459 mLW->Show();460 break;461 462 default :463 break;464 }465 }466 374 return; 467 375 } 376 -
trunk/SophyaPI/PI/piimgtools.h
r116 r118 8 8 #include "pisysdep.h" 9 9 #include PISTDWDG_H 10 #include PIMENU_H11 10 #include PIOPTMENU_H 12 11 #include PIWIN_H 13 12 #include PIAPP_H 14 13 15 // ------ Menu des options et fenetre de dialogue pour changement de LUT -------- 14 // ------ fenetre de dialogue pour changement de LUT et options de PIImage -------- 15 // -------------------------------------------------------------------------------- 16 16 17 // --------------------------------------------------------------18 17 class PIImgLutWind : public PIWindow { 19 18 public : … … 35 34 PILabel* mOlb[2]; 36 35 PIScale* mSc[2]; 36 float min_lut,max_lut; 37 37 // Pour la couleur et le zoom 38 38 PIOptMenu* mOptzc[2]; 39 39 // Pour expand et compress 40 40 PIButton* mButsz[5]; 41 // Pour options d'affichage42 PIButton* mButoa[6];43 41 // Config axes 44 42 PIButton* mButcax[3]; 43 // Options show/hide 44 PIButton* mButoa[5]; 45 45 }; 46 46 47 47 48 class PIImgMenu : public PIMenu49 {50 public :51 PIImgMenu(PIApplication* app);52 virtual ~PIImgMenu();53 protected:54 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);55 PIMenu* pdm[4];56 PIImgLutWind* mLW;57 };58 59 48 60 49 #endif -
trunk/SophyaPI/PI/pioptmenux.cc
r114 r118 45 45 int n = 0; 46 46 CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py); 47 XtSetArg(warg[n],XmNhighlightThickness, 0); n++; 47 48 XtSetArg(warg[n], XmNrecomputeSize, FALSE); n++; 48 49 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; -
trunk/SophyaPI/PI/pisurfdr.cc
r116 r118 54 54 D *= 1.5; 55 55 56 Set3DView((xmin+xmax)/2., (ymin+ymax)/2, (zmin+zmax)*0.4,56 Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.4, 57 57 (xmin+xmax)/2.+D , (ymin+ymax)/2.+2.*D , zmin+(zmax-zmin)*0.1, 0.3, 0.3); 58 58 // printf("PISurfaceDrawer::UpdateSize() : %g-%g %g-%g %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D);
Note:
See TracChangeset
for help on using the changeset viewer.