void
AppearanceAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("AppearanceAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("useSystemDefault")) != 0)
        SetUseSystemDefault(node->AsBool());
    if((node = searchNode->GetNode("background")) != 0)
        SetBackground(node->AsString());
    if((node = searchNode->GetNode("foreground")) != 0)
        SetForeground(node->AsString());
    if((node = searchNode->GetNode("fontName")) != 0)
        SetFontName(node->AsString());
    if((node = searchNode->GetNode("style")) != 0)
        SetStyle(node->AsString());
    if((node = searchNode->GetNode("orientation")) != 0)
        SetOrientation(node->AsInt());
    if((node = searchNode->GetNode("defaultForeground")) != 0)
        SetDefaultForeground(node->AsString());
    if((node = searchNode->GetNode("defaultBackground")) != 0)
        SetDefaultBackground(node->AsString());
    if((node = searchNode->GetNode("defaultFontName")) != 0)
        SetDefaultFontName(node->AsString());
    if((node = searchNode->GetNode("defaultStyle")) != 0)
        SetDefaultStyle(node->AsString());
    if((node = searchNode->GetNode("defaultOrientation")) != 0)
        SetDefaultOrientation(node->AsInt());
}
示例#2
0
/**
 * Init some default values
 */
void CScintillaBibWnd::Init()
{
	CScintillaWnd::Init();

	SetDisplayFolding(TRUE);
	SetDisplayLinenumbers(TRUE);
	SetDisplaySelection(FALSE);

	// BibTeX
	LoadLexerLib(LEXBIB_LIB);
	SetLexer(LEXBIB_NAME);
	SetWrap(SC_WRAP_WORD);
	// Setup some BibTeX styles
	SetForeground(SCE_L_COMMAND, RGB(0, 0, 160));
	SetForeground(SCE_L_MATH, RGB(150, 150, 40));
	SetForeground(SCE_L_COMMENT, RGB(0, 128, 0));
	SetForeground(SCE_L_TAG, RGB(0, 0, 255));
	SetItalic(SCE_L_COMMENT, TRUE);
	SetBold(SCE_BIB_ITEM, TRUE);
	SetBold(SCE_BIB_END, TRUE);
	SetForeground(SCE_BIB_END, RGB(255, 0, 0));
	SetBold(SCE_BIB_START, TRUE);
	SetForeground(SCE_BIB_START, RGB(255, 0, 0));
	SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70));
	SetForeground(SCE_BIB_KEY, RGB(140, 0, 0));
	SetBold(SCE_BIB_KEY, TRUE);
	// We also need HTML
	SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE);
	SetBold(SCE_H_ATTRIBUTE, FALSE);
	SetBold(SCE_H_SINGLESTRING, FALSE);
	SetBold(SCE_H_DOUBLESTRING, FALSE);
	SetBold(SCE_H_TAG, TRUE);
	SetBold(SCE_H_TAGUNKNOWN, TRUE);
	SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0));
