Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8795 for code/branches


Ignore:
Timestamp:
Jul 29, 2011, 10:26:45 PM (13 years ago)
Author:
landauf
Message:

Shell and its derivatives are now based on the new output system

Location:
code/branches/output/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/core/command/IOConsolePOSIX.cc

    r8729 r8795  
    3737#include "util/Clock.h"
    3838#include "util/Math.h"
     39#include "util/output/ConsoleWriter.h"
    3940#include "core/Game.h"
    4041#include "core/input/InputBuffer.h"
     
    7475
    7576        // Disable standard std::cout logging
    76         OutputHandler::getInstance().disableCout();
     77        ConsoleWriter::getInstance().disable();
    7778        // Redirect std::cout to an ostringstream
    7879        // (Other part is in the initialiser list)
     
    8889        std::cout.flush();
    8990        if (!this->origCout_.str().empty())
    90             this->shell_->addOutput(this->origCout_.str(), Shell::None);
     91            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
    9192        // Erase input and status lines
    9293        this->cout_ << "\033[1G\033[J";
     
    102103        std::cout.rdbuf(this->cout_.rdbuf());
    103104        // Enable standard std::cout logging again
    104         OutputHandler::getInstance().enableCout();
     105        ConsoleWriter::getInstance().enable();
    105106    }
    106107
     
    229230        if (!this->origCout_.str().empty())
    230231        {
    231             this->shell_->addOutput(this->origCout_.str(), Shell::None);
     232            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
    232233            this->origCout_.str("");
    233234        }
     
    239240        switch (type)
    240241        {
    241         case Shell::Error:   this->cout_ << "\033[91m"; break;
    242         case Shell::Warning: this->cout_ << "\033[93m"; break;
    243         case Shell::Info:    this->cout_ << "\033[90m"; break;
    244         case Shell::Debug:   this->cout_ << "\033[90m"; break;
    245         case Shell::Verbose: this->cout_ << "\033[90m"; break;
    246         case Shell::Ultra:   this->cout_ << "\033[90m"; break;
    247         case Shell::Command: this->cout_ << "\033[36m"; break;
    248         case Shell::Hint:    this->cout_ << "\033[33m"; break;
    249         case Shell::TDebug:  this->cout_ << "\033[95m"; break;
    250         default: break;
     242            case Shell::DebugOutput:     this->cout_ << "\033[0m"; break;
     243
     244            case Shell::UserError:       this->cout_ << "\033[91m"; break;
     245            case Shell::UserWarning:     this->cout_ << "\033[93m"; break;
     246            case Shell::UserStatus:      this->cout_ << "\033[92m"; break;
     247            case Shell::UserInfo:        this->cout_ << "\033[96m"; break;
     248
     249            case Shell::InternalError:   this->cout_ << "\033[31m"; break;
     250            case Shell::InternalWarning: this->cout_ << "\033[33m"; break;
     251            case Shell::InternalStatus:  this->cout_ << "\033[32m"; break;
     252            case Shell::InternalInfo:    this->cout_ << "\033[36m"; break;
     253
     254            case Shell::Verbose:         this->cout_ << "\033[94m"; break;
     255            case Shell::VerboseMore:     this->cout_ << "\033[34m"; break;
     256            case Shell::VerboseUltra:    this->cout_ << "\033[34m"; break;
     257
     258            case Shell::Command:         this->cout_ << "\033[95m"; break;
     259            case Shell::Hint:            this->cout_ << "\033[35m"; break;
     260
     261            default:                     this->cout_ << "\033[37m"; break;
    251262        }
    252263
  • code/branches/output/src/libraries/core/command/IOConsoleWindows.cc

    r8729 r8795  
    3434#include "util/Clock.h"
    3535#include "util/Math.h"
     36#include "util/output/ConsoleWriter.h"
    3637#include "core/Game.h"
    3738#include "core/input/InputBuffer.h"
     
    5253    {
    5354        // Disable standard this->cout_ logging
    54         OutputHandler::getInstance().disableCout();
     55        ConsoleWriter::getInstance().disable();
    5556        // Redirect std::cout to an ostringstream
    5657        // (Other part is in the initialiser list)
     
    9596        std::cout.flush();
    9697        if (!this->origCout_.str().empty())
    97             this->shell_->addOutput(this->origCout_.str(), Shell::None);
     98            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
    9899
    99100        this->shell_->unregisterListener(this);
     
    108109        std::cout.rdbuf(this->cout_.rdbuf());
    109110        // Enable standard this->cout_ logging again
    110         OutputHandler::getInstance().enableCout();
     111        ConsoleWriter::getInstance().enable();
    111112
    112113        resetTerminalMode();
     
    188189        if (!this->origCout_.str().empty())
    189190        {
    190             this->shell_->addOutput(this->origCout_.str(), Shell::None);
     191            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
    191192            this->origCout_.str("");
    192193        }
     
    200201        switch (type)
    201202        {
    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::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     204
     205            case Shell::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
     206            case Shell::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     207            case Shell::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
     208            case Shell::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     209
     210            case Shell::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
     211            case Shell::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     212            case Shell::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
     213            case Shell::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     214
     215            case Shell::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     216            case Shell::VerboseMore:     colour = 0                    | 0              | 0                | FOREGROUND_BLUE; break;
     217            case Shell::VerboseUltra:    colour = 0                    | 0              | 0                | FOREGROUND_BLUE; break;
     218
     219            case Shell::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     220            case Shell::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     221
     222            default:                     colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    212223        }
    213224
  • code/branches/output/src/libraries/core/command/Shell.cc

    r8729 r8795  
    3535
    3636#include "util/Math.h"
    37 #include "util/OutputHandler.h"
    3837#include "util/StringUtils.h"
    3938#include "util/SubString.h"
     39#include "util/output/MemoryWriter.h"
    4040#include "core/CoreIncludes.h"
    4141#include "core/ConfigFileManager.h"
     
    4848namespace orxonox
    4949{
    50     SetConsoleCommand("log",     OutputHandler::log    );
    51     SetConsoleCommand("error",   OutputHandler::error  ).hide();
    52     SetConsoleCommand("warning", OutputHandler::warning).hide();
    53     SetConsoleCommand("info",    OutputHandler::info   ).hide();
    54     SetConsoleCommand("debug",   OutputHandler::debug  ).hide();
     50//    SetConsoleCommand("log",     OutputHandler::log    );
     51//    SetConsoleCommand("error",   OutputHandler::error  ).hide();
     52//    SetConsoleCommand("warning", OutputHandler::warning).hide();
     53//    SetConsoleCommand("info",    OutputHandler::info   ).hide();
     54//    SetConsoleCommand("debug",   OutputHandler::debug  ).hide();
    5555
    5656    unsigned int Shell::cacheSize_s;
    5757
    5858    /**
    59         @brief Constructor: Initializes the values and registers itself at OutputHandler.
     59        @brief Constructor: Initializes the values.
    6060        @param consoleName The name of the shell - used to define the name of the soft-debug-level config-value
    6161        @param bScrollable If true, the user is allowed to scroll through the output-lines
    6262    */
    6363    Shell::Shell(const std::string& consoleName, bool bScrollable)
    64         : OutputListener(consoleName)
    65         , inputBuffer_(new InputBuffer())
     64        : inputBuffer_(new InputBuffer())
    6665        , consoleName_(consoleName)
    6766        , bScrollable_(bScrollable)
     
    7372        this->historyPosition_ = 0;
    7473        this->historyOffset_ = 0;
    75         this->bFinishedLastLine_ = true;
    7674
    7775        this->clearOutput();
     
    8179        ConfigFileManager::getInstance().setFilename(ConfigFileType::CommandHistory, "commandHistory.ini");
    8280
    83         // Use a stringstream object to buffer the output
    84         this->outputStream_ = &this->outputBuffer_;
    85 
    8681        this->setConfigValues();
    8782
    8883        // Get the previous output and add it to the Shell
    89         OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin();
    90         for (;it != OutputHandler::getInstance().getOutput().end(); ++it)
    91         {
    92             if (it->first <= debugLevel_)
    93             {
    94                 this->outputBuffer_ << it->second;
    95                 this->outputChanged(it->first);
    96             }
    97         }
    98 
    99         // Register the shell as output listener
    100         OutputHandler::getInstance().registerOutputListener(this);
    101         OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
    102     }
    103 
    104     /**
    105         @brief Destructor: Unregisters the shell from OutputHandler.
     84        MemoryWriter::getInstance().resendOutput(this);
     85    }
     86
     87    /**
     88        @brief Destructor
    10689    */
    10790    Shell::~Shell()
    10891    {
    109         OutputHandler::getInstance().unregisterOutputListener(this);
    11092        this->inputBuffer_->destroy();
    11193    }
     
    11395    namespace DefaultLogLevel
    11496    {
    115         const OutputLevel::Value Dev  = OutputLevel::Info;
    116         const OutputLevel::Value User = OutputLevel::Error;
     97        const OutputLevel Dev  = level::internal_warning;
     98        const OutputLevel User = level::user_info;
    11799    }
    118100
     
    130112
    131113        // Choose the default level according to the path Orxonox was started (build directory or not)
    132         OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
     114        OutputLevel defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
    133115        SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel)
    134116            .description("The maximum level of debug output shown in the " + consoleName_);
    135         OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
     117        this->setLevelMax(this->debugLevel_);
    136118    }
    137119
     
    172154        else
    173155        {
    174             OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
     156            OutputLevel level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
    175157            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level);
    176158        }
     
    256238    void Shell::addOutput(const std::string& text, LineType type)
    257239    {
    258         this->outputBuffer_ << text;
    259         this->outputChanged(type);
     240        // yes it was - push the new line to the list
     241        this->outputLines_.push_front(std::make_pair(text, static_cast<LineType>(type)));
     242
     243        // adjust the scroll position if needed
     244        if (this->scrollPosition_)
     245            this->scrollPosition_++;
     246        else
     247            this->scrollIterator_ = this->outputLines_.begin();
     248
     249        if (!this->scrollPosition_)
     250            this->updateListeners<&ShellListener::lineAdded>();
    260251    }
    261252
     
    269260
    270261        this->scrollPosition_ = 0;
    271         this->bFinishedLastLine_ = true;
    272262
    273263        this->updateListeners<&ShellListener::linesChanged>();
     264    }
     265
     266    /**
     267        @brief Inherited from BaseWriter (LogListener), called if a new line of output was sent.
     268    */
     269    void Shell::printLine(const std::string& line, OutputLevel level)
     270    {
     271        this->addOutput(line, static_cast<LineType>(level));
    274272    }
    275273
     
    323321
    324322    /**
    325         @brief Called by OutputHandler or internally whenever output was sent to the output buffer. Reads from the buffer and writes the new output-lines to the list.
    326     */
    327     void Shell::outputChanged(int lineType)
    328     {
    329         bool newline = false;
    330         do
    331         {
    332             // get the first line from the buffer
    333             std::string output;
    334             std::getline(this->outputBuffer_, output);
    335 
    336             // check the state of the buffer
    337             bool eof = this->outputBuffer_.eof();
    338             bool fail = this->outputBuffer_.fail();
    339             if (eof)
    340                 this->outputBuffer_.flush(); // check if more output was received in the meantime
    341             if (eof || fail)
    342                 this->outputBuffer_.clear(); // clear the error flags
    343 
    344             // the line is terminated with a line-break if neither an error occurred nor the end of the file was reached
    345             newline = (!eof && !fail);
    346 
    347             // no output retrieved - break the loop
    348             if (!newline && output.empty())
    349                 break;
    350 
    351             // check if the last line was terminated with a line-break
    352             if (this->bFinishedLastLine_)
    353             {
    354                 // yes it was - push the new line to the list
    355                 this->outputLines_.push_front(std::make_pair(output, static_cast<LineType>(lineType)));
    356 
    357                 // adjust the scroll position if needed
    358                 if (this->scrollPosition_)
    359                     this->scrollPosition_++;
    360                 else
    361                     this->scrollIterator_ = this->outputLines_.begin();
    362 
    363                 if (!this->scrollPosition_)
    364                     this->updateListeners<&ShellListener::lineAdded>();
    365             }
    366             else
    367             {
    368                 // no it wasn't - add the new output to the last line
    369                 this->outputLines_.front().first += output;
    370                 this->updateListeners<&ShellListener::onlyLastLineChanged>();
    371             }
    372 
    373             // remember if the last line was terminated with a line-break
    374             this->bFinishedLastLine_ = newline;
    375 
    376         } while (newline); // loop as long as more lines are in the buffer
    377     }
    378 
    379     /**
    380323        @brief Clears the text in the input buffer.
    381324    */
     
    412355            switch (error)
    413356            {
    414                 case CommandExecutor::Error:       this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command doesn't exist. (S)" << std::endl; break;
    415                 case CommandExecutor::Incomplete:  this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", not enough arguments given. (S)" << std::endl; break;
    416                 case CommandExecutor::Deactivated: this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command is not active. (S)" << std::endl; break;
    417                 case CommandExecutor::Denied:      this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", access denied. (S)" << std::endl; break;
     357                case CommandExecutor::Error:       this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", command doesn't exist. (S)", UserError); break;
     358                case CommandExecutor::Incomplete:  this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", not enough arguments given. (S)", UserError); break;
     359                case CommandExecutor::Deactivated: this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", command is not active. (S)", UserError); break;
     360                case CommandExecutor::Denied:      this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", access denied. (S)", UserError); break;
    418361            }
    419             this->outputChanged(Error);
    420362        }
    421363        else if (result != "")
    422364        {
    423             this->outputBuffer_ << result << std::endl;
    424             this->outputChanged(Command);
     365            this->addOutput(result, Command);
    425366        }
    426367
     
    432373    {
    433374        this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete());
    434         this->outputBuffer_ << CommandExecutor::evaluate(this->inputBuffer_->get()).hint() << std::endl;
    435         this->outputChanged(Hint);
     375        this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);
    436376
    437377        this->inputChanged();
  • code/branches/output/src/libraries/core/command/Shell.h

    r8729 r8795  
    4848#include <vector>
    4949
    50 #include "util/OutputHandler.h"
     50#include "util/output/BaseWriter.h"
    5151#include "core/Core.h"
    5252#include "core/OrxonoxClass.h"
     
    7878        @brief The Shell is the logical component of the console that displays output to the user and allows him to enter commands.
    7979
    80         The Shell gathers output sent from OutputHandler by inheriting from OutputListener.
     80        The Shell gathers output sent from OutputManager by inheriting from BaseWriter.
    8181        The output-lines are stored in the shell, so they can be displayed in a graphical
    8282        console. Additionally the Shell has an InputBuffer which is needed by the user to
     
    8585        Different graphical consoles build upon a Shell, for example InGameConsole and IOConsole.
    8686    */
    87     class _CoreExport Shell : public OutputListener, public DevModeListener
     87    class _CoreExport Shell : public BaseWriter, public DevModeListener
    8888    {
    8989        public:
     
    9191            enum LineType
    9292            {
    93                 TDebug  = OutputLevel::TDebug,
    94                 None    = OutputLevel::None,
    95                 Warning = OutputLevel::Warning,
    96                 Error   = OutputLevel::Error,
    97                 Info    = OutputLevel::Info,
    98                 Debug   = OutputLevel::Debug,
    99                 Verbose = OutputLevel::Verbose,
    100                 Ultra   = OutputLevel::Ultra,
     93                DebugOutput     = debug_output,
     94                UserError       = user_error,
     95                UserWarning     = user_warning,
     96                UserStatus      = user_status,
     97                UserInfo        = user_info,
     98                InternalError   = internal_error,
     99                InternalWarning = internal_warning,
     100                InternalStatus  = internal_status,
     101                InternalInfo    = internal_info,
     102                Verbose         = verbose,
     103                VerboseMore     = verbose_more,
     104                VerboseUltra    = verbose_ultra,
     105                Cout,
    101106                Input,
    102107                Command,
     
    127132            LineList::const_iterator getEndIterator() const;
    128133
    129             void addOutput(const std::string& text, LineType type = None);
     134            void addOutput(const std::string& text, LineType type = DebugOutput);
    130135            void clearOutput();
    131136
     
    150155            const std::string& getFromHistory() const;
    151156            void clearInput();
    152             // OutputListener
    153             void outputChanged(int level);
     157            // BaseWriter
     158            virtual void printLine(const std::string& line, OutputLevel level);
    154159
    155160            void configureInputBuffer();
     
    183188            std::list<ShellListener*> listeners_;           ///< The registered shell listeners
    184189            InputBuffer*              inputBuffer_;         ///< The input buffer that is needed by the user to enter text
    185             std::stringstream         outputBuffer_;        ///< The output buffer that is used to retrieve lines of output from OutputListener
    186             bool                      bFinishedLastLine_;   ///< Stores if the most recent output-line was terminated with a line-break or if more output is expected for this line
    187190            LineList                  outputLines_;         ///< A list of all output-lines that were displayed in the shell so far
    188191            LineList::const_iterator  scrollIterator_;      ///< An iterator to an entry of the list of output-lines, changes if the user scrolls through the output in the shell
     
    197200            unsigned int              historyOffset_;       ///< The command history is a circular buffer, this variable defines the current write-offset
    198201            std::vector<std::string>  commandHistory_;      ///< The history of commands that were entered by the user
    199             int                       debugLevel_;          //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
     202            OutputLevel               debugLevel_;          //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
    200203            static unsigned int       cacheSize_s;          ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
    201204    };
  • code/branches/output/src/libraries/util/output/BaseWriter.cc

    r8794 r8795  
    4747
    4848        for (size_t i = 0; i < lines.size(); ++i)
    49             this->printLine((i == 0 ? prefix : blanks) + lines[i]);
     49            this->printLine((i == 0 ? prefix : blanks) + lines[i], level);
    5050    }
    5151}
  • code/branches/output/src/libraries/util/output/BaseWriter.h

    r8794 r8795  
    4545
    4646        private:
    47             virtual void printLine(const std::string& line) = 0;
     47            virtual void printLine(const std::string& line, OutputLevel level) = 0;
    4848    };
    4949}
  • code/branches/output/src/libraries/util/output/ConsoleWriter.cc

    r8794 r8795  
    3737    ConsoleWriter::ConsoleWriter()
    3838    {
     39#ifdef ORXONOX_RELEASE
    3940        this->setLevelMax(level::user_info);
     41#else
     42        this->setLevelMax(level::internal_warning);
     43#endif
    4044        this->bEnabled_ = true;
    4145    }
     
    5155    }
    5256
    53     void ConsoleWriter::printLine(const std::string& line)
     57    void ConsoleWriter::printLine(const std::string& line, OutputLevel)
    5458    {
    5559        std::cout << line << std::endl;
  • code/branches/output/src/libraries/util/output/ConsoleWriter.h

    r8794 r8795  
    4444
    4545        protected:
    46             virtual void printLine(const std::string& line);
     46            virtual void printLine(const std::string& line, OutputLevel level);
    4747
    4848        private:
  • code/branches/output/src/libraries/util/output/LogWriter.cc

    r8794 r8795  
    7474
    7575        if (this->file_.is_open())
    76             this->printLine("Log file opened");
     76            this->printLine("Log file opened", level::none);
    7777        else
    7878            OutputManager::getInstance().pushMessage(level::user_warning, context::output(), "Failed to open log file. File logging disabled.");
     
    8383        if (this->file_.is_open())
    8484        {
    85             this->printLine("Log file closed");
     85            this->printLine("Log file closed", level::none);
    8686            this->file_.close();
    8787        }
     
    100100    }
    101101
    102     void LogWriter::printLine(const std::string& line)
     102    void LogWriter::printLine(const std::string& line, OutputLevel)
    103103    {
    104104        if (!this->file_.is_open())
  • code/branches/output/src/libraries/util/output/LogWriter.h

    r8794 r8795  
    4646
    4747        protected:
    48             virtual void printLine(const std::string& line);
     48            virtual void printLine(const std::string& line, OutputLevel level);
    4949
    5050        private:
  • code/branches/output/src/orxonox/overlays/InGameConsole.cc

    r8729 r8795  
    4646#include "util/DisplayStringConversions.h"
    4747#include "util/ScopedSingletonManager.h"
     48#include "util/output/MemoryWriter.h"
    4849#include "core/CoreIncludes.h"
    4950#include "core/ConfigValueIncludes.h"
     
    9495        // Output buffering is not anymore needed. Not the best solution to do
    9596        // this here, but there isn't much of another way.
    96         OutputHandler::getInstance().disableMemoryLog();
     97        MemoryWriter::getInstance().disable();
    9798    }
    9899
     
    288289
    289290        for (int i = LINES - 1; i > max; --i)
    290             this->print("", Shell::None, i, true);
     291            this->print("", Shell::DebugOutput, i, true);
    291292
    292293        for (int i = max; i >= 1; --i)
     
    566567        switch (type)
    567568        {
    568         case Shell::Error:   colourTop = ColourValue(0.95f, 0.25f, 0.25f, 1.00f);
    569                           colourBottom = ColourValue(1.00f, 0.50f, 0.50f, 1.00f); break;
    570 
    571         case Shell::Warning: colourTop = ColourValue(0.95f, 0.50f, 0.20f, 1.00f);
    572                           colourBottom = ColourValue(1.00f, 0.70f, 0.50f, 1.00f); break;
    573 
    574         case Shell::Info:    colourTop = ColourValue(0.50f, 0.50f, 0.95f, 1.00f);
    575                           colourBottom = ColourValue(0.80f, 0.80f, 1.00f, 1.00f); break;
    576 
    577         case Shell::Debug:   colourTop = ColourValue(0.65f, 0.48f, 0.44f, 1.00f);
    578                           colourBottom = ColourValue(1.00f, 0.90f, 0.90f, 1.00f); break;
    579 
    580         case Shell::Verbose: colourTop = ColourValue(0.40f, 0.20f, 0.40f, 1.00f);
    581                           colourBottom = ColourValue(0.80f, 0.60f, 0.80f, 1.00f); break;
    582 
    583         case Shell::Ultra:   colourTop = ColourValue(0.21f, 0.69f, 0.21f, 1.00f);
    584                           colourBottom = ColourValue(0.80f, 1.00f, 0.80f, 1.00f); break;
    585 
    586         case Shell::Command: colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
    587                           colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 0.90f); break;
    588 
    589         case Shell::Hint:    colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
    590                           colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 1.00f); break;
    591 
    592         case Shell::TDebug:  colourTop = ColourValue(0.90f, 0.00f, 0.90f, 1.00f);
    593                           colourBottom = ColourValue(1.00f, 0.00f, 1.00f, 1.00f); break;
    594 
    595         default:             colourTop = ColourValue(0.90f, 0.90f, 0.90f, 1.00f);
    596                           colourBottom = ColourValue(1.00f, 1.00f, 1.00f, 1.00f); break;
    597         }
     569            case Shell::DebugOutput:     colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
     570
     571            case Shell::UserError:       colourTop = ColourValue(0.9f, 0.2f, 0.2f); break;
     572            case Shell::UserWarning:     colourTop = ColourValue(0.9f, 0.5f, 0.2f); break;
     573            case Shell::UserStatus:      colourTop = ColourValue(0.2f, 0.9f, 0.2f); break;
     574            case Shell::UserInfo:        colourTop = ColourValue(0.2f, 0.8f, 0.8f); break;
     575
     576            case Shell::InternalError:   colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;
     577            case Shell::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;
     578            case Shell::InternalStatus:  colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;
     579            case Shell::InternalInfo:    colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;
     580
     581            case Shell::Verbose:         colourTop = ColourValue(0.2f, 0.2f, 0.9f); break;
     582            case Shell::VerboseMore:     colourTop = ColourValue(0.1f, 0.1f, 0.6f); break;
     583            case Shell::VerboseUltra:    colourTop = ColourValue(0.0f, 0.0f, 0.4f); break;
     584
     585            case Shell::Command:         colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;
     586            case Shell::Hint:            colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;
     587            case Shell::Input:           colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
     588
     589            default:                     colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;
     590        }
     591
     592        colourBottom = ColourValue(sqrt(colourTop.r), sqrt(colourTop.g), sqrt(colourTop.b));
    598593
    599594        this->consoleOverlayTextAreas_[index]->setColourTop   (colourTop);
Note: See TracChangeset for help on using the changeset viewer.