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

Side by Side Diff: xfa/fwl/core/fwl_formimp.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 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 | « xfa/fwl/core/fwl_formimp.h ('k') | xfa/fwl/core/fwl_noteimp.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 "xfa/fwl/core/fwl_formimp.h" 7 #include "xfa/fwl/core/fwl_formimp.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 m_pNoteLoop = new CFWL_NoteLoop(this); 390 m_pNoteLoop = new CFWL_NoteLoop(this);
391 pDriver->PushNoteLoop(m_pNoteLoop); 391 pDriver->PushNoteLoop(m_pNoteLoop);
392 m_bDoModalFlag = TRUE; 392 m_bDoModalFlag = TRUE;
393 SetStates(FWL_WGTSTATE_Invisible, FALSE); 393 SetStates(FWL_WGTSTATE_Invisible, FALSE);
394 pDriver->Run(); 394 pDriver->Run();
395 #if (_FX_OS_ == _FX_MACOSX_) 395 #if (_FX_OS_ == _FX_MACOSX_)
396 #else 396 #else
397 pDriver->PopNoteLoop(); 397 pDriver->PopNoteLoop();
398 #endif 398 #endif
399 delete m_pNoteLoop; 399 delete m_pNoteLoop;
400 m_pNoteLoop = NULL; 400 m_pNoteLoop = nullptr;
401 return NULL; 401 return nullptr;
402 } 402 }
403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { 403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) {
404 return DoModal(); 404 return DoModal();
405 } 405 }
406 FWL_Error CFWL_FormImp::EndDoModal() { 406 FWL_Error CFWL_FormImp::EndDoModal() {
407 if (!m_pNoteLoop) 407 if (!m_pNoteLoop)
408 return FWL_Error::Indefinite; 408 return FWL_Error::Indefinite;
409 m_bDoModalFlag = FALSE; 409 m_bDoModalFlag = FALSE;
410 #if (_FX_OS_ == _FX_MACOSX_) 410 #if (_FX_OS_ == _FX_MACOSX_)
411 m_pNoteLoop->EndModalLoop(); 411 m_pNoteLoop->EndModalLoop();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { 493 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) {
494 return m_pMaxBox; 494 return m_pMaxBox;
495 } 495 }
496 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { 496 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) {
497 return m_pMinBox; 497 return m_pMinBox;
498 } 498 }
499 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { 499 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) {
500 return m_pCaptionBox; 500 return m_pCaptionBox;
501 } 501 }
502 return NULL; 502 return nullptr;
503 } 503 }
504 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { 504 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) {
505 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { 505 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) {
506 return m_pCloseBox; 506 return m_pCloseBox;
507 } 507 }
508 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { 508 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) {
509 return m_pMaxBox; 509 return m_pMaxBox;
510 } 510 }
511 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { 511 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) {
512 return m_pMinBox; 512 return m_pMinBox;
513 } 513 }
514 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { 514 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) {
515 return m_pCaptionBox; 515 return m_pCaptionBox;
516 } 516 }
517 return NULL; 517 return nullptr;
518 } 518 }
519 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { 519 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) {
520 if (nIndex < 0) 520 if (nIndex < 0)
521 return nullptr; 521 return nullptr;
522 522
523 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; 523 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn;
524 if (m_pMinBox) 524 if (m_pMinBox)
525 arrBtn.Add(m_pMinBox); 525 arrBtn.Add(m_pMinBox);
526 526
527 if (m_pMaxBox) 527 if (m_pMaxBox)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 794 }
795 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft, 795 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
796 FX_FLOAT& fWidth, 796 FX_FLOAT& fWidth,
797 FX_FLOAT fCurX, 797 FX_FLOAT fCurX,
798 FX_FLOAT fSpace, 798 FX_FLOAT fSpace,
799 FX_FLOAT fLimitMin, 799 FX_FLOAT fLimitMin,
800 FX_FLOAT fLimitMax, 800 FX_FLOAT fLimitMax,
801 FX_BOOL bLeft) { 801 FX_BOOL bLeft) {
802 FX_FLOAT fx = fCurX; 802 FX_FLOAT fx = fCurX;
803 FX_FLOAT fy = 0; 803 FX_FLOAT fy = 0;
804 TransformTo(NULL, fx, fy); 804 TransformTo(nullptr, fx, fy);
805 FX_FLOAT fTemp = 805 FX_FLOAT fTemp =
806 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace); 806 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace);
807 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { 807 if (fTemp >= fLimitMin && fTemp <= fLimitMax) {
808 fWidth = fTemp; 808 fWidth = fTemp;
809 fLeft += bLeft ? (fx - fLeft - fSpace) : 0; 809 fLeft += bLeft ? (fx - fLeft - fSpace) : 0;
810 } else { 810 } else {
811 if (fTemp < fLimitMin && fWidth > fLimitMin) { 811 if (fTemp < fLimitMin && fWidth > fLimitMin) {
812 fLeft += bLeft ? (fWidth - fLimitMin) : 0; 812 fLeft += bLeft ? (fWidth - fLimitMin) : 0;
813 fWidth = fLimitMin; 813 fWidth = fLimitMin;
814 } else if (fTemp > fLimitMax && fWidth < fLimitMax) { 814 } else if (fTemp > fLimitMax && fWidth < fLimitMax) {
815 fLeft -= bLeft ? (fLimitMax - fWidth) : 0; 815 fLeft -= bLeft ? (fLimitMax - fWidth) : 0;
816 fWidth = fLimitMax; 816 fWidth = fLimitMax;
817 } 817 }
818 } 818 }
819 } 819 }
820 void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop, 820 void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop,
821 FX_FLOAT& fHeight, 821 FX_FLOAT& fHeight,
822 FX_FLOAT fCurY, 822 FX_FLOAT fCurY,
823 FX_FLOAT fSpace, 823 FX_FLOAT fSpace,
824 FX_FLOAT fLimitMin, 824 FX_FLOAT fLimitMin,
825 FX_FLOAT fLimitMax, 825 FX_FLOAT fLimitMax,
826 FX_BOOL bTop) { 826 FX_BOOL bTop) {
827 FX_FLOAT fx = 0; 827 FX_FLOAT fx = 0;
828 FX_FLOAT fy = fCurY; 828 FX_FLOAT fy = fCurY;
829 TransformTo(NULL, fx, fy); 829 TransformTo(nullptr, fx, fy);
830 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace); 830 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace);
831 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { 831 if (fTemp >= fLimitMin && fTemp <= fLimitMax) {
832 fHeight = fTemp; 832 fHeight = fTemp;
833 fTop += bTop ? (fy - fTop - fSpace) : 0; 833 fTop += bTop ? (fy - fTop - fSpace) : 0;
834 } else { 834 } else {
835 if (fTemp < fLimitMin && fHeight > fLimitMin) { 835 if (fTemp < fLimitMin && fHeight > fLimitMin) {
836 fTop += bTop ? (fHeight - fLimitMin) : 0; 836 fTop += bTop ? (fHeight - fLimitMin) : 0;
837 fHeight = fLimitMin; 837 fHeight = fLimitMin;
838 } else if (fTemp > fLimitMax && fHeight < fLimitMax) { 838 } else if (fTemp > fLimitMax && fHeight < fLimitMax) {
839 fTop -= bTop ? (fLimitMax - fHeight) : 0; 839 fTop -= bTop ? (fLimitMax - fHeight) : 0;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 uint32_t CFWL_SysBtn::GetPartState() const { 1164 uint32_t CFWL_SysBtn::GetPartState() const {
1165 if (IsDisabled()) 1165 if (IsDisabled())
1166 return CFWL_PartState_Disabled; 1166 return CFWL_PartState_Disabled;
1167 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) 1167 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed)
1168 return CFWL_PartState_Pressed; 1168 return CFWL_PartState_Pressed;
1169 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) 1169 if (m_dwState & FWL_SYSBUTTONSTATE_Hover)
1170 return CFWL_PartState_Hovered; 1170 return CFWL_PartState_Hovered;
1171 return CFWL_PartState_Normal; 1171 return CFWL_PartState_Normal;
1172 } 1172 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_formimp.h ('k') | xfa/fwl/core/fwl_noteimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698