Ignore:
Timestamp:
Jan 28, 2013, 3:21:51 PM (11 years ago)
Author:
garnier
Message:

ajout de tooltip et nettoyage de code

Location:
Interface_Web/trunk/pspaWT/sources/userInterface/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_beam.cc

    r272 r287  
    7979    return image_;
    8080}
     81
     82
     83WString GWt_beam::print(){
     84    return WString(abstractElement_->print());
     85}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_bend.cc

    r272 r287  
    8383    return image_;
    8484}
     85
     86
     87WString GWt_bend::print(){
     88    return WString(abstractElement_->print());
     89}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_cell.cc

    r272 r287  
    107107    return image_;
    108108}
     109
     110
     111WString GWt_cell::print(){
     112    return WString(abstractElement_->print());
     113}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_drift.cc

    r272 r287  
    5454    return image_;
    5555}
     56
     57
     58WString GWt_drift::print(){
     59    return WString(abstractElement_->print());
     60}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc

    r286 r287  
    1010
    1111
    12 #define PSPA_DEBUG 1
     12//#define PSPA_DEBUG 1
    1313
    1414GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau()
     
    123123    typedElement eType = e.getElementType();
    124124    ligneFaisceau->addElement(eType, this);
    125    
    126    
    127     /*
    128      nomdElements e(evt.mimeType());
    129      typedElement eType = e.getElementType();
    130      
    131      // update source if necessary
    132      cout<<"dynamic_cast SOURCE------" << evt.source() << endl;
    133      if (dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source())) {
    134      cout<<"OKIKKKIIII" << dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()) << endl;
    135      removeOtherDropZone(dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()));
    136      }
    137      
    138      if(eType == inconnu) {
    139      cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl;
    140      return;
    141      }
    142      
    143      if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    144      GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    145      console->addConsoleMessage(e.getElementName());
    146      }
    147      
    148      abstractElement* ptr = pspa_->getDataManager()->addElement(eType);
    149      
    150      ptr->setLabel(getElementNumberInBeamLine(e));
    151      
    152      GWt_abstractElement* insertedAbstractElement = GWt_abstractElement::ajoute(ptr);
    153      cout << " je vais ajouter l'element  " << ptr->getNomdElement().getElementName() << " de type " << ptr->getNomdElement().getElementType() << "ID "<< insertedAbstractElement << endl;
    154      
    155      if(insertedAbstractElement == NULL) return;
    156      insertedAbstractElement->setLabelWidget();
    157      
    158      WSignalMapper<GWt_abstractElement *> *mapper= new WSignalMapper<GWt_abstractElement *>(this);
    159      mapper->mapped().connect(this,&GWt_dropZoneLigneFaisceau::onClick);
    160      mapper->mapConnect(insertedAbstractElement->getImage()->doubleClicked(),insertedAbstractElement);
    161      
    162      //////////////////////////////////////////////////////////////////
    163      
    164      // add the dropped widget
    165      printf("add the dropped widget\n");
    166      
    167      // add drop zone before and after
    168      if (static_cast <WContainerWidget*> (parent())) {
    169      WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
    170      
    171      cout<<"add the dropped parent %d"<< wc << " COUNT:"<< count () <<"<---------------"<< endl;
    172      // do not insert new element if some element is already present
    173      
    174      WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));
    175      bool replaceElement = false;
    176      
    177      if (abstractElement_) {
    178      replaceElement = true;
    179      }
    180      
    181      // insert one before
    182      if (!replaceElement) {
    183      // if it the first element of the beam line
    184      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))) == 0) {
    185      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,false));
    186      
    187      } else {
    188      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,true));
    189      }
    190      }
    191      // FIXME Replace
    192      
    193      // complete widget
    194      clear();
    195      arrowImage_ = NULL;
    196      abstractElement_ = insertedAbstractElement->getWidget();
    197      addWidget(abstractElement_);
    198      // change strech (useful if it was the last one)
    199      layout->setStretchFactor(this,0);
    200      
    201      // change background
    202      decorationStyle().setBackgroundColor (WColor("white"));
    203      
    204      // remove border
    205      decorationStyle().setBorder (WBorder (WBorder::None));
    206      
    207      
    208      // insert after
    209      // if it is the last, add a strech factor and no link image
    210      cout<<" nb elem:"<< layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 << " COUNT:"<< wc->count () <<"<---------------ID:"<< abstractElement_ << endl;
    211      if (!replaceElement) {
    212      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 == wc->count()) {
    213      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_,false),1);
    214      } else {
    215      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_));
    216      }
    217      }
    218      */
    219    
    220     /*
    221      * Set the image to be draggable, showing the other image (dragImage)
    222      * to be used as the widget that is visually dragged.
    223      */
    224     /*
    225      WImage *dragImage = new WImage(e.getImageFromType(eType).c_str(),this);
    226      
    227      //    setDraggable(evt.mimeType(),dragImage,true);//,insertedAbstractElement->getButton(),true);
    228      abstractElement_->setDraggable(evt.mimeType(),dragImage,true, this);
    229      
    230      
    231      cout<<"add the dropped parent %d"<< wc << " COUNT:"<< wc->count () <<"<---------------"<< endl;
    232      }
    233      
    234      
    235      
    236      //insertedAbstractElement->getWidget()->decorationStyle().setBackgroundColor (WColor("blue"));
    237      pspa_->updateSelections();
    238      
    239      */
    240125}
    241126
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r282 r287  
    125125            dragElementZone_->setMaximumSize(32,32);
    126126            dragElementZone_->setMinimumSize(32,32);
     127            dragElementZone_->setToolTip(abstractElement_->print());
    127128        }
    128129    }
     
    175176
    176177
    177 
    178 void GWt_elementLigneFaisceau::removeOtherDropZone(GWt_elementLigneFaisceau* other)
    179 {
    180     // 3 cases :
    181     // - first element : remove elem + link after
    182     // - last element : remove elem + link before
    183     // - middle element : remove elem + link after/before
    184    
    185     WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
    186     WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));
    187    
    188 #ifdef PSPA_DEBUG
    189     if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    190         GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    191         console->addConsoleMessage("GWt_elementLigneFaisceau::mouseOut");
    192         console->addConsoleMessage("remove from drag Zone");
    193     }
    194     cout << "remove from drag Zone id" << layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) << " count:" << layout->count()<< endl;
    195 #endif
    196     // first element
    197     if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) == 1) {
    198         if (layout->itemAt (2)) {
    199             layout->removeItem (layout->itemAt(2));
    200 #ifdef PSPA_DEBUG
    201             if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    202                 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    203                 console->addConsoleMessage(" remove first link ");
    204             }
    205 #endif
    206         }
    207        
    208         // last and middle
    209     } else if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) == layout->count()-2) {
    210         if (layout->itemAt (layout->count()-3)) {
    211             layout->removeItem (layout->itemAt(layout->count()-3));
    212 #ifdef PSPA_DEBUG
    213             if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    214                 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    215                 console->addConsoleMessage(" remove first link ");
    216             }
    217 #endif
    218         }
    219     }
    220    
    221     // remove the drop zone
    222     if (layout->findWidgetItem (other)) {
    223         layout->removeItem (layout->itemAt(layout->indexOf((WLayoutItem*)(layout->findWidgetItem (other)))));
    224 #ifdef PSPA_DEBUG
    225         if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    226             GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    227             console->addConsoleMessage(" remove drop zone ");
    228         }
    229 #endif
    230         }
    231    
    232    
    233         // FIXME ne pas passer par un label mais par un abstrastElement
    234         //  pspa_->getDataManager()->getCollection()->eraseElement(label);
    235     //  pspa_->updateSelections();
    236 }
    237178
    238179
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_fit.cc

    r272 r287  
    8282    return image_;
    8383}
     84
     85
     86WString GWt_fit::print(){
     87    return WString(abstractElement_->print());
     88}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r284 r287  
    6565    {
    6666        abstractElement* ptr = pspa_->getDataManager()->getCollection()->getElementPointerFromIndex(k);
    67                 GWt_abstractElement* gw = GWt_abstractElement::ajoute(ptr);
    68          if(gw == NULL) {
    69 /*
    70  GWt_dialog warningDialog("PSPA : restore configuration", " Element type "+ptr->getNomdElement().getElementName()+" not reconized", GWt_dialog::Error,true,true);
    71              warningDialog.exec();
    72 */
    73          }
    74          gw->setLabelWidget();
    75          
     67       
    7668        nObjets_[ptr->getNomdElement().getElementType()].incr();
    7769       
    7870        ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaisceau(ptr),1);
    7971       
    80        
    81         /*      if (k < ((unsigned)nbElem-1)) {
    82          ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());
    83          } else {
    84          ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());
    85          }
    86          */
    8772    }
    8873    manageLineFaisceauLayout();
     
    9580   
    9681    cout << " Entree addElement element " << nomdElements::getLabelFromType(eType) << endl;
     82   
     83    int nElements= nomdElements ::getNumberOfElements();
     84    nObjets_= new Compteur[nElements];
    9785   
    9886    // 2 cases :
     
    137125        //  ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0);
    138126        if (index != -1) {
     127            nObjets_[ptr->getNomdElement().getElementType()].incr();
    139128            ligneFaisceauLayout_->insertWidget(index,new GWt_elementLigneFaisceau(ptr),1);
    140129        }
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r272 r287  
    212212    cout << "createDragImage" << dragImage<<endl;
    213213    result->setDraggable(mimeType,dragImage,true);
    214    
    215214}
    216215
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_rfgun.cc

    r272 r287  
    7676    return image_;
    7777}
     78
     79
     80WString GWt_rfgun::print(){
     81    return WString(abstractElement_->print());
     82}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_soleno.cc

    r272 r287  
    6464    return image_;
    6565}
     66
     67
     68WString GWt_soleno::print(){
     69    return WString(abstractElement_->print());
     70}
Note: See TracChangeset for help on using the changeset viewer.