Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2011, 2:47:44 AM (14 years ago)
Author:
rgrieder
Message:

Merged unity_build branch back to trunk.

Features:

  • Implemented fully automatic build units to speed up compilation if requested
  • Added DOUT macro for quick debug output
  • Activated text colouring in the POSIX IOConsole
  • DeclareToluaInterface is not necessary anymore

Improvements:

  • Output levels now change appropriately when switch back and forth from dev mode
  • Log level for the file output is now also correct during startup
  • Removed some header file dependencies in core and tools to speed up compilation

no more file for command line options

  • Improved util::tribool by adapting some concepts from boost::tribool

Regressions:

  • It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/Shell.cc

    r8706 r8729  
    3434#include "Shell.h"
    3535
     36#include "util/Math.h"
    3637#include "util/OutputHandler.h"
    3738#include "util/StringUtils.h"
     
    4041#include "core/ConfigFileManager.h"
    4142#include "core/ConfigValueIncludes.h"
     43#include "core/PathConfig.h"
     44#include "core/input/InputBuffer.h"
    4245#include "CommandExecutor.h"
    4346#include "ConsoleCommand.h"
     
    8487
    8588        // Get the previous output and add it to the Shell
    86         for (OutputHandler::OutputVectorIterator it = OutputHandler::getInstance().getOutputVectorBegin();
    87             it != OutputHandler::getInstance().getOutputVectorEnd(); ++it)
    88         {
    89             if (it->first <= this->getSoftDebugLevel())
     89        OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin();
     90        for (;it != OutputHandler::getInstance().getOutput().end(); ++it)
     91        {
     92            if (it->first <= debugLevel_)
    9093            {
    9194                this->outputBuffer_ << it->second;
     
    9699        // Register the shell as output listener
    97100        OutputHandler::getInstance().registerOutputListener(this);
     101        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
    98102    }
    99103
     
    105109        OutputHandler::getInstance().unregisterOutputListener(this);
    106110        this->inputBuffer_->destroy();
     111    }
     112
     113    namespace DefaultLogLevel
     114    {
     115        const OutputLevel::Value Dev  = OutputLevel::Info;
     116        const OutputLevel::Value User = OutputLevel::Error;
    107117    }
    108118
     
    119129        SetConfigValue(cacheSize_s, 32);
    120130
    121 #ifdef ORXONOX_RELEASE
    122         const unsigned int defaultLevel = 1;
    123 #else
    124         const unsigned int defaultLevel = 3;
    125 #endif
    126         SetConfigValueExternal(softDebugLevel_, "OutputHandler", "softDebugLevel" + this->consoleName_, defaultLevel)
    127             .description("The maximal level of debug output shown in the Shell");
    128         this->setSoftDebugLevel(this->softDebugLevel_);
     131        // 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);
     133        SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel)
     134            .description("The maximum level of debug output shown in the " + consoleName_);
     135        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
    129136    }
    130137
     
    150157            this->commandHistory_.erase(this->commandHistory_.begin() + index);
    151158            ModifyConfigValue(commandHistory_, remove, index);
     159        }
     160    }
     161
     162    /** Called upon changes in the development mode (by Core)
     163        Behaviour details see Core::devModeChanged.
     164    */
     165    void Shell::devModeChanged(bool value)
     166    {
     167        bool isNormal = (value == PathConfig::buildDirectoryRun());
     168        if (isNormal)
     169        {
     170            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update);
     171        }
     172        else
     173        {
     174            OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
     175            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level);
    152176        }
    153177    }
     
    215239    }
    216240
     241    /// Returns the current position of the cursor in the input buffer.
     242    unsigned int Shell::getCursorPosition() const
     243    {
     244        return this->inputBuffer_->getCursorPosition();
     245    }
     246
     247    /// Returns the current content of the input buffer (the text which was entered by the user)
     248    const std::string& Shell::getInput() const
     249    {
     250        return this->inputBuffer_->get();
     251    }
     252
    217253    /**
    218254        @brief Sends output to the internal output buffer.
Note: See TracChangeset for help on using the changeset viewer.