本文整理汇总了C++中CellParser::GetDC方法的典型用法代码示例。如果您正苦于以下问题:C++ CellParser::GetDC方法的具体用法?C++ CellParser::GetDC怎么用?C++ CellParser::GetDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellParser
的用法示例。
在下文中一共展示了CellParser::GetDC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalculateWidths
void FracCell::RecalculateWidths(int fontsize)
{
CellParser *parser = CellParser::Get();
double scale = parser->GetScale();
if (m_isBroken || m_exponent)
{
m_num->RecalculateWidthsList(fontsize);
m_denom->RecalculateWidthsList(fontsize);
}
else
{
m_num->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
m_denom->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
}
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,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
parser->GetFontName(TS_VARIABLE)));
dc.GetTextExtent(wxT("/"), &m_expDivideWidth, &height);
m_width = m_num->GetFullWidth(scale) + m_denom->GetFullWidth(scale) + m_expDivideWidth;
}
else
{
wxDC& dc = parser->GetDC();
// We want half a space's widh of blank space to separate us from the
// next minus.
int dummy = 0;
int fontsize1 = (int) ((double)(fontsize) * scale + 0.5);
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
parser->GetFontName(TS_VARIABLE)));
dc.GetTextExtent(wxT("X"), &m_horizontalGap, &dummy);
m_horizontalGap /= 2;
m_width = MAX(m_num->GetFullWidth(scale), m_denom->GetFullWidth(scale)) + 2 * m_horizontalGap;
}
m_open1->RecalculateWidths(fontsize);
m_close1->RecalculateWidths(fontsize);
m_open2->RecalculateWidths(fontsize);
m_close2->RecalculateWidths(fontsize);
m_divide->RecalculateWidths(fontsize);
ResetData();
}
示例2: 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);
}
示例3: 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);
}
示例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: 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);
}
示例6: 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)));
}
示例7: SetForeground
void MathCell::SetForeground(CellParser& parser)
{
wxColour color;
wxDC& dc = parser.GetDC();
if (m_highlight)
{
color = parser.GetColor(TS_HIGHLIGHT);
}
else {
switch (m_type)
{
case MC_TYPE_PROMPT:
color = parser.GetColor(TS_OTHER_PROMPT);
break;
case MC_TYPE_MAIN_PROMPT:
color = parser.GetColor(TS_MAIN_PROMPT);
break;
case MC_TYPE_ERROR:
color = wxColour(wxT("red"));
break;
case MC_TYPE_LABEL:
color = parser.GetColor(TS_LABEL);
break;
default:
color = parser.GetColor(m_textStyle);
break;
}
}
dc.SetTextForeground(color);
}
示例8: 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();
}
示例9: RecalculateWidths
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);
}
示例10: Draw
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();
}
}
}
示例11: Draw
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);
}
示例12: Draw
void SlideShow::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
// TODO: Enable this when unselecting text updates the right region.
//if (!InUpdateRegion()) return;
CellParser *parser = CellParser::Get();
wxDC& dc = parser->GetDC();
if (DrawThisCell(point) && (m_images[m_displayed] != NULL))
{
wxMemoryDC bitmapDC;
double scale = parser->GetScale();
m_images[m_displayed]->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
m_height = (m_images[m_displayed]->m_height) + 2 * m_imageBorderWidth;
m_width = (m_images[m_displayed]->m_width) + 2 * m_imageBorderWidth;
m_center = m_height / 2;
// Slide show cells have a red border except if they are selected
if(m_drawBoundingBox)
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser->GetColor(TS_SELECTION))));
else
dc.SetPen(*wxRED_PEN);
// If we need a selection border on another redraw we will be informed by OnPaint() again.
m_drawBoundingBox = false;
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
wxBitmap bitmap = m_images[m_displayed]->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();
}
示例13: Draw
void ConjugateCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
double scale = parser.GetScale();
wxDC& dc = parser.GetDC();
if (DrawThisCell(parser, point))
{
SetPen(parser);
wxPoint in;
in.x = point.x + SCALE_PX(4, scale);
in.y = point.y;
m_innerCell->DrawList(parser, in, fontsize);
dc.DrawLine(point.x + SCALE_PX(2, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(2, scale) - 1,
point.y - m_center + SCALE_PX(2, scale)
);
// point.y - m_center + m_height - SCALE_PX(2, scale));
UnsetPen(parser);
}
MathCell::Draw(parser, point, fontsize);
}
示例14: Draw
void ImgCell::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
// TODO: Enable this when unselecting text updates the right region.
//if (!InUpdateRegion()) return;
CellParser *parser = CellParser::Get();
wxDC& dc = parser->GetDC();
if (DrawThisCell(point) && (m_image != NULL))
{
wxMemoryDC bitmapDC;
if(m_drawBoundingBox)
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser->GetColor(TS_SELECTION))));
else
SetPen();
if (m_drawRectangle || m_drawBoundingBox)
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
wxBitmap bitmap = m_image->GetBitmap();
bitmapDC.SelectObject(bitmap);
if ((m_drawBoundingBox == false) || (m_imageBorderWidth > 0))
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
dc.StretchBlit(point.x + 5, point.y - m_center + 5, m_width - 2 * 5, m_height - 2 * 5, &bitmapDC, 0, 0, m_width, m_height);
}
else
// The cell isn't drawn => No need to keep it's image cache for now.
ClearCache();
// The next time we need to draw a bounding box we will be informed again.
m_drawBoundingBox = false;
}
示例15: Draw
void SqrtCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
if (DrawThisCell(parser, point))
{
wxDC& dc = parser.GetDC();
double scale = parser.GetScale();
wxPoint in(point);
if (parser.CheckTeXFonts())
{
SetPen(parser);
in.x += m_signWidth;
double scale = parser.GetScale();
int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
SetForeground(parser);
if (m_signType < 4) {
dc.DrawText(
m_signType == 1 ? wxT("p") :
m_signType == 2 ? wxT("q") :
m_signType == 3 ? wxT("r") : wxT("s"),
point.x,
point.y - m_innerCell->GetMaxCenter() - m_signTop);
}
else {
int yBottom = point.y + m_innerCell->GetMaxDrop() - 3.2*m_signTop;
int yTop = point.y - m_innerCell->GetMaxCenter() - m_signTop;
int dy = m_signSize / 10;
dc.DrawText(wxT("t"),
point.x,
yBottom);
dc.DrawText(wxT("v"),
point.x,
yTop);
while (yTop < yBottom) {
yTop += dy;
dc.DrawText(wxT("u"),
point.x,
yTop);
}
}
dc.DrawLine(point.x + m_signWidth,
point.y - m_innerCell->GetMaxCenter(),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
point.y - m_innerCell->GetMaxCenter());
UnsetPen(parser);
}
else
{
in.x += SCALE_PX(10, scale) + SCALE_PX(1, scale) + 1;
SetPen(parser);
dc.DrawLine(point.x,
point.y,
point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale),
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale) + 1,
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale),
point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(6, scale));
UnsetPen(parser);
}
m_innerCell->Draw(parser, in, fontsize, true);
}
MathCell::Draw(parser, point, fontsize, all);
}