Пример #1
0
void MathPrintout::GetPageMargins(int* horizontal, int* vertical)
{
  double scale = GetPPIScale();

  *horizontal = (int)(SCALE_PX(PRINT_MARGIN_HORIZONTAL, scale) * 10);
  *vertical = (int)(SCALE_PX(PRINT_MARGIN_VERTICAL, scale) * 10);
}
Пример #2
0
void AtCell::Draw(wxPoint point, int fontsize)
{
  MathCell::Draw(point, fontsize);

  Configuration *configuration = Configuration::Get();
  double scale = configuration->GetScale();
  wxDC& dc = configuration->GetDC();
  if (DrawThisCell(point) && InUpdateRegion())
  {
    wxPoint bs, in;

    bs.x = point.x;
    bs.y = point.y;
    m_baseCell->DrawList(bs, fontsize);

    in.x = point.x + m_baseCell->GetFullWidth(scale) + SCALE_PX(4, scale);
    in.y = point.y + m_baseCell->GetMaxDrop() +
           + m_indexCell->GetMaxCenter() - SCALE_PX(7, scale);
    m_indexCell->DrawList(in, MAX(MC_MIN_SIZE, fontsize - 3));
    SetPen();
    dc.DrawLine(in.x - SCALE_PX(2, scale),
                bs.y - m_baseCell->GetMaxCenter(),
                in.x - SCALE_PX(2, scale),
                in.y);
    UnsetPen();
  }
}
Пример #3
0
void FracCell::RecalculateSize(CellParser& parser, int fontsize, bool all)
{
  double scale = parser.GetScale();
  if (m_isBroken || m_exponent)
  {
    m_num->RecalculateSize(parser, fontsize, true);
    m_denom->RecalculateSize(parser, fontsize, true);
  }
  else
  {
    m_num->RecalculateSize(parser, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);
    m_denom->RecalculateSize(parser, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);
  }
  if (!m_exponent)
  {
    m_height = m_num->GetMaxHeight() + m_denom->GetMaxHeight() +
               SCALE_PX(4, scale);
    m_center = m_num->GetMaxHeight() + SCALE_PX(2, scale);
  }
  else
  {
    m_height = m_num->GetMaxHeight();
    m_center = m_height / 2;
  }

  m_open1->RecalculateSize(parser, fontsize, false);
  m_close1->RecalculateSize(parser, fontsize, false);
  m_open2->RecalculateSize(parser, fontsize, false);
  m_close2->RecalculateSize(parser, fontsize, false);
  m_divide->RecalculateSize(parser, fontsize, false);
  MathCell::RecalculateSize(parser, fontsize, all);
}
Пример #4
0
void ParenCell::RecalculateSize(CellParser& parser, int fontsize, bool all)
{
    double scale = parser.GetScale();
    m_innerCell->RecalculateSize(parser, fontsize, true);
    m_height = m_innerCell->GetMaxHeight() + SCALE_PX(2, scale);
    m_center = m_innerCell->GetMaxCenter() + SCALE_PX(1, scale);

#if defined __WXMSW__
    if (!parser.CheckTeXFonts())
    {
        wxDC& dc = parser.GetDC();
        int fontsize1 = (int) ((fontsize * scale + 0.5));
        dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                          false,
                          false,
                          false,
                          parser.GetFontName()));
        dc.GetTextExtent(wxT("("), &m_charWidth1, &m_charHeight1);
    }
