summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-26 14:24:28 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-26 14:24:28 -0800
commit281a9eadff15b167e2ee3032e21b83190ad49125 (patch)
treef02f7d0842f59d8e69bda011b3e62547ffb1acde /fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
parent566b974287ce0e81a963138152b8898f22480f52 (diff)
downloadpdfium-281a9eadff15b167e2ee3032e21b83190ad49125.tar.xz
Re-land "Replace CPDF_Rect and CPDF_Point with CFX types."
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1737593006 .
Diffstat (limited to 'fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp304
1 files changed, 162 insertions, 142 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
index c48052da9a..03bf3238fa 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
@@ -132,24 +132,25 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_ByteTextBuf sButton;
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (rectWnd.IsEmpty())
return;
sAppStream << "q\n";
- CPDF_Point ptCenter = GetCenterPoint();
+ CFX_FloatPoint ptCenter = GetCenterPoint();
switch (m_eScrollBarType) {
case SBT_HSCROLL:
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CPDF_Point pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y);
+ CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -163,11 +164,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
}
} break;
case PSBT_MAX: {
- CPDF_Point pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CPDF_Point pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CPDF_Point pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y);
+ CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -187,11 +189,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
case SBT_VSCROLL:
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
- ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
- CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
- ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
- CPDF_Point pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt3(ptCenter.x,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -205,11 +208,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
}
} break;
case PSBT_MAX: {
- CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
- CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
- CPDF_Point pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
+ CFX_FloatPoint pt3(ptCenter.x,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -238,11 +242,11 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (!IsVisible())
return;
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (rectWnd.IsEmpty())
return;
- CPDF_Point ptCenter = GetCenterPoint();
+ CFX_FloatPoint ptCenter = GetCenterPoint();
int32_t nTransparancy = GetTransparency();
switch (m_eScrollBarType) {
@@ -250,11 +254,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CPDF_Point pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y);
+ CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -273,11 +278,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
} break;
case PSBT_MAX: {
- CPDF_Point pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CPDF_Point pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CPDF_Point pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y);
+ CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y + PWL_TRIANGLE_HALFLEN);
+ CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
+ ptCenter.y - PWL_TRIANGLE_HALFLEN);
if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
@@ -303,7 +309,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
switch (m_eSBButtonType) {
case PSBT_MIN: {
// draw border
- CPDF_Rect rcDraw = rectWnd;
+ CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
ArgbEncode(nTransparancy, 100, 100, 100),
0.0f);
@@ -330,13 +336,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (rectWnd.top - rectWnd.bottom > 6.0f) {
FX_FLOAT fX = rectWnd.left + 1.5f;
FX_FLOAT fY = rectWnd.bottom;
- CPDF_Point pts[7] = {CPDF_Point(fX + 2.5f, fY + 4.0f),
- CPDF_Point(fX + 2.5f, fY + 3.0f),
- CPDF_Point(fX + 4.5f, fY + 5.0f),
- CPDF_Point(fX + 6.5f, fY + 3.0f),
- CPDF_Point(fX + 6.5f, fY + 4.0f),
- CPDF_Point(fX + 4.5f, fY + 6.0f),
- CPDF_Point(fX + 2.5f, fY + 4.0f)};
+ CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 4.0f),
+ CFX_FloatPoint(fX + 2.5f, fY + 3.0f),
+ CFX_FloatPoint(fX + 4.5f, fY + 5.0f),
+ CFX_FloatPoint(fX + 6.5f, fY + 3.0f),
+ CFX_FloatPoint(fX + 6.5f, fY + 4.0f),
+ CFX_FloatPoint(fX + 4.5f, fY + 6.0f),
+ CFX_FloatPoint(fX + 2.5f, fY + 4.0f)};
if (IsEnabled())
CPWL_Utils::DrawFillArea(
@@ -350,7 +356,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
} break;
case PSBT_MAX: {
// draw border
- CPDF_Rect rcDraw = rectWnd;
+ CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
ArgbEncode(nTransparancy, 100, 100, 100),
0.0f);
@@ -376,13 +382,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
FX_FLOAT fX = rectWnd.left + 1.5f;
FX_FLOAT fY = rectWnd.bottom;
- CPDF_Point pts[7] = {CPDF_Point(fX + 2.5f, fY + 5.0f),
- CPDF_Point(fX + 2.5f, fY + 6.0f),
- CPDF_Point(fX + 4.5f, fY + 4.0f),
- CPDF_Point(fX + 6.5f, fY + 6.0f),
- CPDF_Point(fX + 6.5f, fY + 5.0f),
- CPDF_Point(fX + 4.5f, fY + 3.0f),
- CPDF_Point(fX + 2.5f, fY + 5.0f)};
+ CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 5.0f),
+ CFX_FloatPoint(fX + 2.5f, fY + 6.0f),
+ CFX_FloatPoint(fX + 4.5f, fY + 4.0f),
+ CFX_FloatPoint(fX + 6.5f, fY + 6.0f),
+ CFX_FloatPoint(fX + 6.5f, fY + 5.0f),
+ CFX_FloatPoint(fX + 4.5f, fY + 3.0f),
+ CFX_FloatPoint(fX + 2.5f, fY + 5.0f)};
if (IsEnabled())
CPWL_Utils::DrawFillArea(
@@ -396,7 +402,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
} break;
case PSBT_POS: {
// draw border
- CPDF_Rect rcDraw = rectWnd;
+ CFX_FloatRect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
ArgbEncode(nTransparancy, 100, 100, 100),
0.0f);
@@ -410,9 +416,10 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (IsEnabled()) {
// draw shadow effect
- CPDF_Point ptTop = CPDF_Point(rectWnd.left, rectWnd.top - 1.0f);
- CPDF_Point ptBottom =
- CPDF_Point(rectWnd.left, rectWnd.bottom + 1.0f);
+ CFX_FloatPoint ptTop =
+ CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f);
+ CFX_FloatPoint ptBottom =
+ CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f);
ptTop.x += 1.5f;
ptBottom.x += 1.5f;
@@ -499,12 +506,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
FX_FLOAT nFrictionWidth = 5.0f;
FX_FLOAT nFrictionHeight = 5.5f;
- CPDF_Point ptLeft =
- CPDF_Point(ptCenter.x - nFrictionWidth / 2.0f,
- ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
- CPDF_Point ptRight =
- CPDF_Point(ptCenter.x + nFrictionWidth / 2.0f,
- ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
+ CFX_FloatPoint ptLeft =
+ CFX_FloatPoint(ptCenter.x - nFrictionWidth / 2.0f,
+ ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
+ CFX_FloatPoint ptRight =
+ CFX_FloatPoint(ptCenter.x + nFrictionWidth / 2.0f,
+ ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
crStroke, 1.0f);
@@ -531,7 +538,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
}
-FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
+FX_BOOL CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point,
+ FX_DWORD nFlag) {
CPWL_Wnd::OnLButtonDown(point, nFlag);
if (CPWL_Wnd* pParent = GetParentWindow())
@@ -543,7 +551,8 @@ FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
return TRUE;
}
-FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
+FX_BOOL CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point,
+ FX_DWORD nFlag) {
CPWL_Wnd::OnLButtonUp(point, nFlag);
if (CPWL_Wnd* pParent = GetParentWindow())
@@ -555,7 +564,8 @@ FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
return TRUE;
}
-FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) {
+FX_BOOL CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point,
+ FX_DWORD nFlag) {
CPWL_Wnd::OnMouseMove(point, nFlag);
if (CPWL_Wnd* pParent = GetParentWindow()) {
@@ -585,8 +595,8 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) {
}
void CPWL_ScrollBar::RePosChildWnd() {
- CPDF_Rect rcClient = GetClientRect();
- CPDF_Rect rcMinButton, rcMaxButton;
+ CFX_FloatRect rcClient = GetClientRect();
+ CFX_FloatRect rcMinButton, rcMaxButton;
FX_FLOAT fBWidth = 0;
switch (m_sbType) {
@@ -594,21 +604,22 @@ void CPWL_ScrollBar::RePosChildWnd() {
if (rcClient.right - rcClient.left >
PWL_SCROLLBAR_BUTTON_WIDTH * 2 + PWL_SCROLLBAR_POSBUTTON_MINWIDTH +
2) {
- rcMinButton =
- CPDF_Rect(rcClient.left, rcClient.bottom,
- rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH, rcClient.top);
- rcMaxButton = CPDF_Rect(rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.bottom, rcClient.right, rcClient.top);
+ rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
+ rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.top);
+ rcMaxButton =
+ CFX_FloatRect(rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.bottom, rcClient.right, rcClient.top);
} else {
fBWidth = (rcClient.right - rcClient.left -
PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
2;
if (fBWidth > 0) {
- rcMinButton = CPDF_Rect(rcClient.left, rcClient.bottom,
- rcClient.left + fBWidth, rcClient.top);
- rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom,
- rcClient.right, rcClient.top);
+ rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
+ rcClient.left + fBWidth, rcClient.top);
+ rcMaxButton = CFX_FloatRect(rcClient.right - fBWidth, rcClient.bottom,
+ rcClient.right, rcClient.top);
} else {
SetVisible(FALSE);
}
@@ -618,21 +629,23 @@ void CPWL_ScrollBar::RePosChildWnd() {
if (IsFloatBigger(rcClient.top - rcClient.bottom,
PWL_SCROLLBAR_BUTTON_WIDTH * 2 +
PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) {
- rcMinButton =
- CPDF_Rect(rcClient.left, rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.right, rcClient.top);
- rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, rcClient.right,
- rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH);
+ rcMinButton = CFX_FloatRect(rcClient.left,
+ rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.right, rcClient.top);
+ rcMaxButton =
+ CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right,
+ rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH);
} else {
fBWidth = (rcClient.top - rcClient.bottom -
PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
2;
if (IsFloatBigger(fBWidth, 0)) {
- rcMinButton = CPDF_Rect(rcClient.left, rcClient.top - fBWidth,
- rcClient.right, rcClient.top);
- rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom,
- rcClient.right, rcClient.bottom + fBWidth);
+ rcMinButton = CFX_FloatRect(rcClient.left, rcClient.top - fBWidth,
+ rcClient.right, rcClient.top);
+ rcMaxButton =
+ CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right,
+ rcClient.bottom + fBWidth);
} else {
SetVisible(FALSE);
}
@@ -648,7 +661,7 @@ void CPWL_ScrollBar::RePosChildWnd() {
}
void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
CFX_ByteTextBuf sButton;
@@ -666,7 +679,7 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd,
@@ -674,19 +687,20 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice,
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device,
- CPDF_Point(rectWnd.left + 2.0f, rectWnd.top - 2.0f),
- CPDF_Point(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f),
+ CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f),
+ CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f),
ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device,
- CPDF_Point(rectWnd.right - 2.0f, rectWnd.top - 2.0f),
- CPDF_Point(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f),
+ CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f),
+ CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f),
ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
}
}
-FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
+FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point,
+ FX_DWORD nFlag) {
CPWL_Wnd::OnLButtonDown(point, nFlag);
if (HasFlag(PWS_AUTOTRANSPARENT)) {
@@ -696,27 +710,29 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
}
}
- CPDF_Rect rcMinArea, rcMaxArea;
+ CFX_FloatRect rcMinArea, rcMaxArea;
if (m_pPosButton && m_pPosButton->IsVisible()) {
- CPDF_Rect rcClient = GetClientRect();
- CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect();
+ CFX_FloatRect rcClient = GetClientRect();
+ CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect();
switch (m_sbType) {
case SBT_HSCROLL:
- rcMinArea = CPDF_Rect(rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.bottom, rcPosButton.left, rcClient.top);
- rcMaxArea = CPDF_Rect(rcPosButton.right, rcClient.bottom,
- rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.top);
+ rcMinArea =
+ CFX_FloatRect(rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.bottom, rcPosButton.left, rcClient.top);
+ rcMaxArea = CFX_FloatRect(rcPosButton.right, rcClient.bottom,
+ rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.top);
break;
case SBT_VSCROLL:
- rcMinArea = CPDF_Rect(rcClient.left, rcPosButton.top, rcClient.right,
- rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH);
- rcMaxArea = CPDF_Rect(rcClient.left,
- rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.right, rcPosButton.bottom);
+ rcMinArea =
+ CFX_FloatRect(rcClient.left, rcPosButton.top, rcClient.right,
+ rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH);
+ rcMaxArea = CFX_FloatRect(rcClient.left,
+ rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcClient.right, rcPosButton.bottom);
break;
}
@@ -739,7 +755,8 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
return TRUE;
}
-FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
+FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point,
+ FX_DWORD nFlag) {
CPWL_Wnd::OnLButtonUp(point, nFlag);
if (HasFlag(PWS_AUTOTRANSPARENT)) {
@@ -764,41 +781,41 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
switch (msg) {
case PNM_LBUTTONDOWN:
if (pWnd == m_pMinButton) {
- OnMinButtonLBDown(*(CPDF_Point*)lParam);
+ OnMinButtonLBDown(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pMaxButton) {
- OnMaxButtonLBDown(*(CPDF_Point*)lParam);
+ OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pPosButton) {
- OnPosButtonLBDown(*(CPDF_Point*)lParam);
+ OnPosButtonLBDown(*(CFX_FloatPoint*)lParam);
}
break;
case PNM_LBUTTONUP:
if (pWnd == m_pMinButton) {
- OnMinButtonLBUp(*(CPDF_Point*)lParam);
+ OnMinButtonLBUp(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pMaxButton) {
- OnMaxButtonLBUp(*(CPDF_Point*)lParam);
+ OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pPosButton) {
- OnPosButtonLBUp(*(CPDF_Point*)lParam);
+ OnPosButtonLBUp(*(CFX_FloatPoint*)lParam);
}
break;
case PNM_MOUSEMOVE:
if (pWnd == m_pMinButton) {
- OnMinButtonMouseMove(*(CPDF_Point*)lParam);
+ OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pMaxButton) {
- OnMaxButtonMouseMove(*(CPDF_Point*)lParam);
+ OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam);
}
if (pWnd == m_pPosButton) {
- OnPosButtonMouseMove(*(CPDF_Point*)lParam);
+ OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam);
}
break;
case PNM_SETSCROLLINFO: {
@@ -896,8 +913,8 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
ASSERT(m_pMaxButton);
if (m_pPosButton->IsVisible()) {
- CPDF_Rect rcClient;
- CPDF_Rect rcPosArea, rcPosButton;
+ CFX_FloatRect rcClient;
+ CFX_FloatRect rcPosArea, rcPosButton;
rcClient = GetClientRect();
rcPosArea = GetScrollArea();
@@ -917,7 +934,8 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
fLeft = fRight - PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
}
- rcPosButton = CPDF_Rect(fLeft, rcPosArea.bottom, fRight, rcPosArea.top);
+ rcPosButton =
+ CFX_FloatRect(fLeft, rcPosArea.bottom, fRight, rcPosArea.top);
break;
case SBT_VSCROLL:
@@ -932,7 +950,8 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
fTop = fBottom + PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
}
- rcPosButton = CPDF_Rect(rcPosArea.left, fBottom, rcPosArea.right, fTop);
+ rcPosButton =
+ CFX_FloatRect(rcPosArea.left, fBottom, rcPosArea.right, fTop);
break;
}
@@ -941,7 +960,7 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
}
}
-void CPWL_ScrollBar::OnMinButtonLBDown(const CPDF_Point& point) {
+void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) {
m_sData.SubSmall();
MovePosButton(TRUE);
NotifyScrollWindow();
@@ -952,11 +971,11 @@ void CPWL_ScrollBar::OnMinButtonLBDown(const CPDF_Point& point) {
BeginTimer(100);
}
-void CPWL_ScrollBar::OnMinButtonLBUp(const CPDF_Point& point) {}
+void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {}
-void CPWL_ScrollBar::OnMinButtonMouseMove(const CPDF_Point& point) {}
+void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {}
-void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point& point) {
+void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) {
m_sData.AddSmall();
MovePosButton(TRUE);
NotifyScrollWindow();
@@ -967,15 +986,15 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point& point) {
BeginTimer(100);
}
-void CPWL_ScrollBar::OnMaxButtonLBUp(const CPDF_Point& point) {}
+void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {}
-void CPWL_ScrollBar::OnMaxButtonMouseMove(const CPDF_Point& point) {}
+void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {}
-void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point& point) {
+void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) {
m_bMouseDown = TRUE;
if (m_pPosButton) {
- CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect();
+ CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect();
switch (m_sbType) {
case SBT_HSCROLL:
@@ -990,7 +1009,7 @@ void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point& point) {
}
}
-void CPWL_ScrollBar::OnPosButtonLBUp(const CPDF_Point& point) {
+void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) {
if (m_bMouseDown) {
if (!m_bNotifyForever)
NotifyScrollWindow();
@@ -998,7 +1017,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CPDF_Point& point) {
m_bMouseDown = FALSE;
}
-void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point& point) {
+void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) {
FX_FLOAT fOldScrollPos = m_sData.fScrollPos;
FX_FLOAT fNewPos = 0;
@@ -1071,15 +1090,15 @@ void CPWL_ScrollBar::NotifyScrollWindow() {
}
}
-CPDF_Rect CPWL_ScrollBar::GetScrollArea() const {
- CPDF_Rect rcClient = GetClientRect();
- CPDF_Rect rcArea;
+CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const {
+ CFX_FloatRect rcClient = GetClientRect();
+ CFX_FloatRect rcArea;
if (!m_pMinButton || !m_pMaxButton)
return rcClient;
- CPDF_Rect rcMin = m_pMinButton->GetWindowRect();
- CPDF_Rect rcMax = m_pMaxButton->GetWindowRect();
+ CFX_FloatRect rcMin = m_pMinButton->GetWindowRect();
+ CFX_FloatRect rcMax = m_pMaxButton->GetWindowRect();
FX_FLOAT fMinWidth = rcMin.right - rcMin.left;
FX_FLOAT fMinHeight = rcMin.top - rcMin.bottom;
@@ -1089,20 +1108,21 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const {
switch (m_sbType) {
case SBT_HSCROLL:
if (rcClient.right - rcClient.left > fMinWidth + fMaxWidth + 2) {
- rcArea = CPDF_Rect(rcClient.left + fMinWidth + 1, rcClient.bottom,
- rcClient.right - fMaxWidth - 1, rcClient.top);
+ rcArea = CFX_FloatRect(rcClient.left + fMinWidth + 1, rcClient.bottom,
+ rcClient.right - fMaxWidth - 1, rcClient.top);
} else {
- rcArea = CPDF_Rect(rcClient.left + fMinWidth + 1, rcClient.bottom,
- rcClient.left + fMinWidth + 1, rcClient.top);
+ rcArea = CFX_FloatRect(rcClient.left + fMinWidth + 1, rcClient.bottom,
+ rcClient.left + fMinWidth + 1, rcClient.top);
}
break;
case SBT_VSCROLL:
if (rcClient.top - rcClient.bottom > fMinHeight + fMaxHeight + 2) {
- rcArea = CPDF_Rect(rcClient.left, rcClient.bottom + fMinHeight + 1,
- rcClient.right, rcClient.top - fMaxHeight - 1);
+ rcArea = CFX_FloatRect(rcClient.left, rcClient.bottom + fMinHeight + 1,
+ rcClient.right, rcClient.top - fMaxHeight - 1);
} else {
- rcArea = CPDF_Rect(rcClient.left, rcClient.bottom + fMinHeight + 1,
- rcClient.right, rcClient.bottom + fMinHeight + 1);
+ rcArea =
+ CFX_FloatRect(rcClient.left, rcClient.bottom + fMinHeight + 1,
+ rcClient.right, rcClient.bottom + fMinHeight + 1);
}
break;
}
@@ -1113,7 +1133,7 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const {
}
FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) {
- CPDF_Rect rcPosArea;
+ CFX_FloatRect rcPosArea;
rcPosArea = GetScrollArea();
FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
@@ -1136,7 +1156,7 @@ FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) {
}
FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) {
- CPDF_Rect rcPosArea;
+ CFX_FloatRect rcPosArea;
rcPosArea = GetScrollArea();
FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;