Index: trunk/src/util/shell_command.h
===================================================================
--- trunk/src/util/shell.h	(revision 5127)
+++ trunk/src/util/shell_command.h	(revision 5129)
@@ -1,122 +1,88 @@
 /*!
- * @file shell.h
+ * @file shell_command.h
  * Definition of a on-screen-shell
 */
 
-#ifndef _SHELL_H
-#define _SHELL_H
+#ifndef _SHELL_COMMAND_H
+#define _SHELL_COMMAND_H
 
-#include "element_2d.h"
-#include "event_listener.h"
+#include "base_object.h"
 
 #include <stdarg.h>
 
-#define      SHELL_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
+typedef enum ShellParameterType
+{
+  ShellParameterNull,
+  ShellParameterChar,
+  ShellParameterString,
+  ShellParameterInt,
+  ShellParameterUInt,
+  ShellParameterFloat,
+  /* ... */
+};
 
 // FORWARD DECLARATION
-class Text;
 template<class T> class tList;
 template<class T> class tIterator;
+#define MAX_SHELL_COMMAND_SIZE
 
-//! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands
-/**
- * the major idea is, that all the Output can be redirected to the Shell,
- * and does not have to be displayed to the opening Shell, this is good,
- * for developers using Windows, where all output is otherwise redirected
- * to stdout.txt
- *
- * Furthermore the Shell should enable us, to input some simple commands
- * Each Class can tell check itself in to the Shell, and listen for commands.
- *
- * @todo implement what is written above :/
- */
-class Shell : public Element2D, public EventListener {
+class ShellCommandBase
+{
+  public:
+    static bool execute (const char* executionString);
 
-  public:
-    virtual ~Shell();
-    /** @returns a Pointer to the only object of this Class */
-    inline static Shell* getInstance() { if (!Shell::singletonRef) Shell::singletonRef = new Shell();  return Shell::singletonRef; };
+  protected:
+    ShellCommandBase(const char* commandName, ClassID classID);
 
-
-    void activate();
-    void deactivate();
-
-    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
-    void rebuildText();
-
-    // BUFFER //
-    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
-    void setBufferDisplaySize(unsigned int bufferDisplaySize);
-    void flushBuffers();
-    static bool addBufferLineStatic(const char* line, ...);
-    void addBufferLine(const char* line, va_list arg);
-    void printToDisplayBuffer(const char* text);
-    void moveBuffer(int lineCount);
-    const char* getBufferLine(unsigned int lineNumber);
-
-    // InputLine
-    void flushInputLine();
-    void addCharacter(char character);
-    void addCharacters(const char* characters);
-    void removeCharacters(unsigned int characterCount = 1);
-    bool executeCommand();
-
-    void setRepeatDelay(float repeatDelay, float repeatRate);
-
-    // EventListener
-    virtual void process(const Event &event);
-
-    // Element2D-functions
-    void tick(float dt);
-    virtual void draw() const;
-
-    void help() const;
-    void debug() const;
-
-  private:
-    bool autoComplete();
-    bool classComplete(const char* classBegin);
-    bool objectComplete(const char* objectBegin, long classID);
-    bool functionComplete(const char* functionBegin);
-
-    bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
-
-    const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin);
-    const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);
-
-    // helpers //
-    Vector calculateLinePosition(unsigned int lineNumber);
+    static bool isRegistered(const char* commandName, ClassID classID);
 
 
   private:
-    Shell();
-    static Shell*          singletonRef;           //!< The singleton-reference to the only memeber of this class.
+    char*                            commandName;         //!< The name of the Command when executed
+    long                             classID;             //!< The ID of the Class asociated to this Command
 
-    unsigned int           bufferSize;             //!< The Size of the buffer
-    unsigned int           bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
 
-    Text*                  inputLineText;          //!< The inputLine of the Shell
-    char*                  inputLine;              //!< the Char-Array of the Buffer
-    float                  repeatRate;             //!< The Repeat-Delay.
-    float                  repeatDelay;            //!< The delay of the first Character of a given Character.
-    float                  delayed;                //!< how much of the delay is remaining.
-    int                    pressedKey;             //!< the pressed key that will be repeated.
-
-    tList<char>*           buffer;                 //!< A list of stored char-arrays(strings) to store the history
-    tIterator<char>*       bufferIterator;         //!< An iterator for the Shells main buffer.
-
-    Text**                 bufferText;             //!< A list of stored bufferTexts for the display of the buffer
-    unsigned int           textSize;               //!< The size of the text.
-    unsigned int           lineSpacing;            //!< The Spacing between lines.
-    unsigned int           shellHeight;            //!< The hight of the Shell in Pixels
-    bool                   bActive;                //!< if the shell is active;
-
-    char                   bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
-    char                   keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
-    bool                   keepBuffer;
-
-    // completion
-    tList<const char>*    completionList;          //!< A list of completions, that are io.
+    static tList<ShellCommandBase>*  commandList;         //!< A list of availiable commands.
 };
 
-#endif /* _SHELL_H */
+//! keeps information about a ShellCommand
+template<class T> class ShellCommand : public ShellCommandBase
+{
+  public:
+    static void registerCommand(const char* commandName, void* pointerToFunction, ClassID classID, ShellParameterType param1Type, void* Object = NULL);
+
+    static void unregisterCommand(const char* commandNaame, ClassID classID);
+
+  private:
+    ShellCommand(const char* command, void* pointerToFunction, ClassID classID, ShellParameterType param1Type, void* Object = NULL);
+
+
+  public:
+    void*                functionPointer;     //!< The pointer to the function of the Class (or static pointer if ClassID == CL_NULL )
+    T*                   Object;              //!< The pointer to the object to apply this function to (NULL if classID == CL_NULL )
+};
+
+template<class T>
+    ShellCommand<T>::ShellCommand(const char* commandName, void* pointerToFunction, ClassID classID, ShellParameterType param1Type, void* Object)
+  : ShellCommandBase (command, classID)
+{
+
+}
+
+template<class T>
+    void ShellCommand<T>::registerCommand(const char* commandName, void* pointerToFunction, ClassID classID, ShellParameterType param1Type, void* Object)
+{
+  if (isRegistered() == true)
+    return;
+  else
+  {
+    ShellCommand<T>* newCommand = new ShellCommand<T>(command);
+    elem->functionPointer = pointerToFunction;
+    elem->parameter1 = param1Type;
+    elem->Object = Object;
+
+
+  }
+}
+
+#endif /* _SHELL_COMMAND_H */
