Changeset 5784 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Nov 26, 2005, 8:48:11 PM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell.h
r5781 r5784 23 23 class ShellInput; 24 24 class Material; 25 template<class T> class tIterator;26 25 27 26 //! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands -
trunk/src/lib/shell/shell_buffer.h
r5781 r5784 15 15 // FORWARD DECLARATION 16 16 class Shell; 17 template<class T> class tList; 17 18 18 #ifndef NULL 19 19 #define NULL 0 //!< a pointer to NULL -
trunk/src/lib/shell/shell_command.h
r5779 r5784 17 17 18 18 // FORWARD DECLARATION 19 template<class T> class tList;20 19 class ShellCommandClass; 21 20 class ShellCommandAlias; -
trunk/src/lib/shell/shell_completion.h
r5780 r5784 15 15 class BaseObject; 16 16 class ShellInput; 17 template<class T> class tList;18 17 #ifndef NULL 19 18 #define NULL 0 //!< a pointer to NULL -
trunk/src/lib/shell/shell_input.cc
r5639 r5784 49 49 this->inputLine = new char[1]; 50 50 this->inputLine[0] = '\0'; 51 this->history = new tList<char>; 52 this->historyIT = this->history->getIterator(); 51 this->historyIT = this->history.begin(); 53 52 this->setHistoryLength(50); 54 53 this->historyScrolling = false; … … 75 74 delete this->completion; 76 75 77 char* histEl = this->historyIT->firstElement(); 78 while (histEl != NULL) 79 { 80 delete[] histEl; 81 histEl = this->historyIT->nextElement(); 82 } 83 delete this->historyIT; 84 delete this->history; 76 while (!this->history.empty()) 77 { 78 delete[] this->history.front(); 79 this->history.pop_front(); 80 } 85 81 } 86 82 … … 139 135 if (this->historyScrolling) 140 136 { 141 delete[] this->history ->lastElement();142 this->history ->remove(this->history->lastElement());137 delete[] this->history.back(); 138 this->history.pop_back(); 143 139 this->historyScrolling = false; 144 140 } … … 160 156 if (this->historyScrolling) 161 157 { 162 delete[] this->history ->lastElement();163 this->history ->remove(this->history->lastElement());158 delete[] this->history.back(); 159 this->history.pop_back(); 164 160 this->historyScrolling = false; 165 161 } … … 181 177 if (this->historyScrolling) 182 178 { 183 delete[] this->history ->lastElement();184 this->history ->remove(this->history->lastElement());179 delete[] this->history.back(); 180 this->history.pop_back(); 185 181 this->historyScrolling = false; 186 182 } … … 220 216 if (this->historyScrolling) 221 217 { 222 delete[] this->history ->lastElement();223 this->history ->remove(this->history->lastElement());218 delete[] this->history.back(); 219 this->history.pop_back(); 224 220 this->historyScrolling = false; 225 221 } 226 222 227 223 // adding the new Command to the History 228 this->history ->add(newCommand);229 if (this->history ->getSize() > this->historyLength)230 { 231 delete[] this->history ->firstElement();232 this->history ->remove(this->history->firstElement());224 this->history.push_back(newCommand); 225 if (this->history.size() > this->historyLength) 226 { 227 delete[] this->history.front(); 228 this->history.pop_front(); 233 229 } 234 230 … … 248 244 char* currentText = new char[strlen(this->inputLine)+1]; 249 245 strcpy(currentText, this->inputLine); 250 this->history ->add(currentText);246 this->history.push_back(currentText); 251 247 this->historyScrolling = true; 252 this->historyIT ->lastElement();253 } 254 255 char* prevElem = this->historyIT->prevStep();248 this->historyIT = this->history.end(); 249 } 250 251 char* prevElem = *(this->historyIT--); 256 252 if (prevElem == NULL) 257 253 return; … … 270 266 if (!this->historyScrolling) 271 267 return; 272 char* nextElem = this->historyIT->nextStep();268 char* nextElem = *(this->historyIT++); 273 269 if (nextElem == NULL) 274 270 return; -
trunk/src/lib/shell/shell_input.h
r5344 r5784 12 12 #include "text.h" 13 13 #include "event_listener.h" 14 #include <list> 14 15 15 16 // FORWARD DECLARATION 16 template<class T> class tList;17 template<class T> class tIterator;18 17 class ShellCompletion; 19 18 … … 55 54 private: 56 55 // HANDLING TEXT INPUT 57 ShellCompletion* completion; //!< The Completion Interface.56 ShellCompletion* completion; //!< The Completion Interface. 58 57 59 char* inputLine; //!< the Char-Array of the Buffer60 float repeatRate; //!< The Repeat-Delay.61 float repeatDelay; //!< The delay of the first Character of a given Character.62 float delayed; //!< how much of the delay is remaining.63 int pressedKey; //!< the pressed key that will be repeated.58 char* inputLine; //!< the Char-Array of the Buffer 59 float repeatRate; //!< The Repeat-Delay. 60 float repeatDelay; //!< The delay of the first Character of a given Character. 61 float delayed; //!< how much of the delay is remaining. 62 int pressedKey; //!< the pressed key that will be repeated. 64 63 65 tList<char>*history; //!< The history of given commands.66 tIterator<char>*historyIT;67 unsigned int historyLength; //!< The maximum length of the InputHistory.68 bool historyScrolling; //!< true if we are scrolling through the history.64 std::list<char*> history; //!< The history of given commands. 65 std::list<char*>::iterator historyIT; 66 unsigned int historyLength; //!< The maximum length of the InputHistory. 67 bool historyScrolling; //!< true if we are scrolling through the history. 69 68 }; 70 69
Note: See TracChangeset
for help on using the changeset viewer.