Skip to content

Commit

Permalink
Implemented colours for the codecompletion documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yvesdm3000 committed Dec 6, 2015
1 parent 3c86e7f commit ca66fbb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions clangproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "tokendatabase.h"
#include "translationunit.h"
#include <cbcolourmanager.h>

namespace ProxyHelper
{
Expand Down Expand Up @@ -976,6 +977,7 @@ wxString ClangProxy::DocumentCCToken(ClTranslUnitId translUnitId, int tknId)
doc = wxT("namespace ");
for (int i = 0; i < upperBound; ++i)
{

CXCompletionChunkKind kind = clang_getCompletionChunkKind(token->CompletionString, i);
if (kind == CXCompletionChunk_TypedText)
{
Expand Down Expand Up @@ -1027,13 +1029,19 @@ wxString ClangProxy::DocumentCCToken(ClTranslUnitId translUnitId, int tknId)
if (descriptor.IsEmpty())
{
CXString comment = clang_getCompletionBriefComment(token->CompletionString);
descriptor = HTML_Writer::Escape(wxT("\n") + wxString::FromUTF8(clang_getCString(comment)));
descriptor = wxT("<p><font size=\"1\">")+HTML_Writer::Escape(wxString::FromUTF8(clang_getCString(comment)))+wxT("</font></p>");
clang_disposeString(comment);
}
}
ColourManager *colours = Manager::Get()->GetColourManager();
wxString html = _T("<html><body bgcolor=\"");
html += colours->GetColour(wxT("cc_docs_back")).GetAsString(wxC2S_HTML_SYNTAX) + _T("\" text=\"");
html += colours->GetColour(wxT("cc_docs_fore")).GetAsString(wxC2S_HTML_SYNTAX) + _T("\" link=\"");
html += colours->GetColour(wxT("cc_docs_link")).GetAsString(wxC2S_HTML_SYNTAX) + _T("\">");
html += _T("<p><a name=\"top\"></a>");

return wxT("<html><body><br><tt>") + HTML_Writer::SyntaxHl(doc, m_CppKeywords)
+ wxT("</tt>") + descriptor + wxT("</body></html>");
return html + wxT("<font size=\"2\"><code>") + HTML_Writer::SyntaxHl(doc, m_CppKeywords)
+ wxT("</code></font></p>") + descriptor + wxT("</body></html>");
}

wxString ClangProxy::GetCCInsertSuffix(ClTranslUnitId translUnitId, int tknId, const wxString& newLine, std::vector<std::pair<int, int> >& offsetsList)
Expand Down
1 change: 1 addition & 0 deletions clangproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ class ClangProxy
ClangProxy( wxEvtHandler* pEvtHandler, ClTokenDatabase& database, const std::vector<wxString>& cppKeywords);
~ClangProxy();

/** Append a job to the end of the queue */
void AppendPendingJob( ClangProxy::ClangJob& job );
//void PrependPendingJob( ClangProxy::ClangJob& job );

Expand Down

0 comments on commit ca66fbb

Please sign in to comment.