#endif

    m_open->RecalculateSize(parser, fontsize, false);
    m_close->RecalculateSize(parser, fontsize, false);
    MathCell::RecalculateSize(parser, fontsize, all);
}
Пример #5
0
/*
void MathPrintout::RecalculateSize()
{
  wxConfig *config = (wxConfig *)wxConfig::Get();
  int fontsize = 12;
  config->Read(wxT("fontSize"), &fontsize);
  GroupCell* tmp = m_tree;
  double scale = GetPPIScale();

  wxDC *dc = GetDC();
  CellParser parser(*dc, scale);
  int marginX, marginY;
  GetPageMargins(&marginX, &marginY);
  marginX += SCALE_PX(MC_BASE_INDENT, scale);
  parser.SetIndent(marginX);

  while (tmp != NULL)
  {
    tmp->RecalculateSize(parser, fontsize, false);
    tmp = tmp->m_next;
  }
}
*/
void MathPrintout::Recalculate()
{
  wxConfig *config = (wxConfig *)wxConfig::Get();
  int fontsize = 12;
  config->Read(wxT("fontSize"), &fontsize);
  int mfontsize = fontsize;
  config->Read(wxT("mathfontsize"), &mfontsize);
  GroupCell* tmp = (GroupCell *)m_tree;
  double scale = GetPPIScale();

  wxDC *dc = GetDC();
  CellParser parser(*dc, scale);

  int marginX, marginY;
  GetPageMargins(&marginX, &marginY);
  int pageWidth, pageHeight;
  GetPageSizePixels(&pageWidth, &pageHeight);

  parser.SetClientWidth(pageWidth - marginX - marginY
                        - SCALE_PX(MC_BASE_INDENT, scale));

  marginX += SCALE_PX(MC_BASE_INDENT, scale);
  parser.SetIndent(marginX);

  while (tmp != NULL)
  {
    tmp->Recalculate(parser, fontsize, mfontsize);
    tmp = (GroupCell *)tmp->m_next;
  }
}
Пример #6
0
void IntCell::RecalculateSize(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();

  m_under->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - 5));
  m_over->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - 5));
  m_base->RecalculateSizeList(parser, fontsize);
  m_var->RecalculateSizeList(parser, fontsize);

  if (m_intStyle == INT_DEF)
  {
    if (parser.CheckTeXFonts())
    {
      m_center = MAX(m_over->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
                     m_base->GetMaxCenter());
      m_height = m_center +
                 MAX(m_under->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
                     m_base->GetMaxDrop());
    }
    else
    {
      m_center = MAX(m_over->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
                     m_base->GetMaxCenter());
      m_height = m_center +
                 MAX(m_under->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
                     m_base->GetMaxDrop());
    }
  }
  else
  {
    m_center = MAX(m_signSize / 2, m_base->GetMaxCenter());
    m_height = m_center +
      MAX(m_signSize / 2, m_base->GetMaxDrop());
  }
}
Пример #7
0
void SubSupCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
  if (DrawThisCell(parser, point))
  {
    double scale = parser.GetScale();
    wxPoint bs, in;

    bs.x = point.x;
    bs.y = point.y;
    m_baseCell->Draw(parser, bs, fontsize, true);

    in.x = point.x + m_baseCell->GetFullWidth(scale) - SCALE_PX(2, scale);
    in.y = point.y + m_baseCell->GetMaxDrop() +
           m_indexCell->GetMaxCenter() -
           SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
    m_indexCell->Draw(parser, in, MAX(MC_MIN_SIZE, fontsize - SUBSUP_DEC), true);

    in.y = point.y - m_baseCell->GetMaxCenter() - m_exptCell->GetMaxHeight()
           + m_exptCell->GetMaxCenter() +
           SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
    m_exptCell->Draw(parser, in, MAX(MC_MIN_SIZE, fontsize - SUBSUP_DEC), true);
  }

  MathCell::Draw(parser, point, fontsize, all);
}
Пример #8
0
void FracCell::RecalculateSize(int fontsize)
{
  CellParser *parser = CellParser::Get();
  double scale = parser->GetScale();
  if (m_isBroken || m_exponent)
  {
    m_num->RecalculateSizeList(fontsize);
    m_denom->RecalculateSizeList(fontsize);
  }
  else
  {
    m_num->RecalculateSizeList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
    m_denom->RecalculateSizeList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
  }
  if (!m_exponent)
  {
    m_height = m_num->GetMaxHeight() + m_denom->GetMaxHeight() +
               SCALE_PX(4, scale);
    m_center = m_num->GetMaxHeight() + SCALE_PX(2, scale);
  }
  else
  {
    m_height = m_num->GetMaxHeight();
    m_center = m_height / 2;
  }

  m_open1->RecalculateSize(fontsize);
  m_close1->RecalculateSize(fontsize);
  m_open2->RecalculateSize(fontsize);
  m_close2->RecalculateSize(fontsize);
  m_divide->RecalculateSize(fontsize);
  MathCell::RecalculateSize(fontsize);
}
Пример #9
0
void MathPrintout::PrintHeader(int pageNum, wxDC* dc, double scale)
{
  int page_width, page_height;
  int title_width, title_height;
  int marginX, marginY;
  int pageWidth, pageHeight;

  GetPageMargins(&marginX, &marginY);
  GetPageSizePixels(&pageWidth, &pageHeight);

  dc->SetTextForeground(wxColour(wxT("grey")));
  dc->SetPen(wxPen(wxT("light grey"), 1, wxSOLID));

  dc->SetFont(wxFont(SCALE_PX(10, scale), wxMODERN, wxNORMAL, wxNORMAL));
  dc->GetTextExtent(GetTitle(), &title_width, &title_height);
  wxString page = wxString::Format(wxT("%d / %d"), pageNum, m_numberOfPages);
  dc->GetTextExtent(page, &page_width, &page_height);

  dc->DrawText(GetTitle(), marginX, marginY);
  dc->DrawText(page, pageWidth - page_width - marginX, marginY);

  dc->DrawLine(marginX, marginY + title_height + SCALE_PX(3, scale),
               pageWidth - marginX, marginY + title_height + SCALE_PX(3, scale));

  dc->SetTextForeground(wxColour(wxT("black")));
  dc->SetPen(wxPen(wxT("black"), 1, wxSOLID));
}
Пример #10
0
void SqrtCell::RecalculateSize(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_innerCell->RecalculateSizeList(parser, fontsize);
  m_height = m_innerCell->GetMaxHeight() + SCALE_PX(3, scale);
  m_center = m_innerCell->GetMaxCenter() + SCALE_PX(3, scale);
  m_open->RecalculateSizeList(parser, fontsize);
  m_close->RecalculateSizeList(parser, fontsize);
}
Пример #11
0
void SqrtCell::RecalculateSize(int fontsize)
{
  CellParser *parser = CellParser::Get();
  double scale = parser->GetScale();
  m_innerCell->RecalculateSizeList(fontsize);
  m_height = m_innerCell->GetMaxHeight() + SCALE_PX(3, scale);
  m_center = m_innerCell->GetMaxCenter() + SCALE_PX(3, scale);
  m_open->RecalculateSizeList(fontsize);
  m_close->RecalculateSizeList(fontsize);
}
Пример #12
0
int MathPrintout::GetHeaderHeight()
{
  wxDC *dc = GetDC();
  double ppiScale = GetPPIScale();
  int width, height;

  dc->SetFont(wxFont(SCALE_PX(10, ppiScale), wxMODERN, wxNORMAL, wxNORMAL));
  dc->GetTextExtent(GetTitle(), &width, &height);
  return height + SCALE_PX(12, ppiScale);
}
Пример #13
0
void SqrtCell::RecalculateWidths(int fontsize)
{
  CellParser *parser = CellParser::Get();
  double scale = parser->GetScale();
  m_innerCell->RecalculateWidthsList(fontsize);
  if (parser->CheckTeXFonts())
  {
    wxDC& dc = parser->GetDC();
    double scale = parser->GetScale();
    m_innerCell->RecalculateSizeList(fontsize);

    m_signFontScale = 1.0;
    int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);

    dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;

    int size = m_innerCell->GetMaxHeight();

    if  (size <= (m_signSize) / 5)  {
      m_signType = 1;
      m_signFontScale = (5.0 * size) / (1.5 * m_signSize);
    }
    else if (size <= (2*m_signSize) / 5) {
      m_signType = 2;
      m_signFontScale = (5.0 * size) / (2.2 * m_signSize);
    }
    else if (size <= (3*m_signSize) / 5) {
      m_signType = 3;
      m_signFontScale = (5.0 * size) / (3.0 * m_signSize);
    }
    else if (size <= (4*m_signSize) / 5 ) {
      m_signType = 4;
      m_signFontScale = (5.0 * size) / (3.8 * m_signSize);
    }
    else {
      m_signType = 5;
      m_signFontScale = 1.0;
    }

    fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
    dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
  }
  else
    m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(10, scale) +
              3 * SCALE_PX(1, scale) + 1;
  m_open->RecalculateWidthsList(fontsize);
  m_close->RecalculateWidthsList(fontsize);
  ResetData();
}
Пример #14
0
void SqrtCell::RecalculateWidths(CellParser& parser, int fontsize, bool all)
{
  double scale = parser.GetScale();
  m_innerCell->RecalculateWidths(parser, fontsize, true);
  if (parser.CheckTeXFonts())
  {
    wxDC& dc = parser.GetDC();
    double scale = parser.GetScale();
    m_innerCell->RecalculateSize(parser, fontsize, true);

    m_signFontScale = 1.0;
    int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);

    dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;

    int size = m_innerCell->GetMaxHeight();

    if  (size <= (m_signSize) / 5)  {
      m_signType = 1;
      m_signFontScale = (5.0 * size) / (1.5 * m_signSize);
    }
    else if (size <= (2*m_signSize) / 5) {
      m_signType = 2;
      m_signFontScale = (5.0 * size) / (2.2 * m_signSize);
    }
    else if (size <= (3*m_signSize) / 5) {
      m_signType = 3;
      m_signFontScale = (5.0 * size) / (3.0 * m_signSize);
    }
    else if (size <= (4*m_signSize) / 5 ) {
      m_signType = 4;
      m_signFontScale = (5.0 * size) / (3.8 * m_signSize);
    }
    else {
      m_signType = 5;
      m_signFontScale = 1.0;
    }

    fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
    dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
  }
  else
    m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(10, scale) +
              3 * SCALE_PX(1, scale) + 1;
  m_open->RecalculateWidths(parser, fontsize, all);
  m_close->RecalculateWidths(parser, fontsize, all);
  MathCell::RecalculateWidths(parser, fontsize, all);
}
Пример #15
0
void SubSupCell::RecalculateSize(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();

  m_baseCell->RecalculateSizeList(parser, fontsize);
  m_indexCell->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - SUBSUP_DEC));
  m_exptCell->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - SUBSUP_DEC));

  m_height = m_baseCell->GetMaxHeight() + m_indexCell->GetMaxHeight() +
             m_exptCell->GetMaxHeight() -
             2*SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, parser.GetScale());

  m_center = m_exptCell->GetMaxHeight() + m_baseCell->GetMaxCenter() -
             SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
}
Пример #16
0
void FracCell::Draw(wxPoint point, int fontsize)
{
  MathCell::Draw(point, fontsize);
  CellParser *parser = CellParser::Get();

  if (DrawThisCell(point) && InUpdateRegion())
  {
    wxDC& dc = parser->GetDC();
    double scale = parser->GetScale();
    wxPoint num, denom;

    if (m_exponent && !m_isBroken)
    {
      double scale = parser->GetScale();
      
      num.x = point.x;
      num.y = point.y;
      denom.x = point.x + m_num->GetFullWidth(scale) + m_expDivideWidth;
      denom.y = num.y;

      m_num->DrawList(num, fontsize);
      m_denom->DrawList(denom, fontsize);

      int fontsize1 = (int) ((double)(fontsize) * scale + 0.5);
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
    		  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
    		  parser->GetFontName(TS_VARIABLE)));
      dc.DrawText(wxT("/"),
                  point.x + m_num->GetFullWidth(scale),
                  point.y - m_num->GetMaxCenter() + SCALE_PX(MC_TEXT_PADDING, scale));
    }
    else
    {      
      num.x = point.x + (m_width - m_num->GetFullWidth(scale)) / 2;
      num.y = point.y - m_num->GetMaxHeight() + m_num->GetMaxCenter() -
              SCALE_PX(2, scale);
      m_num->DrawList(num, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));

      denom.x = point.x + (m_width - m_denom->GetFullWidth(scale)) / 2;
      denom.y = point.y + m_denom->GetMaxCenter() + SCALE_PX(2, scale);
      m_denom->DrawList(denom, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
      SetPen();
      if (m_fracStyle != FC_CHOOSE)
        dc.DrawLine(point.x + m_horizontalGap, point.y, point.x + m_width - m_horizontalGap, point.y);
      UnsetPen();
    }
  }
}
Пример #17
0
void FracCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
  if (DrawThisCell(parser, point))
  {
    wxDC& dc = parser.GetDC();
    double scale = parser.GetScale();
    wxPoint num, denom;

    if (m_exponent && !m_isBroken)
    {
      double scale = parser.GetScale();

      num.x = point.x;
      num.y = point.y;
      denom.x = point.x + m_num->GetFullWidth(scale) + m_expDivideWidth;
      denom.y = num.y;

      m_num->Draw(parser, num, fontsize, true);
      m_denom->Draw(parser, denom, fontsize, true);

      int fontsize1 = (int) ((double)(fontsize) * scale + 0.5);
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                              false, false, false,
                              parser.GetFontName(TS_VARIABLE)));
      dc.DrawText(wxT("/"),
                  point.x + m_num->GetFullWidth(scale),
                  point.y - m_num->GetMaxCenter() + SCALE_PX(MC_TEXT_PADDING, scale));
    }
    else
    {
      num.x = point.x + (m_width - m_num->GetFullWidth(scale)) / 2;
      num.y = point.y - m_num->GetMaxHeight() + m_num->GetMaxCenter() -
              SCALE_PX(2, scale);
      m_num->Draw(parser, num, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);

      denom.x = point.x + (m_width - m_denom->GetFullWidth(scale)) / 2;
      denom.y = point.y + m_denom->GetMaxCenter() + SCALE_PX(2, scale);
      m_denom->Draw(parser, denom, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);
      SetPen(parser);
      if (m_fracStyle != FC_CHOOSE)
        dc.DrawLine(point.x, point.y, point.x + m_width, point.y);
      UnsetPen(parser);
    }
  }

  MathCell::Draw(parser, point, fontsize, all);
}
Пример #18
0
void ExptCell::RecalculateSize(CellParser& parser, int fontsize, bool all)
{
  double scale = parser.GetScale();
  m_baseCell->RecalculateSize(parser, fontsize, true);
  if (m_isBroken)
    m_powCell->RecalculateSize(parser, fontsize, true);
  else
    m_powCell->RecalculateSize(parser, MAX(MC_MIN_SIZE, fontsize - EXPT_DEC), true);
  m_height = m_baseCell->GetMaxHeight() + m_powCell->GetMaxHeight() -
             SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
  m_center = m_powCell->GetMaxHeight() + m_baseCell->GetMaxCenter() -
             SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
  m_exp->RecalculateSize(parser, fontsize, true);
  m_open->RecalculateSize(parser, fontsize, true);
  m_close->RecalculateSize(parser, fontsize, true);
  MathCell::RecalculateSize(parser, fontsize, all);
}
Пример #19
0
void SubCell::RecalculateHeight(int fontsize)
{
  Configuration *configuration = Configuration::Get();
  m_baseCell->RecalculateHeightList(fontsize);
  m_indexCell->RecalculateHeightList(MAX(MC_MIN_SIZE, fontsize - SUB_DEC));
  m_height = m_baseCell->GetMaxHeight() + m_indexCell->GetMaxHeight() -
             SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, configuration->GetScale());
  m_center = m_baseCell->GetCenter();
}
Пример #20
0
void SubCell::RecalculateSize(CellParser& parser, int fontsize, bool all)
{
  m_baseCell->RecalculateSize(parser, fontsize, true);
  m_indexCell->RecalculateSize(parser, MAX(MC_MIN_SIZE, fontsize - SUB_DEC), true);
  m_height = m_baseCell->GetMaxHeight() + m_indexCell->GetMaxHeight() -
             SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, parser.GetScale());
  m_center = m_baseCell->GetCenter();
  MathCell::RecalculateSize(parser, fontsize, all);
}
Пример #21
0
void SubCell::RecalculateWidths(CellParser& parser, int fontsize, bool all)
{
  double scale = parser.GetScale();
  m_baseCell->RecalculateWidths(parser, fontsize, true);
  m_indexCell->RecalculateWidths(parser, MAX(MC_MIN_SIZE, fontsize - SUB_DEC), true);
  m_width = m_baseCell->GetFullWidth(scale) + m_indexCell->GetFullWidth(scale) -
            SCALE_PX(2, parser.GetScale());
  MathCell::RecalculateWidths(parser, fontsize, all);
}
Пример #22
0
void ConjugateCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_innerCell->RecalculateWidthsList(parser, fontsize);
  m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(8, scale);
  m_open->RecalculateWidthsList(parser, fontsize);
  m_close->RecalculateWidthsList(parser, fontsize);
  ResetData();
}
Пример #23
0
void SubCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_baseCell->RecalculateWidthsList(parser, fontsize);
  m_indexCell->RecalculateWidthsList(parser, MAX(MC_MIN_SIZE, fontsize - SUB_DEC));
  m_width = m_baseCell->GetFullWidth(scale) + m_indexCell->GetFullWidth(scale) -
            SCALE_PX(2, parser.GetScale());
  ResetData();
}
Пример #24
0
void ExptCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
  if (DrawThisCell(parser, point))
  {
    double scale = parser.GetScale();
    wxPoint bs, pw;
    bs.x = point.x;
    bs.y = point.y;
    m_baseCell->Draw(parser, bs, fontsize, true);

    pw.x = point.x + m_baseCell->GetFullWidth(scale) - SCALE_PX(MC_TEXT_PADDING, scale);
    pw.y = point.y - m_baseCell->GetMaxCenter() - m_powCell->GetMaxHeight()
           + m_powCell->GetMaxCenter() +
           SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
    m_powCell->Draw(parser, pw, MAX(MC_MIN_SIZE, fontsize - EXPT_DEC), true);
  }

  MathCell::Draw(parser, point, fontsize, all);
}
Пример #25
0
/*! Get full width of this group.

  \todo Change not to use recursive function calls any more.
 */
