Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Note.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Signature.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
index 6d61705222fcd89b5112f06c23fda51730f1a59b..4287bc2753386ecd65d2bc638e6c80ca900b2aa9 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
@@ -47,7 +47,7 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min,FX_FLOAT max)
}
}
-FX_BOOL PWL_FLOATRANGE::In(FX_FLOAT x) const
+bool PWL_FLOATRANGE::In(FX_FLOAT x) const
{
return (IsFloatBigger(x,fMin) || IsFloatEqual(x, fMin)) &&
(IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax));
@@ -99,14 +99,14 @@ void PWL_SCROLL_PRIVATEDATA::SetBigStep(FX_FLOAT step)
fBigStep = step;
}
-FX_BOOL PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos)
+bool PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos)
{
if (ScrollRange.In(pos))
{
fScrollPos = pos;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void PWL_SCROLL_PRIVATEDATA::AddSmall()
@@ -140,7 +140,7 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE
m_eScrollBarType = eScrollBarType;
m_eSBButtonType = eButtonType;
- m_bMouseDown = FALSE;
+ m_bMouseDown = false;
}
CPWL_SBButton::~CPWL_SBButton()
@@ -359,7 +359,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p
rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f);
if (IsEnabled())
- CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220);
+ CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220);
else
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255));
@@ -402,7 +402,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p
//draw background
rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f);
if (IsEnabled())
- CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220);
+ CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220);
else
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255));
@@ -565,33 +565,33 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p
}
}
-FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
+bool CPWL_SBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
{
CPWL_Wnd::OnLButtonDown(point,nFlag);
if (CPWL_Wnd * pParent = GetParentWindow())
pParent->OnNotify(this,PNM_LBUTTONDOWN,0,(intptr_t)&point);
- m_bMouseDown = TRUE;
+ m_bMouseDown = true;
SetCapture();
- return TRUE;
+ return true;
}
-FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
+bool CPWL_SBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
{
CPWL_Wnd::OnLButtonUp(point,nFlag);
if (CPWL_Wnd * pParent = GetParentWindow())
pParent->OnNotify(this,PNM_LBUTTONUP,0,(intptr_t)&point);
- m_bMouseDown = FALSE;
+ m_bMouseDown = false;
ReleaseCapture();
- return TRUE;
+ return true;
}
-FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag)
+bool CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag)
{
CPWL_Wnd::OnMouseMove(point,nFlag);
@@ -603,12 +603,12 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag)
if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonType == PSBT_MAX))
{
if (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intptr_t)&point))
- return FALSE;
+ return false;
}
*/
}
- return TRUE;
+ return true;
}
/* ------------------------------- CPWL_ScrollBar ---------------------------------- */
@@ -618,9 +618,9 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType):
m_pMinButton(NULL),
m_pMaxButton(NULL),
m_pPosButton(NULL),
- m_bMouseDown(FALSE),
- m_bMinOrMax(FALSE),
- m_bNotifyForever(TRUE)
+ m_bMouseDown(false),
+ m_bMinOrMax(false),
+ m_bNotifyForever(true)
{
}
@@ -665,7 +665,7 @@ void CPWL_ScrollBar::RePosChildWnd()
rcMaxButton = CPDF_Rect(rcClient.right - fBWidth,rcClient.bottom,
rcClient.right,rcClient.top);
}
- else SetVisible(FALSE);
+ else SetVisible(false);
}
break;
case SBT_VSCROLL:
@@ -687,16 +687,16 @@ void CPWL_ScrollBar::RePosChildWnd()
rcMaxButton = CPDF_Rect(rcClient.left,rcClient.bottom,
rcClient.right,rcClient.bottom + fBWidth);
}
- else SetVisible(FALSE);
+ else SetVisible(false);
}
break;
}
if (m_pMinButton)
- m_pMinButton->Move(rcMinButton, TRUE, FALSE);
+ m_pMinButton->Move(rcMinButton, true, false);
if (m_pMaxButton)
- m_pMaxButton->Move(rcMaxButton, TRUE, FALSE);
- MovePosButton(FALSE);
+ m_pMaxButton->Move(rcMaxButton, true, false);
+ MovePosButton(false);
}
void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
@@ -708,7 +708,7 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
CFX_ByteTextBuf sButton;
sButton << "q\n";
- sButton << "0 w\n" << CPWL_Utils::GetColorAppStream(GetBackgroundColor(),TRUE);
+ sButton << "0 w\n" << CPWL_Utils::GetColorAppStream(GetBackgroundColor(),true);
sButton << rectWnd.left << " " << rectWnd.bottom << " "
<< rectWnd.right - rectWnd.left << " " << rectWnd.top - rectWnd.bottom << " re b Q\n";
@@ -734,7 +734,7 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix*
}
}
-FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
+bool CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
{
CPWL_Wnd::OnLButtonDown(point,nFlag);
@@ -777,22 +777,22 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
if (rcMinArea.Contains(point.x,point.y))
{
m_sData.SubBig();
- MovePosButton(TRUE);
+ MovePosButton(true);
NotifyScrollWindow();
}
if (rcMaxArea.Contains(point.x,point.y))
{
m_sData.AddBig();
- MovePosButton(TRUE);
+ MovePosButton(true);
NotifyScrollWindow();
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
+bool CPWL_ScrollBar::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
{
CPWL_Wnd::OnLButtonUp(point,nFlag);
@@ -806,9 +806,9 @@ FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
}
EndTimer();
- m_bMouseDown = FALSE;
+ m_bMouseDown = false;
- return TRUE;
+ return true;
}
void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam)
@@ -922,7 +922,7 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM & cp)
if (!m_pPosButton)
{
m_pPosButton = new CPWL_SBButton(m_sbType,PSBT_POS);
- m_pPosButton->SetVisible(FALSE);
+ m_pPosButton->SetVisible(false);
m_pPosButton->Create(scp);
}
}
@@ -943,12 +943,12 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClient
if (IsFloatSmaller(m_sData.ScrollRange.GetWidth(), 0.0f))
{
- m_pPosButton->SetVisible(FALSE);
+ m_pPosButton->SetVisible(false);
}
else
{
- m_pPosButton->SetVisible(TRUE);
- MovePosButton(TRUE);
+ m_pPosButton->SetVisible(true);
+ MovePosButton(true);
}
}
}
@@ -960,7 +960,7 @@ void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos)
m_sData.SetPos(fPos);
if (!IsFloatEqual(m_sData.fScrollPos, fOldPos))
- MovePosButton(TRUE);
+ MovePosButton(true);
}
void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep)
@@ -969,7 +969,7 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep)
m_sData.SetSmallStep(fSmallStep);
}
-void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh)
+void CPWL_ScrollBar::MovePosButton(bool bRefresh)
{
ASSERT (m_pPosButton != NULL);
ASSERT (m_pMinButton != NULL);
@@ -1031,17 +1031,17 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh)
break;
}
- m_pPosButton->Move(rcPosButton,TRUE,bRefresh);
+ m_pPosButton->Move(rcPosButton,true,bRefresh);
}
}
void CPWL_ScrollBar::OnMinButtonLBDown(const CPDF_Point & point)
{
m_sData.SubSmall();
- MovePosButton(TRUE);
+ MovePosButton(true);
NotifyScrollWindow();
- m_bMinOrMax = TRUE;
+ m_bMinOrMax = true;
EndTimer();
BeginTimer(100);
@@ -1058,10 +1058,10 @@ void CPWL_ScrollBar::OnMinButtonMouseMove(const CPDF_Point & point)
void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point & point)
{
m_sData.AddSmall();
- MovePosButton(TRUE);
+ MovePosButton(true);
NotifyScrollWindow();
- m_bMinOrMax = FALSE;
+ m_bMinOrMax = false;
EndTimer();
BeginTimer(100);
@@ -1077,7 +1077,7 @@ void CPWL_ScrollBar::OnMaxButtonMouseMove(const CPDF_Point & point)
void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point & point)
{
- m_bMouseDown = TRUE;
+ m_bMouseDown = true;
if (m_pPosButton)
{
@@ -1104,7 +1104,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CPDF_Point & point)
if (!m_bNotifyForever)
NotifyScrollWindow();
}
- m_bMouseDown = FALSE;
+ m_bMouseDown = false;
}
void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point)
@@ -1163,7 +1163,7 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point)
if (!IsFloatEqual(fOldScrollPos, m_sData.fScrollPos))
{
- MovePosButton(TRUE);
+ MovePosButton(true);
if (m_bNotifyForever)
NotifyScrollWindow();
@@ -1297,7 +1297,7 @@ void CPWL_ScrollBar::TimerProc()
if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0)
{
- MovePosButton(TRUE);
+ MovePosButton(true);
NotifyScrollWindow();
}
}
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Note.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Signature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698