void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); CPDF_Rect rcClient = GetClientRect(); rcClient.left = rcClient.right - 15.0f; CPDF_Point ptCenter = CPDF_Point((rcClient.left + rcClient.right) * 0.5f, (rcClient.top + rcClient.bottom) * 0.5f); CPDF_Point pt1(ptCenter.x - 2.0f, ptCenter.y + 2.0f * 0.5f); CPDF_Point pt2(ptCenter.x + 2.0f, ptCenter.y + 2.0f * 0.5f); CPDF_Point pt3(ptCenter.x, ptCenter.y - 3.0f * 0.5f); CFX_PathData path; path.SetPointCount(4); path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); pDevice->DrawPath(&path, pUser2Device, NULL, CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), 0, FXFILL_ALTERNATE); }
void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) { if (IsVisible() && m_bFlash) { CFX_FloatRect rcRect = GetCaretRect(); CFX_FloatRect rcClip = GetClipRect(); CFX_PathData path; path.SetPointCount(2); FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f; FX_FLOAT fCaretTop = rcRect.top; FX_FLOAT fCaretBottom = rcRect.bottom; if (!rcClip.IsEmpty()) { rcRect.Intersect(rcClip); if (!rcRect.IsEmpty()) { fCaretTop = rcRect.top; fCaretBottom = rcRect.bottom; path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO); path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO); } else { return; } } else { path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO); path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO); } CFX_GraphStateData gsd; gsd.m_LineWidth = m_fWidth; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); } }
void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { CPWL_Button::DrawThisAppearance(pDevice, pUser2Device); CPDF_Rect rcClient = this->GetClientRect(); rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; CFX_PathData pathCross; if (m_bMouseDown) { rcClient.left += 0.5f; rcClient.right += 0.5f; rcClient.top -= 0.5f; rcClient.bottom -= 0.5f; } pathCross.SetPointCount(4); pathCross.SetPoint(0, rcClient.left, rcClient.bottom, FXPT_MOVETO); pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO); pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO); pDevice->DrawPath(&pathCross, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); }
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { CPDF_Point ptCenter = GetCenterPoint(); CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt3(ptCenter.x, ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && IsFloatBigger(rectWnd.top - rectWnd.bottom, PWL_CBBUTTON_TRIANGLE_HALFLEN)) { CFX_PathData path; path.SetPointCount(4); path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); pDevice->DrawPath(&path, pUser2Device, NULL, CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR, GetTransparency()), 0, FXFILL_ALTERNATE); } } }
void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { ASSERT(pPageView != NULL); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (IsVisible(pWidget)) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { if (pFormFiller->IsValid()) { pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); pAnnot->GetPDFPage(); CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); if (pDocument->GetFocusAnnot() == pAnnot) { CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); if (!rcFocus.IsEmpty()) { CFX_PathData path; path.SetPointCount(5); path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); CFX_GraphStateData gsd; gsd.SetDashCount(1); gsd.m_DashArray[0] = 1.0f; gsd.m_DashPhase = 0; gsd.m_LineWidth = 1.0f; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); } } return; } } if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); else pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) pWidget->DrawShadow(pDevice, pPageView); } }
void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { CPDF_Rect rcClient = this->GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; CFX_PathData pathCross; pathCross.SetPointCount(4); pathCross.SetPoint(0, rcClient.right, rcClient.top, FXPT_MOVETO); pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.right, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); pDevice->DrawPath(&pathCross, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); }
FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* pMatrix, FX_BOOL& bThin, FX_BOOL bAdjust) const { if (m_PointCount < 3) { return FALSE; } if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO && (m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO && (m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO && m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) { NewPath.AddPointCount(2); if (bAdjust) { if (pMatrix) { FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY; pMatrix->TransformPoint(x, y); x = (int)x + 0.5f; y = (int)y + 0.5f; NewPath.SetPoint(0, x, y, FXPT_MOVETO); x = m_pPoints[1].m_PointX, y = m_pPoints[1].m_PointY; pMatrix->TransformPoint(x, y); x = (int)x + 0.5f; y = (int)y + 0.5f; NewPath.SetPoint(1, x, y, FXPT_LINETO); pMatrix->SetIdentity(); } else { FX_FLOAT x = (int)m_pPoints[0].m_PointX + 0.5f, y = (int)m_pPoints[0].m_PointY + 0.5f; NewPath.SetPoint(0, x, y, FXPT_MOVETO); x = (int)m_pPoints[1].m_PointX + 0.5f, y = (int)m_pPoints[1].m_PointY + 0.5f; NewPath.SetPoint(1, x, y, FXPT_LINETO); } } else { NewPath.SetPoint(0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY, FXPT_MOVETO); NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, FXPT_LINETO); } if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX && m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) { bThin = TRUE; } return TRUE; } if (((m_PointCount > 3) && (m_PointCount % 2))) { int mid = m_PointCount / 2; FX_BOOL bZeroArea = FALSE; CFX_PathData t_path; for (int i = 0; i < mid; i++) { if (!(m_pPoints[mid - i - 1].m_PointX == m_pPoints[mid + i + 1].m_PointX && m_pPoints[mid - i - 1].m_PointY == m_pPoints[mid + i + 1].m_PointY && ((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && (m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) { bZeroArea = TRUE; break; } int new_count = t_path.GetPointCount(); t_path.AddPointCount(2); t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX, m_pPoints[mid - i].m_PointY, FXPT_MOVETO); t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX, m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO); } if (!bZeroArea) { NewPath.Append(&t_path, NULL); bThin = TRUE; return TRUE; } } int stratPoint = 0; int next = 0, i; for (i = 0; i < m_PointCount; i++) { int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; if (point_type == FXPT_MOVETO) { stratPoint = i; } else if (point_type == FXPT_LINETO) { next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoint; if ((m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && (m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_MOVETO) { if ((m_pPoints[i - 1].m_PointX == m_pPoints[i].m_PointX && m_pPoints[i].m_PointX == m_pPoints[next].m_PointX) && ((m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) * (m_pPoints[i].m_PointY - m_pPoints[next].m_PointY) > 0)) { int pre = i; if (FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) < FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[next].m_PointY)) { pre--; next--; } int new_count = NewPath.GetPointCount(); NewPath.AddPointCount(2); NewPath.SetPoint(new_count, m_pPoints[pre].m_PointX, m_pPoints[pre].m_PointY, FXPT_MOVETO); NewPath.SetPoint(new_count + 1, m_pPoints[next].m_PointX, m_pPoints[next].m_PointY, FXPT_LINETO); } else if ((m_pPoints[i - 1].m_PointY == m_pPoints[i].m_PointY && m_pPoints[i].m_PointY == m_pPoints[next].m_PointY) && ((m_pPoints[i].m_PointX - m_pPoints[i - 1].m_PointX) * (m_pPoints[i].m_PointX - m_pPoints[next].m_PointX) > 0)) { int pre = i; if (FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[i - 1].m_PointX) < FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[next].m_PointX)) { pre--; next--; } int new_count = NewPath.GetPointCount(); NewPath.AddPointCount(2); NewPath.SetPoint(new_count, m_pPoints[pre].m_PointX, m_pPoints[pre].m_PointY, FXPT_MOVETO); NewPath.SetPoint(new_count + 1, m_pPoints[next].m_PointX, m_pPoints[next].m_PointY, FXPT_LINETO); } else if ((m_pPoints[i - 1].m_Flag & FXPT_TYPE) == FXPT_MOVETO && (m_pPoints[next].m_Flag & FXPT_TYPE) == FXPT_LINETO && m_pPoints[i - 1].m_PointX == m_pPoints[next].m_PointX && m_pPoints[i - 1].m_PointY == m_pPoints[next].m_PointY && m_pPoints[next].m_Flag & FXPT_CLOSEFIGURE) { int new_count = NewPath.GetPointCount(); NewPath.AddPointCount(2); NewPath.SetPoint(new_count, m_pPoints[i - 1].m_PointX, m_pPoints[i - 1].m_PointY, FXPT_MOVETO); NewPath.SetPoint(new_count + 1, m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, FXPT_LINETO); bThin = TRUE; } } } else if (point_type == FXPT_BEZIERTO) { i += 2; continue; } } if (m_PointCount > 3 && NewPath.GetPointCount()) { bThin = TRUE; } if (NewPath.GetPointCount() == 0) { return FALSE; } return TRUE; }
void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) { CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); CPDF_Rect rcClient = GetClientRect(); CFX_ByteTextBuf sLine; int32_t nCharArray = m_pEdit->GetCharArray(); FX_SAFE_INT32 nCharArraySafe = nCharArray; nCharArraySafe -= 1; nCharArraySafe *= 2; if (nCharArray > 0 && nCharArraySafe.IsValid()) { switch (GetBorderStyle()) { case PBS_SOLID: { CFX_GraphStateData gsd; gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); CFX_PathData path; path.SetPointCount(nCharArraySafe.ValueOrDie()); for (int32_t i = 0; i < nCharArray - 1; i++) { path.SetPoint( i * 2, rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.bottom, FXPT_MOVETO); path.SetPoint( i * 2 + 1, rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.top, FXPT_LINETO); } if (path.GetPointCount() > 0) pDevice->DrawPath( &path, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), FXFILL_ALTERNATE); } break; case PBS_DASH: { CFX_GraphStateData gsd; gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); gsd.SetDashCount(2); gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash; gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap; gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase; CFX_PathData path; path.SetPointCount(nCharArraySafe.ValueOrDie()); for (int32_t i = 0; i < nCharArray - 1; i++) { path.SetPoint( i * 2, rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.bottom, FXPT_MOVETO); path.SetPoint( i * 2 + 1, rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.top, FXPT_LINETO); } if (path.GetPointCount() > 0) pDevice->DrawPath( &path, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), FXFILL_ALTERNATE); } break; } } CPDF_Rect rcClip; CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); CPVT_WordRange* pRange = NULL; if (!HasFlag(PES_TEXTOVERFLOW)) { rcClip = GetClientRect(); pRange = &wrRange; } IFX_SystemHandler* pSysHandler = GetSystemHandler(); IFX_Edit::DrawEdit( pDevice, pUser2Device, m_pEdit, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), rcClip, CPDF_Point(0.0f, 0.0f), pRange, pSysHandler, m_pFormFiller); if (HasFlag(PES_SPELLCHECK)) { CPWL_Utils::DrawEditSpellCheck(pDevice, pUser2Device, m_pEdit, rcClip, CPDF_Point(0.0f, 0.0f), pRange, GetCreationParam().pSpellCheck); } }