int MathCell::GetFullWidth(double scale)
{
  // Recalculate the with of this list of cells only if this has been marked as necessary.
  if (m_fullWidth < 0)
  {
    MathCell *tmp = this;

    // We begin this calculation with a negative offset since the full width of only a single
    // cell doesn't contain the space that separates two cells - that is automatically added
    // to every cell in the next step.
    m_fullWidth = -SCALE_PX(MC_CELL_SKIP, scale);
    while(tmp != NULL)
    {
      m_fullWidth += tmp->m_width;
      tmp = tmp->m_next + SCALE_PX(MC_CELL_SKIP, scale);
    }
  }
  return m_fullWidth;
}
Пример #26
0
void AtCell::RecalculateHeight(int fontsize)
{
  Configuration *configuration = Configuration::Get();
  double scale = configuration->GetScale();
  m_baseCell->RecalculateHeightList(fontsize);
  m_indexCell->RecalculateHeightList(MAX(MC_MIN_SIZE, fontsize - 3));
  m_height = m_baseCell->GetMaxHeight() + m_indexCell->GetMaxHeight() -
             SCALE_PX(7, scale);
  m_center = m_baseCell->GetCenter();
}
Пример #27
0
void AtCell::RecalculateWidths(int fontsize)
{
  Configuration *configuration = Configuration::Get();
  double scale = configuration->GetScale();
  m_baseCell->RecalculateWidthsList(fontsize);
  m_indexCell->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - 4));
  m_width = m_baseCell->GetFullWidth(scale) + m_indexCell->GetFullWidth(scale) +
            SCALE_PX(4, scale);
  ResetData();
}
Пример #28
0
void ExptCell::Draw(wxPoint point, int fontsize)
{
  MathCell::Draw(point, fontsize);

  if (DrawThisCell(point) && InUpdateRegion())
  {
    Configuration *configuration = Configuration::Get();
    double scale = configuration->GetScale();
    wxPoint bs, pw;
    bs.x = point.x;
    bs.y = point.y;
    m_baseCell->DrawList(bs, fontsize);

    pw.x = point.x + m_baseCell->GetFullWidth(scale) - SCALE_PX(MC_TEXT_PADDING, scale);
    pw.y = point.y - m_baseCell->GetMaxCenter() - m_powCell->GetMaxHeight()
           + m_powCell->GetMaxCenter() +
           SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
    m_powCell->DrawList(pw, MAX(MC_MIN_SIZE, fontsize - EXPT_DEC));
  }
}
Пример #29
0
void MathCell::DrawList(CellParser& parser, wxPoint point, int fontsize)
{
  MathCell *tmp=this;
  while(tmp!=NULL)
  {
    tmp->Draw(parser,point,fontsize);
    double scale = parser.GetScale();
    point.x += tmp->m_width + SCALE_PX(MC_CELL_SKIP, scale);
    tmp=tmp->m_nextToDraw;
  }
}
Пример #30
0
void SubCell::Draw(wxPoint point, int fontsize)
{
  MathCell::Draw(point, fontsize);

  if (DrawThisCell(point) && InUpdateRegion())
  {
    Configuration *configuration = Configuration::Get();
    double scale = configuration->GetScale();
    wxPoint bs, in;

    bs.x = point.x;
    bs.y = point.y;
    m_baseCell->DrawList(bs, fontsize);

    in.x = point.x + m_baseCell->GetFullWidth(scale) - SCALE_PX(2, scale);
    in.y = point.y + m_baseCell->GetMaxDrop() +
           m_indexCell->GetMaxCenter() -
           SCALE_PX((8 * fontsize) / 10 + MC_EXP_INDENT, scale);
    m_indexCell->DrawList(in, MAX(MC_MIN_SIZE, fontsize - SUB_DEC));
  }
}