当前位置: 首页>>代码示例>>C++>>正文


C++ MathCell::Copy方法代码示例

本文整理汇总了C++中MathCell::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ MathCell::Copy方法的具体用法?C++ MathCell::Copy怎么用?C++ MathCell::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MathCell的用法示例。


在下文中一共展示了MathCell::Copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Copy

MathCell *MathCell::CopyList()
{
  MathCell *dest = Copy();
  MathCell *src = this->m_next;
  MathCell *ret = dest;
  
  while(src != NULL)
  {
    dest->AppendCell(src->Copy());
    src = src->m_next;
    dest = dest->m_next;
  }

  return ret;
}
开发者ID:BigMcLargeHuge,项目名称:wxmaxima,代码行数:15,代码来源:MathCell.cpp

示例2: ToTeX

wxString GroupCell::ToTeX(wxString imgDir, wxString filename, int *imgCounter)
{
  wxString str;
  bool SuppressLeadingNewlines = true;
  // Now we might want to introduce some markdown:
  MarkDownTeX MarkDownParser;

  bool exportInput = true;
  wxConfig::Get()->Read(wxT("exportInput"), &exportInput);

  // pagebreak
  if (m_groupType == GC_TYPE_PAGEBREAK) {
    str = wxT("\\pagebreak\n");
    SuppressLeadingNewlines = true;
  }

  // IMAGE CELLS
  else if (m_groupType == GC_TYPE_IMAGE && imgDir != wxEmptyString) {
    MathCell *copy = m_output->Copy();
    (*imgCounter)++;
    wxString image = filename + wxString::Format(wxT("_%d"), *imgCounter);
    wxString file = imgDir + wxT("/") + image + wxT(".png");

    Bitmap bmp;
    bmp.SetData(copy);

    if (!wxDirExists(imgDir))
      wxMkdir(imgDir);

    if (bmp.ToFile(file).x>=0)
    {
      str << wxT("\\begin{figure}[htb]\n")
          << wxT("  \\begin{center}\n")
          << wxT("    \\includeimage{")
          << filename << wxT("_img/") << image << wxT("}\n")
          << wxT("  \\caption{") << PrepareForTeX(m_input->m_next->GetValue()) << wxT("}\n")
          << wxT("  \\end{center}\n")
          << wxT("\\end{figure}");
    }
  }
  else if (m_groupType == GC_TYPE_IMAGE)
    str << wxT("\n\\vert|<<GRAPHICS>>|\n");

  // CODE CELLS
  else if (m_groupType == GC_TYPE_CODE) {
    // Input cells
    if(exportInput)
    {
      str = wxT("\n\\noindent\n%%%%%%%%%%%%%%%\n")
        wxT("%%% INPUT:\n")
        wxT("\\begin{minipage}[t]{8ex}{\\color{red}\\bf\n")
        wxT("\\begin{verbatim}\n") +
        m_input->ToString() +
        wxT("\n\\end{verbatim}}\n\\end{minipage}");
      
      if (m_input->m_next!=NULL)
      {
        
        wxString input = m_input->m_next->ToString();
#if wxUSE_UNICODE
        input.Replace(wxT("\x2212"), wxT("-")); // unicode minus sign
        input.Replace(wxT("\xDCB6"), wxT(" ")); // Some weird unicode space character
#endif
        str += wxT("\n\\begin{minipage}[t]{\\textwidth}{\\color{blue}\n\\begin{verbatim}\n") +
          input +
             wxT("\n\\end{verbatim}}\n\\end{minipage}");
      }
      
      str += wxT("\n");
    }
    else str = wxEmptyString;

    if (m_output != NULL) {
      str += wxT("%%% OUTPUT:\n");
      // Need to define labelcolor if this is Copy as LaTeX!
      if (imgCounter == NULL)
        str += wxT("\\definecolor{labelcolor}{RGB}{100,0,0}\n");
      MathCell *tmp = m_output;

      bool mathMode = false;

      while (tmp != NULL)
      {
        if (tmp->GetType() == MC_TYPE_IMAGE || tmp->GetType() == MC_TYPE_SLIDE)
        {
          if (imgDir != wxEmptyString)
          {
            MathCell *copy = tmp->Copy();
            (*imgCounter)++;
            wxString image = filename + wxString::Format(wxT("_%d"), *imgCounter);
	    
            if (!wxDirExists(imgDir))
              if (!wxMkdir(imgDir))
                continue;
	    
	    // Do we want to output LaTeX animations?
	    bool AnimateLaTeX=true;
	    wxConfig::Get()->Read(wxT("AnimateLaTeX"), &AnimateLaTeX);
	    if((tmp->GetType() == MC_TYPE_SLIDE)&&(AnimateLaTeX))
            {
//.........这里部分代码省略.........
开发者ID:BigMcLargeHuge,项目名称:wxmaxima,代码行数:101,代码来源:GroupCell.cpp

示例3: ToTeX

wxString GroupCell::ToTeX(bool all, wxString imgDir, wxString filename, int *imgCounter)
{
  wxString str;

  // pagebreak
  if (m_groupType == GC_TYPE_PAGEBREAK) {
    str = wxT("\\pagebreak\n");
  }

  // IMAGE CELLS
  else if (m_groupType == GC_TYPE_IMAGE && imgDir != wxEmptyString) {
    MathCell *copy = m_output->Copy(false);
    (*imgCounter)++;
    wxString image = filename + wxString::Format(wxT("_%d.png"), *imgCounter);
    wxString file = imgDir + wxT("/") + image;

    Bitmap bmp;
    bmp.SetData(copy);

    if (!wxDirExists(imgDir))
      wxMkdir(imgDir);

    if (bmp.ToFile(file))
    {
      str << wxT("\\begin{figure}[htb]\n")
          << wxT("  \\begin{center}\n")
          << wxT("    \\includegraphics{")
          << filename << wxT("_img/") << image << wxT("}\n")
          << wxT("  \\caption{") << PrepareForTeX(m_input->m_next->GetValue()) << wxT("}\n")
          << wxT("  \\end{center}\n")
          << wxT("\\end{figure}");
    }
  }
  else if (m_groupType == GC_TYPE_IMAGE)
    str << wxT("\n\\vert|<<GRAPHICS>>|\n");

  // CODE CELLS
  else if (m_groupType == GC_TYPE_CODE) {
    // Input cells
    str = wxT("\n\\noindent\n%%%%%%%%%%%%%%%\n")
          wxT("%%% INPUT:\n")
          wxT("\\begin{minipage}[t]{8ex}{\\color{red}\\bf\n")
          wxT("\\begin{verbatim}\n") +
          m_input->ToString(false) +
          wxT("\n\\end{verbatim}}\n\\end{minipage}");

    if (m_input->m_next!=NULL)
    {
      str += wxT("\n\\begin{minipage}[t]{\\textwidth}{\\color{blue}\n\\begin{verbatim}\n") +
             m_input->m_next->ToString(true) +
             wxT("\n\\end{verbatim}}\n\\end{minipage}");
    }

    str += wxT("\n");

    if (m_output != NULL) {
      str += wxT("%%% OUTPUT:\n");
      // Need to define labelcolor if this is Copy as LaTeX!
      if (imgCounter == NULL)
        str += wxT("\\definecolor{labelcolor}{RGB}{100,0,0}\n");
      str += wxT("\\begin{math}\\displaystyle\n");
      MathCell *tmp = m_output;

      while (tmp != NULL) {

        if (tmp->GetType() == MC_TYPE_IMAGE || tmp->GetType() == MC_TYPE_SLIDE)
        {
          if (imgDir != wxEmptyString)
          {
            MathCell *copy = tmp->Copy(false);
            (*imgCounter)++;
            wxString image = filename + wxString::Format(wxT("_%d.png"), *imgCounter);
            wxString file = imgDir + wxT("/") + image;

            Bitmap bmp;
            bmp.SetData(copy);

            if (!wxDirExists(imgDir))
              if (!wxMkdir(imgDir))
                continue;

            if (bmp.ToFile(file))
              str += wxT("\\includegraphics[width=9cm]{") +
                  filename + wxT("_img/") + image + wxT("}");
          }
          else
            str << wxT("\n\\verb|<<GRAPHICS>>|\n");
        }

        else if (tmp->GetStyle() == TS_LABEL)
        {
          if (str.Right(13) != wxT("displaystyle\n"))
            str += wxT("\n\\end{math}\n\n\\begin{math}\\displaystyle\n");
          str += wxT("\\parbox{8ex}{\\color{labelcolor}") + tmp->ToTeX(false) + wxT("}\n");
        }

        else
          str += tmp->ToTeX(false);

        tmp = tmp->m_nextToDraw;
//.........这里部分代码省略.........
开发者ID:BlackEdder,项目名称:wxmaxima,代码行数:101,代码来源:GroupCell.cpp


注:本文中的MathCell::Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。