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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Signature.cpp

Issue 1254703002: FX_BOOL considered harmful, part 2. (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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_Icon.h" 9 #include "../../include/pdfwindow/PWL_Icon.h"
10 #include "../../include/pdfwindow/PWL_Signature.h" 10 #include "../../include/pdfwindow/PWL_Signature.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 fHScale = rcClient.Width() / fImageW; 63 fHScale = rcClient.Width() / fImageW;
64 fVScale = rcClient.Height() / fImageH; 64 fVScale = rcClient.Height() / fImageH;
65 } 65 }
66 66
67 /* --------------------------------- CPWL_Signature ---------------------------- ----- */ 67 /* --------------------------------- CPWL_Signature ---------------------------- ----- */
68 68
69 CPWL_Signature::CPWL_Signature() : 69 CPWL_Signature::CPWL_Signature() :
70 m_pText(NULL), 70 m_pText(NULL),
71 m_pDescription(NULL), 71 m_pDescription(NULL),
72 m_pImage(NULL), 72 m_pImage(NULL),
73 » m_bTextExist(TRUE), 73 » m_bTextExist(true),
74 » m_bImageExist(FALSE), 74 » m_bImageExist(false),
75 » m_bFlagExist(TRUE) 75 » m_bFlagExist(true)
76 { 76 {
77 } 77 }
78 78
79 CPWL_Signature::~CPWL_Signature() 79 CPWL_Signature::~CPWL_Signature()
80 { 80 {
81 } 81 }
82 82
83 void CPWL_Signature::SetTextFlag(FX_BOOL bTextExist) 83 void CPWL_Signature::SetTextFlag(bool bTextExist)
84 { 84 {
85 m_bTextExist = bTextExist; 85 m_bTextExist = bTextExist;
86 86
87 RePosChildWnd(); 87 RePosChildWnd();
88 } 88 }
89 89
90 void CPWL_Signature::SetImageFlag(FX_BOOL bImageExist) 90 void CPWL_Signature::SetImageFlag(bool bImageExist)
91 { 91 {
92 m_bImageExist = bImageExist; 92 m_bImageExist = bImageExist;
93 93
94 RePosChildWnd(); 94 RePosChildWnd();
95 } 95 }
96 96
97 void CPWL_Signature::SetFoxitFlag(FX_BOOL bFlagExist) 97 void CPWL_Signature::SetFoxitFlag(bool bFlagExist)
98 { 98 {
99 m_bFlagExist = bFlagExist; 99 m_bFlagExist = bFlagExist;
100 } 100 }
101 101
102 void CPWL_Signature::SetText(const FX_WCHAR* sText) 102 void CPWL_Signature::SetText(const FX_WCHAR* sText)
103 { 103 {
104 m_pText->SetText(sText); 104 m_pText->SetText(sText);
105 105
106 RePosChildWnd(); 106 RePosChildWnd();
107 } 107 }
(...skipping 20 matching lines...) Expand all
128 RePosChildWnd(); 128 RePosChildWnd();
129 } 129 }
130 130
131 void CPWL_Signature::RePosChildWnd() 131 void CPWL_Signature::RePosChildWnd()
132 { 132 {
133 CPDF_Rect rcClient = GetClientRect(); 133 CPDF_Rect rcClient = GetClientRect();
134 134
135 CPDF_Rect rcText = rcClient; 135 CPDF_Rect rcText = rcClient;
136 CPDF_Rect rcDescription = rcClient; 136 CPDF_Rect rcDescription = rcClient;
137 137
138 » FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0; 138 » bool bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0;
139 139
140 if ((bTextVisible || m_bImageExist) && 140 if ((bTextVisible || m_bImageExist) &&
141 m_pDescription->GetText().GetLength() > 0) 141 m_pDescription->GetText().GetLength() > 0)
142 { 142 {
143 if (rcClient.Width() >= rcClient.Height()) 143 if (rcClient.Width() >= rcClient.Height())
144 { 144 {
145 rcText.right = rcText.left + rcClient.Width() / 2.0f; 145 rcText.right = rcText.left + rcClient.Width() / 2.0f;
146 rcDescription.left = rcDescription.right - rcClient.Widt h() / 2.0f; 146 rcDescription.left = rcDescription.right - rcClient.Widt h() / 2.0f;
147 } 147 }
148 else 148 else
149 { 149 {
150 rcText.bottom = rcText.top - rcClient.Height() / 2.0f; 150 rcText.bottom = rcText.top - rcClient.Height() / 2.0f;
151 rcDescription.top = rcDescription.bottom + rcClient.Heig ht() / 2.0f; 151 rcDescription.top = rcDescription.bottom + rcClient.Heig ht() / 2.0f;
152 } 152 }
153 } 153 }
154 154
155 m_pText->SetVisible(bTextVisible); 155 m_pText->SetVisible(bTextVisible);
156 m_pImage->SetVisible(m_bImageExist); 156 m_pImage->SetVisible(m_bImageExist);
157 157
158 » m_pText->Move(rcText, TRUE, FALSE); 158 » m_pText->Move(rcText, true, false);
159 » m_pImage->Move(rcText, TRUE, FALSE); 159 » m_pImage->Move(rcText, true, false);
160 » m_pDescription->Move(rcDescription, TRUE, FALSE); 160 » m_pDescription->Move(rcDescription, true, false);
161 } 161 }
162 162
163 void CPWL_Signature::CreateChildWnd(const PWL_CREATEPARAM & cp) 163 void CPWL_Signature::CreateChildWnd(const PWL_CREATEPARAM & cp)
164 { 164 {
165 m_pImage = new CPWL_Signature_Image; 165 m_pImage = new CPWL_Signature_Image;
166 PWL_CREATEPARAM icp = cp; 166 PWL_CREATEPARAM icp = cp;
167 icp.pParentWnd = this; 167 icp.pParentWnd = this;
168 icp.dwFlags = PWS_CHILD | PWS_VISIBLE; 168 icp.dwFlags = PWS_CHILD | PWS_VISIBLE;
169 icp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); 169 icp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0);
170 m_pImage->Create(icp); 170 m_pImage->Create(icp);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), FXFILL_ALTERNATE); 211 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), FXFILL_ALTERNATE);
212 */ 212 */
213 } 213 }
214 214
215 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) 215 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
216 { 216 {
217 CPWL_Wnd::GetThisAppearanceStream(sAppStream); 217 CPWL_Wnd::GetThisAppearanceStream(sAppStream);
218 } 218 }
219 219
220 220
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698