- Timestamp:
- Aug 23, 2011, 12:45:53 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/core/command/IOConsoleWindows.cc
r8729 r8858 34 34 #include "util/Clock.h" 35 35 #include "util/Math.h" 36 #include "util/output/ConsoleWriter.h" 36 37 #include "core/Game.h" 37 38 #include "core/input/InputBuffer.h" … … 43 44 //! Redirects std::cout, creates the corresponding Shell and changes the terminal mode 44 45 IOConsole::IOConsole() 45 : shell_(new Shell(" IOConsole", false))46 : shell_(new Shell("Console", false)) 46 47 , buffer_(shell_->getInputBuffer()) 47 48 , cout_(std::cout.rdbuf()) … … 52 53 { 53 54 // Disable standard this->cout_ logging 54 OutputHandler::getInstance().disableCout();55 ConsoleWriter::getInstance().disable(); 55 56 // Redirect std::cout to an ostringstream 56 57 // (Other part is in the initialiser list) … … 95 96 std::cout.flush(); 96 97 if (!this->origCout_.str().empty()) 97 this->shell_->addOutput(this->origCout_.str(), Shell:: None);98 this->shell_->addOutput(this->origCout_.str(), Shell::Cout); 98 99 99 100 this->shell_->unregisterListener(this); … … 108 109 std::cout.rdbuf(this->cout_.rdbuf()); 109 110 // Enable standard this->cout_ logging again 110 OutputHandler::getInstance().enableCout();111 ConsoleWriter::getInstance().enable(); 111 112 112 113 resetTerminalMode(); … … 188 189 if (!this->origCout_.str().empty()) 189 190 { 190 this->shell_->addOutput(this->origCout_.str(), Shell:: None);191 this->shell_->addOutput(this->origCout_.str(), Shell::Cout); 191 192 this->origCout_.str(""); 192 193 } … … 200 201 switch (type) 201 202 { 202 case Shell::Error: colour = FOREGROUND_INTENSITY | FOREGROUND_RED; break; 203 case Shell::Warning: colour = FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED; break; 204 case Shell::Info: 205 case Shell::Debug: 206 case Shell::Verbose: 207 case Shell::Ultra: colour = FOREGROUND_INTENSITY ; break; 208 case Shell::Command: colour = FOREGROUND_GREEN | FOREGROUND_BLUE; break; 209 case Shell::Hint: colour = FOREGROUND_GREEN | FOREGROUND_RED ; break; 210 case Shell::TDebug: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE; break; 211 default: colour = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; break; 203 case Shell::Message: 204 case Shell::DebugOutput: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 205 206 case Shell::UserError: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | 0 ; break; 207 case Shell::UserWarning: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 208 case Shell::UserStatus: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | 0 ; break; 209 case Shell::UserInfo: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 210 211 case Shell::InternalError: colour = 0 | FOREGROUND_RED | 0 | 0 ; break; 212 case Shell::InternalWarning: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 213 case Shell::InternalStatus: colour = 0 | 0 | FOREGROUND_GREEN | 0 ; break; 214 case Shell::InternalInfo: colour = 0 | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 215 216 case Shell::Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 217 case Shell::VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 218 case Shell::VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 219 220 case Shell::Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 221 case Shell::Hint: colour = 0 | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 222 223 default: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 212 224 } 213 225 … … 238 250 || !SetConsoleMode(this->stdInHandle_, 0)) 239 251 { 240 COUT(1) << "Error: Could not set Windows console settings" << std::endl;252 orxout(user_error) << "Could not set Windows console settings" << endl; 241 253 return; 242 254 } … … 318 330 void IOConsole::executed() 319 331 { 320 this->shell_->addOutput(this->promptString_ + this->shell_->getInput() + '\n', Shell::Command);332 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command); 321 333 } 322 334 … … 377 389 } 378 390 379 //! Called if only the last output-line has changed380 void IOConsole::onlyLastLineChanged()381 {382 int newLineHeight = 1 + this->shell_->getNewestLineIterator()->first.size() / this->terminalWidth_;383 // Compute the number of new lines needed384 int newLines = newLineHeight - this->lastOutputLineHeight_;385 this->lastOutputLineHeight_ = newLineHeight;386 // Scroll console if necessary387 if (newLines > 0) // newLines < 0 is assumed impossible388 this->createNewOutputLines(newLines);389 Shell::LineList::const_iterator it = this->shell_->getNewestLineIterator();390 this->printOutputLine(it->first, it->second, makeCOORD(0, this->inputLineRow_ - newLineHeight));391 }392 393 391 //! Called if a new output line was added 394 392 void IOConsole::lineAdded()
Note: See TracChangeset
for help on using the changeset viewer.