Backed out changeset: e82d9467bec8
parent
4af2158029
commit
29b2129e1e
|
|
@ -34,7 +34,7 @@
|
|||
#include "lltexteditor.h"
|
||||
#include "llstl.h"
|
||||
|
||||
inline bool LLKeywordToken::isHead(const llwchar* s) const
|
||||
inline BOOL LLKeywordToken::isHead(const llwchar* s) const
|
||||
{
|
||||
// strncmp is much faster than string compare
|
||||
BOOL res = TRUE;
|
||||
|
|
@ -51,7 +51,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const
|
|||
return res;
|
||||
}
|
||||
|
||||
inline bool LLKeywordToken::isTail(const llwchar* s) const
|
||||
inline BOOL LLKeywordToken::isTail(const llwchar* s) const
|
||||
{
|
||||
BOOL res = TRUE;
|
||||
const llwchar* t = mDelimiter.c_str();
|
||||
|
|
@ -198,7 +198,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in)
|
|||
return LLUIColorTable::instance().getColor(ColourGroup);
|
||||
}
|
||||
|
||||
bool LLKeywords::initialise(ELLPath path, const std::string filename)
|
||||
BOOL LLKeywords::initialise(ELLPath path, const std::string filename)
|
||||
{
|
||||
mReady = false;
|
||||
setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) );
|
||||
|
|
@ -214,7 +214,7 @@ bool LLKeywords::initialise(ELLPath path, const std::string filename)
|
|||
return mReady;
|
||||
}
|
||||
|
||||
bool LLKeywords::loadFromFile()
|
||||
BOOL LLKeywords::loadFromFile()
|
||||
{
|
||||
processTokens();
|
||||
return true;
|
||||
|
|
@ -226,14 +226,14 @@ bool LLKeywords::loadFromFile()
|
|||
* contained data to the specified LLSD object.
|
||||
* @return Returns boolean true/false indicating success or failure.
|
||||
*/
|
||||
bool LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data)
|
||||
BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data)
|
||||
{
|
||||
mLoaded = false;
|
||||
llifstream file;
|
||||
file.open(filename);
|
||||
if(file.is_open())
|
||||
{
|
||||
mLoaded = (bool)LLSDSerialize::fromXML(data, file);
|
||||
mLoaded = (BOOL)LLSDSerialize::fromXML(data, file);
|
||||
if (!mLoaded)
|
||||
{
|
||||
LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ public:
|
|||
|
||||
S32 getLengthHead() const { return mToken.size(); }
|
||||
S32 getLengthTail() const { return mDelimiter.size(); }
|
||||
bool isHead(const llwchar* s) const;
|
||||
bool isTail(const llwchar* s) const;
|
||||
BOOL isHead(const llwchar* s) const;
|
||||
BOOL isTail(const llwchar* s) const;
|
||||
const LLWString& getToken() const { return mToken; }
|
||||
const LLColor4& getColor() const { return mColor; }
|
||||
TOKEN_TYPE getType() const { return mType; }
|
||||
|
|
@ -111,13 +111,13 @@ public:
|
|||
|
||||
void addColorGroup(const std::string key_in, const LLColor4 color);
|
||||
LLColor4 getColorGroup(const std::string key_in);
|
||||
bool loadFromFile();
|
||||
bool loadFromFile(const std::string& filename);
|
||||
bool isLoaded() const { return mLoaded; }
|
||||
BOOL loadFromFile();
|
||||
BOOL loadFromFile(const std::string& filename);
|
||||
BOOL isLoaded() const { return mLoaded; }
|
||||
void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; }
|
||||
|
||||
void findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor );
|
||||
bool initialise(ELLPath path, const std::string filename);
|
||||
BOOL initialise(ELLPath path, const std::string filename);
|
||||
std::string processColors();
|
||||
std::string processColors(LLSD &data, const std::string strGroup);
|
||||
void processTokens();
|
||||
|
|
@ -176,10 +176,10 @@ protected:
|
|||
LLColor4 readColor(LLSD& sd);
|
||||
void insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor);
|
||||
void insertSegments(const LLWString& wtext, std::vector<LLTextSegmentPtr>& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor);
|
||||
bool loadIntoLLSD( const std::string& filename, LLSD& data );
|
||||
BOOL loadIntoLLSD( const std::string& filename, LLSD& data );
|
||||
|
||||
LLSD mColors;
|
||||
bool mLoaded;
|
||||
BOOL mLoaded;
|
||||
LLSD mSyntax;
|
||||
word_token_map_t mWordTokenMap;
|
||||
typedef std::deque<LLKeywordToken*> token_list_t;
|
||||
|
|
@ -194,8 +194,8 @@ protected:
|
|||
std::string getArguments(LLSD& args);
|
||||
|
||||
private:
|
||||
bool ready() { return mReady; }
|
||||
bool mReady;
|
||||
BOOL ready() { return mReady; }
|
||||
BOOL mReady;
|
||||
std::string mFilenameSyntax;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,11 @@ BOOL LLScriptEdCore::postBuild()
|
|||
|
||||
initMenu();
|
||||
|
||||
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLScriptEdCore::initKeywords(), this));
|
||||
// Make this work ;-)
|
||||
mSyntaxIdLSL.initialise();
|
||||
// ...
|
||||
mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml");
|
||||
// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec());
|
||||
|
||||
// FIX: Refactor LLTextEditor::loadKeywords so these can be removed.
|
||||
std::vector<std::string> funcs;
|
||||
|
|
@ -452,15 +456,6 @@ BOOL LLScriptEdCore::postBuild()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void LLScriptEdCore::initKeywords()
|
||||
{
|
||||
// Make this work ;-)
|
||||
mSyntaxIdLSL.initialise();
|
||||
// ...
|
||||
mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml");
|
||||
// mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML());
|
||||
}
|
||||
|
||||
void LLScriptEdCore::initMenu()
|
||||
{
|
||||
// *TODO: Skinning - make these callbacks data driven
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ public:
|
|||
~LLScriptEdCore();
|
||||
|
||||
void initMenu();
|
||||
void initKeywords();
|
||||
|
||||
virtual void draw();
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ void LLSyntaxIdLSL::initialise()
|
|||
LL_WARNS("LSLSyntax")
|
||||
<< "Filename is cached, no need to download!"
|
||||
<< LL_ENDL;
|
||||
loadKeywordsFileIntoLLSD();
|
||||
openKeywordsFile();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -256,58 +256,27 @@ void LLSyntaxIdLSL::initialise()
|
|||
LL_WARNS("LSLSyntax")
|
||||
<< "ID is null so SyntaxID does not need to be processed!"
|
||||
<< LL_ENDL;
|
||||
loadKeywordsFileIntoLLSD();
|
||||
openKeywordsFile();
|
||||
}
|
||||
mFileNameCurrent = mFileNameNew;
|
||||
mSyntaxIdCurrent = mSyntaxIdNew;
|
||||
// TODO add a signal here to tell the editor the hash has changed?
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("LSLSyntax")
|
||||
<< "No change to Syntax! Nothing to see here. Move along now!"
|
||||
<< LL_ENDL;
|
||||
|
||||
}
|
||||
//LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// loadKeywordsFileIntoLLSD
|
||||
// openKeywordsFile
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Load xml serialised LLSD
|
||||
* @desc Opens the specified filespec and attempts to deserialise the
|
||||
* contained data to the specified LLSD object.
|
||||
* @return Returns boolean true/false indicating success or failure.
|
||||
*/
|
||||
bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD()
|
||||
void LLSyntaxIdLSL::openKeywordsFile()
|
||||
{
|
||||
LL_WARNS("LSLSyntax")
|
||||
<< "Trying to open default or cached keyword file ;-)"
|
||||
<< LL_ENDL;
|
||||
|
||||
bool loaded = false;
|
||||
LLSD content;
|
||||
llifstream file;
|
||||
file.open(mFullFileSpec);
|
||||
if (file.is_open())
|
||||
{
|
||||
loaded = (bool)LLSDSerialize::fromXML(content, file);
|
||||
if (!loaded)
|
||||
{
|
||||
LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << filename << LL_ENDL;
|
||||
|
||||
// Is this the right thing to do, or should we leave the old content
|
||||
// even if it isn't entirely accurate anymore?
|
||||
sKeywordsXml = LLSD.emptyMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
sKeywordsXml = content;
|
||||
LL_INFOS("LSLSyntax") << "Deserialised file: " << filename << LL_ENDL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("LSLSyntax") << "Unable to open file: " << filename << LL_ENDL;
|
||||
}
|
||||
return loaded;
|
||||
// TODO Open the file and load LLSD into sKeywordsXml
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ public:
|
|||
bool checkSyntaxIdChanged();
|
||||
std::string getFileNameCurrent() const { return mFileNameCurrent; }
|
||||
ELLPath getFilePath() const { return mFilePath; }
|
||||
LLSD getKeywordsXML() const { return sKeywordsXml; }
|
||||
LLUUID getSyntaxId() const { return mSyntaxIdCurrent; }
|
||||
|
||||
void initialise();
|
||||
|
|
@ -51,8 +50,7 @@ protected:
|
|||
std::string buildFileNameNew();
|
||||
std::string buildFullFileSpec();
|
||||
void fetchKeywordsFile();
|
||||
//void openKeywordsFile();
|
||||
bool loadKeywordsFileIntoLLSD();
|
||||
void openKeywordsFile();
|
||||
void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; }
|
||||
void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; }
|
||||
void setFileNameDefault(std::string& name) { mFileNameDefault = name; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue