source: src/UIElements/TextWindow.cpp@ 8f67e2

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
Last change on this file since 8f67e2 was 12b845, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Seperated building of mainWindow and contained Menus

  • Moved code to build Menus to builder.cpp
  • Moved WindowGeneration code to constructor
  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * TextWindow.cpp
3 *
4 * Created on: Jan 7, 2010
5 * Author: crueger
6 */
7
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
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"
42
43#include <iostream>
44
45using namespace std;
46
47// TODO: see what code can be moved to a base class for Graphic and Text Windows
48TextWindow::TextWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName)
49{
50 old_menu = new oldmenu;
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);
99}
100
101TextWindow::~TextWindow()
102{
103 delete old_menu;
104 delete quitAction;
105 delete returnFromEditMoleculeAction;
106 delete moleculeView;
107 delete main_menu;
108}
109
110void TextWindow::display() {
111 main_menu->display();
112}
Note: See TracBrowser for help on using the repository browser.