Changeset 6375 for code/branches/presentation2
- Timestamp:
- Dec 18, 2009, 12:11:16 AM (15 years ago)
- Location:
- code/branches/presentation2/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/IOConsole.cc
r6350 r6375 60 60 void IOConsole::executed() 61 61 { 62 this->shell_->addOutput Line(this->promptString_ + this->shell_->getInput(), Shell::Command);62 this->shell_->addOutput(this->promptString_ + this->shell_->getInput() + '\n', Shell::Command); 63 63 } 64 64 … … 509 509 std::cout.flush(); 510 510 if (!this->origCout_.str().empty()) 511 this->shell_->addOutput Line(this->origCout_.str(), Shell::None);511 this->shell_->addOutput(this->origCout_.str(), Shell::None); 512 512 513 513 this->shell_->unregisterListener(this); … … 602 602 if (!this->origCout_.str().empty()) 603 603 { 604 this->shell_->addOutput Line(this->origCout_.str(), Shell::None);604 this->shell_->addOutput(this->origCout_.str(), Shell::None); 605 605 this->origCout_.str(""); 606 606 } -
code/branches/presentation2/src/libraries/core/Shell.cc
r6374 r6375 189 189 } 190 190 191 void Shell::addOutputLine(const std::string& line, LineType type) 192 { 193 // Make sure we really only have one line per line (no new lines!) 194 SubString lines(line, '\n'); 195 for (unsigned i = 0; i < lines.size(); ++i) 196 { 197 this->outputLines_.push_front(std::make_pair(lines[i], type)); 198 199 if (this->scrollPosition_) 200 this->scrollPosition_++; 201 else 202 this->scrollIterator_ = this->outputLines_.begin(); 203 204 this->bFinishedLastLine_ = true; 205 if (!this->scrollPosition_) 206 this->updateListeners<&ShellListener::lineAdded>(); 207 } 191 void Shell::addOutput(const std::string& text, LineType type) 192 { 193 this->outputBuffer_ << text; 194 this->outputChanged(type); 208 195 } 209 196 … … 248 235 } 249 236 250 void Shell::outputChanged(int l evel)237 void Shell::outputChanged(int lineType) 251 238 { 252 239 bool newline = false; … … 268 255 269 256 if (this->bFinishedLastLine_) 270 this->addOutputLine(output, static_cast<LineType>(level)); 257 { 258 this->outputLines_.push_front(std::make_pair(output, static_cast<LineType>(lineType))); 259 260 if (this->scrollPosition_) 261 this->scrollPosition_++; 262 else 263 this->scrollIterator_ = this->outputLines_.begin(); 264 265 this->bFinishedLastLine_ = newline; 266 267 if (!this->scrollPosition_) 268 this->updateListeners<&ShellListener::lineAdded>(); 269 } 271 270 else 272 271 { 273 272 this->outputLines_.front().first += output; 273 this->bFinishedLastLine_ = newline; 274 274 this->updateListeners<&ShellListener::onlyLastLineChanged>(); 275 275 } … … 308 308 309 309 if (!CommandExecutor::execute(this->inputBuffer_->get())) 310 this->addOutputLine("Error: Can't execute \"" + this->inputBuffer_->get() + "\".", Error); 310 { 311 this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\"." << std::endl; 312 this->outputChanged(Error); 313 } 311 314 312 315 this->clearInput(); … … 316 319 { 317 320 this->inputBuffer_->set(CommandExecutor::complete(this->inputBuffer_->get())); 318 this->addOutputLine(CommandExecutor::hint(this->inputBuffer_->get()), Hint); 321 this->outputBuffer_ << CommandExecutor::hint(this->inputBuffer_->get()) << std::endl; 322 this->outputChanged(Hint); 319 323 320 324 this->inputChanged(); -
code/branches/presentation2/src/libraries/core/Shell.h
r6374 r6375 103 103 LineList::const_iterator getEndIterator() const; 104 104 105 void addOutput Line(const std::string& line, LineType type = None);105 void addOutput(const std::string& text, LineType type = None); 106 106 void clearOutput(); 107 107 -
code/branches/presentation2/src/orxonox/overlays/InGameConsole.cc
r6223 r6375 340 340 void InGameConsole::executed() 341 341 { 342 this->shell_->addOutput Line(this->shell_->getInput(), Shell::Command);342 this->shell_->addOutput(this->shell_->getInput() + '\n', Shell::Command); 343 343 } 344 344
Note: See TracChangeset
for help on using the changeset viewer.