Changeset 9e9100 for src/UIElements
- Timestamp:
- Feb 14, 2016, 12:33:42 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:
- 5cd3a33
- Parents:
- 6d4925
- git-author:
- Frederik Heber <heber@…> (12/28/15 11:43:34)
- git-committer:
- Frederik Heber <heber@…> (02/14/16 12:33:42)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
r6d4925 r9e9100 69 69 AtomObservable::NameChanged, 70 70 AtomObservable::ElementChanged, 71 AtomObservable::PositionChanged; 71 AtomObservable::PositionChanged, 72 AtomObservable::SelectionChanged; 72 73 return channels; 73 74 } … … 86 87 const Observable::channels_t 87 88 QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged); 89 const Observable::channels_t 90 QtObservedAtom::AtomSelectedChannels(1, AtomObservable::SelectionChanged); 88 91 89 92 QtObservedAtom::QtObservedAtom( … … 112 115 boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(ObservedValues[AtomName])->noteCallBackIsGone(); 113 116 boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone(); 117 boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(ObservedValues[AtomSelected])->noteCallBackIsGone(); 114 118 115 119 deactivateObserver(); … … 196 200 } 197 201 202 bool QtObservedAtom::updateSelected( 203 const boost::function<const atomId_t ()> &_getAtomIndex) 204 { 205 const atom * const _atom = getAtomConst(_getAtomIndex()); 206 if (_atom != NULL) { 207 return _atom->getSelected(); 208 } else { 209 return false; 210 } 211 } 212 198 213 void QtObservedAtom::update(Observable *publisher) 199 214 { … … 240 255 case AtomObservable::PositionChanged: 241 256 emit positionChanged(); 257 break; 258 case AtomObservable::SelectionChanged: 259 emit selectedChanged(); 242 260 break; 243 261 default: … … 324 342 const boost::function<Vector ()> AtomPositionUpdater( 325 343 boost::bind(&QtObservedAtom::updatePosition, AtomIndexGetter)); 344 const boost::function<bool ()> AtomSelectedUpdater( 345 boost::bind(&QtObservedAtom::updateSelected, AtomIndexGetter)); 326 346 327 347 _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, atomId_t>( … … 363 383 AtomPositionUpdater(), 364 384 AtomPositionChannels, 385 _subjectKilled, 386 AtomIndexGetter); 387 _ObservedValues[AtomSelected] = new ObservedValue_wCallback<bool, atomId_t>( 388 _atomref, 389 AtomSelectedUpdater, 390 "AtomSelected_"+toString(_id), 391 AtomSelectedUpdater(), 392 AtomSelectedChannels, 365 393 _subjectKilled, 366 394 AtomIndexGetter); … … 376 404 delete boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(_ObservedValues[AtomName]); 377 405 delete boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(_ObservedValues[AtomPosition]); 406 delete boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(_ObservedValues[AtomSelected]); 378 407 _ObservedValues.clear(); 379 408 } … … 408 437 return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->get(); 409 438 } 439 440 const bool QtObservedAtom::getAtomSelected() const 441 { 442 return boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(ObservedValues[AtomSelected])->get(); 443 } -
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp
r6d4925 r9e9100 121 121 */ 122 122 const moleculeId_t& getAtomMoleculeIndex() const; 123 124 /** Getter to atom's selected status. 125 * 126 * \return true - atom selected, false - else 127 */ 128 const bool getAtomSelected() const; 123 129 124 130 signals: … … 130 136 void positionChanged(); 131 137 void atomRemoved(); 138 void selectedChanged(); 132 139 133 140 //private slots: … … 151 158 const boost::function<const atomId_t ()> &_getAtomIndex); 152 159 static Vector updatePosition( 160 const boost::function<const atomId_t ()> &_getAtomIndex); 161 static bool updateSelected( 153 162 const boost::function<const atomId_t ()> &_getAtomIndex); 154 163 … … 167 176 //!> contains the current atom position 168 177 AtomPosition, 178 //!> contains the current atom's selection status 179 AtomSelected, 169 180 //!> gives the size of the enumeration 170 181 MAX_ObservedTypes … … 215 226 //!> list of channels when position needs to update 216 227 static const Observable::channels_t AtomPositionChannels; 228 //!> list of channels when selection needs to update 229 static const Observable::channels_t AtomSelectedChannels; 217 230 218 231 //!> we get multiple subjectKilled(), count and call callback() only on last -
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp
r6d4925 r9e9100 64 64 molecule::IndexChanged, 65 65 molecule::MoleculeNameChanged, 66 molecule::BoundingBoxChanged; 66 molecule::BoundingBoxChanged, 67 molecule::SelectionChanged; 67 68 return channels; 68 69 } … … 96 97 const Observable::channels_t QtObservedMolecule::NameChannels(1, molecule::MoleculeNameChanged); 97 98 const Observable::channels_t QtObservedMolecule::NonHydrogenCountChannels(1, molecule::FormulaChanged); 99 const Observable::channels_t QtObservedMolecule::SelectedChannels(1, molecule::SelectionChanged); 98 100 99 101 QtObservedMolecule::QtObservedMolecule( … … 124 126 boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->noteCallBackIsGone(); 125 127 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->noteCallBackIsGone(); 128 boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->noteCallBackIsGone(); 126 129 127 130 deactivateObserver(); … … 254 257 #endif 255 258 emit nameChanged(); 259 break; 260 } 261 case molecule::SelectionChanged: 262 { 263 #ifdef LOG_OBSERVER 264 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that selected has changed."; 265 #endif 266 emit selectedChanged(); 256 267 break; 257 268 } … … 327 338 const boost::function<molecule::BoundingBoxInfo ()> BoundingBoxUpdater( 328 339 boost::bind(&QtObservedMolecule::updateBoundingBox, MolIndexGetter)); 340 const boost::function<bool ()> SelectedUpdater( 341 boost::bind(&QtObservedMolecule::updateSelected, MolIndexGetter)); 329 342 330 343 _ObservedValues[AtomCount] = new ObservedValue_wCallback<int, moleculeId_t>( … … 382 395 NonHydrogenCountUpdater(), 383 396 NonHydrogenCountChannels, 397 _subjectKilled, 398 MolIndexGetter); 399 _ObservedValues[MolSelected] = new ObservedValue_wCallback<bool, moleculeId_t>( 400 _molref, 401 SelectedUpdater, 402 "MoleculeSelected_"+toString(_molid), 403 SelectedUpdater(), 404 SelectedChannels, 384 405 _subjectKilled, 385 406 MolIndexGetter); … … 397 418 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]); 398 419 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[NonHydrogenCount]); 420 delete boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(_ObservedValues[MolSelected]); 399 421 _ObservedValues.clear(); 400 422 } … … 475 497 } 476 498 499 bool QtObservedMolecule::updateSelected( 500 const boost::function<const moleculeId_t ()> &_getMolIndex) 501 { 502 const molecule * const mol = getMolecule(_getMolIndex()); 503 if (mol != NULL) 504 return mol->getSelected(); 505 else 506 return false; 507 } 508 477 509 const int& QtObservedMolecule::getAtomCount() const 478 510 { … … 514 546 return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get(); 515 547 } 548 549 const bool& QtObservedMolecule::getMolSelected() const 550 { 551 return boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->get(); 552 } -
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp
r6d4925 r9e9100 128 128 const molecule::BoundingBoxInfo& getBoundingBox() const; 129 129 130 /** Getter to molecule's selected status. 131 * 132 * \return true - molecule selected, false - else 133 */ 134 const bool& getMolSelected() const; 135 130 136 static const molecule * const getMolecule(const moleculeId_t _id); 131 137 … … 143 149 void atomRemoved(const atomId_t); 144 150 void moleculeRemoved(); 151 void selectedChanged(); 145 152 146 153 private: … … 164 171 const boost::function<const moleculeId_t ()> &_getMolIndex); 165 172 static int updateNonHydrogenCount( 173 const boost::function<const moleculeId_t ()> &_getMolIndex); 174 static bool updateSelected( 166 175 const boost::function<const moleculeId_t ()> &_getMolIndex); 167 176 … … 182 191 //!> list of channels when the name needs to update 183 192 static const Observable::channels_t NonHydrogenCountChannels; 193 //!> list of channels when the name needs to update 194 static const Observable::channels_t SelectedChannels; 184 195 185 196 private: … … 204 215 //!> contains the current molecule's non-hydrogen atom count 205 216 NonHydrogenCount, 217 //!> contains the current molecule's selection status 218 MolSelected, 206 219 //!> gives the size of the enumeration 207 220 MAX_ObservedTypes
Note:
See TracChangeset
for help on using the changeset viewer.