Changeset 1637 for code/branches/input/src/core/Shell.cc
- Timestamp:
- Jul 20, 2008, 6:49:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/Shell.cc
r1540 r1637 34 34 #include "ConsoleCommand.h" 35 35 #include "input/InputInterfaces.h" 36 #include "input/SimpleInputState.h" 37 #include "input/InputManager.h" 36 38 37 39 #define SHELL_UPDATE_LISTENERS(function) \ … … 57 59 this->clearLines(); 58 60 59 this->inputBuffer_ = 0; 60 this->setInputBuffer(new InputBuffer()); 61 this->inputBuffer_ = new InputBuffer(); 62 this->configureInputBuffer(); 63 InputManager::createSimpleInputState("console", 40)->setKeyHandler(this->inputBuffer_); 61 64 62 65 this->outputBuffer_.registerListener(this); 63 66 64 67 this->setConfigValues(); 68 } 69 70 Shell::~Shell() 71 { 72 SimpleInputState * inputState = dynamic_cast<SimpleInputState*>(InputManager::getState("console")); 73 if (inputState) 74 { 75 inputState->removeAndDestroyAllHandlers(); 76 InputManager::destroyState("console"); 77 } 65 78 } 66 79 … … 97 110 } 98 111 99 void Shell::setInputBuffer(InputBuffer* buffer) 100 { 101 if (this->inputBuffer_) 102 { 103 this->inputBuffer_->unregisterListener(this); 104 // TODO: may be very dangerous. InputManager already deletes InputBuffer instance!!! 105 delete this->inputBuffer_; 106 } 107 108 this->inputBuffer_ = buffer; 112 void Shell::configureInputBuffer() 113 { 109 114 this->inputBuffer_->registerListener(this, &Shell::inputChanged, true); 110 115 this->inputBuffer_->registerListener(this, &Shell::execute, '\r', false);
Note: See TracChangeset
for help on using the changeset viewer.