//	SetItalic(SCE_H_COMMENT, TRUE);

	// Marker
	DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF));
	DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
}
示例#3
0
void gendrawselected(short *newselect, objectptr curobj, objinstptr curinst)
{
   /* Don't draw selection color when selecting for edit */
   if (eventmode == PENDING_MODE) return;

   if (*newselect >= curobj->parts) return;	// Safety check

   XcSetFunction(GXcopy);
   XcSetForeground(BACKGROUND);
   geneasydraw(*newselect, DOFORALL, curobj, curinst);
   indicateparams(*(curobj->plist + *newselect));

   XcSetFunction(GXxor);
   XcSetForeground(SELECTCOLOR ^ BACKGROUND);
   geneasydraw(*newselect, DOFORALL, curobj, curinst);

   SetForeground(dpy, areawin->gc, AUXCOLOR ^ BACKGROUND);
   indicateparams(*(curobj->plist + *newselect));

   SetForeground(dpy, areawin->gc, areawin->gccolor);
   SetFunction(dpy, areawin->gc, areawin->gctype);
}
示例#4
0
void DjvuPic::Create( CreateMode mode )
{
	Destroy();
	if(mode==IN_MEMORY || mode==NORMAL)
	{
		SetForeground(); 	
		SetBackground(); 	
		if(mode==NORMAL) SetBuffer(FullName);
		if(CenterRotate.angle) Rotate(); 
		ViewRgn=MyRect(0,0,Parent->Wnd.Width(),Parent->Wnd.Height());
		for(int i=0;i<Zones.GetSize();i++)
		{
			if(Zones[i]) Zones[i]->Create();
		}
	}
    return;
}
示例#5
0
void XWindow::InitWindow()
{
  m_pDisplay = XOpenDisplay(nullptr);
  m_screen = DefaultScreen(m_pDisplay);
  m_window = XCreateSimpleWindow(
      m_pDisplay,
      DefaultRootWindow(m_pDisplay),
      0,
      0,
      m_width,
      m_height,
      5,
      Color::BLACK().Rgb(),
      Color::WHITE().Rgb()
  );
  XSetStandardProperties(
      m_pDisplay,
      m_window,
      "Howdy",
      "Hi",
      None,
      nullptr,
      0,
      nullptr
  );
  XSelectInput(
      m_pDisplay,
      m_window,
      ExposureMask | ButtonPressMask | KeyPressMask
  );
  m_gc = XCreateGC(m_pDisplay, m_window, 0, 0);
  SetBackground(Color::RED());
  SetForeground(Color::BLACK());
  XClearWindow(m_pDisplay, m_window);
  XMapRaised(m_pDisplay, m_window);
}
示例#6
0
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);
}
示例#7
0
void ParenCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
  if (DrawThisCell(parser, point))
  {
    double scale = parser.GetScale();
    wxDC& dc = parser.GetDC();
    wxPoint in(point);

    if (parser.CheckTeXFonts())
    {
      in.x = point.x + m_signWidth;
      SetForeground(parser);
      int fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
			wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
                        m_bigParenType < 1 ?
			parser.GetTeXCMRI() :
			parser.GetTeXCMEX()));
      if (m_bigParenType < 2)
      {
        dc.DrawText(m_bigParenType == 0 ? wxT("(") :
                                          wxT(PAREN_OPEN),
                    point.x,
                    point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
                    (m_bigParenType > 0 ? m_signTop : 0));
        dc.DrawText(m_bigParenType == 0 ? wxT(")") :
                                          wxT(PAREN_CLOSE),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
                    (m_bigParenType > 0 ? m_signTop : 0));
      }
      else {
        int top = point.y - m_center - m_signTop;
        int bottom = point.y + m_height - m_center - m_signTop - m_signSize / 2;
        dc.DrawText(wxT(PAREN_OPEN_TOP),
                    point.x,
                    top);
        dc.DrawText(wxT(PAREN_CLOSE_TOP),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    top);
        dc.DrawText(wxT(PAREN_OPEN_BOTTOM),
                    point.x,
                    bottom);
        dc.DrawText(wxT(PAREN_CLOSE_BOTTOM),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    bottom);
        top = top + m_signSize / 2;
        if (top <= bottom)
        {
          while (top < bottom)
          {
            dc.DrawText(wxT(PAREN_OPEN_EXTEND),
                          point.x,
                          top-1);
            dc.DrawText(wxT(PAREN_CLOSE_EXTEND),
                          point.x + m_width - m_signWidth,
                          top-1);
            top += m_signSize / 10;
          }
        }
      }
    }
    else
    {
#if defined __WXMSW__
      in.x += m_charWidth;
      int fontsize1 = (int) ((PAREN_FONT_SIZE * scale + 0.5));
      SetForeground(parser);
      if (m_height < (3*m_charHeight)/2)
      {
        fontsize1 = (int) ((fontsize * scale + 0.5));
        dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                          wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
                          false,
                          parser.GetFontName()));
        dc.DrawText(wxT("("),
                    point.x + m_charWidth - m_charWidth1,
                    point.y - m_charHeight1 / 2);
        dc.DrawText(wxT(")"),
                    point.x + m_width - m_charWidth,
                    point.y - m_charHeight1 / 2);
      }
      else
      {
        dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                          wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
                          false,
                          parser.GetSymbolFontName(),
			  wxFONTENCODING_CP1250));
        dc.DrawText(PAREN_LEFT_TOP,
                    point.x,
                    point.y - m_center);
        dc.DrawText(PAREN_LEFT_BOTTOM,
                    point.x,
                    point.y + m_height - m_center - m_charHeight);
        dc.DrawText(PAREN_RIGHT_TOP,
                    point.x + m_width - m_charWidth,
                    point.y - m_center);
        dc.DrawText(PAREN_RIGHT_BOTTOM,
                    point.x + m_width - m_charWidth,
                    point.y + m_height - m_center - m_charHeight);
        int top, bottom;
        top = point.y - m_center + m_charHeight/2;
        bottom = point.y + m_height - m_center - (4*m_charHeight)/3;
        if (top <= bottom)
        {
          while (top < bottom)
          {
            dc.DrawText(PAREN_LEFT_EXTEND,
			point.x,
			top);
            dc.DrawText(PAREN_RIGHT_EXTEND,
			point.x + m_width - m_charWidth,
			top);
            top += (2*m_charHeight)/3;
          }
          dc.DrawText(PAREN_LEFT_EXTEND,
		      point.x,
		      point.y + m_height - m_center - (3*m_charHeight)/2);
          dc.DrawText(PAREN_RIGHT_EXTEND,
		      point.x + m_width - m_charWidth,
		      point.y + m_height - m_center - (3*m_charHeight)/2);
        }
      }
