Changeset cc04b7
- Timestamp:
- Jan 7, 2010, 2:46:34 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:
- 12b845
- Parents:
- a56275
- Location:
- src
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
ra56275 rcc04b7 6 6 */ 7 7 8 #include "Action.hpp"8 #include <string> 9 9 10 Action::Action() 11 {} 10 #include "Actions/Action.hpp" 11 #include "Actions/ActionRegistry.hpp" 12 13 using namespace std; 14 15 Action::Action(std::string _name,bool _doRegister) : 16 name(_name) 17 { 18 if(_doRegister){ 19 ActionRegistry::getRegistry()->registerAction(this); 20 } 21 } 12 22 13 23 Action::~Action() 14 24 {} 25 26 const string Action::getName(){ 27 return name; 28 } -
src/Actions/Action.hpp
ra56275 rcc04b7 8 8 #ifndef ACTION_H_ 9 9 #define ACTION_H_ 10 11 #include <string> 10 12 11 13 /** … … 21 23 protected: 22 24 public: 23 Action( );25 Action(std::string _name,bool _doRegister=true); 24 26 virtual ~Action(); 25 27 … … 28 30 virtual bool canUndo()=0; 29 31 32 virtual const std::string getName(); 33 34 private: 35 std::string name; 30 36 }; 31 37 -
src/Actions/ErrorAction.cpp
ra56275 rcc04b7 14 14 using namespace std; 15 15 16 ErrorAction::ErrorAction(const char * _errorMsg) : 16 ErrorAction::ErrorAction(string _name,const char * _errorMsg,bool _doRegister) : 17 Action(_name,_doRegister), 17 18 errorMsg(_errorMsg) 18 19 { -
src/Actions/ErrorAction.hpp
ra56275 rcc04b7 15 15 { 16 16 public: 17 ErrorAction( const char *);17 ErrorAction(std::string _name,const char * _errorMsg,bool _doRegister=true); 18 18 virtual ~ErrorAction(); 19 19 -
src/Actions/MakroAction.cpp
ra56275 rcc04b7 6 6 */ 7 7 8 #include <string> 9 8 10 #include "Actions/MakroAction.hpp" 9 11 #include "Actions/Action.hpp" 10 12 #include "Actions/ActionSequence.hpp" 11 13 12 MakroAction::MakroAction(ActionSequence* _actions) : 14 using namespace std; 15 16 MakroAction::MakroAction(string _name,ActionSequence* _actions,bool _doRegister) : 17 Action(_name,_doRegister), 13 18 actions(_actions) 14 19 { -
src/Actions/MakroAction.hpp
ra56275 rcc04b7 8 8 #ifndef MAKROACTION_HPP_ 9 9 #define MAKROACTION_HPP_ 10 11 #include <string> 10 12 11 13 #include "Actions/Action.hpp" … … 21 23 { 22 24 public: 23 MakroAction( ActionSequence*);25 MakroAction(std::string _name,ActionSequence* _actions,bool _doRegister=true); 24 26 virtual ~MakroAction(); 25 27 -
src/Actions/MethodAction.cpp
ra56275 rcc04b7 8 8 #include <iostream> 9 9 #include <boost/function.hpp> 10 #include <string> 10 11 11 12 #include "MethodAction.hpp" … … 13 14 using namespace std; 14 15 15 MethodAction::MethodAction(boost::function<void()> _executeMethod) : 16 MethodAction::MethodAction(string _name,boost::function<void()> _executeMethod,bool _doRegister) : 17 Action(_name,_doRegister), 16 18 executeMethod(_executeMethod) 17 19 { -
src/Actions/MethodAction.hpp
ra56275 rcc04b7 10 10 11 11 #include <boost/function.hpp> 12 #include <string> 12 13 13 14 #include "Actions/Action.hpp" … … 19 20 { 20 21 public: 21 MethodAction( boost::function<void()>);22 MethodAction(std::string _name,boost::function<void()> _executeMethod,bool _doRegister=true); 22 23 virtual ~MethodAction(); 23 24 -
src/Makefile.am
ra56275 rcc04b7 5 5 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 6 6 7 ACTIONSSOURCE = Actions/Action.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp 8 ACTIONSHEADER = Actions/Action.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp 7 ACTIONSSOURCE = Actions/Action.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/ActionRegistry.cpp 8 ACTIONSHEADER = Actions/Action.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/ActionRegistry.hpp 9 9 10 10 VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp … … 14 14 MENUHEADER = Menu/Menu.hpp Menu/TextMenu.hpp Menu/MenuItem.hpp Menu/SubMenuItem.hpp Menu/ActionMenuItem.hpp Menu/SeperatorItem.hpp Menu/DisplayMenuItem.hpp 15 15 16 UISOURCE = ${ACTIONSSOURCE} ${VIEWSOURCE} ${MENUSOURCE} UIElements/UIFactory.cpp UIElements/TextUIFactory.cpp UIElements/ Dialog.cpp UIElements/TextDialog.cpp17 UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/UIFactory.hpp UIElements/TextUIFactory.hpp UIElements/ Dialog.hpp UIElements/TextDialog.hpp16 UISOURCE = ${ACTIONSSOURCE} ${VIEWSOURCE} ${MENUSOURCE} UIElements/UIFactory.cpp UIElements/TextUIFactory.cpp UIElements/MainWindow.cpp UIElements/TextWindow.cpp UIElements/Dialog.cpp UIElements/TextDialog.cpp 17 UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/UIFactory.hpp UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp 18 18 19 19 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${UISOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp -
src/UIElements/TextUIFactory.cpp
ra56275 rcc04b7 7 7 8 8 #include "UIElements/TextUIFactory.hpp" 9 #include "UIElements/TextWindow.hpp" 9 10 #include "UIElements/TextDialog.hpp" 11 10 12 11 13 TextUIFactory::TextUIFactory() … … 25 27 } 26 28 29 MainWindow* TextUIFactory::makeMainWindow() { 30 return new TextWindow(); 31 } 27 32 -
src/UIElements/TextUIFactory.hpp
ra56275 rcc04b7 19 19 20 20 virtual Dialog* makeDialog(); 21 virtual MainWindow* makeMainWindow(); 21 22 22 23 protected: -
src/UIElements/TextWindow.cpp
ra56275 rcc04b7 8 8 #include "UIElements/TextWindow.hpp" 9 9 #include "../menu.hpp" 10 11 #include <iostream> 12 13 using namespace std; 10 14 11 15 TextWindow::TextWindow() … … 21 25 22 26 void TextWindow::display(MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) { 27 cout << "creating main window" <<endl; 23 28 oldmenu *main_menu; 24 29 main_menu = new oldmenu; -
src/UIElements/UIFactory.cpp
ra56275 rcc04b7 12 12 // all factories that can be used: 13 13 #include "UIElements/TextUIFactory.hpp" 14 15 UIFactory *UIFactory::theFactory = 0; 14 16 15 17 UIFactory::UIFactory() … … 41 43 return theFactory; 42 44 } 45 46 47 void UIFactory::purgeInstance(){ 48 if(theFactory) { 49 delete theFactory; 50 theFactory = 0; 51 } 52 } -
src/UIElements/UIFactory.hpp
ra56275 rcc04b7 9 9 #define UIFACTORY_HPP_ 10 10 11 class MainWindow; 11 12 class Dialog; 12 13 … … 14 15 { 15 16 17 public: 16 18 enum InterfaceTypes {Text}; 17 public:18 19 virtual ~UIFactory(); 19 20 20 21 // methods for creating UIElements 22 virtual MainWindow* makeMainWindow()=0; 21 23 virtual Dialog* makeDialog()=0; 22 24 … … 25 27 26 28 // singleton stuff 29 private: 30 static UIFactory *theFactory; 31 27 32 public: 28 33 static void makeUserInterface(InterfaceTypes type); 29 34 static UIFactory* get(); 30 31 private: 32 static UIFactory *theFactory; 35 static void purgeInstance(); 33 36 }; 34 37 -
src/builder.cpp
ra56275 rcc04b7 65 65 #include "molecule.hpp" 66 66 #include "periodentafel.hpp" 67 #include "menu.hpp" 67 #include "UIElements/UIFactory.hpp" 68 #include "UIElements/MainWindow.hpp" 68 69 69 70 /** Parses the command line options. … … 904 905 char *ConfigFileName = NULL; 905 906 int j; 906 oldmenu *main_menu;907 main_menu = new oldmenu;908 907 setVerbosity(0); 909 908 /* structure of ParseCommandLineOptions will be refactored later */ … … 940 939 941 940 942 943 main_menu->perform(molecules, configuration, periode, ConfigFileName); 941 UIFactory::makeUserInterface(UIFactory::Text); 942 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(); 943 mainWindow->display(molecules, configuration, periode, ConfigFileName); 944 944 945 945 if(periode->StorePeriodentafel(configuration->databasepath)) … … 952 952 delete(periode); 953 953 delete(configuration); 954 955 delete mainWindow; 954 956 955 957 Log() << Verbose(0) << "Maximum of allocated memory: " … … 960 962 logger::purgeInstance(); 961 963 errorLogger::purgeInstance(); 962 964 UIFactory::purgeInstance(); 963 965 return (0); 964 966 } -
src/menu.cpp
ra56275 rcc04b7 993 993 TextMenu *MergeMoleculesMenu = new TextMenu(Log() << Verbose(0), "Merge Molecules"); 994 994 995 Action *simpleAddAction = new MethodAction( boost::bind(&oldmenu::SimpleAddMolecules,this,molecules));995 Action *simpleAddAction = new MethodAction("simpleAddAction",boost::bind(&oldmenu::SimpleAddMolecules,this,molecules),false); 996 996 new ActionMenuItem('a',"simple add of one molecule to another",MergeMoleculesMenu,simpleAddAction); 997 997 998 Action *embeddAction = new MethodAction( boost::bind(&oldmenu::embeddMolecules,this,molecules));998 Action *embeddAction = new MethodAction("embeddAction",boost::bind(&oldmenu::embeddMolecules,this,molecules),false); 999 999 new ActionMenuItem('e',"embedding merge of two molecules",MergeMoleculesMenu,embeddAction); 1000 1000 1001 Action *multiMergeAction = new MethodAction( boost::bind(&oldmenu::multiMergeMolecules,this,molecules));1001 Action *multiMergeAction = new MethodAction("multiMergeAction",boost::bind(&oldmenu::multiMergeMolecules,this,molecules),false); 1002 1002 new ActionMenuItem('m',"multi-merge of all molecules",MergeMoleculesMenu,multiMergeAction); 1003 1003 1004 Action *scatterMergeAction = new ErrorAction(" Not Implemented yet");1004 Action *scatterMergeAction = new ErrorAction("scatterMergeAction","Not Implemented yet",false); 1005 1005 new ActionMenuItem('s',"scatter merge of two molecules",MergeMoleculesMenu,scatterMergeAction); 1006 1006 1007 Action *simpleMergeAction = new MethodAction( boost::bind(&oldmenu::simpleMergeMolecules,this,molecules));1007 Action *simpleMergeAction = new MethodAction("simpleMergeAction",boost::bind(&oldmenu::simpleMergeMolecules,this,molecules),false); 1008 1008 new ActionMenuItem('t',"simple merge of two molecules",MergeMoleculesMenu,simpleMergeAction); 1009 1009 1010 Action *returnAction = new MethodAction( boost::bind(&TextMenu::doQuit,MergeMoleculesMenu));1010 Action *returnAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,MergeMoleculesMenu),false); 1011 1011 MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",MergeMoleculesMenu,returnAction); 1012 1012 … … 1125 1125 new SeperatorItem(main_menu); 1126 1126 1127 Action *setMoleculeAction = new MethodAction( boost::bind(&MoleculeListClass::flipChosen,molecules));1127 Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules)); 1128 1128 new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction); 1129 1129 … … 1131 1131 new SubMenuItem('e',"edit molecules (load, parse, save)",main_menu,editMoleculesMenu); 1132 1132 1133 Action *manipulateMoleculeAction = new MethodAction( boost::bind(&oldmenu::ManipulateMolecules,this,periode, molecules, configuration));1133 Action *manipulateMoleculeAction = new MethodAction("manipulateMoleculeAction",boost::bind(&oldmenu::ManipulateMolecules,this,periode, molecules, configuration)); 1134 1134 new ActionMenuItem('g',"globally manipulate atoms in molecule",main_menu,manipulateMoleculeAction); 1135 1135 1136 Action *mergeMoleculeAction = new MethodAction( boost::bind(&oldmenu::MergeMolecules,this,periode, molecules));1136 Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,this,periode, molecules)); 1137 1137 new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction); 1138 1138 1139 Action *manipulateAtomsAction = new MethodAction( boost::bind(&oldmenu::ManipulateAtoms,this,periode, molecules, configuration));1139 Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,this,periode, molecules, configuration)); 1140 1140 new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction); 1141 1141 1142 1142 new SeperatorItem(main_menu); 1143 1143 1144 Action *editConfigAction = new MethodAction( boost::bind(&config::Edit,configuration));1144 Action *editConfigAction = new MethodAction("editConfigAction",boost::bind(&config::Edit,configuration)); 1145 1145 new ActionMenuItem('c',"edit the current configuration",main_menu,editConfigAction); 1146 1146 1147 1147 new SeperatorItem(main_menu); 1148 1148 1149 Action *saveConfigAction = new MethodAction( boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules));1149 Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules)); 1150 1150 new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction); 1151 1151 1152 Action *doTestAction = new MethodAction( boost::bind(&oldmenu::testroutine,this,molecules));1152 Action *doTestAction = new MethodAction("doTestAction",boost::bind(&oldmenu::testroutine,this,molecules)); 1153 1153 new ActionMenuItem('T',"call the current test routine",main_menu,doTestAction); 1154 1154 1155 Action *quitAction = new MethodAction( boost::bind(&TextMenu::doQuit,main_menu));1155 Action *quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false); 1156 1156 new ActionMenuItem('q',"quit",main_menu,quitAction); 1157 1157 … … 1159 1159 1160 1160 // build the EditMoleculesMenu 1161 Action *createMoleculeAction = new MethodAction( boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));1161 Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode)); 1162 1162 new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction); 1163 1163 1164 Action *loadMoleculeAction = new MethodAction( boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));1164 Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode)); 1165 1165 new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction); 1166 1166 1167 Action *changeFilenameAction = new MethodAction( boost::bind(&MoleculeListClass::changeName,molecules));1167 Action *changeFilenameAction = new MethodAction("changeFilenameAction",boost::bind(&MoleculeListClass::changeName,molecules)); 1168 1168 new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction); 1169 1169 1170 Action *giveFilenameAction = new MethodAction( boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));1170 Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules)); 1171 1171 new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction); 1172 1172 1173 Action *parseAtomsAction = new MethodAction( boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));1173 Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules)); 1174 1174 new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction); 1175 1175 1176 Action *eraseMoleculeAction = new MethodAction( boost::bind(&MoleculeListClass::eraseMolecule,molecules));1176 Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules)); 1177 1177 new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction); 1178 1178 1179 Action *returnAction = new MethodAction( boost::bind(&TextMenu::doQuit,editMoleculesMenu));1179 Action *returnAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false); 1180 1180 MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnAction); 1181 1181 … … 1208 1208 delete eraseMoleculeAction; 1209 1209 delete returnAction; 1210 1210 1211 }; -
src/unittests/ActionSequenceTest.cpp
ra56275 rcc04b7 26 26 { 27 27 public: 28 canUndoActionStub() {}28 canUndoActionStub(): Action("canUndoActionStub",false){} 29 29 virtual ~canUndoActionStub(){} 30 30 … … 39 39 { 40 40 public: 41 cannotUndoActionStub() {}41 cannotUndoActionStub() : Action("cannotUndoActionStub",false){} 42 42 virtual ~cannotUndoActionStub(){} 43 43 … … 53 53 public: 54 54 wasCalledActionStub() : 55 Action("wasCalledActionStub",false), 55 56 called(false) 56 57 {}
Note:
See TracChangeset
for help on using the changeset viewer.