Changeset b31bc4 for src/UIElements


Ignore:
Timestamp:
Mar 25, 2010, 12:01:58 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, Candidate_v1.7.0, 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:
9848ba
Parents:
66e95e (diff), d56640 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'StructureRefactoring' into MenuRefactoring

Location:
src/UIElements
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextWindow.cpp

    r66e95e rb31bc4  
    9494  populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode);
    9595
    96   returnFromEditMoleculeAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false);
     96  Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu);
    9797  MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction);
    9898
     
    108108  delete old_menu;
    109109  delete quitAction;
    110   delete returnFromEditMoleculeAction;
    111110  delete moleculeView;
    112111  delete statusIndicator;
  • src/UIElements/TextWindow.hpp

    r66e95e rb31bc4  
    2929  // some actions only needed in textMenus
    3030  Action *quitAction;
    31   Action *returnFromEditMoleculeAction;
    3231  // all views that are contained in the main Menu
    3332  StringView *moleculeView;
  • src/UIElements/UIFactory.cpp

    r66e95e rb31bc4  
    88
    99#include <cassert>
     10#include "Patterns/Singleton_impl.hpp"
    1011#include "UIElements/UIFactory.hpp"
    1112
    1213// all factories that can be used:
    1314#include "UIElements/TextUIFactory.hpp"
    14 
    15 UIFactory *UIFactory::theFactory = 0;
    1615
    1716UIFactory::UIFactory()
     
    2726
    2827void UIFactory::makeUserInterface(InterfaceTypes type) {
    29   assert(theFactory == 0 && "makeUserInterface should only be called once");
    3028  switch(type) {
    3129    case Text :
    32       theFactory = new TextUIFactory();
     30      setInstance(new TextUIFactory());
    3331      break;
    3432
     
    3937}
    4038
    41 UIFactory* UIFactory::get(){
    42   assert(theFactory != 0 && "No UserInterface created prior to factory access");
    43   return theFactory;
    44 }
    45 
    46 
    47 void UIFactory::purgeInstance(){
    48   if(theFactory) {
    49     delete theFactory;
    50     theFactory = 0;
    51   }
    52 }
     39CONSTRUCT_SINGLETON(UIFactory)
  • src/UIElements/UIFactory.hpp

    r66e95e rb31bc4  
    1717
    1818struct menuPopulaters;
     19
     20#include "Patterns/Singleton.hpp"
     21
    1922/**
    2023 * Abstract Factory to create any kind of User interface object needed by the programm.
     
    2427 * UIs can be handled in a concise abstract way.
    2528 */
    26 class UIFactory
     29class UIFactory : public Singleton<UIFactory,false>
    2730{
    2831
     
    4548  UIFactory();
    4649
    47 // singleton stuff
    48 private:
    49   static UIFactory *theFactory;
    50 
    5150public:
    5251  /**
     
    5554  static void makeUserInterface(InterfaceTypes type);
    5655
    57   /**
    58    * get the previously created factory
    59    */
    60   static UIFactory* get();
    61 
    62   /**
    63    * Destroy the created factory.
    64    *
    65    * Make sure that all UIElements that were created by the factory are destroyed before calling this method.
    66    */
    67   static void purgeInstance();
    6856};
    6957
Note: See TracChangeset for help on using the changeset viewer.