Changeset 770138 for molecuilder/src
- Timestamp:
- Mar 26, 2010, 3:13:31 PM (16 years ago)
- Children:
- 0f7883, 71910a, abd4a1
- Parents:
- cbc639
- Location:
- molecuilder/src
- Files:
-
- 9 edited
-
Actions/Action.cpp (modified) (1 diff)
-
Actions/Action.hpp (modified) (1 diff)
-
Actions/ActionHistory.cpp (modified) (3 diffs)
-
Actions/ActionHistory.hpp (modified) (3 diffs)
-
Menu/ActionMenuItem.cpp (modified) (1 diff)
-
Menu/ActionMenuItem.hpp (modified) (1 diff)
-
Menu/MenuItem.cpp (modified) (1 diff)
-
Menu/MenuItem.hpp (modified) (2 diffs)
-
Menu/TextMenu.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Actions/Action.cpp
rcbc639 r770138 53 53 return performRedo(_state); 54 54 } 55 56 57 bool Action::isActive(){ 58 return true; 59 } -
molecuilder/src/Actions/Action.hpp
rcbc639 r770138 44 44 virtual bool shouldUndo()=0; 45 45 46 virtual bool isActive(); 47 46 48 virtual const std::string getName(); 47 49 -
molecuilder/src/Actions/ActionHistory.cpp
rcbc639 r770138 34 34 Action::state_ptr oldState = elem.action->redo(elem.state); 35 35 history.push_back(HistoryElement(elem.action,oldState)); 36 } 37 38 bool ActionHistory::hasUndo(){ 39 return history.size()>0; 40 } 41 42 bool ActionHistory::hasRedo(){ 43 return yrotsih.size()>0; 36 44 } 37 45 … … 73 81 } 74 82 83 bool ActionHistory::UndoAction::isActive(){ 84 return hist->hasUndo(); 85 } 86 75 87 Action::state_ptr ActionHistory::UndoAction::performCall(){ 76 88 hist->undoLast(); … … 103 115 } 104 116 117 bool ActionHistory::RedoAction::isActive(){ 118 return hist->hasRedo(); 119 } 120 105 121 Action::state_ptr ActionHistory::RedoAction::performCall(){ 106 122 hist->redoLast(); -
molecuilder/src/Actions/ActionHistory.hpp
rcbc639 r770138 37 37 virtual bool shouldUndo(); 38 38 39 virtual bool isActive(); 40 39 41 private: 40 42 virtual Action::state_ptr performCall(); … … 53 55 virtual bool shouldUndo(); 54 56 57 virtual bool isActive(); 58 55 59 private: 56 60 virtual Action::state_ptr performCall(); … … 65 69 void undoLast(); 66 70 void redoLast(); 71 72 bool hasUndo(); 73 bool hasRedo(); 67 74 68 75 void addElement(Action*,Action::state_ptr); -
molecuilder/src/Menu/ActionMenuItem.cpp
rcbc639 r770138 20 20 21 21 ActionMenuItem::~ActionMenuItem() 22 { 23 // TODO Auto-generated destructor stub 24 } 22 {} 25 23 26 24 void ActionMenuItem::doTrigger() { 27 25 action->call(); 28 26 } 27 28 bool ActionMenuItem::isActive() { 29 return action->isActive(); 30 } -
molecuilder/src/Menu/ActionMenuItem.hpp
rcbc639 r770138 26 26 virtual void doTrigger(); 27 27 28 virtual bool isActive(); 29 28 30 private: 29 31 Action* action; //!< this action will be called when the trigger matches -
molecuilder/src/Menu/MenuItem.cpp
rcbc639 r770138 78 78 return added; 79 79 } 80 81 bool MenuItem::isActive(){ 82 return true; 83 } -
molecuilder/src/Menu/MenuItem.hpp
rcbc639 r770138 21 21 */ 22 22 class MenuItem { 23 private:24 char trigger;25 string *description;26 bool added;27 28 23 public: 29 24 MenuItem(char,const char*,Menu*); … … 41 36 bool wasAdded(); 42 37 38 virtual bool isActive(); 39 43 40 protected: 44 41 void setDescription(string); 42 43 private: 44 char trigger; 45 string *description; 46 bool added; 45 47 }; 46 48 -
molecuilder/src/Menu/TextMenu.cpp
rcbc639 r770138 52 52 53 53 void 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"; 55 62 } 56 63 … … 75 82 list<MenuItem*>::iterator iter; 76 83 for(iter = items.begin(); iter!=items.end();iter++){ 77 somethingChosen |= (*iter)->checkTrigger(choice); 84 if((*iter)->isActive()){ 85 somethingChosen |= (*iter)->checkTrigger(choice); 86 } 78 87 } 79 88 // see if something was chosen and call default Item if not
Note:
See TracChangeset
for help on using the changeset viewer.
