Changeset 2486 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc
- Timestamp:
- Dec 26, 2003, 12:17:41 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pistdimgapp.cc
r2427 r2486 90 90 /* --Methode-- */ 91 91 PIStdImgApp::PIStdImgApp(int narg, char* arg[]) 92 : PIApplication(420, 320, narg, arg)92 : PIApplication(420, 320, narg, arg) , resusg(ResourceUsage::RU_All) 93 93 { 94 94 … … 188 188 // le widget zoom, colormap, stats, ... 189 189 190 int bss = 10 0+mFgScSz*15;190 int bss = 105+mFgScSz*15; 191 191 192 192 int statc_szy = bss+10+14+mFgScSz*2+5; … … 202 202 203 203 // Widget pour affichage des stats / ressources 204 lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 10);204 lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 5); 205 205 lab_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 206 206 lab_mem->SetLabel("MemoryUsage"); 207 207 lab_mem->SetForegroundColor(PI_Red); 208 208 lab_mem->SetBorderWidth(1); 209 therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 20, 2*bss+20, 35);209 therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 15, 2*bss+20, 30); 210 210 therm_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 211 211 therm_mem->SetThreshold(0.5, 0.75); 212 212 213 lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 60);213 lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 50); 214 214 lab_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 215 215 lab_cpu->SetLabel("CPUUsage"); 216 216 lab_cpu->SetForegroundColor(PI_Black); 217 217 lab_cpu->SetBorderWidth(1); 218 therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 20, 2*bss+20, 85);218 therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 15, 2*bss+20, 75); 219 219 therm_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 220 220 therm_cpu->SetThreshold(0.75, 0.90); 221 222 fg_exc_cmd = false; 221 lab_thrcmd = new PILabel(statcont, "thrcmdlab", msx-2*(bss+20), 20, 2*bss+20, 95); 222 lab_thrcmd->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 223 lab_thrcmd->SetLabel("CommandThread"); 224 lab_thrcmd->SetForegroundColor(PI_Green); 225 lab_thrcmd->SetBorderWidth(1); 226 227 fg_exc_cmd = false; 228 mCmd = NULL; // Avant d'appeler UpdateStatResource() si PIACmd non cree 223 229 UpdateStatResourceInfo(); 224 230 resupd_periodic = new SIA_RU__Periodic(this); … … 347 353 delete lab_cpu; 348 354 delete therm_cpu; 355 delete lab_thrcmd; 349 356 350 357 delete statcont; … … 372 379 373 380 } 381 382 /* --Methode-- */ 383 void PIStdImgApp::Run() 384 { 385 XEvent evt; 386 int szx, szy, szf; 387 XtAppContext * appctx = PIXtAppCtx(szx, szy, szf); 388 // Pour appeler FinishCreate() des objets dans la fenetre principale 389 if (mStop) { // C'est la premiere fois 390 topcont->SetSize(topcont->XSize(), topcont->YSize()); 391 MBCont()->FinishCreate(); 392 } 393 else mStop = true; // On rerentre apres un stop 394 395 mCmd->start(); 396 397 while (mStop) { 398 thr_glsyn.lock(); // <ZThread> 399 if (XtAppPending(*appctx) != 0) { 400 XtAppNextEvent(*appctx, &evt); 401 XtDispatchEvent(&evt); 402 } 403 thr_glsyn.unlock(); // <ZThread> 404 usleep(1000); 405 } 406 return; 407 } 374 408 375 409 /* --Methode-- */ … … 479 513 #else 480 514 try { 481 mCmd->Interpret(s); 515 // mCmd->Interpret(s); 516 mCmd->AddInputLine(s); 482 517 } 483 518 catch ( PThrowable & exc ) { … … 559 594 // Pas de same ou inset pour DispImage 560 595 if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next; 596 597 // <ZThread> global PIApplication event loop synchronisation 598 ZSync zs(thr_glsyn); 561 599 562 600 // Choix de la taille de fenetre … … 626 664 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 627 665 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 666 667 // <ZThread> global PIApplication event loop synchronisation 668 ZSync zs(thr_glsyn); 669 628 670 // Trace en superpoistion 629 671 if ( (dwopt == Disp_Same) && (mLastWdg) ) { … … 726 768 727 769 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 770 771 // <ZThread> global PIApplication event loop synchronisation 772 ZSync zs(thr_glsyn); 773 728 774 // Trace en superpoistion 729 775 if ( (dwopt == Disp_Same) && (mLastWdg) ) { … … 1359 1405 else 1360 1406 therm_cpu->SetValue(resusg.getAverageCPULoad()); 1407 int nlx = 0; 1408 bool fgx = false; 1409 if (mCmd) fgx = mCmd->isRunning(nlx); 1410 if (!fgx) { 1411 lab = "PIACmdThread Idle"; 1412 lab_thrcmd->SetLabel(lab); 1413 lab_thrcmd->SetForegroundColor(PI_Green); 1414 } 1415 else { 1416 sprintf(buff, "PIACmdThread Running - NL=%d" , nlx); 1417 lab = buff; 1418 lab_thrcmd->SetLabel(lab); 1419 if (nlx < 3) lab_thrcmd->SetForegroundColor(PI_Yellow); 1420 else lab_thrcmd->SetForegroundColor(PI_Red); 1421 } 1361 1422 } 1362 1423
Note:
See TracChangeset
for help on using the changeset viewer.