Changeset 6180 for code/branches/presentation2/src/libraries/core/Shell.cc
- Timestamp:
- Nov 29, 2009, 10:43:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/Shell.cc
r6139 r6180 45 45 SetConsoleCommandShortcut(OutputHandler, debug); 46 46 47 Shell::Shell(const std::string& consoleName, bool bScrollable , bool bPrependOutputLevel)47 Shell::Shell(const std::string& consoleName, bool bScrollable) 48 48 : OutputListener(consoleName) 49 49 , inputBuffer_(new InputBuffer()) 50 50 , consoleName_(consoleName) 51 , bPrependOutputLevel_(bPrependOutputLevel)52 51 , bScrollable_(bScrollable) 53 52 { … … 191 190 } 192 191 193 void Shell::addOutputLine(const std::string& line, int level)192 void Shell::addOutputLine(const std::string& line, LineType type) 194 193 { 195 194 // Make sure we really only have one line per line (no new lines!) … … 197 196 for (unsigned i = 0; i < lines.size(); ++i) 198 197 { 199 if (level <= this->softDebugLevel_) 200 this->outputLines_.push_front(lines[i]); 198 this->outputLines_.push_front(std::make_pair(lines[i], type)); 201 199 this->updateListeners<&ShellListener::lineAdded>(); 202 200 } … … 214 212 } 215 213 216 std::list<std::string>::const_iterator Shell::getNewestLineIterator() const214 Shell::LineList::const_iterator Shell::getNewestLineIterator() const 217 215 { 218 216 if (this->scrollPosition_) … … 222 220 } 223 221 224 std::list<std::string>::const_iterator Shell::getEndIterator() const222 Shell::LineList::const_iterator Shell::getEndIterator() const 225 223 { 226 224 return this->outputLines_.end(); … … 264 262 if (this->bFinishedLastLine_) 265 263 { 266 if (this->bPrependOutputLevel_) 267 { 268 if (level == 0) 269 output.insert(0, 1, static_cast<char>(-1)); 270 else 271 output.insert(0, 1, static_cast<char>(level)); 272 } 273 274 this->outputLines_.push_front(output); 264 this->outputLines_.push_front(std::make_pair(output, static_cast<LineType>(level))); 275 265 276 266 if (this->scrollPosition_) … … 288 278 else 289 279 { 290 (*this->outputLines_.begin())+= output;280 this->outputLines_.front().first += output; 291 281 this->bFinishedLastLine_ = newline; 292 282 this->updateListeners<&ShellListener::onlyLastLineChanged>(); … … 325 315 326 316 if (!CommandExecutor::execute(this->inputBuffer_->get())) 327 this->addOutputLine("Error: Can't execute \"" + this->inputBuffer_->get() + "\".", 1);317 this->addOutputLine("Error: Can't execute \"" + this->inputBuffer_->get() + "\".", Error); 328 318 329 319 this->clearInput(); … … 333 323 { 334 324 this->inputBuffer_->set(CommandExecutor::complete(this->inputBuffer_->get())); 335 this->addOutputLine(CommandExecutor::hint(this->inputBuffer_->get()), -1);325 this->addOutputLine(CommandExecutor::hint(this->inputBuffer_->get()), Hint); 336 326 337 327 this->inputChanged();
Note: See TracChangeset
for help on using the changeset viewer.