#else
      in.x = point.x + SCALE_PX(6, scale);
      SetPen(parser);
      // left
      dc.DrawLine(point.x + SCALE_PX(5, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(1, scale),
                  point.x + SCALE_PX(2, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale));
      dc.DrawLine(point.x + SCALE_PX(2, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale),
                  point.x + SCALE_PX(2, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale));
      dc.DrawLine(point.x + SCALE_PX(2, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale),
                  point.x + SCALE_PX(5, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(1, scale));
      // right
      dc.DrawLine(point.x + m_width - SCALE_PX(5, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(1, scale),
                  point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale));
      dc.DrawLine(point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale),
                  point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale));
      dc.DrawLine(point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale),
                  point.x + m_width - SCALE_PX(5, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(1, scale));
      UnsetPen(parser);
#endif
    }
    m_innerCell->DrawList(parser, in, fontsize);
  }
  MathCell::Draw(parser, point, fontsize);
}
示例#8
0
void SqrtCell::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 in(point);

    if (parser->CheckTeXFonts())
    {
      SetPen();

      in.x += m_signWidth;
      double scale = parser->GetScale();

      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()));
      SetForeground();
      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;
        wxASSERT_MSG((yTop != 0) || (yBottom != 0),_("Font issue? The contents of a sqrt() has the size 0."));
        wxASSERT_MSG(dy>0,_("Font issue: The sqrt() sign has the size 0! Installing http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html and checking \"Use JSmath fonts\" in the configuration dialogue should be a workaround."));
        if(dy <= 0)
          dy = 1;
        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();
    }
    else
    {
      in.x += SCALE_PX(10, scale) + SCALE_PX(1, scale) + 1;

      SetPen();
      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();
    }

    m_innerCell->DrawList(in, fontsize);
  }
}
示例#9
0
void IntCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
  if (DrawThisCell(parser, point))
  {
    wxDC& dc = parser.GetDC();
    double scale = parser.GetScale();

    wxPoint base(point), under(point), over(point), var(point), sign(point);

    if (parser.CheckTeXFonts())
    {
      SetForeground(parser);
      int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                        false, false, false,
                        parser.GetTeXCMEX()));
      dc.DrawText(wxT("\x5A"),
                  sign.x,
                  sign.y - m_signTop);
    }
    else
    {
#if defined __WXMSW__
      SetForeground(parser);
      int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
      int m_signWCenter = m_signWidth / 2;

      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                        false, false, false,
                        parser.GetSymbolFontName()));
      dc.DrawText(wxT(INTEGRAL_TOP),
                  sign.x + m_signWCenter - m_charWidth / 2,
                  sign.y - (m_signSize + 1) / 2);
      dc.DrawText(wxT(INTEGRAL_BOTTOM),
                  sign.x + m_signWCenter - m_charWidth / 2,
                  sign.y + (m_signSize + 1) / 2 - m_charHeight);

      int top, bottom;
      top = sign.y - (m_signSize + 1) / 2 + m_charHeight / 2;
      bottom = sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2;
      if (top <= bottom)
      {
        while (top < bottom)
        {
          dc.DrawText(wxT(INTEGRAL_EXTEND),
                        point.x + m_signWCenter - m_charWidth / 2,
                        top);
          top += (2*m_charHeight)/3;
        }
        dc.DrawText(wxT(INTEGRAL_EXTEND),
                        point.x + m_signWCenter - m_charWidth / 2,
                        sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2);
      }
