- Timestamp:
- Mar 25, 2010, 12:01:27 PM (15 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:
- 975a11, b31bc4
- Parents:
- 5b0b98
- git-author:
- Tillmann Crueger <crueger@…> (03/25/10 11:59:56)
- git-committer:
- Tillmann Crueger <crueger@…> (03/25/10 12:01:27)
- Location:
- src
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
r5b0b98 rd56640 10 10 #include "Actions/Action.hpp" 11 11 #include "Actions/ActionRegistry.hpp" 12 #include "Actions/ActionHistory.hpp" 12 13 13 14 using namespace std; … … 34 35 void Action::call(){ 35 36 // forward to private virtual 36 performCall(); 37 state_ptr state = performCall(); 38 if(shouldUndo() && state != failure){ 39 if(canUndo()){ 40 ActionHistory::getInstance().addElement(this,state); 41 } 42 else{ 43 ActionHistory::getInstance().clear(); 44 } 45 } 37 46 } 38 47 Action::state_ptr Action::undo(state_ptr _state) { -
src/Actions/ActionRegistry.cpp
r5b0b98 rd56640 12 12 13 13 #include <string> 14 #include <cassert>14 #include "Helpers/Assert.hpp" 15 15 #include <iostream> 16 16 … … 33 33 map<const string,Action*>::iterator iter; 34 34 iter = actionMap.find(name); 35 assert(iter!=actionMap.end() &&"Query for an action not stored in registry");35 ASSERT(iter!=actionMap.end(),"Query for an action not stored in registry"); 36 36 return iter->second; 37 37 } … … 40 40 pair<map<const string,Action*>::iterator,bool> ret; 41 41 ret = actionMap.insert(pair<const string,Action*>(action->getName(),action)); 42 assert(ret.second &&"Two actions with the same name added to registry");42 ASSERT(ret.second,"Two actions with the same name added to registry"); 43 43 } 44 44 -
src/Actions/small_actions.cpp
r5b0b98 rd56640 26 26 }; 27 27 28 c har ChangeMoleculeNameAction::NAME[] = "Change filename of Molecule";28 const char ChangeMoleculeNameAction::NAME[] = "Change filename of Molecule"; 29 29 30 30 ChangeMoleculeNameAction::ChangeMoleculeNameAction(MoleculeListClass *_molecules) : -
src/Actions/small_actions.hpp
r5b0b98 rd56640 24 24 25 25 MoleculeListClass *molecules; 26 static c har NAME[];26 static const char NAME[]; 27 27 }; 28 28 -
src/Makefile.am
r5b0b98 rd56640 8 8 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 9 9 10 ACTIONSSOURCE = Actions/Action.cpp Actions/Process.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/small_actions.cpp Actions/ManipulateAtomsProcess.cpp Actions/ActionRegistry.cpp 11 ACTIONSHEADER = Actions/Action.hpp Actions/Process.hpp Actions/Calculation.hpp Actions/Calculation_impl.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/small_actions.hpp Actions/ManipulateAtomsProcess.hpp Actions/ActionRegistry.hpp 10 ACTIONSSOURCE = Actions/Action.cpp \ 11 Actions/ActionHistory.cpp \ 12 Actions/ActionRegistry.cpp \ 13 Actions/ActionSequence.cpp \ 14 Actions/ErrorAction.cpp \ 15 Actions/MakroAction.cpp \ 16 Actions/ManipulateAtomsProcess.cpp \ 17 Actions/MethodAction.cpp \ 18 Actions/Process.cpp \ 19 Actions/small_actions.cpp 20 21 22 ACTIONSHEADER = Actions/Action.hpp \ 23 Actions/ActionHistory.hpp \ 24 Actions/ActionRegistry.hpp \ 25 Actions/ActionSequence.hpp \ 26 Actions/Calculation.hpp \ 27 Actions/Calculation_impl.hpp \ 28 Actions/ErrorAction.hpp \ 29 Actions/MakroAction.hpp \ 30 Actions/ManipulateAtomsProcess.hpp \ 31 Actions/MethodAction.hpp \ 32 Actions/Process.hpp \ 33 Actions/small_actions.hpp 34 35 12 36 13 37 PATTERNSOURCE = Patterns/Observer.cpp -
src/Menu/TextMenu.cpp
r5b0b98 rd56640 11 11 #include "Menu/TextMenu.hpp" 12 12 #include "Menu/MenuItem.hpp" 13 #include "Helpers/Assert.hpp" 13 14 14 15 … … 88 89 } 89 90 91 string TextMenu::getTitle(){ 92 return title; 93 } 94 90 95 void TextMenu::addDefault(MenuItem* _defaultItem) { 91 96 defaultItem = _defaultItem; 92 97 } 98 99 /****************************** Contained Actions ****************/ 100 101 const string TextMenu::LeaveAction::nameBase = "Leave menu: "; 102 103 TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) : 104 Action(nameBase+_menu->getTitle()), 105 menu(_menu) 106 {} 107 108 TextMenu::LeaveAction::~LeaveAction(){} 109 110 bool TextMenu::LeaveAction::canUndo(){ 111 return false; 112 } 113 114 bool TextMenu::LeaveAction::shouldUndo(){ 115 return false; 116 } 117 118 Action::state_ptr TextMenu::LeaveAction::performCall(){ 119 menu->doQuit(); 120 return Action::success; 121 } 122 123 124 Action::state_ptr TextMenu::LeaveAction::performUndo(Action::state_ptr){ 125 ASSERT(0,"Cannot undo leaving a menu"); 126 return Action::success; 127 } 128 129 Action::state_ptr TextMenu::LeaveAction::performRedo(Action::state_ptr){ 130 ASSERT(0,"Cannot redo leaving a menu"); 131 return Action::success; 132 } -
src/Menu/TextMenu.hpp
r5b0b98 rd56640 14 14 15 15 #include "Menu/Menu.hpp" 16 #include "Actions/Action.hpp" 16 17 #include "defs.hpp" 17 18 … … 26 27 { 27 28 public: 29 class LeaveAction : public Action { 30 public: 31 LeaveAction(TextMenu*); 32 virtual ~LeaveAction(); 33 34 bool canUndo(); 35 bool shouldUndo(); 36 37 private: 38 virtual Action::state_ptr performCall(); 39 virtual Action::state_ptr performUndo(Action::state_ptr); 40 virtual Action::state_ptr performRedo(Action::state_ptr); 41 42 TextMenu* menu; 43 44 static const string nameBase; 45 }; 46 28 47 TextMenu(ostream& _outputter, string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH); 29 48 virtual ~TextMenu(); … … 32 51 virtual void removeItem(MenuItem*); 33 52 virtual void display(); 53 virtual string getTitle(); 34 54 35 55 /** -
src/UIElements/TextDialog.cpp
r5b0b98 rd56640 68 68 69 69 bool TextDialog::StringTextQuery::handle() { 70 //Log() << Verbose(0) << getTitle();70 Log() << Verbose(0) << getTitle(); 71 71 cin >> tmp; 72 72 return true; -
src/UIElements/TextWindow.cpp
r5b0b98 rd56640 94 94 populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode); 95 95 96 returnFromEditMoleculeAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false);96 Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu); 97 97 MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction); 98 98 … … 108 108 delete old_menu; 109 109 delete quitAction; 110 delete returnFromEditMoleculeAction;111 110 delete moleculeView; 112 111 delete statusIndicator; -
src/UIElements/TextWindow.hpp
r5b0b98 rd56640 29 29 // some actions only needed in textMenus 30 30 Action *quitAction; 31 Action *returnFromEditMoleculeAction;32 31 // all views that are contained in the main Menu 33 32 StringView *moleculeView; -
src/builder.cpp
r5b0b98 rd56640 74 74 #include "Menu/ActionMenuItem.hpp" 75 75 #include "Actions/ActionRegistry.hpp" 76 #include "Actions/ActionHistory.hpp" 76 77 #include "Actions/MethodAction.hpp" 77 78 #include "Actions/small_actions.hpp" … … 2192 2193 2193 2194 setVerbosity(0); 2195 // need to init the history before any action is created 2196 ActionHistory::init(); 2194 2197 /* structure of ParseCommandLineOptions will be refactored later */ 2195 2198 j = ParseCommandLineOptions(argc, argv, World::getInstance().getMolecules(), World::getInstance().getPeriode(), *configuration, ConfigFileName);
Note:
See TracChangeset
for help on using the changeset viewer.