| OLD | NEW |
| 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 "fpdfsdk/include/pdfwindow/PDFWindow.h" | |
| 8 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" |
| 9 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 8 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
| 11 | 10 |
| 12 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 11 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 13 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 12 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 14 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 13 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 15 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 14 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
| 16 | 15 |
| 17 PWL_FLOATRANGE::PWL_FLOATRANGE() { | 16 PWL_FLOATRANGE::PWL_FLOATRANGE() { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } else { | 602 } else { |
| 604 fBWidth = (rcClient.right - rcClient.left - | 603 fBWidth = (rcClient.right - rcClient.left - |
| 605 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / | 604 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / |
| 606 2; | 605 2; |
| 607 | 606 |
| 608 if (fBWidth > 0) { | 607 if (fBWidth > 0) { |
| 609 rcMinButton = CPDF_Rect(rcClient.left, rcClient.bottom, | 608 rcMinButton = CPDF_Rect(rcClient.left, rcClient.bottom, |
| 610 rcClient.left + fBWidth, rcClient.top); | 609 rcClient.left + fBWidth, rcClient.top); |
| 611 rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom, | 610 rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom, |
| 612 rcClient.right, rcClient.top); | 611 rcClient.right, rcClient.top); |
| 613 } else | 612 } else { |
| 614 SetVisible(FALSE); | 613 SetVisible(FALSE); |
| 614 } |
| 615 } | 615 } |
| 616 break; | 616 break; |
| 617 case SBT_VSCROLL: | 617 case SBT_VSCROLL: |
| 618 if (IsFloatBigger(rcClient.top - rcClient.bottom, | 618 if (IsFloatBigger(rcClient.top - rcClient.bottom, |
| 619 PWL_SCROLLBAR_BUTTON_WIDTH * 2 + | 619 PWL_SCROLLBAR_BUTTON_WIDTH * 2 + |
| 620 PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) { | 620 PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) { |
| 621 rcMinButton = | 621 rcMinButton = |
| 622 CPDF_Rect(rcClient.left, rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH, | 622 CPDF_Rect(rcClient.left, rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH, |
| 623 rcClient.right, rcClient.top); | 623 rcClient.right, rcClient.top); |
| 624 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, rcClient.right, | 624 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, rcClient.right, |
| 625 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH); | 625 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH); |
| 626 } else { | 626 } else { |
| 627 fBWidth = (rcClient.top - rcClient.bottom - | 627 fBWidth = (rcClient.top - rcClient.bottom - |
| 628 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / | 628 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / |
| 629 2; | 629 2; |
| 630 | 630 |
| 631 if (IsFloatBigger(fBWidth, 0)) { | 631 if (IsFloatBigger(fBWidth, 0)) { |
| 632 rcMinButton = CPDF_Rect(rcClient.left, rcClient.top - fBWidth, | 632 rcMinButton = CPDF_Rect(rcClient.left, rcClient.top - fBWidth, |
| 633 rcClient.right, rcClient.top); | 633 rcClient.right, rcClient.top); |
| 634 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, | 634 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, |
| 635 rcClient.right, rcClient.bottom + fBWidth); | 635 rcClient.right, rcClient.bottom + fBWidth); |
| 636 } else | 636 } else { |
| 637 SetVisible(FALSE); | 637 SetVisible(FALSE); |
| 638 } |
| 638 } | 639 } |
| 639 break; | 640 break; |
| 640 } | 641 } |
| 641 | 642 |
| 642 if (m_pMinButton) | 643 if (m_pMinButton) |
| 643 m_pMinButton->Move(rcMinButton, TRUE, FALSE); | 644 m_pMinButton->Move(rcMinButton, TRUE, FALSE); |
| 644 if (m_pMaxButton) | 645 if (m_pMaxButton) |
| 645 m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); | 646 m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); |
| 646 MovePosButton(FALSE); | 647 MovePosButton(FALSE); |
| 647 } | 648 } |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 if (m_bMinOrMax) | 1168 if (m_bMinOrMax) |
| 1168 m_sData.SubSmall(); | 1169 m_sData.SubSmall(); |
| 1169 else | 1170 else |
| 1170 m_sData.AddSmall(); | 1171 m_sData.AddSmall(); |
| 1171 | 1172 |
| 1172 if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) { | 1173 if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) { |
| 1173 MovePosButton(TRUE); | 1174 MovePosButton(TRUE); |
| 1174 NotifyScrollWindow(); | 1175 NotifyScrollWindow(); |
| 1175 } | 1176 } |
| 1176 } | 1177 } |
| OLD | NEW |