Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 31, 2009, 11:13:52 PM (14 years ago)
Author:
rgrieder
Message:

Sorted out some small stuff in the Shell and hopefully fixed IOConsole problems (flickering and too much output).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/libraries/core/Shell.h

    r6004 r6010  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Reto Grieder
    2626 *
    2727 */
     
    6161    };
    6262
     63
    6364    class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener
    6465    {
    6566        public:
    66             Shell(const std::string& consoleName, bool bScrollable);
    67             virtual ~Shell();
     67            Shell(const std::string& consoleName, bool bScrollable, bool bPrependOutputLevel = false);
     68            ~Shell();
    6869
    6970            void setConfigValues();
     
    8182                { return this->inputBuffer_->getCursorPosition(); }
    8283
    83             void setInput(const std::string& input);
    84 
    85             inline void clearInput()
    86                 { this->setInput(""); }
    8784            inline std::string getInput() const
    8885                { return this->inputBuffer_->get(); }
     
    9188            std::list<std::string>::const_iterator getEndIterator() const;
    9289
    93             void addLine(const std::string& line, int level = 0);
    94             void clearLines();
     90            void addOutputLine(const std::string& line, int level = 0);
     91            void clearOutput();
    9592
    9693            inline unsigned int getNumLines() const
     
    9996                { return this->scrollPosition_; }
    10097
    101             inline void addOutputLevel(bool bAddOutputLevel)
    102                 { this->bAddOutputLevel_ = bAddOutputLevel; }
     98            inline const std::string& getPromptPrefix() const { return this->promptPrefix_; }
     99            void setPromptPrefix(const std::string& str);
    103100
    104101        private:
    105102            Shell(const Shell& other);
    106103
     104            void addToHistory(const std::string& command);
     105            std::string getFromHistory() const;
     106            void clearInput();
     107            // OutputListener
     108            void outputChanged(int level);
     109
    107110            void configureInputBuffer();
    108111
    109             void addToHistory(const std::string& command);
    110             std::string getFromHistory() const;
    111 
    112             virtual void outputChanged(int level);
    113 
     112            // InputBuffer callbacks
    114113            void inputChanged();
    115114            void execute();
    116             void hintandcomplete();
     115            void hintAndComplete();
    117116            void backspace();
    118             void deletechar();
    119             void clear();
    120             void cursor_right();
    121             void cursor_left();
    122             void cursor_end();
    123             void cursor_home();
    124             void history_up();
    125             void history_down();
    126             void history_search_up();
    127             void history_search_down();
    128             void scroll_up();
    129             void scroll_down();
     117            void deleteChar();
     118            void cursorRight();
     119            void cursorLeft();
     120            void cursorEnd();
     121            void cursorHome();
     122            void historyUp();
     123            void historyDown();
     124            void historySearchUp();
     125            void historySearchDown();
     126            void scrollUp();
     127            void scrollDown();
    130128            void exit();
    131129
     
    138136
    139137            std::list<ShellListener*> listeners_;
    140             InputBuffer* inputBuffer_;
    141             std::stringstream outputBuffer_;
    142             bool finishedLastLine_;
    143             std::list<std::string> outputLines_;
     138            InputBuffer*              inputBuffer_;
     139            std::stringstream         outputBuffer_;
     140            bool                      bFinishedLastLine_;
     141            std::list<std::string>    outputLines_;
    144142            std::list<std::string>::const_iterator scrollIterator_;
    145             unsigned int scrollPosition_;
    146             unsigned int historyPosition_;
    147             bool bAddOutputLevel_;
    148             ConfigFileType commandHistoryConfigFileType_;
    149             const std::string consoleName_;
    150             const bool bScrollable_;
     143            unsigned int              scrollPosition_;
     144            unsigned int              historyPosition_;
     145            ConfigFileType            commandHistoryConfigFileType_;
     146
     147            std::string               promptPrefix_;
     148            const std::string         consoleName_;
     149            const bool                bPrependOutputLevel_;
     150            const bool                bScrollable_;
    151151
    152152            // Config values
    153             unsigned int maxHistoryLength_;
    154             unsigned int historyOffset_;
    155             std::vector<std::string> commandHistory_;
    156             int softDebugLevel_;
     153            unsigned int              maxHistoryLength_;
     154            unsigned int              historyOffset_;
     155            std::vector<std::string>  commandHistory_;
     156            int                       softDebugLevel_;
    157157    };
    158158}
Note: See TracChangeset for help on using the changeset viewer.