|
|
|
@ -23,38 +23,10 @@ namespace MWGui
|
|
|
|
|
{
|
|
|
|
|
class Console : public WindowBase, private Compiler::ErrorHandler, public ReferenceInterface
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
Compiler::Extensions mExtensions;
|
|
|
|
|
MWScript::CompilerContext mCompilerContext;
|
|
|
|
|
std::vector<std::string> mNames;
|
|
|
|
|
bool mConsoleOnlyScripts;
|
|
|
|
|
|
|
|
|
|
bool compile (const std::string& cmd, Compiler::Output& output);
|
|
|
|
|
|
|
|
|
|
/// Report error to the user.
|
|
|
|
|
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
|
|
|
|
|
|
|
|
|
/// Report a file related error
|
|
|
|
|
virtual void report (const std::string& message, Type type);
|
|
|
|
|
|
|
|
|
|
void listNames();
|
|
|
|
|
///< Write all valid identifiers and keywords into mNames and sort them.
|
|
|
|
|
/// \note If mNames is not empty, this function is a no-op.
|
|
|
|
|
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
|
|
|
|
/// time).
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/// Set the implicit object for script execution
|
|
|
|
|
void setSelectedObject(const MWWorld::Ptr& object);
|
|
|
|
|
///< Set the implicit object for script execution
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void onReferenceUnavailable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MyGUI::EditBox* mCommandLine;
|
|
|
|
|
MyGUI::EditBox* mHistory;
|
|
|
|
|
|
|
|
|
@ -70,6 +42,8 @@ namespace MWGui
|
|
|
|
|
virtual void open();
|
|
|
|
|
virtual void close();
|
|
|
|
|
|
|
|
|
|
virtual void exit();
|
|
|
|
|
|
|
|
|
|
void setFont(const std::string &fntName);
|
|
|
|
|
|
|
|
|
|
void onResChange(int width, int height);
|
|
|
|
@ -92,6 +66,10 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
void executeFile (const std::string& path);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void onReferenceUnavailable();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
void keyPress(MyGUI::Widget* _sender,
|
|
|
|
@ -101,6 +79,25 @@ namespace MWGui
|
|
|
|
|
void acceptCommand(MyGUI::EditBox* _sender);
|
|
|
|
|
|
|
|
|
|
std::string complete( std::string input, std::vector<std::string> &matches );
|
|
|
|
|
|
|
|
|
|
Compiler::Extensions mExtensions;
|
|
|
|
|
MWScript::CompilerContext mCompilerContext;
|
|
|
|
|
std::vector<std::string> mNames;
|
|
|
|
|
bool mConsoleOnlyScripts;
|
|
|
|
|
|
|
|
|
|
bool compile (const std::string& cmd, Compiler::Output& output);
|
|
|
|
|
|
|
|
|
|
/// Report error to the user.
|
|
|
|
|
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
|
|
|
|
|
|
|
|
|
/// Report a file related error
|
|
|
|
|
virtual void report (const std::string& message, Type type);
|
|
|
|
|
|
|
|
|
|
/// Write all valid identifiers and keywords into mNames and sort them.
|
|
|
|
|
/// \note If mNames is not empty, this function is a no-op.
|
|
|
|
|
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
|
|
|
|
/// time).
|
|
|
|
|
void listNames();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|