Changeset 5b9bba
- Timestamp:
- Dec 16, 2009, 12:30:16 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:
- 9d8609
- Parents:
- f767d4
- git-author:
- Tillmann Crueger <crueger@…> (12/14/09 10:31:58)
- git-committer:
- Frederik Heber <heber@…> (12/16/09 12:30:16)
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Menu/MenuItem.cpp
rf767d4 r5b9bba 16 16 { 17 17 description = new string(_description); 18 menu->addItem(this);18 add_to_menu(menu); 19 19 } 20 20 … … 43 43 return s.str(); 44 44 } 45 46 void MenuItem::add_to_menu(Menu* menu) { 47 if(!wasAdded()) { 48 menu->addItem(this); 49 added=true; 50 } 51 } 52 53 bool MenuItem::wasAdded(){ 54 return added; 55 } -
src/Menu/MenuItem.hpp
rf767d4 r5b9bba 19 19 char trigger; 20 20 string *description; 21 bool added; 21 22 22 23 public: … … 32 33 char getTrigger(); 33 34 35 void add_to_menu(Menu*); 36 bool wasAdded(); 37 34 38 protected: 35 39 void setDescription(string); -
src/Menu/SeperatorItem.cpp
rf767d4 r5b9bba 5 5 * Author: crueger 6 6 */ 7 #include <string> 8 #include <sstream> 7 9 8 10 #include "Menu/SeperatorItem.hpp" 9 11 #include "Menu/Menu.hpp" 10 #include <string> 12 #include "defs.hpp" 13 11 14 12 15 SeperatorItem::SeperatorItem(Menu* menu): 13 MenuItem('\0',"",menu) 16 MenuItem('\0',"",menu), 17 spacer(STD_SEPERATOR_SPACER), 18 length(STD_MENU_LENGTH) 19 { 20 // TODO Auto-generated constructor stub 21 22 } 23 24 SeperatorItem::SeperatorItem(Menu* menu,char _spacer, int _length): 25 MenuItem('\0',"",menu), 26 spacer(_spacer), 27 length(_length) 14 28 { 15 29 // TODO Auto-generated constructor stub … … 31 45 32 46 const string SeperatorItem::formatEntry(){ 33 return string ("---------------------------------------------------"); 47 stringstream s; 48 for(int i=0; i<length;i++) 49 s << spacer; 50 return s.str(); 34 51 } -
src/Menu/SeperatorItem.hpp
rf767d4 r5b9bba 15 15 public: 16 16 SeperatorItem(Menu*); 17 SeperatorItem(Menu*,char,int); 17 18 virtual ~SeperatorItem(); 18 19 … … 23 24 24 25 virtual const string formatEntry(); 26 private: 27 char spacer; 28 int length; 25 29 }; 26 30 -
src/Menu/SubMenuItem.cpp
rf767d4 r5b9bba 8 8 #include "SubMenuItem.hpp" 9 9 10 SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _menu,ostream& _outputter,string _title) : 10 SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _menu, 11 ostream& _outputter,string _title,char _spacer, int _length) : 12 MenuItem(_trigger,_description,_menu), 13 TextMenu(_outputter,_title,_spacer,_length) 14 { 15 } 16 17 SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _menu, 18 ostream& _outputter,string _title) : 11 19 MenuItem(_trigger,_description,_menu), 12 20 TextMenu(_outputter,_title) -
src/Menu/SubMenuItem.hpp
rf767d4 r5b9bba 10 10 { 11 11 public: 12 SubMenuItem(char,const char*,Menu *,ostream&,string,char,int); 12 13 SubMenuItem(char,const char*,Menu *,ostream&,string); 13 14 virtual ~SubMenuItem(); -
src/Menu/TextMenu.cpp
rf767d4 r5b9bba 8 8 #include <boost/bind.hpp> 9 9 #include <iostream> 10 #include "TextMenu.hpp" 11 #include "MenuItem.hpp" 10 #include <cmath> 11 #include "defs.hpp" 12 #include "Menu/TextMenu.hpp" 13 #include "Menu/MenuItem.hpp" 14 15 TextMenu::TextMenu(ostream& _outputter, string _title, char _spacer,int _length) : 16 outputter(_outputter), 17 title(_title), 18 spacer(_spacer), 19 length(_length), 20 quit(false) 21 { 22 } 12 23 13 24 TextMenu::TextMenu(ostream& _outputter, string _title) : 14 25 outputter(_outputter), 15 26 title(_title), 27 spacer(STD_MENU_TITLE_SPACER), 28 length(STD_MENU_LENGTH), 16 29 quit(false) 17 30 { … … 48 61 char choice; 49 62 do { 50 outputter << title << "\n"; 63 int pre = floor((length - title.length()) /2.0); 64 int post = ceil((length - title.length()) /2.0); 65 for(int i=0;i<pre;i++) 66 outputter << spacer; 67 outputter << title; 68 for(int i=0;i<post;i++) 69 outputter << spacer; 70 outputter << '\n'; 51 71 for_each(items.begin(), items.end(), boost::bind(&TextMenu::showEntry,this,_1)); 52 72 outputter.flush(); -
src/Menu/TextMenu.hpp
rf767d4 r5b9bba 20 20 { 21 21 public: 22 TextMenu(ostream&,string,char,int); 22 23 TextMenu(ostream&,string); 23 24 virtual ~TextMenu(); … … 37 38 ostream& outputter; 38 39 string title; 40 char spacer; 41 int length; 42 39 43 bool quit; 40 44 }; -
src/defs.hpp
rf767d4 r5b9bba 77 77 #define UPDATECOUNT 10 //!< update ten sites per BOSSANOVA interval 78 78 79 #define STD_MENU_LENGTH 60 80 #define STD_MENU_TITLE_SPACER '=' 81 #define STD_SEPERATOR_SPACER '-' 82 79 83 #endif /*DEFS_HPP_*/
Note:
See TracChangeset
for help on using the changeset viewer.