本文整理汇总了C++中MathCell::IsMath方法的典型用法代码示例。如果您正苦于以下问题:C++ MathCell::IsMath方法的具体用法?C++ MathCell::IsMath怎么用?C++ MathCell::IsMath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathCell
的用法示例。
在下文中一共展示了MathCell::IsMath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BreakUpCells
void GroupCell::BreakUpCells(MathCell *cell, CellParser parser, int fontsize, int clientWidth)
{
MathCell *tmp = cell;
while (tmp != NULL && !m_hide) {
if (tmp->GetWidth() > clientWidth) {
if (tmp->BreakUp()) {
tmp->RecalculateWidths(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
tmp->RecalculateSize(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
}
}
tmp = tmp->m_nextToDraw;
}
}
示例2: Draw
void Bitmap::Draw()
{
MathCell* tmp = m_tree;
wxMemoryDC dc;
dc.SelectObject(m_bmp);
wxString bgColStr = wxT("white");
wxConfig::Get()->Read(wxT("Style/Background/color"), &bgColStr);
dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(bgColStr, wxBRUSHSTYLE_SOLID)));
dc.Clear();
if (tmp != NULL)
{
wxPoint point;
point.x = 0;
point.y = tmp->GetMaxCenter();
int fontsize = 12;
int drop = tmp->GetMaxDrop();
wxConfig::Get()->Read(wxT("fontSize"), &fontsize);
int mfontsize = fontsize;
wxConfig::Get()->Read(wxT("mathfontsize"), &mfontsize);
CellParser parser(dc);
while (tmp != NULL)
{
if (!tmp->m_isBroken)
{
tmp->Draw(parser, point, tmp->IsMath() ? mfontsize : fontsize, false);
if (tmp->m_next != NULL && tmp->m_next->BreakLineHere())
{
point.x = 0;
point.y += drop + tmp->m_next->GetMaxCenter();
if (tmp->m_bigSkip)
point.y += MC_LINE_SKIP;
drop = tmp->m_next->GetMaxDrop();
}
else
point.x += (tmp->GetWidth() + MC_CELL_SKIP);
}
else
{
if (tmp->m_next != NULL && tmp->m_next->BreakLineHere())
{
point.x = 0;
point.y += drop + tmp->m_next->GetMaxCenter();
if (tmp->m_bigSkip)
point.y += MC_LINE_SKIP;
drop = tmp->m_next->GetMaxDrop();
}
}
tmp = tmp->m_nextToDraw;
}
}
dc.SelectObject(wxNullBitmap);
}
示例3: RecalculateAppended
// We assume that appended cells will be in a new line!
void GroupCell::RecalculateAppended(CellParser& parser)
{
if (m_appendedCells == NULL)
return;
MathCell *tmp = m_appendedCells;
int fontsize = m_fontSize;
double scale = parser.GetScale();
// Recalculate widths of cells
while (tmp != NULL) {
tmp->RecalculateWidths(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
tmp = tmp->m_next;
}
// Breakup cells and break lines
BreakUpCells(m_appendedCells, parser, fontsize, parser.GetClientWidth());
BreakLines(m_appendedCells, parser.GetClientWidth());
// Recalculate size of cells
tmp = m_appendedCells;
while (tmp != NULL) {
tmp->RecalculateSize(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
tmp = tmp->m_next;
}
// Update widths
tmp = m_appendedCells;
while (tmp != NULL) {
if (tmp->BreakLineHere() || tmp == m_appendedCells) {
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;
}
示例4: 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;
}
示例5: BreakUpCells
void Bitmap::BreakUpCells()
{
MathCell *tmp = m_tree;
int fontsize = 12;
wxConfig::Get()->Read(wxT("fontSize"), &fontsize);
int mfontsize = fontsize;
wxConfig::Get()->Read(wxT("mathfontsize"), &mfontsize);
wxMemoryDC dc;
CellParser parser(dc);
while (tmp != NULL)
{
if (tmp->GetWidth() > BM_FULL_WIDTH)
{
if (tmp->BreakUp())
{
tmp->RecalculateWidths(parser, tmp->IsMath() ? mfontsize : fontsize, false);
tmp->RecalculateSize(parser, tmp->IsMath() ? mfontsize : fontsize, false);
}
}
tmp = tmp->m_nextToDraw;
}
}
示例6: RecalculateSize
void Bitmap::RecalculateSize()
{
int fontsize = 12;
wxConfig::Get()->Read(wxT("fontSize"), &fontsize);
int mfontsize = fontsize;
wxConfig::Get()->Read(wxT("mathfontsize"), &mfontsize);
MathCell* tmp = m_tree;
wxMemoryDC dc;
dc.SelectObject(m_bmp);
CellParser parser(dc);
while (tmp != NULL)
{
tmp->RecalculateSize(parser, tmp->IsMath() ? mfontsize : fontsize, false);
tmp = tmp->m_next;
}
}
示例7: RecalculateWidths
void GroupCell::RecalculateWidths(CellParser& parser, int fontsize)
{
if (m_width == -1 || m_height == -1 || parser.ForceUpdate())
{
// special case of 'line cell'
if (m_groupType == GC_TYPE_PAGEBREAK) {
m_width = 10;
m_height = 2;
ResetData();
return;
}
UnBreakUpCells();
double scale = parser.GetScale();
m_input->RecalculateWidthsList(parser, fontsize);
// recalculate the position of input in ReEvaluateSelection!
if (m_input->m_next != NULL) {
m_input->m_next->m_currentPoint.x = m_currentPoint.x + m_input->GetWidth() + MC_CELL_SKIP;
}
if (m_output == NULL || m_hide) {
m_width = m_input->GetFullWidth(scale);
}
else {
MathCell *tmp = m_output;
while (tmp != NULL) {
tmp->RecalculateWidths(parser, tmp->IsMath() ? m_mathFontSize : m_fontSize);
tmp = tmp->m_next;
}
// This is not correct, m_width will be computed correctly in RecalculateSize!
m_width = m_input->GetFullWidth(scale);
}
BreakUpCells(parser, m_fontSize, parser.GetClientWidth());
BreakLines(parser.GetClientWidth());
}
ResetData();
}
示例8: Draw
void GroupCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
double scale = parser.GetScale();
wxDC& dc = parser.GetDC();
if (m_width == -1 || m_height == -1) {
RecalculateWidths(parser, fontsize);
RecalculateSize(parser, fontsize);
}
if (DrawThisCell(parser, point))
{
// draw a thick line for 'page break'
// and return
if (m_groupType == GC_TYPE_PAGEBREAK) {
wxRect rect = GetRect(false);
int y = rect.GetY();
wxPen pen(parser.GetColor(TS_CURSOR), 1, wxPENSTYLE_DOT);
dc.SetPen(pen);
dc.DrawLine(0, y , 10000, y);
MathCell::Draw(parser, point, fontsize);
return;
}
//
// Paint background if we have a text cell
//
if (m_groupType == GC_TYPE_TEXT) {
wxRect rect = GetRect(false);
int y = rect.GetY();
if (m_height > 0 && m_width > 0 && y>=0) {
wxBrush br(parser.GetColor(TS_TEXT_BACKGROUND));
dc.SetBrush(br);
wxPen pen(parser.GetColor(TS_TEXT_BACKGROUND));
dc.SetPen(pen);
dc.DrawRectangle(0, y , 10000, rect.GetHeight());
}
}
//
// Draw input and output
//
SetPen(parser);
wxPoint in(point);
parser.Outdated(false);
m_input->DrawList(parser, in, fontsize);
if (m_groupType == GC_TYPE_CODE && m_input->m_next)
parser.Outdated(((EditorCell *)(m_input->m_next))->ContainsChanges());
if (m_output != NULL && !m_hide) {
MathCell *tmp = m_output;
int drop = tmp->GetMaxDrop();
in.y += m_input->GetMaxDrop() + m_output->GetMaxCenter();
m_outputRect.y = in.y - m_output->GetMaxCenter();
m_outputRect.x = in.x;
while (tmp != NULL) {
if (!tmp->m_isBroken) {
tmp->m_currentPoint.x = in.x;
tmp->m_currentPoint.y = in.y;
if (tmp->DrawThisCell(parser, in))
tmp->Draw(parser, in, MAX(tmp->IsMath() ? m_mathFontSize : m_fontSize, MC_MIN_SIZE));
if (tmp->m_nextToDraw != NULL) {
if (tmp->m_nextToDraw->BreakLineHere()) {
in.x = m_indent;
in.y += drop + tmp->m_nextToDraw->GetMaxCenter();
if (tmp->m_bigSkip)
in.y += MC_LINE_SKIP;
drop = tmp->m_nextToDraw->GetMaxDrop();
} else
in.x += (tmp->GetWidth() + MC_CELL_SKIP);
}
} else {
if (tmp->m_nextToDraw != NULL && tmp->m_nextToDraw->BreakLineHere()) {
in.x = m_indent;
in.y += drop + tmp->m_nextToDraw->GetMaxCenter();
if (tmp->m_bigSkip)
in.y += MC_LINE_SKIP;
drop = tmp->m_nextToDraw->GetMaxDrop();
}
}
tmp = tmp->m_nextToDraw;
}
}
parser.Outdated(false);
MathCell *editable = GetEditable();
if (editable != NULL && editable->IsActive()) {
dc.SetPen( *(wxThePenList->FindOrCreatePen(parser.GetColor(TS_ACTIVE_CELL_BRACKET), 2, wxPENSTYLE_SOLID))); // window linux, set a pen
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser.GetColor(TS_ACTIVE_CELL_BRACKET)))); //highlight c.
}
else {
dc.SetPen( *(wxThePenList->FindOrCreatePen(parser.GetColor(TS_CELL_BRACKET), 1, wxPENSTYLE_SOLID))); // window linux, set a pen
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser.GetColor(TS_CELL_BRACKET)))); //highlight c.
}
if ((!m_hide) && (!m_hiddenTree)) {
dc.SetBrush(*wxTRANSPARENT_BRUSH);
}
//.........这里部分代码省略.........