Changeset 248 in PSPA
- Timestamp:
- Jan 21, 2013, 4:49:49 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 8 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r246 r248 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 21 Janvier 2012 Laurent Garnier 9 - Grosse modifications pour une meilleur gestion des drag & drop (a terminer) 10 - Deplacement des styles dans la feuille css 11 - modification du appRoo() par un docRoot() 7 12 8 13 19 Janvier 2012 Laurent Garnier -
Interface_Web/trunk/pspaWT/cmt/requirements
r243 r248 27 27 28 28 #macro PSPSLib_linkopts " -L${PSPAWTROOT}/$(Platform_bin) -lPSPSLib " 29 application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_beam.cc GWt_globalParameters.cc GWt_drift.cc GWt_fit.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc elementBeam.cc elementFit.cc globalParameters.cc abstractElement.cc GWt_console.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_ dropZoneLigneFaiseau.cc GWt_draggableImage.cc GWt_dialog.cc nomdElements.cc nomDeLogiciel.cc beam2Moments.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags}"'29 application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_beam.cc GWt_globalParameters.cc GWt_drift.cc GWt_fit.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc elementBeam.cc elementFit.cc globalParameters.cc abstractElement.cc GWt_console.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_elementLigneFaiseau.cc GWt_dropZoneLigneFaisceau.cc GWt_draggableImage.cc GWt_dialog.cc nomdElements.cc nomDeLogiciel.cc beam2Moments.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags}"' 30 30 31 31 macro DrawWt_linkopts " ${PSPSLib_linkopts} ${Wt_linkopts} ${boost_linkopts} ${dld_linkopts}" -
Interface_Web/trunk/pspaWT/include/GWt_LigneFaisceau.h
r198 r248 25 25 class GWt_LigneFaisceau : public WContainerWidget 26 26 { 27 WHBoxLayout* hbox_;27 WHBoxLayout* ligneFaisceauLayout_; 28 28 PspaApplication* pspa_; 29 29 Compteur *nObjets_; … … 33 33 GWt_LigneFaisceau() {;} 34 34 GWt_LigneFaisceau(PspaApplication*); 35 void addElement(typedElement eType); 35 36 36 37 ~GWt_LigneFaisceau() { -
Interface_Web/trunk/pspaWT/include/GWt_elementLigneFaiseau.h
r243 r248 1 #ifndef GWT_ DROPZONELIGNEFAISEAU_SEEN2 #define GWT_ DROPZONELIGNEFAISEAU_SEEN1 #ifndef GWT_ELEMENTLIGNEFAISEAU_SEEN 2 #define GWT_ELEMENTLIGNEFAISEAU_SEEN 3 3 4 4 #include "GWt_dialog.h" … … 6 6 #include "abstractElement.h" 7 7 #include "GWt_abstractElement.h" 8 #include "GWt_dropZoneLigneFaisceau.h" 8 9 9 10 #include <Wt/WContainerWidget> … … 12 13 13 14 14 class GWt_ dropZoneLigneFaiseau : public WContainerWidget15 class GWt_elementLigneFaiseau : public WContainerWidget 15 16 { 16 17 public : 17 18 /** 18 19 dropZone element 19 @param pspa : application name 20 @param linkImage : true/false if the drop zone have to display the link image 21 @param showInsertMessage : true/false if it has to display the insertMessage at first step 20 a drop zone is the basic element for a widget in the ligne faisceau drop zone area 21 it should be like this : 22 23 +----------+--------+---------+ 24 | (--->) | ELEM | (-----) | 25 +----------+--------+---------+ 26 | NAME | 27 +----------+--------+---------+ 28 ELEM : Element representation, draggable object 29 (----) and (---->) : Droppable zone, contain arrows or line if this element is connected to another 30 NAME : editable element name 31 32 At first time, the ELEM element is replace by a message. 33 34 @param pspa : application name 35 @param linkImage : true/false if the drop zone have to display the link image 36 @param showInsertMessage : true/false if it has to display the insertMessage at first step 22 37 */ 23 38 24 GWt_dropZoneLigneFaiseau(PspaApplication* pspa,bool linkImage = true,bool showInsertMessage = false); 25 ~GWt_dropZoneLigneFaiseau(); 26 void addElement(WContainerWidget* elem); 39 GWt_elementLigneFaiseau(); 40 GWt_elementLigneFaiseau(abstractElement*); 41 42 ~GWt_elementLigneFaiseau(); 43 void addElement(GWt_abstractElement* elem); 44 45 inline WText* getElementName() { 46 return elementName_; 47 } 48 49 inline WText* getElementIcon() { 50 return elementName_; 51 } 27 52 28 53 private: 29 void mouseOver(const WMouseEvent &e );30 void mouseOut(const WMouseEvent &e );31 void mouseUp(const WMouseEvent &e );32 void mouseDown(const WMouseEvent &e );33 void mouseIsDragged(const WMouseEvent &e );34 void dropEvent(WDropEvent evt);35 54 36 55 void onClick(GWt_abstractElement*); 37 56 void removeDone(GWt_abstractElement*); 38 57 std::string getElementNumberInBeamLine(nomdElements el); 39 void removeOtherDropZone(GWt_ dropZoneLigneFaiseau*);40 58 void removeOtherDropZone(GWt_elementLigneFaiseau*); 59 void initialize_ligneFaisceau(abstractElement*); 41 60 PspaApplication* pspa_; 42 61 GWt_dialog* messageDropZone_; 43 WText* insertMessage_; 44 WWidget* linkImage_; 62 WText* firstTimeInsertMessage_; 45 63 46 WContainerWidget* abstractElement_; 64 GWt_dropZoneLigneFaisceau* arrowImage_; 65 WContainerWidget* dragElementZone_; 66 GWt_dropZoneLigneFaisceau* lineImage_; 67 WText* elementName_; 68 69 GWt_abstractElement* abstractElement_; 47 70 }; 48 71 #endif -
Interface_Web/trunk/pspaWT/include/pspa.css
r246 r248 1 1 body { 2 2 padding-top: 30px 3 } 3 } 4 4 5 body { 5 6 background: url("../icons/fond.jpg") repeat fixed left top / 100% auto #FFFFFF; 6 }7 8 toolbar {9 background: url("../icons/fond_toolbar.png") repeat fixed left top / 100% 100% #FFFFFF;10 7 } 11 8 … … 13 10 background-repeat: no; 14 11 } 12 13 .elementLigneFaiseau_line { 14 background-image : url("../icons/line.gif"); 15 background-repeat : repeat-x; 16 } 17 18 .elementLigneFaiseau_arrow { 19 background-image : url("../icons/arrow.gif"); 20 background-repeat : no-repeat; 21 float: right; 22 } 23 24 .saveButton { 25 background-image : url("../icons/save.png"); 26 background-repeat : no-repeat; 27 background-size : 100% 100%; 28 } 29 30 .restoreButton { 31 background-image : url("../icons/restore.png"); 32 background-repeat : no-repeat; 33 background-size : 100% 100%; 34 } 35 36 .loadNewButton { 37 background-image : url("../icons/open.png"); 38 background-repeat : no-repeat; 39 background-size : 100% 100%; 40 } 41 42 .histoButton { 43 background-image : url("../icons/histo.png"); 44 background-repeat : no-repeat; 45 background-size : 100% 100%; 46 } -
Interface_Web/trunk/pspaWT/src/GWt_LigneFaisceau.cc
r239 r248 1 1 #include <iostream> 2 2 3 #include "GWt_ dropZoneLigneFaiseau.h"3 #include "GWt_elementLigneFaiseau.h" 4 4 #include "GWt_LigneFaisceau.h" 5 5 #include "GWt_drift.h" … … 23 23 cout<<"GWt_LigneFaisceau::GWt_LigneFaisceau() %d"<< this << "<---------------"<< endl; 24 24 25 hbox_ = new WHBoxLayout();25 ligneFaisceauLayout_ = new WHBoxLayout(); 26 26 // decorationStyle().setBackgroundColor (WColor(245,245,245)); 27 decorationStyle().setBackgroundImage (WApplication::appRoot()+" ../icons/background.png");28 setLayout( hbox_);27 decorationStyle().setBackgroundImage (WApplication::appRoot()+"/icons/background.png"); 28 setLayout(ligneFaisceauLayout_); 29 29 30 30 int nElts= nomdElements::getNumberOfElements(); 31 31 nObjets_= new Compteur[nElts]; 32 for(int k = 0; k < nElts; k++) { 33 typedElement eType= (typedElement)k; 34 acceptDrops(nomdElements::getImageFromType(eType)); 35 } 32 33 // set the object name 34 setObjectName("ligneFaisceau"); 36 35 37 36 // add the first drop zone 38 hbox_->addWidget(new GWt_dropZoneLigneFaiseau(pspa_,false,true)); 37 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau()); 38 39 39 40 40 // add a strech element at the end 41 // hbox_->addStretch(1);41 // ligneFaisceauLayout_->addStretch(1); 42 42 } 43 43 … … 49 49 cout<<"GWt_LigneFaisceau::restoreElementCollection()"<<endl; 50 50 51 hbox_->clear();51 ligneFaisceauLayout_->clear(); 52 52 53 53 delete[] nObjets_; … … 59 59 60 60 // add first dropZone 61 hbox_->addWidget(new GWt_dropZoneLigneFaiseau(pspa_,false));61 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau()); 62 62 63 63 for(k = 0; k < (unsigned)nbElem; k++) 64 { 64 { 65 65 abstractElement* ptr = pspa_->getDataManager()->getCollection()->getElementPointerFromIndex(k); 66 GWt_abstractElement* gw = GWt_abstractElement::ajoute(ptr);66 /* GWt_abstractElement* gw = GWt_abstractElement::ajoute(ptr); 67 67 if(gw == NULL) { 68 68 cerr << "GWt_LigneFaisceau::restaure element type " << ptr->getNomdElement().getElementName() << " est inconnu " << endl; 69 69 } 70 71 70 gw->setLabelWidget(); 71 */ 72 72 nObjets_[ptr->getNomdElement().getElementType()].incr(); 73 GWt_dropZoneLigneFaiseau* dropZone = new GWt_dropZoneLigneFaiseau(pspa_); 74 dropZone->addElement(gw->getWidget()); 75 hbox_->addWidget(dropZone); 73 GWt_elementLigneFaiseau* dropZone = new GWt_elementLigneFaiseau(ptr); 76 74 77 if (k < ((unsigned)nbElem-1)) { 78 hbox_->addWidget(new GWt_dropZoneLigneFaiseau(pspa_)); 75 /* dropZone->addElement(gw->getWidget()); 76 */ 77 ligneFaisceauLayout_->addWidget(dropZone); 78 79 80 /* if (k < ((unsigned)nbElem-1)) { 81 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau()); 79 82 } else { 80 hbox_->addWidget(new GWt_dropZoneLigneFaiseau(pspa_,false));83 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau()); 81 84 } 82 } 85 */ 86 } 83 87 84 88 pspa_->updateSelections(); 85 89 } 86 90 91 92 void GWt_LigneFaisceau::addElement(typedElement eType){ 93 94 95 abstractElement* ptr = pspa_->getDataManager()->addElement(eType); 96 97 if(eType == inconnu) { 98 cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl; 99 return; 100 } 101 102 103 ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr)); 104 } 105 -
Interface_Web/trunk/pspaWT/src/GWt_abstractElement.cc
r243 r248 21 21 22 22 GWt_abstractElement::GWt_abstractElement(abstractElement* elem) 23 : WContainerWidget() 23 24 { 24 25 // pspa_ = ps; -
Interface_Web/trunk/pspaWT/src/GWt_console.cc
r247 r248 7 7 :WContainerWidget() 8 8 { 9 9 setObjectName("console"); 10 10 } 11 11 -
Interface_Web/trunk/pspaWT/src/GWt_elementLigneFaiseau.cc
r246 r248 1 1 #include <iostream> 2 2 3 #include "GWt_ dropZoneLigneFaiseau.h"3 #include "GWt_elementLigneFaiseau.h" 4 4 #include "nomdElements.h" 5 5 #include "GWt_console.h" 6 #include "abstractElement.h" 7 #include "GWt_rfgun.h" 8 #include "GWt_drift.h" 9 #include "GWt_cell.h" 10 #include "GWt_bend.h" 11 #include "GWt_soleno.h" 12 #include "GWt_beam.h" 13 #include "GWt_fit.h" 14 6 15 7 16 #include <Wt/WCssDecorationStyle> … … 14 23 #include <Wt/WVBoxLayout> 15 24 16 17 GWt_dropZoneLigneFaiseau::GWt_dropZoneLigneFaiseau(PspaApplication* ps,bool linkImageOk, bool showInsertMessage) 25 #define PSPA_DEBUG 1 26 27 GWt_elementLigneFaiseau::GWt_elementLigneFaiseau() 18 28 : WContainerWidget(), 19 pspa_(ps),20 insertMessage_(NULL),21 lin kImage_(NULL),29 firstTimeInsertMessage_(NULL), 30 arrowImage_(NULL), 31 lineImage_(NULL), 22 32 abstractElement_(NULL) 23 33 { 24 resize(5,5); 25 cout<<"new GWt_dropZoneLigneFaiseau : "<< this << endl; 26 27 // connect mouse events 28 29 // setMouseOverDelay(100); 30 mouseWentOver().connect(this, &GWt_dropZoneLigneFaiseau::mouseOver); 31 mouseWentUp().connect(this, &GWt_dropZoneLigneFaiseau::mouseUp); 32 mouseWentDown().connect(this, &GWt_dropZoneLigneFaiseau::mouseDown); 33 mouseWentOut().connect(this, &GWt_dropZoneLigneFaiseau::mouseOut); 34 mouseDragged().connect(this, &GWt_dropZoneLigneFaiseau::mouseIsDragged); 35 36 decorationStyle().setBorder (WBorder (WBorder::Dotted)); 37 38 WText* insertMessage_ = new WText("Drag elements here"); 39 40 WVBoxLayout* fit = new WVBoxLayout(); 41 fit->addWidget(insertMessage_,1,Wt::AlignCenter |Wt::AlignMiddle); 42 setLayout(fit); 43 44 if (linkImageOk) { 45 linkImage_ = new WImage("icons/link.jpg"); 46 linkImage_->setMargin(4, Top | Bottom); // add margin vertically 47 addWidget(linkImage_); 48 } 49 50 if (! showInsertMessage) { 51 insertMessage_->hide(); 52 } 53 54 // accept drops 55 int nElts= nomdElements::getNumberOfElements(); 56 for(int k = 0; k < nElts; k++) { 57 typedElement eType= (typedElement)k; 58 acceptDrops(nomdElements::getImageFromType(eType)); 59 } 60 61 62 } 63 64 65 GWt_dropZoneLigneFaiseau::~GWt_dropZoneLigneFaiseau() 66 { 67 } 68 69 70 void GWt_dropZoneLigneFaiseau::mouseOver(const WMouseEvent& e) 71 { 72 // Add text 73 #ifdef PSPA_DEBUG 74 printf("button %d\n",WMouseEvent::LeftButton); 75 #endif 76 if (insertMessage_) { 77 // only if mouse is pressed 78 if (e.button () == WMouseEvent::LeftButton) { 79 if (!abstractElement_) { 80 insertMessage_->show(); 81 resize(insertMessage_->width(),insertMessage_->height()); 82 } 83 } else { 84 #ifdef PSPA_DEBUG 85 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 86 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 87 console->addConsoleMessage("GWt_dropZoneLigneFaiseau::mouseOver but no button press"); 88 } 89 #endif 90 } 91 } 92 if (linkImage_) { 93 linkImage_->hide(); 94 } 95 96 97 #ifdef PSPA_DEBUG 98 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 99 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 100 console->addConsoleMessage("GWt_dropZoneLigneFaiseau::mouseOver"); 101 } 102 #endif 103 } 104 105 void GWt_dropZoneLigneFaiseau::mouseOut(const WMouseEvent& e) 106 { 107 if (!abstractElement_) { 108 if (linkImage_) { 109 resize(10,32); // image size 110 } else { 111 resize(10,10); 112 } 113 } 114 if (insertMessage_) { 115 insertMessage_->hide(); 116 } 117 if (linkImage_) { 118 linkImage_->show(); 119 } 120 121 #ifdef PSPA_DEBUG 122 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 123 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 124 console->addConsoleMessage("GWt_dropZoneLigneFaiseau::mouseOut"); 125 } 126 #endif 127 } 128 129 void GWt_dropZoneLigneFaiseau::mouseIsDragged(const WMouseEvent& e) 130 { 131 #ifdef PSPA_DEBUG 132 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 133 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 134 console->addConsoleMessage(" GWt_dropZoneLigneFaiseau::mouseDragged"); 135 } 136 #endif 137 } 138 139 void GWt_dropZoneLigneFaiseau::mouseUp(const WMouseEvent& e) 140 { 141 #ifdef PSPA_DEBUG 142 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 143 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 144 console->addConsoleMessage("GWt_dropZoneLigneFaiseau::mouseOut up"); 145 } 146 #endif 147 } 148 149 void GWt_dropZoneLigneFaiseau::mouseDown(const WMouseEvent& e) 150 { 151 #ifdef PSPA_DEBUG 152 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 153 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 154 console->addConsoleMessage("GWt_dropZoneLigneFaiseau::mouseDown up"); 155 } 156 #endif 157 } 158 159 void GWt_dropZoneLigneFaiseau::dropEvent(WDropEvent evt) 160 { 161 #ifdef PSPA_DEBUG 162 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 163 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 164 console->addConsoleMessage(" GWt_dropZoneLigneFaiseau::dropEvent"); 165 } 166 #endif 167 168 nomdElements e(evt.mimeType()); 169 typedElement eType = e.getElementType(); 170 171 // update source if necessary 172 cout<<"dynamic_cast SOURCE------" << evt.source() << endl; 173 if (dynamic_cast <GWt_dropZoneLigneFaiseau*> (evt.source())) { 174 cout<<"OKIKKKIIII" << dynamic_cast <GWt_dropZoneLigneFaiseau*> (evt.source()) << endl; 175 removeOtherDropZone(dynamic_cast <GWt_dropZoneLigneFaiseau*> (evt.source())); 176 } 177 178 if(eType == inconnu) { 179 cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl; 180 return; 181 } 182 183 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 184 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 185 console->addConsoleMessage(e.getElementName()); 186 } 187 188 abstractElement* ptr = pspa_->getDataManager()->addElement(eType); 189 190 ptr->setLabel(getElementNumberInBeamLine(e)); 191 192 GWt_abstractElement* insertedAbstractElement = GWt_abstractElement::ajoute(ptr); 193 cout << " je vais ajouter l'element " << ptr->getNomdElement().getElementName() << " de type " << ptr->getNomdElement().getElementType() << "ID "<< insertedAbstractElement << endl; 194 195 if(insertedAbstractElement == NULL) return; 196 insertedAbstractElement->setLabelWidget(); 197 198 // ////////////////////////////////////////////////////////////////// 199 // // pourVoir 200 201 // cout<<"container: "<<gw->getWidget()->id()<<endl; 202 // cout << "number of widgets in this container= " << insertedAbstractElement->getWidget()->count() << ": "; 203 // for(int k = 0; k < insertedAbstractElement->getWidget()->count(); k++) { 204 // WWidget *w= insertedAbstractElement->getWidget()->widget(k); 205 // cout << w->id() << ", "; 206 // } 207 // cout << endl; 208 209 // ////////////////////////////////////////////////////////////////// 210 211 WSignalMapper<GWt_abstractElement *> *mapper= new WSignalMapper<GWt_abstractElement *>(this); 212 mapper->mapped().connect(this,&GWt_dropZoneLigneFaiseau::onClick); 213 mapper->mapConnect(insertedAbstractElement->getImage()->doubleClicked(),insertedAbstractElement); 214 215 ////////////////////////////////////////////////////////////////// 216 217 // add the dropped widget 218 printf("add the dropped widget\n"); 219 220 // add drop zone before and after 221 if (static_cast <WContainerWidget*> (parent())) { 222 WContainerWidget* wc = static_cast <WContainerWidget*> (parent()); 223 224 cout<<"add the dropped parent %d"<< wc << " COUNT:"<< count () <<"<---------------"<< endl; 225 // do not insert new element if some element is already present 226 227 WBoxLayout* layout = ((WBoxLayout*)(wc->layout())); 228 bool replaceElement = false; 229 230 if (abstractElement_) { 231 replaceElement = true; 232 } 233 234 // insert one before 235 if (!replaceElement) { 236 // if it the first element of the beam line 237 if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))) == 0) { 238 layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaiseau(pspa_,false)); 239 240 } else { 241 layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaiseau(pspa_,true)); 242 } 243 } 244 // FIXME Replace 245 246 // complete widget 247 clear(); 248 insertMessage_ = NULL; 249 linkImage_ = NULL; 250 abstractElement_ = insertedAbstractElement->getWidget(); 251 addWidget(abstractElement_); 252 // change strech (useful if it was the last one) 253 layout->setStretchFactor(this,0); 254 255 // change background 256 decorationStyle().setBackgroundColor (WColor("white")); 257 258 // remove border 259 decorationStyle().setBorder (WBorder (WBorder::None)); 260 261 262 // insert after 263 // if it is the last, add a strech factor and no link image 264 cout<<" nb elem:"<< layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 << " COUNT:"<< wc->count () <<"<---------------ID:"<< abstractElement_ << endl; 265 if (!replaceElement) { 266 if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 == wc->count()) { 267 layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaiseau(pspa_,false),1); 268 } else { 269 layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaiseau(pspa_)); 270 } 271 } 272 273 /* 274 * Set the image to be draggable, showing the other image (dragImage) 275 * to be used as the widget that is visually dragged. 276 */ 277 WImage *dragImage = new WImage(e.getImageFromType(eType).c_str(),this); 278 279 // setDraggable(evt.mimeType(),dragImage,true);//,insertedAbstractElement->getButton(),true); 280 abstractElement_->setDraggable(evt.mimeType(),dragImage,true, this); 281 282 283 cout<<"add the dropped parent %d"<< wc << " COUNT:"<< wc->count () <<"<---------------"<< endl; 284 } 285 286 287 288 //insertedAbstractElement->getWidget()->decorationStyle().setBackgroundColor (WColor("blue")); 289 pspa_->updateSelections(); 290 291 // ////////////////////////////////////////////////////////////////// 292 // // pourVoir 293 294 // cout << "number of items in the layout= " << hbox_->count() << ": "; 295 // for(int k = 0; k < hbox_->count(); k++) 296 // { 297 // WLayoutItem *wi= hbox_->itemAt(k); 298 // WWidget *w= wi->widget(); 299 // cout << w->id() << ", "; 300 // } 301 // cout << endl; 302 303 // ////////////////////////////////////////////////////////////////// 304 // // pourVoir 305 306 // int nElts= pspa_->getDataManager()->beamLineSize(); 307 // cout << "GWt_LigneFaisceau:: nElts= " << nElts << endl; 308 // unsigned int k; 309 // for(k = 0; k < (unsigned)nElts; k++) { 310 // abstractElement* ptr= pspa_->getDataManager()->getCollection()->getElementPointer(k); 311 // string label= ptr->getLabel(); 312 // cout << "GWt_LigneFaisceau:: " << label << " dans la liste" << endl; 313 // } 314 315 } 316 317 318 void GWt_dropZoneLigneFaiseau::onClick(GWt_abstractElement* gw) 34 initialize_ligneFaisceau(NULL); 35 } 36 37 38 GWt_elementLigneFaiseau::GWt_elementLigneFaiseau(abstractElement* abstractElement) 39 : WContainerWidget(), 40 firstTimeInsertMessage_(NULL), 41 arrowImage_(NULL), 42 lineImage_(NULL), 43 abstractElement_(NULL), 44 elementName_(NULL) 45 { 46 initialize_ligneFaisceau(abstractElement); 47 } 48 49 50 void GWt_elementLigneFaiseau::initialize_ligneFaisceau(abstractElement* abstractElement) 51 { 52 53 cout<<"new GWt_elementLigneFaiseau : "<< this << endl; 54 55 // set layout 56 // +----------+--------+---------+ 57 // | (--->) | ELEM | (-----) | 58 // +----------+--------+---------+ 59 // | NAME | 60 // +----------+--------+---------+ 61 62 WGridLayout *gridLayout = new WGridLayout(); 63 64 // add first line : initialize arrow and link images 65 arrowImage_ = new GWt_dropZoneLigneFaisceau(); 66 dragElementZone_ = new WContainerWidget(); 67 lineImage_ = new GWt_dropZoneLigneFaisceau(); 68 69 // change object name in order to manage css : 70 arrowImage_->setStyleClass("elementLigneFaiseau_line"); 71 lineImage_->setStyleClass("elementLigneFaiseau_line"); 72 73 74 WContainerWidget* arrow = new WContainerWidget(); 75 new WImage(arrow); 76 arrow->resize(11,30); 77 78 arrow->setStyleClass("elementLigneFaiseau_arrow"); 79 arrowImage_->addWidget(arrow); 80 81 gridLayout->addWidget (arrowImage_,0,0); 82 gridLayout->addWidget (dragElementZone_,0,1); 83 gridLayout->addWidget (lineImage_,0,2); 84 85 // add the image if present 86 if (abstractElement != NULL) { 87 typedElement eType = abstractElement->getNomdElement().getElementType(); 88 89 switch ( eType ) { 90 case RFgun : 91 abstractElement_ = new GWt_rfgun(abstractElement); 92 break; 93 case drift : 94 abstractElement_ = new GWt_drift(abstractElement); 95 break; 96 case cell : 97 abstractElement_ = new GWt_cell(abstractElement); 98 break; 99 case bend : 100 abstractElement_ = new GWt_bend(abstractElement); 101 break; 102 case soleno : 103 abstractElement_ = new GWt_soleno(abstractElement); 104 break; 105 case beam : 106 abstractElement_ = new GWt_beam(abstractElement); 107 break; 108 case fit : 109 abstractElement_ = new GWt_fit(abstractElement); 110 break; 111 case inconnu : 112 abstractElement_ = NULL; 113 } 114 if (abstractElement_ != NULL) { 115 WImage *elemImage = new WImage(abstractElement->getNomdElement().getImageFromType(eType).c_str(),this); 116 dragElementZone_->addWidget(elemImage); 117 dragElementZone_->setMaximumSize(32,32); 118 dragElementZone_->setMinimumSize(32,32); 119 } 120 } 121 // add second line 122 if (abstractElement == NULL) { 123 elementName_ = new WText(); 124 } else { 125 elementName_ = new WText(abstractElement->getLabel()); 126 } 127 128 gridLayout->addWidget (elementName_,1,0,1,3); 129 130 decorationStyle().setBorder (WBorder (WBorder::Dotted)); 131 132 // first insert message 133 if (abstractElement == NULL) { 134 firstTimeInsertMessage_ = new WText("Drag elements here"); 135 136 WVBoxLayout* fit = new WVBoxLayout(); 137 fit->addWidget(firstTimeInsertMessage_,1,Wt::AlignCenter |Wt::AlignMiddle); 138 dragElementZone_->setLayout(fit); 139 } 140 141 // dragElementZone_->addWidget(firstTimeInsertMessage_); 142 // gridLayout->addWidget (new WText("Drag elements here"),0,0); 143 144 // set layout 145 setLayout(gridLayout); 146 //addWidget(new WText("Drag elements here")); 147 } 148 149 150 GWt_elementLigneFaiseau::~GWt_elementLigneFaiseau() 151 { 152 } 153 154 155 void GWt_elementLigneFaiseau::onClick(GWt_abstractElement* gw) 319 156 { 320 157 cout << "mouse key was double clicked on this widget " << gw->getWidget()->id()<< endl; … … 323 160 324 161 WSignalMapper<GWt_abstractElement *> *MyMap = new WSignalMapper<GWt_abstractElement *>(this); 325 MyMap->mapped().connect(this, &GWt_ dropZoneLigneFaiseau::removeDone);162 MyMap->mapped().connect(this, &GWt_elementLigneFaiseau::removeDone); 326 163 MyMap->mapConnect(messageDropZone_->finished(),gw); 327 164 messageDropZone_->exec(); … … 329 166 330 167 331 void GWt_ dropZoneLigneFaiseau::removeDone(GWt_abstractElement* gw)168 void GWt_elementLigneFaiseau::removeDone(GWt_abstractElement* gw) 332 169 { 333 170 if (messageDropZone_->result() == WDialog::Accepted) { … … 339 176 340 177 341 void GWt_ dropZoneLigneFaiseau::removeOtherDropZone(GWt_dropZoneLigneFaiseau* other)178 void GWt_elementLigneFaiseau::removeOtherDropZone(GWt_elementLigneFaiseau* other) 342 179 { 343 180 // 3 cases : … … 352 189 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 353 190 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 354 console->addConsoleMessage("GWt_ dropZoneLigneFaiseau::mouseOut");191 console->addConsoleMessage("GWt_elementLigneFaiseau::mouseOut"); 355 192 console->addConsoleMessage("remove from drag Zone"); 356 193 } … … 400 237 401 238 402 void GWt_ dropZoneLigneFaiseau::addElement(WContainerWidget* elem){239 void GWt_elementLigneFaiseau::addElement(GWt_abstractElement* elem){ 403 240 404 241 clear(); … … 412 249 413 250 414 insertMessage_ = NULL;415 linkImage_ = NULL;416 } 417 418 std::string GWt_ dropZoneLigneFaiseau::getElementNumberInBeamLine(nomdElements elem){251 firstTimeInsertMessage_ = NULL; 252 arrowImage_ = NULL; 253 } 254 255 std::string GWt_elementLigneFaiseau::getElementNumberInBeamLine(nomdElements elem){ 419 256 string str = ""; 420 257 -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r246 r248 44 44 { 45 45 46 workingDir_ = WApplication:: appRoot()+WORKINGAREA;46 workingDir_ = WApplication::docRoot()+ "/"+WORKINGAREA; 47 47 nameOfCase_ = "pspa"; // default 48 48 … … 52 52 } 53 53 54 // include the styleSheet 54 55 WContainerWidget *widroot = root(); 55 useStyleSheet ( WApplication::appRoot()+"../include/pspa.css");56 useStyleSheet ("include/pspa.css"); 56 57 dtmanage_ = new dataManager(); 57 58 … … 60 61 */ 61 62 WGridLayout *layout = new WGridLayout(); 62 layout->addWidget(createTitle("<a href='../workingArea/parmin'> Menu (In future)</a>"), 0, 0, 1, 2);63 layout->addWidget(createTitle("Menu (In future)"), 0, 0, 1, 2);63 // layout->addWidget(createTitle("<a href='workingArea/parmin'> Menu (In future)</a>"), 0, 0, 1, 2); 64 // layout->addWidget(createTitle("Menu (In future)"), 0, 0, 1, 2); 64 65 65 66 WHBoxLayout *toolbarLayout = new WHBoxLayout(); … … 70 71 WPushButton* boutongraphicalAnalysis = new WPushButton(); 71 72 72 boutonSauve->decorationStyle().setBackgroundImage (WApplication::appRoot()+"../icons/save.png"); 73 // boutonSauve->setIcon ("../icons/save.png"); 74 boutonRestaure->decorationStyle().setBackgroundImage (WApplication::appRoot()+"../icons/restore.png"); 75 boutonLoadNew->decorationStyle().setBackgroundImage (WApplication::appRoot()+"../icons/open.png"); 76 boutongraphicalAnalysis->decorationStyle().setBackgroundImage (WApplication::appRoot()+"../icons/histo.png"); 73 boutonSauve->setStyleClass("saveButton"); 74 boutonRestaure->setStyleClass("restoreButton"); 75 boutonLoadNew->setStyleClass("loadNewButton"); 76 boutongraphicalAnalysis->setStyleClass("histoButton"); 77 77 78 78 boutonSauve->setToolTip ("sauvegarder la config"); … … 107 107 WContainerWidget * layoutContainer = new WContainerWidget(); 108 108 layoutContainer->setLayout(toolbarLayout); 109 layoutContainer->decorationStyle().setBackgroundImage ( WApplication::appRoot()+"../icons/fond_toolbar.png");109 layoutContainer->decorationStyle().setBackgroundImage ("/icons/fond_toolbar.png"); 110 110 layout->addWidget(layoutContainer, 1, 0, 1, 2); 111 111 layout->addWidget(createPalette(), 2, 0, 4, 1); … … 116 116 117 117 // console_ = new WContainerWidget(); 118 // console_->decorationStyle().setBackgroundColor (WColor("lightgray")); 118 // console_->decorationStyle().setBackgroundColor (WColor("lightgray")); 119 119 // console_->setMaximumSize(600,200); 120 120 // layout->addWidget(console_, 3, 1);
Note: See TracChangeset
for help on using the changeset viewer.