コード例 #1
0
ファイル: lexers.cpp プロジェクト: hfvw/wxExtension
void wxExLexers::Initialize()
{
  m_DefaultStyle = wxExStyle();
  m_ThemeColours.clear();
  m_GlobalProperties.clear();
  m_Indicators.clear();
  m_Lexers.clear();
  m_Macros.clear();
  m_ThemeMacros.clear();
  m_Markers.clear();
  m_Styles.clear();
  m_StylesHex.clear();
  m_ThemeColours[m_NoTheme] = m_DefaultColours;
  const std::map<wxString, wxString> empty_map;
  m_ThemeMacros[m_NoTheme] = empty_map;  
}
コード例 #2
0
ファイル: lexers.cpp プロジェクト: hfvw/wxExtension
void wxExLexers::ParseNodeGlobal(const wxXmlNode* node)
{
  wxXmlNode* child = node->GetChildren();

  while (child)
  {
    if (m_Theme == m_NoTheme)
    {
      // Do nothing.
    }
    else if (child->GetName() == "hex")
    {
      m_StylesHex.push_back(wxExStyle(child, "global"));
    }
    else if (child->GetName() == "indicator")
    {
      const wxExIndicator indicator (child);

      if (indicator.IsOk())
      {
        m_Indicators.insert(indicator);
      }
    }
    else if (child->GetName() == "marker")
    {
      const wxExMarker marker(child);

      if (marker.IsOk())
      {
        m_Markers.insert(marker);
      }
    }
    else if (child->GetName() == "properties")
    {
      wxExNodeProperties(child, m_GlobalProperties);
    }
    else if (child->GetName() == "style")
    {
      const wxExStyle style(child, "global");

      if (style.ContainsDefaultStyle())
      {
        if (m_DefaultStyle.IsOk())
        {
          wxLogError("Duplicate default style: %s on line: %d",
            child->GetName().c_str(), 
            child->GetLineNumber());
        }
        else
        {
          m_DefaultStyle = style;
        }
      }
      else
      {
        m_Styles.push_back(style);
      }
    }
    
    child = child->GetNext();
  }
}
コード例 #3
0
#include <numeric>
#include <wx/wxprec.h>
#include <wx/xml/xml.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/extension/style.h>
#include <wx/extension/managedframe.h>
#include <wx/extension/stc.h>
#include "test.h"

TEST_CASE("wxExStyle", "[stc][lexer]")
{
  SECTION("Default constructor")
  {
    REQUIRE(!wxExStyle().IsOk() );
  }
  
  SECTION("Constructor using no and value")
  {
    for (const auto& style : std::vector<
      std::pair<
        std::pair<std::string,std::string>,
        std::pair<std::string,std::string>>> {
      {{"MARK_CIRCLE",""}, {"ugly","global"}},
      {{"mark_circle","0 "}, {"ugly","global"}},
      {{"512",""}, {"ugly","global"}},
      {{"number,string,comment","1 4 6 "}, {"fore:blue", "cpp"}},
      {{"number,string,xxx","4 6 "}, {"fore:black", "cpp"}},
      {{"xxx",""}, {"fore:black", "cpp"}}})
    {