#else
      SetPen(parser);
      // top decoration
      int m_signWCenter = m_signWidth / 2;
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
                  sign.x + m_signWCenter + SCALE_PX(3, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
      dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(3, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale),
                  sign.x + m_signWCenter + SCALE_PX(6, scale),
                  sign.y - (m_signSize + 1) / 2);
      dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(6, scale),
                  sign.y - (m_signSize + 1) / 2,
                  sign.x + m_signWCenter + SCALE_PX(9, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
      // bottom decoration
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1,
                  sign.x + m_signWCenter - SCALE_PX(3, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
      dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(3, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale),
                  sign.x + m_signWCenter - SCALE_PX(6, scale),
                  sign.y + (m_signSize + 1) / 2);
      dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(6, scale),
                  sign.y + (m_signSize + 1) / 2,
                  sign.x + m_signWCenter - SCALE_PX(9, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
      // line
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
                  sign.x + m_signWCenter,
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1);
      UnsetPen(parser);
#endif
    }

    if (m_intStyle == INT_DEF)
    {
      under.x += m_signWidth;
      under.y = point.y + m_signSize / 2 + m_under->GetMaxCenter() + SCALE_PX(2, scale) -
                m_signSize / 3;
      m_under->Draw(parser, under, MAX(MC_MIN_SIZE, fontsize - 5), true);

      if (parser.CheckTeXFonts())
        over.x += 2*m_signWidth;
      else
        over.x += m_signWidth;

      over.y = point.y - m_signSize / 2 - m_over->GetMaxDrop() - SCALE_PX(2, scale) +
               m_signSize / 3;
      m_over->Draw(parser, over, MAX(MC_MIN_SIZE, fontsize - 5), true);

      if (parser.CheckTeXFonts())
      {
        base.x += m_signWidth +
                  MAX(m_over->GetFullWidth(scale) + m_signWidth, m_under->GetFullWidth(scale));
      }
      else
        base.x += m_signWidth +
                  MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale));
    }

    else if (parser.CheckTeXFonts())
      base.x += 2*m_signWidth;
    else
      base.x += m_signWidth;

    m_base->Draw(parser, base, fontsize, true);

    var.x = base.x + m_base->GetFullWidth(scale);
    m_var->Draw(parser, var, fontsize, true);
  }

  MathCell::Draw(parser, point, fontsize, all);
}
示例#10
0
void ParenCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
  if (DrawThisCell(parser, point))
  {
    double scale = parser.GetScale();
    wxDC& dc = parser.GetDC();
    wxPoint in(point);

    if (parser.CheckTeXFonts())
    {
      in.x = point.x + m_signWidth;
      SetForeground(parser);
      int fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
			wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
                        m_bigParenType < 1 ?
			parser.GetTeXCMRI() :
			parser.GetTeXCMEX()));
      if (m_bigParenType < 2)
      {
        dc.DrawText(m_bigParenType == 0 ? wxT("(") :
                                          wxT(PAREN_OPEN),
                    point.x,
                    point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
                    (m_bigParenType > 0 ? m_signTop : 0));
        dc.DrawText(m_bigParenType == 0 ? wxT(")") :
                                          wxT(PAREN_CLOSE),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
                    (m_bigParenType > 0 ? m_signTop : 0));
      }
      else {
        int top = point.y - m_center - m_signTop;
        int bottom = point.y + m_height - m_center - m_signTop - m_signSize / 2;
        dc.DrawText(wxT(PAREN_OPEN_TOP),
                    point.x,
                    top);
        dc.DrawText(wxT(PAREN_CLOSE_TOP),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    top);
        dc.DrawText(wxT(PAREN_OPEN_BOTTOM),
                    point.x,
                    bottom);
        dc.DrawText(wxT(PAREN_CLOSE_BOTTOM),
                    point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
                    bottom);
        top = top + m_signSize / 2;

        wxASSERT_MSG(m_signSize>=10,_("Font issue: The Parenthesis sign is too small!"));
        if(m_signSize <= 10)
          m_signSize = 10;

        if (top <= bottom)
        {
          while (top < bottom)
          {
            dc.DrawText(wxT(PAREN_OPEN_EXTEND),
                          point.x,
                          top-1);
            dc.DrawText(wxT(PAREN_CLOSE_EXTEND),
                          point.x + m_width - m_signWidth,
                          top-1);
            top += m_signSize / 10;
          }
        }
      }
    }
    else
    {
#if defined __WXMSW__
      in.x += m_charWidth;
      int fontsize1 = (int) ((PAREN_FONT_SIZE * scale + 0.5));
      SetForeground(parser);
      if (m_height < (3*m_charHeight)/2)
      {
        fontsize1 = (int) ((fontsize * scale + 0.5));
        dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                          wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
                          false,
                          parser.GetFontName()));
        dc.DrawText(wxT("("),
                    point.x + m_charWidth - m_charWidth1,
                    point.y - m_charHeight1 / 2);
        dc.DrawText(wxT(")"),
                    point.x + m_width - m_charWidth,
                    point.y - m_charHeight1 / 2);
      }
      else
      {
        dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
                          wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
                          false,
                          parser.GetSymbolFontName(),
			  wxFONTENCODING_CP1250));
        dc.DrawText(PAREN_LEFT_TOP,
                    point.x,
                    point.y - m_center);
        dc.DrawText(PAREN_LEFT_BOTTOM,
                    point.x,
                    point.y + m_height - m_center - m_charHeight);
        dc.DrawText(PAREN_RIGHT_TOP,
                    point.x + m_width - m_charWidth,
                    point.y - m_center);
        dc.DrawText(PAREN_RIGHT_BOTTOM,
                    point.x + m_width - m_charWidth,
                    point.y + m_height - m_center - m_charHeight);
        int top, bottom;
        top = point.y - m_center + m_charHeight/2;
        bottom = point.y + m_height - m_center - (4*m_charHeight)/3;

        wxASSERT_MSG(m_charHeight>=2,_("Font issue: The char height is too small! Installing http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html and checking \"Use JSmath fonts\" in the configuration dialogue should be a workaround."));
        if(m_charHeight <= 2)
          m_charHeight = 2;

        if (top <= bottom)
        {
          while (top < bottom)
          {
            dc.DrawText(PAREN_LEFT_EXTEND,
			point.x,
			top);
            dc.DrawText(PAREN_RIGHT_EXTEND,
			point.x + m_width - m_charWidth,
			top);
            top += (2*m_charHeight)/3;
          }
          dc.DrawText(PAREN_LEFT_EXTEND,
		      point.x,
		      point.y + m_height - m_center - (3*m_charHeight)/2);
          dc.DrawText(PAREN_RIGHT_EXTEND,
		      point.x + m_width - m_charWidth,
		      point.y + m_height - m_center - (3*m_charHeight)/2);
        }
      }
