Changeset 5cd3a33 for src/UIElements
- Timestamp:
- Feb 14, 2016, 12:33:43 PM (9 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 0f368b
- Parents:
- 9e9100
- git-author:
- Frederik Heber <heber@…> (12/28/15 17:12:08)
- git-committer:
- Frederik Heber <heber@…> (02/14/16 12:33:43)
- Location:
- src/UIElements
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/QtMainWindow.cpp
r9e9100 r5cd3a33 126 126 // glWorldView->setFocus(); 127 127 glWorldView->camera()->setEye( QVector3D(0,3,10)); 128 glWorldView->setSelectionChangedAgent(selectionagent);129 128 130 129 MainMenu = new QtMenu<QMenuBar>(menuBar(), ""); -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r9e9100 r5cd3a33 78 78 connect( ObservedAtom.get(), SIGNAL(positionChanged()), this, SLOT(resetPosition())); 79 79 connect( ObservedAtom.get(), SIGNAL(bondsChanged()), this, SLOT(resetPosition())); 80 connect( ObservedAtom.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected())); 80 81 81 82 // use that ObservedValues::AtomBonds is always up-to-date … … 162 163 } 163 164 164 void GLMoleculeObject_atom:: Selected()165 void GLMoleculeObject_atom::resetSelected() 165 166 { 166 ASSERT( !m_selected, 167 "GLMoleculeObject_atom::Selected() - 3D rep of atom is already selected."); 168 m_selected = true; 167 const bool new_selected = ObservedAtom->getAtomSelected(); 168 ASSERT( m_selected != new_selected, 169 "GLMoleculeObject_atom::resetSelected() - new and old selection state are the same."); 170 m_selected = new_selected; 169 171 170 172 emit changed(); 171 173 } 172 173 void GLMoleculeObject_atom::Unselected()174 {175 ASSERT( m_selected,176 "GLMoleculeObject_atom::Unselected() - 3D rep of atom is already unselected.");177 m_selected = false;178 179 emit changed();180 }181 182 174 183 175 void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane) -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp
r9e9100 r5cd3a33 41 41 void draw(QGLPainter *painter, const QVector4D &cameraPlane); 42 42 43 public slots:44 void Selected();45 void Unselected();46 47 43 private slots: 48 44 void wasClicked(); … … 51 47 void resetPosition(); 52 48 void resetBonds(); 49 void resetSelected(); 53 50 54 51 signals: -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r9e9100 r5cd3a33 151 151 connect (ObservedMolecule.get(), SIGNAL(atomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t))); 152 152 connect (ObservedMolecule.get(), SIGNAL(atomRemoved(const atomId_t)), this, SLOT(atomRemoved(const atomId_t))); 153 connect (ObservedMolecule.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected())); 153 154 154 155 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked())); … … 280 281 } 281 282 282 void GLMoleculeObject_molecule::AtomSelected(const atomId_t _id) 283 { 284 AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id); 285 if (iter != AtomsinSceneMap.end()) 286 QMetaObject::invokeMethod(iter->second, // pointer to a QObject 287 "Selected", // member name (no parameters here) 288 Qt::QueuedConnection); // connection type 289 else 290 ELOG(2, "GLMoleculeObject_molecule::AtomSelected() - atom " 291 << _id << " unknown to GLMoleculeObject_molecule."); 292 } 293 294 void GLMoleculeObject_molecule::AtomUnselected(const atomId_t _id) 295 { 296 AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id); 297 if (iter != AtomsinSceneMap.end()) 298 QMetaObject::invokeMethod(iter->second, // pointer to a QObject 299 "Unselected", // member name (no parameters here) 300 Qt::QueuedConnection); // connection type 301 else ELOG(2, "GLMoleculeObject_molecule::AtomUnselected() - atom " 302 << _id << " unknown to GLMoleculeObject_molecule."); 303 } 304 305 void GLMoleculeObject_molecule::Selected() 306 { 307 ASSERT( !m_selected, 308 "GLMoleculeObject_molecule::Selected() - 3D rep of molecule is already selected."); 309 m_selected = true; 283 void GLMoleculeObject_molecule::resetSelected() 284 { 285 const bool new_selected = ObservedMolecule->getMolSelected(); 286 ASSERT( m_selected != new_selected, 287 "GLMoleculeObject_molecule::resetSelected() - new and old selection state are the same."); 288 m_selected = new_selected; 310 289 311 290 emit changed(); 312 291 } 313 314 void GLMoleculeObject_molecule::Unselected()315 {316 ASSERT( m_selected,317 "GLMoleculeObject_molecule::Unselected() - 3D rep of molecule is already unselected.");318 m_selected = false;319 320 emit changed();321 }322 323 292 324 293 void GLMoleculeObject_molecule::initialize(QGLView *view, QGLPainter *painter) -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
r9e9100 r5cd3a33 90 90 void resetBoundingBox(); 91 91 void resetIndex(); 92 93 void AtomSelected(const atomId_t _id); 94 void AtomUnselected(const atomId_t _id); 95 void Selected(); 96 void Unselected(); 92 void resetSelected(); 97 93 98 94 private: -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r9e9100 r5cd3a33 50 50 51 51 #include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp" 52 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"53 52 54 53 #include "CodePatterns/MemDebug.hpp" … … 438 437 } 439 438 440 void GLWorldScene::setSelectionChangedAgent(QtSelectionChangedAgent *agent)441 {442 connect(agent, SIGNAL(atomSelected(const moleculeId_t, const atomId_t)),443 this, SLOT(AtomSelected(const moleculeId_t, const atomId_t)));444 connect(agent, SIGNAL(atomUnselected(const moleculeId_t, const atomId_t)),445 this, SLOT(AtomUnselected(const moleculeId_t, const atomId_t)));446 447 connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),448 this, SLOT(MoleculeSelected(const moleculeId_t)));449 connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),450 this, SLOT(MoleculeUnselected(const moleculeId_t)));451 }452 453 439 void GLWorldScene::setSelectionModeAtom() 454 440 { … … 500 486 } 501 487 502 void GLWorldScene::AtomSelected(const moleculeId_t _molid, const atomId_t _id)503 {504 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);505 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);506 // use direct connection as it's lightweight and we avoid index change troubles507 if (iter != MoleculesinSceneMap.end())508 QMetaObject::invokeMethod(iter->second, // pointer to a QObject509 "AtomSelected", // member name (no parameters here)510 Qt::DirectConnection, // connection type511 Q_ARG(const atomId_t, _id)); // parameters512 else513 ELOG(2, "DEBUG: GLWorldScene::AtomSelected() - molecule " <<514 _molid << " unknown to GLWorldScene.");515 }516 517 void GLWorldScene::AtomUnselected(const moleculeId_t _molid, const atomId_t _id)518 {519 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);520 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);521 // use direct connection as it's lightweight and we avoid index change troubles522 if (iter != MoleculesinSceneMap.end())523 QMetaObject::invokeMethod(iter->second, // pointer to a QObject524 "AtomUnselected", // member name (no parameters here)525 Qt::DirectConnection, // connection type526 Q_ARG(const atomId_t, _id)); // parameters527 else528 ELOG(2, "GLWorldScene::AtomUnselected() - molecule "529 << _molid << " unknown to GLWorldScene.");530 }531 532 void GLWorldScene::MoleculeSelected(const moleculeId_t _molid)533 {534 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);535 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);536 if (iter != MoleculesinSceneMap.end())537 QMetaObject::invokeMethod(iter->second, // pointer to a QObject538 "Selected", // member name (no parameters here)539 Qt::QueuedConnection); // connection type540 else541 ELOG(2, "GLWorldScene::MoleculeSelected() - molecule "542 << _molid << " unknown to GLWorldScene.");543 }544 545 void GLWorldScene::MoleculeUnselected(const moleculeId_t _molid)546 {547 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);548 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);549 if (iter != MoleculesinSceneMap.end())550 QMetaObject::invokeMethod(iter->second, // pointer to a QObject551 "Unselected", // member name (no parameters here)552 Qt::QueuedConnection); // connection type553 else554 ELOG(2, "GLWorldScene::MoleculeUnselected() - molecule "555 << _molid << " unknown to GLWorldScene.");556 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r9e9100 r5cd3a33 39 39 class GLMoleculeObject_molecule; 40 40 class GLMoleculeObject_shape; 41 class QtSelectionChangedAgent;42 41 43 42 class QtObservedInstanceBoard; … … 73 72 void setSelectionMode(SelectionModeType mode); 74 73 75 void setSelectionChangedAgent(QtSelectionChangedAgent *agent);76 77 74 signals: 78 75 void changed(); … … 102 99 void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible); 103 100 void changeMoleculeId(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t); 104 105 void AtomSelected(const moleculeId_t _molid, const atomId_t);106 void AtomUnselected(const moleculeId_t _molid, const atomId_t);107 void MoleculeSelected(const moleculeId_t);108 void MoleculeUnselected(const moleculeId_t);109 101 110 102 public: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r9e9100 r5cd3a33 313 313 } 314 314 315 void GLWorldView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)316 {317 worldscene->setSelectionChangedAgent(agent);318 }319 320 315 /** 321 316 * Update operation which can be invoked by the observable (which should be the -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r9e9100 r5cd3a33 26 26 class QToolBar; 27 27 class QTimer; 28 class QtSelectionChangedAgent;29 28 30 29 class QtObservedInstanceBoard; … … 46 45 void createDomainBox(); 47 46 void createDreiBein(); 48 49 void setSelectionChangedAgent(QtSelectionChangedAgent *agent);50 47 51 48 // Observer functions
Note:
See TracChangeset
for help on using the changeset viewer.