Changeset 12b845
- Timestamp:
- Jan 9, 2010, 11:30:49 AM (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:
- 3c5606
- Parents:
- cc04b7
- Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionRegistry.cpp
rcc04b7 r12b845 19 19 ActionRegistry::ActionRegistry() 20 20 { 21 // TODO Auto-generated constructor stub22 23 21 } 24 22 25 23 ActionRegistry::~ActionRegistry() 26 24 { 27 // TODO Auto-generated destructor stub 25 map<const string,Action*>::iterator iter; 26 for(iter=actionMap.begin();iter!=actionMap.end();iter++) { 27 delete iter->second; 28 actionMap.erase(iter); 29 } 28 30 } 29 31 -
src/UIElements/MainWindow.hpp
rcc04b7 r12b845 13 13 class periodentafel; 14 14 15 class Menu; 16 15 17 class MainWindow 16 18 { … … 19 21 virtual ~MainWindow(); 20 22 21 virtual void display( MoleculeListClass *, config *, periodentafel *, char *)=0;23 virtual void display()=0; 22 24 23 25 }; 24 26 27 typedef void (*MenuMaker)(Menu*,MoleculeListClass*, config*, periodentafel*); 28 29 struct menuPopulaters{ 30 MenuMaker MakeEditMoleculesMenu; 31 }; 32 25 33 #endif /* MAINWINDOW_HPP_ */ -
src/UIElements/TextUIFactory.cpp
rcc04b7 r12b845 27 27 } 28 28 29 MainWindow* TextUIFactory::makeMainWindow( ) {30 return new TextWindow( );29 MainWindow* TextUIFactory::makeMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) { 30 return new TextWindow(populaters,molecules,configuration,periode,ConfigFileName); 31 31 } 32 32 -
src/UIElements/TextUIFactory.hpp
rcc04b7 r12b845 19 19 20 20 virtual Dialog* makeDialog(); 21 virtual MainWindow* makeMainWindow( );21 virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *); 22 22 23 23 protected: -
src/UIElements/TextWindow.cpp
rcc04b7 r12b845 7 7 8 8 #include "UIElements/TextWindow.hpp" 9 10 #include <boost/bind.hpp> 11 12 13 // TODO: When done with refactoring most of these wont be needed anymore 14 #include "analysis_correlation.hpp" 15 #include "atom.hpp" 16 #include "bond.hpp" 17 #include "bondgraph.hpp" 18 #include "boundary.hpp" 19 #include "config.hpp" 20 #include "element.hpp" 21 #include "ellipsoid.hpp" 22 #include "helpers.hpp" 23 #include "leastsquaremin.hpp" 24 #include "linkedcell.hpp" 25 #include "log.hpp" 26 #include "memoryusageobserverunittest.hpp" 27 #include "molecule.hpp" 28 #include "periodentafel.hpp" 29 9 30 #include "../menu.hpp" 31 32 #include "Menu/Menu.hpp" 33 #include "Menu/TextMenu.hpp" 34 #include "Menu/ActionMenuItem.hpp" 35 #include "Menu/SeperatorItem.hpp" 36 #include "Menu/DisplayMenuItem.hpp" 37 #include "Menu/SubMenuItem.hpp" 38 #include "Actions/MethodAction.hpp" 39 #include "Actions/ErrorAction.hpp" 40 #include "Views/StreamStringView.hpp" 41 #include "Views/MethodStringView.hpp" 10 42 11 43 #include <iostream> … … 13 45 using namespace std; 14 46 15 TextWindow::TextWindow() 47 // TODO: see what code can be moved to a base class for Graphic and Text Windows 48 TextWindow::TextWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) 16 49 { 17 // TODO Auto-generated constructor stub50 old_menu = new oldmenu; 18 51 52 // build the main menu 53 main_menu = new TextMenu(Log() << Verbose(0), "Main Menu"); 54 55 moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1)); 56 new DisplayMenuItem(main_menu,moleculeView,"Molecule List"); 57 58 new SeperatorItem(main_menu); 59 60 Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules)); 61 new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction); 62 63 TextMenu *editMoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules"); 64 new SubMenuItem('e',"edit molecules (load, parse, save)",main_menu,editMoleculesMenu); 65 66 Action *manipulateMoleculeAction = new MethodAction("manipulateMoleculeAction",boost::bind(&oldmenu::ManipulateMolecules,old_menu,periode, molecules, configuration)); 67 new ActionMenuItem('g',"globally manipulate atoms in molecule",main_menu,manipulateMoleculeAction); 68 69 Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,old_menu,periode, molecules)); 70 new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction); 71 72 Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,old_menu,periode, molecules, configuration)); 73 new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction); 74 75 new SeperatorItem(main_menu); 76 77 Action *editConfigAction = new MethodAction("editConfigAction",boost::bind(&config::Edit,configuration)); 78 new ActionMenuItem('c',"edit the current configuration",main_menu,editConfigAction); 79 80 new SeperatorItem(main_menu); 81 82 Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules)); 83 new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction); 84 85 Action *doTestAction = new MethodAction("doTestAction",boost::bind(&oldmenu::testroutine,old_menu,molecules)); 86 new ActionMenuItem('T',"call the current test routine",main_menu,doTestAction); 87 88 quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false); 89 new ActionMenuItem('q',"quit",main_menu,quitAction); 90 91 // call all functions used to build the submenus 92 93 populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode); 94 95 returnFromEditMoleculeAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false); 96 MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction); 97 98 editMoleculesMenu->addDefault(returnItem); 19 99 } 20 100 21 101 TextWindow::~TextWindow() 22 102 { 23 // TODO Auto-generated destructor stub 103 delete old_menu; 104 delete quitAction; 105 delete returnFromEditMoleculeAction; 106 delete moleculeView; 107 delete main_menu; 24 108 } 25 109 26 void TextWindow::display(MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) { 27 cout << "creating main window" <<endl; 28 oldmenu *main_menu; 29 main_menu = new oldmenu; 30 main_menu->perform(molecules, configuration, periode, ConfigFileName); 31 delete main_menu; 110 void TextWindow::display() { 111 main_menu->display(); 32 112 } -
src/UIElements/TextWindow.hpp
rcc04b7 r12b845 11 11 #include "UIElements/MainWindow.hpp" 12 12 13 class TextMenu; 14 class Action; 15 class oldmenu; 16 class StringView; 17 13 18 class TextWindow : public MainWindow 14 19 { 15 20 public: 16 TextWindow( );21 TextWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *); 17 22 virtual ~TextWindow(); 18 23 19 virtual void display(MoleculeListClass *, config *, periodentafel *, char *); 24 virtual void display(); 25 private: 26 TextMenu *main_menu; 27 28 // some actions only needed in textMenus 29 Action *quitAction; 30 Action *returnFromEditMoleculeAction; 31 // all views that are contained in the main Menu 32 StringView *moleculeView; 33 34 // This class still contains a lot of scattered functionality 35 oldmenu *old_menu; 20 36 }; 21 37 -
src/UIElements/UIFactory.hpp
rcc04b7 r12b845 12 12 class Dialog; 13 13 14 class MoleculeListClass; 15 class config; 16 class periodentafel; 17 18 struct menuPopulaters; 19 14 20 class UIFactory 15 21 { … … 20 26 21 27 // methods for creating UIElements 22 virtual MainWindow* makeMainWindow( )=0;28 virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *)=0; 23 29 virtual Dialog* makeDialog()=0; 24 30 -
src/builder.cpp
rcc04b7 r12b845 47 47 */ 48 48 49 50 #include <boost/bind.hpp> 49 51 50 52 using namespace std; … … 67 69 #include "UIElements/UIFactory.hpp" 68 70 #include "UIElements/MainWindow.hpp" 71 #include "Menu/ActionMenuItem.hpp" 72 #include "Actions/ActionRegistry.hpp" 73 #include "Actions/MethodAction.hpp" 74 69 75 70 76 /** Parses the command line options. … … 891 897 }; 892 898 899 /***************************************** Functions used to build all menus **********************/ 900 901 void populateEditMoleculesMenu(Menu* editMoleculesMenu,MoleculeListClass *molecules, config *configuration, periodentafel *periode){ 902 // build the EditMoleculesMenu 903 Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode)); 904 new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction); 905 906 Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode)); 907 new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction); 908 909 Action *changeFilenameAction = new MethodAction("changeFilenameAction",boost::bind(&MoleculeListClass::changeName,molecules)); 910 new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction); 911 912 Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules)); 913 new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction); 914 915 Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules)); 916 new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction); 917 918 Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules)); 919 new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction); 920 } 921 922 893 923 /********************************************** Main routine **************************************/ 894 924 … … 938 968 } 939 969 940 941 UIFactory::makeUserInterface(UIFactory::Text); 942 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(); 943 mainWindow->display(molecules, configuration, periode, ConfigFileName); 970 { 971 menuPopulaters populaters; 972 populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu; 973 974 UIFactory::makeUserInterface(UIFactory::Text); 975 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,molecules, configuration, periode, ConfigFileName); 976 mainWindow->display(); 977 delete mainWindow; 978 } 944 979 945 980 if(periode->StorePeriodentafel(configuration->databasepath)) … … 953 988 delete(configuration); 954 989 955 delete mainWindow; 990 956 991 957 992 Log() << Verbose(0) << "Maximum of allocated memory: " … … 963 998 errorLogger::purgeInstance(); 964 999 UIFactory::purgeInstance(); 1000 ActionRegistry::purgeRegistry(); 965 1001 return (0); 966 1002 } -
src/menu.cpp
rcc04b7 r12b845 1117 1117 { 1118 1118 1119 // build the main menu1120 TextMenu *main_menu = new TextMenu(Log() << Verbose(0), "Main Menu");1121 1122 StringView *moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1));1123 new DisplayMenuItem(main_menu,moleculeView,"Molecule List");1124 1125 new SeperatorItem(main_menu);1126 1127 Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules));1128 new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction);1129 1130 TextMenu *editMoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");1131 new SubMenuItem('e',"edit molecules (load, parse, save)",main_menu,editMoleculesMenu);1132 1133 Action *manipulateMoleculeAction = new MethodAction("manipulateMoleculeAction",boost::bind(&oldmenu::ManipulateMolecules,this,periode, molecules, configuration));1134 new ActionMenuItem('g',"globally manipulate atoms in molecule",main_menu,manipulateMoleculeAction);1135 1136 Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,this,periode, molecules));1137 new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction);1138 1139 Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,this,periode, molecules, configuration));1140 new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction);1141 1142 new SeperatorItem(main_menu);1143 1144 Action *editConfigAction = new MethodAction("editConfigAction",boost::bind(&config::Edit,configuration));1145 new ActionMenuItem('c',"edit the current configuration",main_menu,editConfigAction);1146 1147 new SeperatorItem(main_menu);1148 1149 Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules));1150 new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction);1151 1152 Action *doTestAction = new MethodAction("doTestAction",boost::bind(&oldmenu::testroutine,this,molecules));1153 new ActionMenuItem('T',"call the current test routine",main_menu,doTestAction);1154 1155 Action *quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false);1156 new ActionMenuItem('q',"quit",main_menu,quitAction);1157 1158 1159 1160 // build the EditMoleculesMenu1161 Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));1162 new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);1163 1164 Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));1165 new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);1166 1167 Action *changeFilenameAction = new MethodAction("changeFilenameAction",boost::bind(&MoleculeListClass::changeName,molecules));1168 new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);1169 1170 Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));1171 new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);1172 1173 Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));1174 new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);1175 1176 Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));1177 new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);1178 1179 Action *returnAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false);1180 MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnAction);1181 1182 editMoleculesMenu->addDefault(returnItem);1183 1184 main_menu->display();1185 1186 1187 delete main_menu;1188 1189 // delete all actions and views contained in Menu1190 // TODO: find a better way to handle this1191 1192 delete moleculeView;1193 1194 delete setMoleculeAction;1195 delete manipulateMoleculeAction;1196 delete mergeMoleculeAction;1197 delete manipulateAtomsAction;1198 delete editConfigAction;1199 delete saveConfigAction;1200 delete doTestAction;1201 delete quitAction;1202 1203 delete createMoleculeAction;1204 delete loadMoleculeAction;1205 delete changeFilenameAction;1206 delete giveFilenameAction;1207 delete parseAtomsAction;1208 delete eraseMoleculeAction;1209 delete returnAction;1210 1211 1119 }; -
src/menu.hpp
rcc04b7 r12b845 34 34 void simpleMergeMolecules(MoleculeListClass *molecules); 35 35 36 protected:37 36 void AddAtoms(periodentafel *, molecule *); 38 37 void AlignAtoms(periodentafel *, molecule *);
Note:
See TracChangeset
for help on using the changeset viewer.