#else
      in.x = point.x + SCALE_PX(6, scale);
      SetPen(parser);
      // left
      dc.DrawLine(point.x + SCALE_PX(5, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(1, scale),
                  point.x + SCALE_PX(2, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale));
      dc.DrawLine(point.x + SCALE_PX(2, scale),
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale),
                  point.x + SCALE_PX(2, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale));
      dc.DrawLine(point.x + SCALE_PX(2, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale),
                  point.x + SCALE_PX(5, scale),
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(1, scale));
      // right
      dc.DrawLine(point.x + m_width - SCALE_PX(5, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(1, scale),
                  point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale));
      dc.DrawLine(point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y - m_innerCell->GetMaxCenter() + SCALE_PX(7, scale),
                  point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale));
      dc.DrawLine(point.x + m_width - SCALE_PX(2, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(7, scale),
                  point.x + m_width - SCALE_PX(5, scale) - 1,
                  point.y + m_innerCell->GetMaxDrop() - SCALE_PX(1, scale));
      UnsetPen(parser);
#endif
    }
    m_innerCell->DrawList(parser, in, fontsize);
  }
  MathCell::Draw(parser, point, fontsize);
}
示例#11
0
void IntCell::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 base(point), under(point), over(point), var(point), sign(point);

    if (parser->CheckTeXFonts())
    {
      SetForeground();
      int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
			wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
                        parser->GetTeXCMEX()));
      dc.DrawText(wxT("\x5A"),
                  sign.x,
                  sign.y - m_signTop);
    }
    else
    {
#if defined __WXMSW__
      SetForeground();
      int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
      int m_signWCenter = m_signWidth / 2;

      dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
			wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
			false,
                        parser->GetSymbolFontName()));
      dc.DrawText(INTEGRAL_TOP,
                  sign.x + m_signWCenter - m_charWidth / 2,
                  sign.y - (m_signSize + 1) / 2);
      dc.DrawText(INTEGRAL_BOTTOM,
                  sign.x + m_signWCenter - m_charWidth / 2,
                  sign.y + (m_signSize + 1) / 2 - m_charHeight);

      int top, bottom;
      top = sign.y - (m_signSize + 1) / 2 + m_charHeight / 2;
      bottom = sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2;
      if (top <= bottom)
      {
        wxASSERT_MSG(m_charHeight>=2,_("Font issue: The char height is too small! Installing http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html and checking \"Use JSmath fonts\" in the configuration dialogue should be a workaround."));
        if(m_charHeight <= 2)
          m_charHeight = 2;
        
        while (top < bottom)
        {
          dc.DrawText(INTEGRAL_EXTEND,
		      point.x + m_signWCenter - m_charWidth / 2,
		      top);
          top += (2*m_charHeight)/3;
        }
        dc.DrawText(INTEGRAL_EXTEND,
		    point.x + m_signWCenter - m_charWidth / 2,
		    sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2);
      }
