Changeset 2651 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc


Ignore:
Timestamp:
Feb 18, 2005, 3:09:47 PM (21 years ago)
Author:
ansari
Message:

Modifications pour l'utilisation viewer PIImageNavigator (ajout commande imagnav) - Reza 18 Fev 2005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2638 r2651  
    661661PIApplication::SetBusy();
    662662// Attention : Appel XSync specifique X11 -  en attendant multi-thread
    663 XSync(PIXDisplay(), False); 
     663// XSync(PIXDisplay(), False);  RZDEL
    664664}
    665665
     
    671671PIApplication::SetBlocked();
    672672// Attention : Appel XSync specifique X11 -  en attendant multi-thread
    673 XSync(PIXDisplay(), False); 
     673// XSync(PIXDisplay(), False);  RZDEL
    674674}
    675675
     
    701701/* --Methode-- */
    702702int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop,
    703                            int oid, bool fglock)
    704 {
    705 PIImage* pii;
     703                           bool fgimagnav, int oid, bool fglock)
     704{
     705PIImage* pii=NULL;
     706PIImageNavigator* piin=NULL;
    706707PIWindow* win;
    707708int sx, sy, px, py, flag;
     
    738739px = py = 0;
    739740win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    740 pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
    741 pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    742 pii->SetZoomWin(zoom, false);
    743 pii->SetGloVWin(gimv, false);
    744 pii->SetCMapWin(cmapv, false);
    745 pii->ShowCursor(true);
    746 pii->SetUserData(NULL, oid);
    747 
     741if (fgimagnav) {  // Creation de naviguateur d'image
     742  piin = new PIImageNavigator(win, (char *)name.c_str(), sx, sy, px,py);
     743  piin->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     744  piin->ImageWdg()->ShowCursor(true);
     745  pii = piin->ImageWdg();
     746  pii->SetUserData(NULL, oid);
     747  //  XSync(PIXDisplay(), False); 
     748  // cout << " DBG-ImagNav-BBB-BBB Apres XSync() " << endl; 
     749 
     750}
     751else { // Creation de widget PIImage normal
     752  pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
     753  pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     754  pii->SetZoomWin(zoom, false);
     755  pii->SetGloVWin(gimv, false);
     756  pii->SetCMapWin(cmapv, false);
     757  pii->ShowCursor(true);
     758  pii->SetUserData(NULL, oid);
     759}
    748760
    749761// On recalcule la taille de la fenetre si Disp_Win
     
    776788mBWList[mBWId] = pii;
    777789// pii->Refresh();
    778 pii->Apply();
    779 cmapv->Refresh();
     790  pii->Apply(true);
     791  //  cmapv->Refresh();  Pas besoin ? , Reza Fev 2005
    780792return(mBWId);
    781793}
     
    13801392    PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
    13811393//    cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
    1382     if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
     1394    if (nw) DeleteWidget(nw, false, false);
    13831395    flag = mGrIdx;
    13841396    mGrIdx = (mGrIdx+1)%(nx*ny);
     
    14301442  for(k=0; k<mGrW->NbChilds(); k++) {
    14311443    if ((cwd = mGrW->GetChild(k)) == NULL)  continue;
    1432     DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
     1444    DeleteWidget(cwd, false, false);
    14331445    }
    14341446  mGrW->SetZone(nzx, nzy);
     
    14611473for(k=0; k<w->NbChilds(); k++) {
    14621474  if ((cwd = w->GetChild(k)) == NULL)  continue;
    1463   DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
     1475  DeleteWidget(cwd,false,false);
    14641476  }
    14651477delete w;
     
    14681480
    14691481/* --Methode-- */
    1470 void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
     1482void PIStdImgApp::DeleteWidget(PIWdg* w, bool dw, bool dwin)
    14711483{
    14721484if (w == NULL)  return;
     
    14741486for(it = mBWList.begin(); it != mBWList.end(); it++)
    14751487  if ((*it).second == w)  { mBWList.erase(it);  break; }
    1476 int k;
    1477 PIDrawer* drw;
    1478 for(k=0; k<w->NbDrawers(); k++) {
    1479   if ((drw = w->GetDrawer(k)) == NULL)  continue;
    1480   DrwMList::iterator itt;
    1481   for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
    1482     if ((*itt).second == drw)  { mDrwList.erase(itt);  break; }
    1483   }
    1484 
    1485 if (w == mCurWdg) { 
     1488PIBaseWdg* bw = dynamic_cast<PIBaseWdg *>(w);
     1489if (bw != NULL) {
     1490  PIDrawer* drw;
     1491  int k;
     1492  for(k=0; k<bw->NbDrawers(); k++) {
     1493    if ((drw = bw->GetDrawer(k)) == NULL)  continue;
     1494    DrwMList::iterator itt;
     1495    for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
     1496      if ((*itt).second == drw)  { mDrwList.erase(itt);  break; }
     1497  }
     1498}
     1499
     1500// Reza Fev 2005 - On met systematiquement mCurWdg et mLastWdg a NULL
     1501// Il peuvent en effet etre un des fils du widget qui est supprime
     1502// if (w == mCurWdg) { 
     1503if (true) {    // Reza Fev 2005 - mCurWdg = NULL systematique
    14861504  mCurWdg = NULL;
    14871505  if (mFgCWImg) {
     
    14921510  }
    14931511
    1494 if (w == mLastWdg)  mLastWdg = NULL;
     1512// if (w == mLastWdg)  mLastWdg = NULL;
     1513mLastWdg = NULL; // Reza Fev 2005 - mLastWdg = NULL systematique
    14951514
    14961515PIWdg* pw=NULL;
    1497 if (dwin)  pw = (PIWdg*)(w->Parent());
    1498 //DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
    1499 if (dw) delete w;
    1500 if (pw && (pw->kind() == PIWindow::ClassId )) {
    1501  PIWindow* pww = (PIWindow*) pw;
    1502  if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
     1516pw = (PIWdg*)(w->Parent());
     1517//DBG printf("DeleteWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
     1518if (dw) {
     1519  if (pw && (pw->kind() == PIImageNavigator::ClassId) )  {
     1520    delete pw;
     1521    pw = NULL;
     1522  }
     1523  else delete w;
     1524}
     1525if (dwin && pw && (pw->kind() == PIWindow::ClassId )) {
     1526 PIWindow* pww = dynamic_cast<PIWindow *>(pw);
     1527 if (pww && (pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
    15031528    DeleteWindow((PIWindow*)pw);
    15041529 }
     
    15161541  it  = mBWList.find(k);
    15171542  if (it == mBWList.end())  return;
    1518   PIBaseWdg* wd = (*it).second;
     1543  PIWdg* wd = (*it).second;
    15191544//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
    1520   DeleteBaseWidget(wd, true, true);
     1545  DeleteWidget(wd, true, true);
    15211546  }
    15221547else {  // C'est un drawer
     
    18671892    if (mCurWdg) {
    18681893      int oid = mCurWdg->UserFlag();
    1869       DeleteBaseWidget(mCurWdg);
     1894      DeleteWidget(mCurWdg);
    18701895      mObjMgr->DelObj_Id(oid);
    18711896      }
     
    19641989    if (mStW) {
    19651990      PIWdg* cw =  mStW->CurrentWdg();
    1966       if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
     1991      if (cw) DeleteWidget(cw);
    19671992      }
    19681993    break;
Note: See TracChangeset for help on using the changeset viewer.