Changeset f9352d for src/Menu


Ignore:
Timestamp:
Mar 26, 2010, 3:13:31 PM (15 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, 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:
0a4f7f, 2efa90, 4415da, 9cf88c
Parents:
f6bbc6
Message:

Added mechanism that deactivates undo and redo menupoint if not applicable

Location:
src/Menu
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Menu/ActionMenuItem.cpp

    rf6bbc6 rf9352d  
    2020
    2121ActionMenuItem::~ActionMenuItem()
    22 {
    23   // TODO Auto-generated destructor stub
    24 }
     22{}
    2523
    2624void ActionMenuItem::doTrigger() {
    2725  action->call();
    2826}
     27
     28bool ActionMenuItem::isActive() {
     29  return action->isActive();
     30}
  • src/Menu/ActionMenuItem.hpp

    rf6bbc6 rf9352d  
    2626  virtual void doTrigger();
    2727
     28  virtual bool isActive();
     29
    2830private:
    2931  Action* action; //!< this action will be called when the trigger matches
  • src/Menu/MenuItem.cpp

    rf6bbc6 rf9352d  
    7878  return added;
    7979}
     80
     81bool MenuItem::isActive(){
     82  return true;
     83}
  • src/Menu/MenuItem.hpp

    rf6bbc6 rf9352d  
    2121 */
    2222class MenuItem {
    23 private:
    24   char trigger;
    25   string *description;
    26   bool added;
    27 
    2823public:
    2924  MenuItem(char,const char*,Menu*);
     
    4136  bool wasAdded();
    4237
     38  virtual bool isActive();
     39
    4340protected:
    4441  void setDescription(string);
     42
     43private:
     44  char trigger;
     45  string *description;
     46  bool added;
    4547};
    4648
  • src/Menu/TextMenu.cpp

    rf6bbc6 rf9352d  
    5252
    5353void TextMenu::showEntry(MenuItem* entry){
    54   outputter << entry->formatEntry() << "\n";
     54  if(entry->isActive()==false){
     55    outputter << "(";
     56  }
     57  outputter << entry->formatEntry();
     58  if(entry->isActive()==false){
     59    outputter << ")";
     60  }
     61  outputter << "\n";
    5562}
    5663
     
    7582    list<MenuItem*>::iterator iter;
    7683    for(iter = items.begin(); iter!=items.end();iter++){
    77       somethingChosen |= (*iter)->checkTrigger(choice);
     84      if((*iter)->isActive()){
     85        somethingChosen |= (*iter)->checkTrigger(choice);
     86      }
    7887    }
    7988    // see if something was chosen and call default Item if not
Note: See TracChangeset for help on using the changeset viewer.