#else
      SetPen();
      // top decoration
      int m_signWCenter = m_signWidth / 2;
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
                  sign.x + m_signWCenter + SCALE_PX(3, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
      dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(3, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale),
                  sign.x + m_signWCenter + SCALE_PX(6, scale),
                  sign.y - (m_signSize + 1) / 2);
      dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(6, scale),
                  sign.y - (m_signSize + 1) / 2,
                  sign.x + m_signWCenter + SCALE_PX(9, scale),
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
      // bottom decoration
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1,
                  sign.x + m_signWCenter - SCALE_PX(3, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
      dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(3, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale),
                  sign.x + m_signWCenter - SCALE_PX(6, scale),
                  sign.y + (m_signSize + 1) / 2);
      dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(6, scale),
                  sign.y + (m_signSize + 1) / 2,
                  sign.x + m_signWCenter - SCALE_PX(9, scale),
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
      // line
      dc.DrawLine(sign.x + m_signWCenter,
                  sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
                  sign.x + m_signWCenter,
                  sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1);
      UnsetPen();
#endif
    }

    if (m_intStyle == INT_DEF)
    {
      under.x += m_signWidth;
      under.y = point.y + m_signSize / 2 + m_under->GetMaxCenter() + SCALE_PX(2, scale) -
                m_signSize / 3;
      m_under->DrawList(under, MAX(MC_MIN_SIZE, fontsize - 5));

      if (parser->CheckTeXFonts())
        over.x += 2*m_signWidth;
      else
        over.x += m_signWidth;

      over.y = point.y - m_signSize / 2 - m_over->GetMaxDrop() - SCALE_PX(2, scale) +
               m_signSize / 3;
      m_over->DrawList(over, MAX(MC_MIN_SIZE, fontsize - 5));

      if (parser->CheckTeXFonts())
      {
        base.x += m_signWidth +
                  MAX(m_over->GetFullWidth(scale) + m_signWidth, m_under->GetFullWidth(scale));
      }
      else
        base.x += m_signWidth +
                  MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale));
    }

    else if (parser->CheckTeXFonts())
      base.x += 2*m_signWidth;
    else
      base.x += m_signWidth;

    m_base->DrawList(base, fontsize);

    var.x = base.x + m_base->GetFullWidth(scale);
    m_var->DrawList(var, fontsize);
  }
}
示例#12
0
static MRESULT EXPENTRY AttachStatProc(HWND hwnd, ULONG message, MPARAM mp1,
                                       MPARAM mp2)
{
   extern WINDOWPOSITIONS windowpositions;
   extern WINDOWCOLORS windowcolors;
   extern WINDOWFONTS windowfonts;
   extern HWND frame;
   extern HWND hwndhelp;
   PCHECKATPAR pCheckPar=NULL;
   PFIELDINFO pFieldInfo, pFirstFieldInfo;
   FIELDINFOINSERT FieldInfoInsert;
   CNRINFO CnrInfo;
   PATTACHRECORD pRecord, pFirstRecord;
   RECORDINSERT RecordInsert;
   HWND hwndCnr;
   PFILELIST pTemp;

   static char pchTitleFile[50];
   static char pchTitleSize[50];
   static char pchTitleStatus[50];
   static char pchOK[50];
   static char pchNotFound[50];

   switch(message)
   {
      case WM_INITDLG:
         pCheckPar=(PCHECKATPAR) mp2;
         LoadString(IDST_ATT_TITLEFILE,   50, pchTitleFile);
         LoadString(IDST_ATT_TITLESIZE,   50, pchTitleSize);
         LoadString(IDST_ATT_TITLESTATUS, 50, pchTitleStatus);
         LoadString(IDST_ATT_OK,          50, pchOK);
         LoadString(IDST_ATT_NOTF,        50, pchNotFound);

         WinAssociateHelpInstance(hwndhelp, hwnd);

         hwndCnr=WinWindowFromID(hwnd, IDD_ATTACHSTAT+2);
         OldAttachContainerProc=WinSubclassWindow(hwndCnr,
                                                  NewAttachContainerProc);

         SetFont(hwndCnr, windowfonts.attachfont);
         SetForeground(hwndCnr, &windowcolors.attachfore);
         SetBackground(hwndCnr, &windowcolors.attachback);

         /* Felder des Containers vorbereiten */
         pFirstFieldInfo=(PFIELDINFO)SendMsg(hwndCnr,
                                                CM_ALLOCDETAILFIELDINFO,
                                                MPFROMLONG(3), NULL);

         pFieldInfo=pFirstFieldInfo;

         pFieldInfo->cb=sizeof(FIELDINFO);
         pFieldInfo->flData=CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
         pFieldInfo->flTitle=0;
         pFieldInfo->pTitleData= pchTitleFile;
         pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, pchFileName);
         pFieldInfo=pFieldInfo->pNextFieldInfo;

         pFieldInfo->cb=sizeof(FIELDINFO);
         pFieldInfo->flData=CFA_ULONG | CFA_HORZSEPARATOR | CFA_SEPARATOR |
                            CFA_RIGHT;
         pFieldInfo->flTitle=0;
         pFieldInfo->pTitleData= pchTitleSize;
         pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, ulSize);
         pFieldInfo=pFieldInfo->pNextFieldInfo;

         pFieldInfo->cb=sizeof(FIELDINFO);
         pFieldInfo->flData=CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR |
                            CFA_CENTER;
         pFieldInfo->flTitle=0;
         pFieldInfo->pTitleData= pchTitleStatus;
         pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, pchStatus);

         /* Felder des Containers einfuegen */
         FieldInfoInsert.cb=sizeof(FIELDINFOINSERT);
         FieldInfoInsert.pFieldInfoOrder=(PFIELDINFO) CMA_FIRST;
         FieldInfoInsert.fInvalidateFieldInfo=TRUE;
         FieldInfoInsert.cFieldInfoInsert=3;

         SendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO,
                    pFirstFieldInfo, &FieldInfoInsert);

         /* Container-Attribute setzen */
         CnrInfo.cb=sizeof(CNRINFO);
         CnrInfo.pFieldInfoLast=NULL;
         CnrInfo.flWindowAttr=CV_DETAIL | CA_DETAILSVIEWTITLES;
         CnrInfo.xVertSplitbar=0;

         SendMsg(hwndCnr, CM_SETCNRINFO, &CnrInfo,
                    MPFROMLONG(CMA_FLWINDOWATTR));

         /* Elemente einfuegen */

         pFirstRecord=(PATTACHRECORD)SendMsg(hwndCnr, CM_ALLOCRECORD,
                           MPFROMLONG(sizeof(ATTACHRECORD)-sizeof(MINIRECORDCORE)),
                           MPFROMLONG(pCheckPar->ulCountRecords));
         pRecord=pFirstRecord;
         pTemp=pCheckPar->pFileList;
         while(pTemp)
         {
            pRecord->pchFileName=pTemp->pchFileName;
            pRecord->ulSize=pTemp->ulSize;
            if (pTemp->bFound)
                pRecord->pchStatus = pchOK;
            else
                pRecord->pchStatus = pchNotFound;

            pRecord=(PATTACHRECORD)pRecord->RecordCore.preccNextRecord;
            pTemp=pTemp->next;
         }

         RecordInsert.cb=sizeof(RECORDINSERT);
         RecordInsert.pRecordOrder=(PRECORDCORE) CMA_FIRST;
         RecordInsert.pRecordParent=NULL;
         RecordInsert.fInvalidateRecord=TRUE;
         RecordInsert.zOrder=CMA_TOP;
         RecordInsert.cRecordsInsert=pCheckPar->ulCountRecords;

         SendMsg(hwndCnr, CM_INSERTRECORD, pFirstRecord, &RecordInsert);

         RestoreWinPos(hwnd, &windowpositions.attachpos, FALSE, TRUE);
         break;

      case WM_DESTROY:
         QueryWinPos(hwnd, &windowpositions.attachpos);
         QueryFont(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2),
                   windowfonts.attachfont);
         QueryForeground(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2),
                         &windowcolors.attachfore);
         QueryBackground(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2),
                         &windowcolors.attachback);
         WinAssociateHelpInstance(hwndhelp, frame);
         break;

      default:
         break;
   }
   return WinDefDlgProc(hwnd, message, mp1, mp2);
}