本文整理汇总了C++中CellParser类的典型用法代码示例。如果您正苦于以下问题:C++ CellParser类的具体用法?C++ CellParser怎么用?C++ CellParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CellParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalculateWidths
void FracCell::RecalculateWidths(CellParser& parser, int fontsize, bool all)
{
double scale = parser.GetScale();
if (m_isBroken || m_exponent)
{
m_num->RecalculateWidths(parser, fontsize, true);
m_denom->RecalculateWidths(parser, fontsize, true);
}
else
{
m_num->RecalculateWidths(parser, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);
m_denom->RecalculateWidths(parser, MAX(MC_MIN_SIZE, fontsize - FRAC_DEC), true);
}
if (m_exponent && !m_isBroken)
{
wxDC& dc = parser.GetDC();
int height;
int fontsize1 = (int) ((double)(fontsize) * scale + 0.5);
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false, false, false,
parser.GetFontName(TS_VARIABLE)));
dc.GetTextExtent(wxT("/"), &m_expDivideWidth, &height);
m_width = m_num->GetFullWidth(scale) + m_denom->GetFullWidth(scale) + m_expDivideWidth;
}
else
{
m_width = MAX(m_num->GetFullWidth(scale), m_denom->GetFullWidth(scale));
}
m_open1->RecalculateWidths(parser, fontsize, false);
m_close1->RecalculateWidths(parser, fontsize, false);
m_open2->RecalculateWidths(parser, fontsize, false);
m_close2->RecalculateWidths(parser, fontsize, false);
m_divide->RecalculateWidths(parser, fontsize, false);
MathCell::RecalculateWidths(parser, fontsize, all);
}
示例2: UnsetPen
/***
* Reset the pen in the device context.
*/
void MathCell::UnsetPen(CellParser& parser)
{
wxDC& dc = parser.GetDC();
if (m_type == MC_TYPE_PROMPT || m_type == MC_TYPE_INPUT || m_highlight)
dc.SetPen(*(wxThePenList->FindOrCreatePen(parser.GetColor(TS_DEFAULT),
1, wxPENSTYLE_SOLID)));
}
示例3: Draw
void ImgCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
wxDC& dc = parser.GetDC();
if (DrawThisCell(parser, point) && m_image != NULL)
{
wxMemoryDC bitmapDC;
double scale = parser.GetScale();
m_image->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
m_height = (m_image->m_height) + 2 * m_imageBorderWidth;
m_width = (m_image->m_width) + 2 * m_imageBorderWidth;
SetPen(parser);
if (m_drawRectangle)
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
wxBitmap bitmap = m_image->GetBitmap();
bitmapDC.SelectObject(bitmap);
dc.Blit(point.x + m_imageBorderWidth, point.y - m_center + m_imageBorderWidth, m_width - 2 * m_imageBorderWidth, m_height - 2 * m_imageBorderWidth, &bitmapDC, 0, 0);
}
else
// The cell isn't drawn => No need to keep it's image cache for now.
ClearCache();
MathCell::Draw(parser, point, fontsize);
}
示例4: Draw
void SlideShow::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
if (DrawThisCell(parser, point) && m_bitmaps[m_displayed] != NULL)
{
wxDC& dc = parser.GetDC();
wxMemoryDC bitmapDC;
double scale = parser.GetScale();
scale = MAX(scale, 1.0);
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
if (scale != 1.0)
{
wxImage img = m_bitmaps[m_displayed]->ConvertToImage();
img.Rescale(m_width, m_height);
wxBitmap bmp = img;
bitmapDC.SelectObject(bmp);
}
else
bitmapDC.SelectObject(*m_bitmaps[m_displayed]);
dc.Blit(point.x + 1, point.y - m_center + 1, m_width, m_height, &bitmapDC, 0, 0);
}
MathCell::Draw(parser, point, fontsize, all);
}
示例5: RecalculateSize
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());
}
}
示例6: RecalculateSize
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);
}
示例7: RecalculateSize
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);
}
示例8: RecalculateWidths
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();
}
示例9: RecalculateWidths
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);
}
示例10: RecalculateWidths
void DiffCell::RecalculateWidths(int fontsize)
{
CellParser *parser = CellParser::Get();
double scale = parser->GetScale();
m_baseCell->RecalculateWidthsList(fontsize);
m_diffCell->RecalculateWidthsList(fontsize);
m_width = m_baseCell->GetFullWidth(scale) + m_diffCell->GetFullWidth(scale) + 2*MC_CELL_SKIP;
ResetData();
}
示例11: DrawThisCell
/*! Is this cell currently visible in the window?.
*/
bool MathCell::DrawThisCell(CellParser& parser, wxPoint point)
{
int top = parser.GetTop();
int bottom = parser.GetBottom();
if (top == -1 || bottom == -1)
return true;
if (point.y - GetMaxCenter() > bottom || point.y + GetMaxDrop() < top)
return false;
return true;
}
示例12: RecalculateSize
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);
}
示例13: RecalculateWidths
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: RecalculateSize
void GroupCell::RecalculateSize(CellParser& parser, int fontsize)
{
if (m_width == -1 || m_height == -1 || parser.ForceUpdate())
{
// special case
if (m_groupType == GC_TYPE_PAGEBREAK) {
m_width = 10;
m_height = 2;
m_center = 0;
m_indent = 0;
MathCell::RecalculateWidthsList(parser, fontsize);
return;
}
double scale = parser.GetScale();
m_input->RecalculateSizeList(parser, fontsize);
m_center = m_input->GetMaxCenter();
m_height = m_input->GetMaxHeight();
m_indent = parser.GetIndent();
if (m_output != NULL && !m_hide) {
MathCell *tmp = m_output;
while (tmp != NULL) {
tmp->RecalculateSize(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
tmp = tmp->m_next;
}
m_outputRect.x = m_currentPoint.x;
m_outputRect.y = m_currentPoint.y - m_output->GetMaxCenter();
m_outputRect.width = 0;
m_outputRect.height = 0;
m_height = m_input->GetMaxHeight();
m_width = m_input->GetFullWidth(scale);
tmp = m_output;
while (tmp != NULL) {
if (tmp->BreakLineHere() || tmp == m_output) {
m_width = MAX(m_width, tmp->GetLineWidth(scale));
m_outputRect.width = MAX(m_outputRect.width, tmp->GetLineWidth(scale));
m_height += tmp->GetMaxHeight();
if (tmp->m_bigSkip)
m_height += MC_LINE_SKIP;
m_outputRect.height += tmp->GetMaxHeight() + MC_LINE_SKIP;
}
tmp = tmp->m_nextToDraw;
}
}
}
m_appendedCells = NULL;
}
示例15: RecalculateWidths
void SlideShow::RecalculateWidths(int fontsize)
{
// Here we recalculate the height, as well:
// - This doesn't cost much time and
// - as image cell's sizes might change when the resolution does
// we might have intermittent calculation issues otherwise
CellParser *parser = CellParser::Get();
double scale = parser->GetScale();
m_images[m_displayed]->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
m_width = (scale * m_images[m_displayed]->m_width) + 2 * m_imageBorderWidth;
m_height = (scale * m_images[m_displayed]->m_height) + 2 * m_imageBorderWidth;
m_center = m_height / 2;
}