From 951b1119d4c7487364bee4c5124b36453e00130d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 2 Oct 2017 10:38:55 -0400 Subject: More define cleanup Remove unused defines; Move to .cpp files where possible; Fixup values. Change-Id: I88cd5deb04b14ab8e9f8097a695c3d0b52d64b4c Reviewed-on: https://pdfium-review.googlesource.com/15130 Reviewed-by: Henrique Nakashima Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- core/fxcodec/gif/cfx_gif.h | 1 - fpdfsdk/fsdk_common.h | 6 ------ fpdfsdk/pwl/cpwl_combo_box.cpp | 6 +++--- fpdfsdk/pwl/cpwl_combo_box.h | 2 -- fpdfsdk/pwl/cpwl_wnd.h | 2 -- fxbarcode/utils.h | 24 +++++------------------- xfa/fwl/cfwl_caret.cpp | 12 +++++++----- xfa/fwl/cfwl_caret.h | 2 -- xfa/fwl/cfwl_form.cpp | 8 ++++---- xfa/fwl/cfwl_form.h | 4 ---- xfa/fwl/cfwl_monthcalendar.h | 1 - xfa/fwl/theme/cfwl_utils.h | 1 - xfa/fxfa/cxfa_ffpushbutton.h | 5 ++--- 13 files changed, 21 insertions(+), 53 deletions(-) diff --git a/core/fxcodec/gif/cfx_gif.h b/core/fxcodec/gif/cfx_gif.h index f723526841..e9eb5c4054 100644 --- a/core/fxcodec/gif/cfx_gif.h +++ b/core/fxcodec/gif/cfx_gif.h @@ -26,7 +26,6 @@ class CFX_GifContext; #define GIF_D_STATUS_SIG 0x01 #define GIF_D_STATUS_TAIL 0x02 #define GIF_D_STATUS_EXT 0x03 -#define GIF_D_STATUS_EXT_AE 0x04 #define GIF_D_STATUS_EXT_CE 0x05 #define GIF_D_STATUS_EXT_GCE 0x06 #define GIF_D_STATUS_EXT_PTE 0x07 diff --git a/fpdfsdk/fsdk_common.h b/fpdfsdk/fsdk_common.h index d8030261c7..78ecd98b4a 100644 --- a/fpdfsdk/fsdk_common.h +++ b/fpdfsdk/fsdk_common.h @@ -10,7 +10,6 @@ // for all fields #define FIELDFLAG_READONLY 1 #define FIELDFLAG_REQUIRED 2 -#define FIELDFLAG_NOEXPORT 4 // for text fields #define FIELDFLAG_MULTILINE (1 << 12) #define FIELDFLAG_PASSWORD (1 << 13) @@ -20,14 +19,9 @@ #define FIELDFLAG_COMB (1 << 24) #define FIELDFLAG_RICHTEXT (1 << 25) // for button fileds -#define FIELDFLAG_NOTOGGLETOOFF (1 << 14) -#define FIELDFLAG_RADIO (1 << 15) -#define FIELDFLAG_PUSHBUTTON (1 << 16) #define FIELDFLAG_RADIOSINUNISON (1 << 27) // for choice fields -#define FIELDFLAG_COMBO (1 << 17) #define FIELDFLAG_EDIT (1 << 18) -#define FIELDFLAG_SORT (1 << 19) #define FIELDFLAG_MULTISELECT (1 << 21) #define FIELDFLAG_COMMITONSELCHANGE (1 << 26) diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 5bb9124931..3ebccca263 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -22,6 +22,7 @@ namespace { constexpr float kDefaultFontSize = 12.0f; constexpr float kTriangleHalfLength = 3.0f; +constexpr int kDefaultButtonWidth = 13; } // namespace @@ -324,7 +325,7 @@ void CPWL_ComboBox::RePosChildWnd() { CFX_FloatRect rcList = CPWL_Wnd::GetWindowRect(); CFX_FloatRect rcButton = rcClient; rcButton.left = - std::max(rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH, rcClient.left); + std::max(rcButton.right - kDefaultButtonWidth, rcClient.left); CFX_FloatRect rcEdit = rcClient; rcEdit.right = std::max(rcButton.left - 1.0f, rcEdit.left); if (m_bBottom) { @@ -352,8 +353,7 @@ void CPWL_ComboBox::RePosChildWnd() { } CFX_FloatRect rcButton = rcClient; - rcButton.left = - std::max(rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH, rcClient.left); + rcButton.left = std::max(rcButton.right - kDefaultButtonWidth, rcClient.left); if (m_pButton) m_pButton->Move(rcButton, true, false); diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index d8e384e501..20744df169 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h @@ -28,8 +28,6 @@ class CPWL_CBListBox : public CPWL_ListBox { bool OnCharNotify(uint16_t nChar, uint32_t nFlag); }; -#define PWL_COMBOBOX_BUTTON_WIDTH 13 - class CPWL_CBButton : public CPWL_Wnd { public: CPWL_CBButton() {} diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index 11b62b337c..c37fa2fff3 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -95,8 +95,6 @@ inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) { #define PWL_SCROLLBAR_WIDTH 12.0f #define PWL_SCROLLBAR_TRANSPARENCY 150 -#define PWL_DEFAULT_SELBACKCOLOR \ - CFX_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f) #define PWL_DEFAULT_BLACKCOLOR CFX_Color(COLORTYPE_GRAY, 0) #define PWL_DEFAULT_WHITECOLOR CFX_Color(COLORTYPE_GRAY, 1) diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h index 9e6c70fe7c..2303af44b0 100644 --- a/fxbarcode/utils.h +++ b/fxbarcode/utils.h @@ -7,6 +7,8 @@ #ifndef FXBARCODE_UTILS_H_ #define FXBARCODE_UTILS_H_ +#include + #include #include "core/fxcrt/fx_string.h" @@ -21,21 +23,9 @@ void BC_FX_ByteString_Append(ByteString& dst, const std::vector& ba); #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include -#define FXSYS_isnan(x) _isnan(x) -#define FXSYS_nan() (std::numeric_limits::quiet_NaN()) -#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - -#if _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ - _FX_OS_ == _FX_OS_ANDROID_ -#if _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ +#elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ #include -#endif // _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ - -#include -#define FXSYS_isnan(x) std::isnan(x) -#define FXSYS_nan() NAN -#endif // _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ || \ - // _FX_OS_ == _FX_OS_ANDROID_ +#endif enum BCFORMAT { BCFORMAT_UNSPECIFY = -1, @@ -51,11 +41,7 @@ enum BCFORMAT { BCFORMAT_DATAMATRIX, BCFORMAT_QR_CODE }; -#define BCFORMAT_ECLEVEL_L 0 -#define BCFORMAT_ECLEVEL_M 1 -#define BCFORMAT_ECLEVEL_Q 2 -#define BCFORMAT_ECLEVEL_H 3 -#include + #define BCExceptionNO 0 #define BCExceptionIllegalArgument 16 #define BCExceptionDegreeIsNegative 31 diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp index 1cef4f673a..cd85041d92 100644 --- a/xfa/fwl/cfwl_caret.cpp +++ b/xfa/fwl/cfwl_caret.cpp @@ -19,6 +19,8 @@ namespace { const uint32_t kFrequency = 400; +constexpr int kStateHighlight = (1 << 0); + } // namespace CFWL_Caret::CFWL_Caret(const CFWL_App* app, @@ -27,7 +29,7 @@ CFWL_Caret::CFWL_Caret(const CFWL_App* app, : CFWL_Widget(app, std::move(properties), pOuter), m_pTimer(pdfium::MakeUnique(this)), m_pTimerInfo(nullptr) { - SetStates(FWL_STATE_CAT_HightLight); + SetStates(kStateHighlight); } CFWL_Caret::~CFWL_Caret() { @@ -73,7 +75,7 @@ void CFWL_Caret::HideCaret() { void CFWL_Caret::DrawCaretBK(CXFA_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { - if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) + if (!(m_pProperties->m_dwStates & kStateHighlight)) return; CFWL_ThemeBackground param; @@ -98,10 +100,10 @@ CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {} void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { CFWL_Caret* pCaret = static_cast(m_pWidget.Get()); - if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight)) - pCaret->SetStates(FWL_STATE_CAT_HightLight); + if (!(pCaret->GetStates() & kStateHighlight)) + pCaret->SetStates(kStateHighlight); else - pCaret->RemoveStates(FWL_STATE_CAT_HightLight); + pCaret->RemoveStates(kStateHighlight); CFX_RectF rt = pCaret->GetWidgetRect(); pCaret->RepaintRect(CFX_RectF(0, 0, rt.width + 1, rt.height)); diff --git a/xfa/fwl/cfwl_caret.h b/xfa/fwl/cfwl_caret.h index 8a0b54fda0..638823699d 100644 --- a/xfa/fwl/cfwl_caret.h +++ b/xfa/fwl/cfwl_caret.h @@ -16,8 +16,6 @@ class CFWL_WidgetProperties; class CFWL_Widget; -#define FWL_STATE_CAT_HightLight 1 - class CFWL_Caret : public CFWL_Widget { public: CFWL_Caret(const CFWL_App* app, diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp index 9042e3bc74..d1c178322c 100644 --- a/xfa/fwl/cfwl_form.cpp +++ b/xfa/fwl/cfwl_form.cpp @@ -83,7 +83,7 @@ void CFWL_Form::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; DrawBackground(pGraphics, pTheme); -#ifdef FWL_UseMacSystemBorder +#if _FX_OS_ == _FX_OS_MACOSX_ return; #endif CFWL_ThemeBackground param; @@ -177,7 +177,7 @@ void CFWL_Form::SetWorkAreaRect() { void CFWL_Form::Layout() { m_rtRelative = GetRelativeRect(); -#ifndef FWL_UseMacSystemBorder +#if _FX_OS_ == _FX_OS_MACOSX_ IFWL_ThemeProvider* theme = GetAvailableTheme(); m_fCXBorder = theme ? theme->GetCXBorderSize() : 0.0f; m_fCYBorder = theme ? theme->GetCYBorderSize() : 0.0f; @@ -211,7 +211,7 @@ void CFWL_Form::UnRegisterForm() { } void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { -#ifndef FWL_UseMacSystemBorder +#if _FX_OS_ == _FX_OS_MACOSX_ if (!pMessage) return; @@ -233,7 +233,7 @@ void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { default: break; } -#endif // FWL_UseMacSystemBorder +#endif // _FX_OS_ == _FX_OS_MACOSX_ } void CFWL_Form::OnDrawWidget(CXFA_Graphics* pGraphics, diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h index f62d3755bf..cac1747385 100644 --- a/xfa/fwl/cfwl_form.h +++ b/xfa/fwl/cfwl_form.h @@ -16,10 +16,6 @@ #define FWL_CLASS_Form L"FWL_FORM" #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" -#if (_FX_OS_ == _FX_OS_MACOSX_) -#define FWL_UseMacSystemBorder -#endif - class CFWL_MessageMouse; class CFWL_NoteLoop; class CFWL_Widget; diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h index 50e6843507..325fa96158 100644 --- a/xfa/fwl/cfwl_monthcalendar.h +++ b/xfa/fwl/cfwl_monthcalendar.h @@ -15,7 +15,6 @@ #include "xfa/fwl/cfwl_widget.h" #include "xfa/fwl/cfwl_widgetproperties.h" -#define FWL_ITEMSTATE_MCD_Nomal 0 #define FWL_ITEMSTATE_MCD_Flag (1L << 0) #define FWL_ITEMSTATE_MCD_Selected (1L << 1) diff --git a/xfa/fwl/theme/cfwl_utils.h b/xfa/fwl/theme/cfwl_utils.h index 51bd07fbf9..8aa9a3c305 100644 --- a/xfa/fwl/theme/cfwl_utils.h +++ b/xfa/fwl/theme/cfwl_utils.h @@ -32,7 +32,6 @@ enum FWLTHEME_DIRECTION { #define FWLTHEME_COLOR_EDGERB1 (ArgbEncode(255, 241, 239, 226)) #define FWLTHEME_COLOR_Background (ArgbEncode(255, 236, 233, 216)) #define FWLTHEME_COLOR_BKSelected (ArgbEncode(255, 153, 193, 218)) -#define FWLTHEME_COLOR_Green_BKSelected (ArgbEncode(255, 147, 160, 112)) #define FWLTHEME_CAPACITY_FontSize 12.0f #define FWLTHEME_CAPACITY_TextColor (ArgbEncode(255, 0, 0, 0)) diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h index f5b7f06e7e..c2bc89f858 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.h +++ b/xfa/fxfa/cxfa_ffpushbutton.h @@ -11,10 +11,9 @@ #include "xfa/fxfa/cxfa_fffield.h" -#define XFA_FWL_PSBSTYLEEXT_HiliteNone (0L << 0) #define XFA_FWL_PSBSTYLEEXT_HiliteInverted (1L << 0) -#define XFA_FWL_PSBSTYLEEXT_HilitePush (2L << 0) -#define XFA_FWL_PSBSTYLEEXT_HiliteOutLine (4L << 0) +#define XFA_FWL_PSBSTYLEEXT_HilitePush (1L << 1) +#define XFA_FWL_PSBSTYLEEXT_HiliteOutLine (1L << 2) class CXFA_TextProvider; -- cgit v1.2.3