Changeset 287 in PSPA for Interface_Web/trunk/pspaWT/sources/userInterface/src
- Timestamp:
- Jan 28, 2013, 3:21:51 PM (11 years ago)
- 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 79 79 return image_; 80 80 } 81 82 83 WString GWt_beam::print(){ 84 return WString(abstractElement_->print()); 85 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_bend.cc
r272 r287 83 83 return image_; 84 84 } 85 86 87 WString GWt_bend::print(){ 88 return WString(abstractElement_->print()); 89 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_cell.cc
r272 r287 107 107 return image_; 108 108 } 109 110 111 WString GWt_cell::print(){ 112 return WString(abstractElement_->print()); 113 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_drift.cc
r272 r287 54 54 return image_; 55 55 } 56 57 58 WString GWt_drift::print(){ 59 return WString(abstractElement_->print()); 60 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc
r286 r287 10 10 11 11 12 #define PSPA_DEBUG 112 //#define PSPA_DEBUG 1 13 13 14 14 GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau() … … 123 123 typedElement eType = e.getElementType(); 124 124 ligneFaisceau->addElement(eType, this); 125 126 127 /*128 nomdElements e(evt.mimeType());129 typedElement eType = e.getElementType();130 131 // update source if necessary132 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 widget165 printf("add the dropped widget\n");166 167 // add drop zone before and after168 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 present173 174 WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));175 bool replaceElement = false;176 177 if (abstractElement_) {178 replaceElement = true;179 }180 181 // insert one before182 if (!replaceElement) {183 // if it the first element of the beam line184 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 Replace192 193 // complete widget194 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 background202 decorationStyle().setBackgroundColor (WColor("white"));203 204 // remove border205 decorationStyle().setBorder (WBorder (WBorder::None));206 207 208 // insert after209 // if it is the last, add a strech factor and no link image210 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 */240 125 } 241 126 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r282 r287 125 125 dragElementZone_->setMaximumSize(32,32); 126 126 dragElementZone_->setMinimumSize(32,32); 127 dragElementZone_->setToolTip(abstractElement_->print()); 127 128 } 128 129 } … … 175 176 176 177 177 178 void GWt_elementLigneFaisceau::removeOtherDropZone(GWt_elementLigneFaisceau* other)179 {180 // 3 cases :181 // - first element : remove elem + link after182 // - last element : remove elem + link before183 // - middle element : remove elem + link after/before184 185 WContainerWidget* wc = static_cast <WContainerWidget*> (parent());186 WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));187 188 #ifdef PSPA_DEBUG189 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 #endif196 // first element197 if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) == 1) {198 if (layout->itemAt (2)) {199 layout->removeItem (layout->itemAt(2));200 #ifdef PSPA_DEBUG201 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 #endif206 }207 208 // last and middle209 } 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_DEBUG213 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 #endif218 }219 }220 221 // remove the drop zone222 if (layout->findWidgetItem (other)) {223 layout->removeItem (layout->itemAt(layout->indexOf((WLayoutItem*)(layout->findWidgetItem (other)))));224 #ifdef PSPA_DEBUG225 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 #endif230 }231 232 233 // FIXME ne pas passer par un label mais par un abstrastElement234 // pspa_->getDataManager()->getCollection()->eraseElement(label);235 // pspa_->updateSelections();236 }237 178 238 179 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_fit.cc
r272 r287 82 82 return image_; 83 83 } 84 85 86 WString GWt_fit::print(){ 87 return WString(abstractElement_->print()); 88 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r284 r287 65 65 { 66 66 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 76 68 nObjets_[ptr->getNomdElement().getElementType()].incr(); 77 69 78 70 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaisceau(ptr),1); 79 71 80 81 /* if (k < ((unsigned)nbElem-1)) {82 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());83 } else {84 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());85 }86 */87 72 } 88 73 manageLineFaisceauLayout(); … … 95 80 96 81 cout << " Entree addElement element " << nomdElements::getLabelFromType(eType) << endl; 82 83 int nElements= nomdElements ::getNumberOfElements(); 84 nObjets_= new Compteur[nElements]; 97 85 98 86 // 2 cases : … … 137 125 // ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0); 138 126 if (index != -1) { 127 nObjets_[ptr->getNomdElement().getElementType()].incr(); 139 128 ligneFaisceauLayout_->insertWidget(index,new GWt_elementLigneFaisceau(ptr),1); 140 129 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r272 r287 212 212 cout << "createDragImage" << dragImage<<endl; 213 213 result->setDraggable(mimeType,dragImage,true); 214 215 214 } 216 215 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_rfgun.cc
r272 r287 76 76 return image_; 77 77 } 78 79 80 WString GWt_rfgun::print(){ 81 return WString(abstractElement_->print()); 82 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_soleno.cc
r272 r287 64 64 return image_; 65 65 } 66 67 68 WString GWt_soleno::print(){ 69 return WString(abstractElement_->print()); 70 }
Note: See TracChangeset
for help on using the changeset viewer.