Patch #2651 2009-01-18 22:08

danselmi

moved CommentTokens to configuration files
Download
2651-moved_CommentT.patch (45.2 KB)
Category
Application::Refinement
Status
Accepted
Close date
2009-06-11 17:08
Assigned to
mortenmacfly
Index: include/editorcolourset.h
===================================================================
--- include/editorcolourset.h    (revision 5414)
+++ include/editorcolourset.h    (working copy)
@@ -39,6 +39,15 @@
 };
 WX_DEFINE_ARRAY(OptionColour*, OptionColours);
 
+struct CommentToken {
+    wxString lineComment;
+    wxString streamCommentStart;
+    wxString streamCommentEnd;
+    wxString boxCommentStart;
+    wxString boxCommentMid;
+    wxString boxCommentEnd;
+};
+
 struct OptionSet
 {
     wxString m_Langs;
@@ -53,6 +62,9 @@
 
     wxString m_originalKeywords[wxSCI_KEYWORDSET_MAX + 1]; // wxSCI_KEYWORDSET_MAX+1 keyword sets
     wxArrayString m_originalFileMasks;
+
+    CommentToken comment;
+    bool m_CaseSensitive;
 };
 WX_DECLARE_STRING_HASH_MAP(OptionSet, OptionSetsMap);
 
@@ -97,6 +109,10 @@
         void SetFileMasks(HighlightLanguage lang, const wxString& masks, const wxString& = _(","));
         wxString GetSampleCode(HighlightLanguage lang, int* breakLine, int* debugLine, int* errorLine);
         void SetSampleCode(HighlightLanguage lang, const wxString& sample, int breakLine, int debugLine, int errorLine);
+        CommentToken GetCommentToken(HighlightLanguage lang);
+        void SetCommentToken(HighlightLanguage lang, CommentToken token);
+        bool GetCaseSensitivity(HighlightLanguage lang);
+        void SetCaseSensitivity(HighlightLanguage lang, bool CaseSensitive);
     protected:
     private:
         void DoApplyStyle(cbStyledTextCtrl* control, int value, OptionColour* option);
Index: include/editorlexerloader.h
===================================================================
--- include/editorlexerloader.h    (revision 5414)
+++ include/editorlexerloader.h    (working copy)
@@ -25,6 +25,7 @@
         void DoKeywords(HighlightLanguage language, TiXmlElement* node);
         void DoSingleKeywordNode(HighlightLanguage language, TiXmlElement* node, const wxString& nodename);
         void DoSampleCode(HighlightLanguage language, TiXmlElement* node);
+        void DoLangAttributes(HighlightLanguage language, TiXmlElement* node);
         EditorColourSet* m_pTarget;
     private:
 };
Index: sdk/editorcolourset.cpp
===================================================================
--- sdk/editorcolourset.cpp    (revision 5414)
+++ sdk/editorcolourset.cpp    (working copy)
@@ -797,3 +797,41 @@
     mset.m_DebugLine = debugLine;
     mset.m_ErrorLine = errorLine;
 }
+
+void EditorColourSet::SetCommentToken(HighlightLanguage lang, CommentToken token)
+{
+    if (lang == HL_NONE)
+        return;
+    m_Sets[lang].comment = token;
+}
+
+CommentToken EditorColourSet::GetCommentToken(HighlightLanguage lang)
+{
+    CommentToken com;
+    com.lineComment        = _T("");
+    com.streamCommentStart = _T("");
+    com.streamCommentEnd   = _T("");
+    com.boxCommentStart    = _T("");
+    com.boxCommentMid      = _T("");
+    com.boxCommentEnd      = _T("");
+
+    if (lang != HL_NONE)
+    {
+        com = m_Sets[lang].comment;
+    }
+    return com;
+}
+
+void EditorColourSet::SetCaseSensitivity(HighlightLanguage lang, bool CaseSensitive)
+{
+    if ( lang == HL_NONE )
+        return;
+    m_Sets[lang].m_CaseSensitive = CaseSensitive;
+}
+
+bool EditorColourSet::GetCaseSensitivity(HighlightLanguage lang)
+{
+    if ( lang == HL_NONE )
+        return false;
+    return m_Sets[lang].m_CaseSensitive;
+}
Index: sdk/editorlexerloader.cpp
===================================================================
--- sdk/editorlexerloader.cpp    (revision 5414)
+++ sdk/editorlexerloader.cpp    (working copy)
@@ -90,6 +90,7 @@
     DoStyles(style, node);
     DoKeywords(style, node);
     DoSampleCode(style, node);
+    DoLangAttributes(style, node);
 }
 
 void EditorLexerLoader::DoStyles(HighlightLanguage language, TiXmlElement* node)
@@ -190,3 +191,24 @@
     int errorLine = sample->Attribute("error_line") ? atol(sample->Attribute("error_line")) : -1;
     m_pTarget->SetSampleCode(language, code, breakLine, debugLine, errorLine);
 }
+
+void EditorLexerLoader::DoLangAttributes(HighlightLanguage language, TiXmlElement* node)
+{
+    TiXmlElement* attribs = node->FirstChildElement("LanguageAttributes");
+    if ( !attribs )
+        return;
+
+    bool CaseSensitive = attribs->Attribute("CaseSensitive") ? atol(attribs->Attribute("CaseSensitive")) != 0 : false;
+    m_pTarget->SetCaseSensitivity(language, CaseSensitive);
+
+
+    CommentToken token;
+    token.lineComment = wxString( attribs->Attribute("LineComment"), wxConvUTF8 );
+    token.streamCommentStart = wxString( attribs->Attribute("StreamCommentStart"), wxConvUTF8 );
+    token.streamCommentEnd = wxString( attribs->Attribute("StreamCommentEnd"), wxConvUTF8 );
+    token.boxCommentStart = wxString( attribs->Attribute("BoxCommentStart"), wxConvUTF8 );
+    token.boxCommentMid = wxString( attribs->Attribute("BoxCommentMid"), wxConvUTF8 );
+    token.boxCommentEnd = wxString( attribs->Attribute("BoxCommentEnd"), wxConvUTF8 );
+
+
download for full patch...
mortenmacfly 2009-06-11 17:08

Applied int trunk. Thanks a lot!!!