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 "xfa/fwl/core/cfwl_edit.h" | 7 #include "xfa/fwl/core/cfwl_edit.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (iTextLen > 0) { | 115 if (iTextLen > 0) { |
116 CFX_WideString wsText = m_EdtEngine.GetText(0); | 116 CFX_WideString wsText = m_EdtEngine.GetText(0); |
117 CFX_SizeF sz = CalcTextSize( | 117 CFX_SizeF sz = CalcTextSize( |
118 wsText, m_pProperties->m_pThemeProvider, | 118 wsText, m_pProperties->m_pThemeProvider, |
119 !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); | 119 !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); |
120 rect.Set(0, 0, sz.x, sz.y); | 120 rect.Set(0, 0, sz.x, sz.y); |
121 } | 121 } |
122 CFWL_Widget::GetWidgetRect(rect, true); | 122 CFWL_Widget::GetWidgetRect(rect, true); |
123 } | 123 } |
124 | 124 |
125 void CFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { | 125 void CFWL_Edit::SetStates(uint32_t dwStates) { |
126 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) || | 126 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) || |
127 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { | 127 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { |
128 HideCaret(nullptr); | 128 HideCaret(nullptr); |
129 } | 129 } |
130 CFWL_Widget::SetStates(dwStates, bSet); | 130 CFWL_Widget::SetStates(dwStates); |
131 } | 131 } |
132 | 132 |
133 void CFWL_Edit::Update() { | 133 void CFWL_Edit::Update() { |
134 if (IsLocked()) | 134 if (IsLocked()) |
135 return; | 135 return; |
136 if (!m_pProperties->m_pThemeProvider) | 136 if (!m_pProperties->m_pThemeProvider) |
137 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 137 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
138 | 138 |
139 Layout(); | 139 Layout(); |
140 if (m_rtClient.IsEmpty()) | 140 if (m_rtClient.IsEmpty()) |
141 return; | 141 return; |
142 | 142 |
143 UpdateEditEngine(); | 143 UpdateEditEngine(); |
144 UpdateVAlignment(); | 144 UpdateVAlignment(); |
145 UpdateScroll(); | 145 UpdateScroll(); |
146 InitCaret(); | 146 InitCaret(); |
147 } | 147 } |
148 | 148 |
149 FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 149 FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
150 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { | 150 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { |
151 if (IsShowScrollBar(true)) { | 151 if (IsShowScrollBar(true)) { |
152 CFX_RectF rect; | 152 CFX_RectF rect; |
153 m_pVertScrollBar->GetWidgetRect(rect); | 153 m_pVertScrollBar->GetWidgetRect(rect, false); |
154 if (rect.Contains(fx, fy)) | 154 if (rect.Contains(fx, fy)) |
155 return FWL_WidgetHit::VScrollBar; | 155 return FWL_WidgetHit::VScrollBar; |
156 } | 156 } |
157 if (IsShowScrollBar(false)) { | 157 if (IsShowScrollBar(false)) { |
158 CFX_RectF rect; | 158 CFX_RectF rect; |
159 m_pHorzScrollBar->GetWidgetRect(rect); | 159 m_pHorzScrollBar->GetWidgetRect(rect, false); |
160 if (rect.Contains(fx, fy)) | 160 if (rect.Contains(fx, fy)) |
161 return FWL_WidgetHit::HScrollBar; | 161 return FWL_WidgetHit::HScrollBar; |
162 } | 162 } |
163 } | 163 } |
164 if (m_rtClient.Contains(fx, fy)) | 164 if (m_rtClient.Contains(fx, fy)) |
165 return FWL_WidgetHit::Edit; | 165 return FWL_WidgetHit::Edit; |
166 return FWL_WidgetHit::Unknown; | 166 return FWL_WidgetHit::Unknown; |
167 } | 167 } |
168 | 168 |
169 void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, | 169 void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return; | 425 return; |
426 | 426 |
427 bool bRepaintContent = UpdateOffset(); | 427 bool bRepaintContent = UpdateOffset(); |
428 UpdateCaret(); | 428 UpdateCaret(); |
429 CFX_RectF rtInvalid; | 429 CFX_RectF rtInvalid; |
430 rtInvalid.Set(0, 0, 0, 0); | 430 rtInvalid.Set(0, 0, 0, 0); |
431 bool bRepaintScroll = false; | 431 bool bRepaintScroll = false; |
432 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { | 432 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { |
433 CFWL_ScrollBar* pScroll = UpdateScroll(); | 433 CFWL_ScrollBar* pScroll = UpdateScroll(); |
434 if (pScroll) { | 434 if (pScroll) { |
435 pScroll->GetWidgetRect(rtInvalid); | 435 pScroll->GetWidgetRect(rtInvalid, false); |
436 bRepaintScroll = true; | 436 bRepaintScroll = true; |
437 } | 437 } |
438 } | 438 } |
439 if (bRepaintContent || bRepaintScroll) { | 439 if (bRepaintContent || bRepaintScroll) { |
440 if (bRepaintContent) | 440 if (bRepaintContent) |
441 rtInvalid.Union(m_rtEngine); | 441 rtInvalid.Union(m_rtEngine); |
442 Repaint(&rtInvalid); | 442 Repaint(&rtInvalid); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (dwStates) | 522 if (dwStates) |
523 param.m_dwStates = CFWL_PartState_Disabled; | 523 param.m_dwStates = CFWL_PartState_Disabled; |
524 param.m_pGraphics = pGraphics; | 524 param.m_pGraphics = pGraphics; |
525 param.m_matrix = *pMatrix; | 525 param.m_matrix = *pMatrix; |
526 param.m_rtPart = m_rtClient; | 526 param.m_rtPart = m_rtClient; |
527 pTheme->DrawBackground(¶m); | 527 pTheme->DrawBackground(¶m); |
528 | 528 |
529 if (!IsShowScrollBar(true) || !IsShowScrollBar(false)) | 529 if (!IsShowScrollBar(true) || !IsShowScrollBar(false)) |
530 return; | 530 return; |
531 | 531 |
532 CFX_RectF rtScorll; | 532 CFX_RectF rtScroll; |
533 m_pHorzScrollBar->GetWidgetRect(rtScorll); | 533 m_pHorzScrollBar->GetWidgetRect(rtScroll, false); |
534 | 534 |
535 CFX_RectF rtStatic; | 535 CFX_RectF rtStatic; |
536 rtStatic.Set(m_rtClient.right() - rtScorll.height, | 536 rtStatic.Set(m_rtClient.right() - rtScroll.height, |
537 m_rtClient.bottom() - rtScorll.height, rtScorll.height, | 537 m_rtClient.bottom() - rtScroll.height, rtScroll.height, |
538 rtScorll.height); | 538 rtScroll.height); |
539 param.m_bStaticBackground = true; | 539 param.m_bStaticBackground = true; |
540 param.m_bMaximize = true; | 540 param.m_bMaximize = true; |
541 param.m_rtPart = rtStatic; | 541 param.m_rtPart = rtStatic; |
542 pTheme->DrawBackground(¶m); | 542 pTheme->DrawBackground(¶m); |
543 } | 543 } |
544 | 544 |
545 void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, | 545 void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, |
546 IFWL_ThemeProvider* pTheme, | 546 IFWL_ThemeProvider* pTheme, |
547 const CFX_Matrix* pMatrix) { | 547 const CFX_Matrix* pMatrix) { |
548 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); | 548 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 return nullptr; | 907 return nullptr; |
908 | 908 |
909 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); | 909 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); |
910 if (!pPage) | 910 if (!pPage) |
911 return nullptr; | 911 return nullptr; |
912 | 912 |
913 const CFX_RectF& rtFDE = pPage->GetContentsBox(); | 913 const CFX_RectF& rtFDE = pPage->GetContentsBox(); |
914 CFWL_ScrollBar* pRepaint = nullptr; | 914 CFWL_ScrollBar* pRepaint = nullptr; |
915 if (bShowHorz) { | 915 if (bShowHorz) { |
916 CFX_RectF rtScroll; | 916 CFX_RectF rtScroll; |
917 m_pHorzScrollBar->GetWidgetRect(rtScroll); | 917 m_pHorzScrollBar->GetWidgetRect(rtScroll, false); |
918 if (rtScroll.width < rtFDE.width) { | 918 if (rtScroll.width < rtFDE.width) { |
919 m_pHorzScrollBar->LockUpdate(); | 919 m_pHorzScrollBar->LockUpdate(); |
920 FX_FLOAT fRange = rtFDE.width - rtScroll.width; | 920 FX_FLOAT fRange = rtFDE.width - rtScroll.width; |
921 m_pHorzScrollBar->SetRange(0.0f, fRange); | 921 m_pHorzScrollBar->SetRange(0.0f, fRange); |
922 | 922 |
923 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange); | 923 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange); |
924 m_pHorzScrollBar->SetPos(fPos); | 924 m_pHorzScrollBar->SetPos(fPos); |
925 m_pHorzScrollBar->SetTrackPos(fPos); | 925 m_pHorzScrollBar->SetTrackPos(fPos); |
926 m_pHorzScrollBar->SetPageSize(rtScroll.width); | 926 m_pHorzScrollBar->SetPageSize(rtScroll.width); |
927 m_pHorzScrollBar->SetStepSize(rtScroll.width / 10); | 927 m_pHorzScrollBar->SetStepSize(rtScroll.width / 10); |
928 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); | 928 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Disabled); |
929 m_pHorzScrollBar->UnlockUpdate(); | 929 m_pHorzScrollBar->UnlockUpdate(); |
930 m_pHorzScrollBar->Update(); | 930 m_pHorzScrollBar->Update(); |
931 pRepaint = m_pHorzScrollBar.get(); | 931 pRepaint = m_pHorzScrollBar.get(); |
932 } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { | 932 } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { |
933 m_pHorzScrollBar->LockUpdate(); | 933 m_pHorzScrollBar->LockUpdate(); |
934 m_pHorzScrollBar->SetRange(0, -1); | 934 m_pHorzScrollBar->SetRange(0, -1); |
935 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); | 935 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled); |
936 m_pHorzScrollBar->UnlockUpdate(); | 936 m_pHorzScrollBar->UnlockUpdate(); |
937 m_pHorzScrollBar->Update(); | 937 m_pHorzScrollBar->Update(); |
938 pRepaint = m_pHorzScrollBar.get(); | 938 pRepaint = m_pHorzScrollBar.get(); |
939 } | 939 } |
940 } | 940 } |
941 | 941 |
942 if (bShowVert) { | 942 if (bShowVert) { |
943 CFX_RectF rtScroll; | 943 CFX_RectF rtScroll; |
944 m_pVertScrollBar->GetWidgetRect(rtScroll); | 944 m_pVertScrollBar->GetWidgetRect(rtScroll, false); |
945 if (rtScroll.height < rtFDE.height) { | 945 if (rtScroll.height < rtFDE.height) { |
946 m_pVertScrollBar->LockUpdate(); | 946 m_pVertScrollBar->LockUpdate(); |
947 FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace; | 947 FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace; |
948 FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep); | 948 FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep); |
949 | 949 |
950 m_pVertScrollBar->SetRange(0.0f, fRange); | 950 m_pVertScrollBar->SetRange(0.0f, fRange); |
951 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange); | 951 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange); |
952 m_pVertScrollBar->SetPos(fPos); | 952 m_pVertScrollBar->SetPos(fPos); |
953 m_pVertScrollBar->SetTrackPos(fPos); | 953 m_pVertScrollBar->SetTrackPos(fPos); |
954 m_pVertScrollBar->SetPageSize(rtScroll.height); | 954 m_pVertScrollBar->SetPageSize(rtScroll.height); |
955 m_pVertScrollBar->SetStepSize(fStep); | 955 m_pVertScrollBar->SetStepSize(fStep); |
956 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); | 956 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Disabled); |
957 m_pVertScrollBar->UnlockUpdate(); | 957 m_pVertScrollBar->UnlockUpdate(); |
958 m_pVertScrollBar->Update(); | 958 m_pVertScrollBar->Update(); |
959 pRepaint = m_pVertScrollBar.get(); | 959 pRepaint = m_pVertScrollBar.get(); |
960 } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { | 960 } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { |
961 m_pVertScrollBar->LockUpdate(); | 961 m_pVertScrollBar->LockUpdate(); |
962 m_pVertScrollBar->SetRange(0, -1); | 962 m_pVertScrollBar->SetRange(0, -1); |
963 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); | 963 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled); |
964 m_pVertScrollBar->UnlockUpdate(); | 964 m_pVertScrollBar->UnlockUpdate(); |
965 m_pVertScrollBar->Update(); | 965 m_pVertScrollBar->Update(); |
966 pRepaint = m_pVertScrollBar.get(); | 966 pRepaint = m_pVertScrollBar.get(); |
967 } | 967 } |
968 } | 968 } |
969 return pRepaint; | 969 return pRepaint; |
970 } | 970 } |
971 | 971 |
972 bool CFWL_Edit::IsShowScrollBar(bool bVert) { | 972 bool CFWL_Edit::IsShowScrollBar(bool bVert) { |
973 bool bShow = | 973 bool bShow = |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 m_rtClient.height); | 1047 m_rtClient.height); |
1048 } else { | 1048 } else { |
1049 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, | 1049 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, |
1050 m_rtClient.height); | 1050 m_rtClient.height); |
1051 if (bShowHorzScrollbar) | 1051 if (bShowHorzScrollbar) |
1052 rtVertScr.height -= fWidth; | 1052 rtVertScr.height -= fWidth; |
1053 m_rtEngine.width -= fWidth; | 1053 m_rtEngine.width -= fWidth; |
1054 } | 1054 } |
1055 | 1055 |
1056 m_pVertScrollBar->SetWidgetRect(rtVertScr); | 1056 m_pVertScrollBar->SetWidgetRect(rtVertScr); |
1057 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); | 1057 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); |
1058 m_pVertScrollBar->Update(); | 1058 m_pVertScrollBar->Update(); |
1059 } else if (m_pVertScrollBar) { | 1059 } else if (m_pVertScrollBar) { |
1060 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); | 1060 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); |
1061 } | 1061 } |
1062 | 1062 |
1063 if (bShowHorzScrollbar) { | 1063 if (bShowHorzScrollbar) { |
1064 InitScrollBar(false); | 1064 InitScrollBar(false); |
1065 | 1065 |
1066 CFX_RectF rtHoriScr; | 1066 CFX_RectF rtHoriScr; |
1067 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { | 1067 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { |
1068 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, | 1068 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, |
1069 m_rtClient.width, fWidth); | 1069 m_rtClient.width, fWidth); |
1070 } else { | 1070 } else { |
1071 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, | 1071 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, |
1072 m_rtClient.width, fWidth); | 1072 m_rtClient.width, fWidth); |
1073 if (bShowVertScrollbar) | 1073 if (bShowVertScrollbar) |
1074 rtHoriScr.width -= fWidth; | 1074 rtHoriScr.width -= fWidth; |
1075 m_rtEngine.height -= fWidth; | 1075 m_rtEngine.height -= fWidth; |
1076 } | 1076 } |
1077 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); | 1077 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); |
1078 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); | 1078 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); |
1079 m_pHorzScrollBar->Update(); | 1079 m_pHorzScrollBar->Update(); |
1080 } else if (m_pHorzScrollBar) { | 1080 } else if (m_pHorzScrollBar) { |
1081 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); | 1081 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); |
1082 } | 1082 } |
1083 } | 1083 } |
1084 | 1084 |
1085 void CFWL_Edit::LayoutScrollBar() { | 1085 void CFWL_Edit::LayoutScrollBar() { |
1086 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) == | 1086 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) == |
1087 0) { | 1087 0) { |
1088 return; | 1088 return; |
1089 } | 1089 } |
1090 | 1090 |
1091 FX_FLOAT* pfWidth = nullptr; | 1091 FX_FLOAT* pfWidth = nullptr; |
(...skipping 11 matching lines...) Expand all Loading... |
1103 m_rtClient.height); | 1103 m_rtClient.height); |
1104 } else { | 1104 } else { |
1105 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, | 1105 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, |
1106 m_rtClient.height); | 1106 m_rtClient.height); |
1107 if (bShowHorzScrollbar) | 1107 if (bShowHorzScrollbar) |
1108 rtVertScr.height -= fWidth; | 1108 rtVertScr.height -= fWidth; |
1109 } | 1109 } |
1110 m_pVertScrollBar->SetWidgetRect(rtVertScr); | 1110 m_pVertScrollBar->SetWidgetRect(rtVertScr); |
1111 m_pVertScrollBar->Update(); | 1111 m_pVertScrollBar->Update(); |
1112 } | 1112 } |
1113 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); | 1113 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); |
1114 } else if (m_pVertScrollBar) { | 1114 } else if (m_pVertScrollBar) { |
1115 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); | 1115 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); |
1116 } | 1116 } |
1117 | 1117 |
1118 if (bShowHorzScrollbar) { | 1118 if (bShowHorzScrollbar) { |
1119 if (!m_pHorzScrollBar) { | 1119 if (!m_pHorzScrollBar) { |
1120 if (!pfWidth) { | 1120 if (!pfWidth) { |
1121 pfWidth = static_cast<FX_FLOAT*>( | 1121 pfWidth = static_cast<FX_FLOAT*>( |
1122 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 1122 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
1123 } | 1123 } |
1124 | 1124 |
1125 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; | 1125 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; |
1126 InitScrollBar(false); | 1126 InitScrollBar(false); |
1127 CFX_RectF rtHoriScr; | 1127 CFX_RectF rtHoriScr; |
1128 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { | 1128 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { |
1129 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, | 1129 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, |
1130 m_rtClient.width, fWidth); | 1130 m_rtClient.width, fWidth); |
1131 } else { | 1131 } else { |
1132 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, | 1132 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, |
1133 m_rtClient.width, fWidth); | 1133 m_rtClient.width, fWidth); |
1134 if (bShowVertScrollbar) | 1134 if (bShowVertScrollbar) |
1135 rtHoriScr.width -= (fWidth); | 1135 rtHoriScr.width -= (fWidth); |
1136 } | 1136 } |
1137 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); | 1137 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); |
1138 m_pHorzScrollBar->Update(); | 1138 m_pHorzScrollBar->Update(); |
1139 } | 1139 } |
1140 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); | 1140 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); |
1141 } else if (m_pHorzScrollBar) { | 1141 } else if (m_pHorzScrollBar) { |
1142 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); | 1142 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); |
1143 } | 1143 } |
1144 if (bShowVertScrollbar || bShowHorzScrollbar) | 1144 if (bShowVertScrollbar || bShowHorzScrollbar) |
1145 UpdateScroll(); | 1145 UpdateScroll(); |
1146 } | 1146 } |
1147 | 1147 |
1148 void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) { | 1148 void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) { |
1149 pt.x += m_fScrollOffsetX - m_rtEngine.left; | 1149 pt.x += m_fScrollOffsetX - m_rtEngine.left; |
1150 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset; | 1150 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset; |
1151 } | 1151 } |
1152 | 1152 |
(...skipping 22 matching lines...) Expand all Loading... |
1175 Repaint(&m_rtEngine); | 1175 Repaint(&m_rtEngine); |
1176 return; | 1176 return; |
1177 } | 1177 } |
1178 | 1178 |
1179 CFWL_Widget* pOuter = this; | 1179 CFWL_Widget* pOuter = this; |
1180 pRect->Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); | 1180 pRect->Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); |
1181 while (pOuter->GetOuter()) { | 1181 while (pOuter->GetOuter()) { |
1182 pOuter = pOuter->GetOuter(); | 1182 pOuter = pOuter->GetOuter(); |
1183 | 1183 |
1184 CFX_RectF rtOuter; | 1184 CFX_RectF rtOuter; |
1185 pOuter->GetWidgetRect(rtOuter); | 1185 pOuter->GetWidgetRect(rtOuter, false); |
1186 pRect->Offset(rtOuter.left, rtOuter.top); | 1186 pRect->Offset(rtOuter.left, rtOuter.top); |
1187 } | 1187 } |
1188 | 1188 |
1189 CXFA_FFWidget* pXFAWidget = | 1189 CXFA_FFWidget* pXFAWidget = |
1190 static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()); | 1190 static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()); |
1191 if (!pXFAWidget) | 1191 if (!pXFAWidget) |
1192 return; | 1192 return; |
1193 | 1193 |
1194 IXFA_DocEnvironment* pDocEnvironment = | 1194 IXFA_DocEnvironment* pDocEnvironment = |
1195 pXFAWidget->GetDoc()->GetDocEnvironment(); | 1195 pXFAWidget->GetDoc()->GetDocEnvironment(); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } | 1641 } |
1642 if (iCurPos == fPos) | 1642 if (iCurPos == fPos) |
1643 return true; | 1643 return true; |
1644 | 1644 |
1645 pScrollBar->SetPos(fPos); | 1645 pScrollBar->SetPos(fPos); |
1646 pScrollBar->SetTrackPos(fPos); | 1646 pScrollBar->SetTrackPos(fPos); |
1647 UpdateOffset(pScrollBar, fPos - iCurPos); | 1647 UpdateOffset(pScrollBar, fPos - iCurPos); |
1648 UpdateCaret(); | 1648 UpdateCaret(); |
1649 | 1649 |
1650 CFX_RectF rect; | 1650 CFX_RectF rect; |
1651 GetWidgetRect(rect); | 1651 GetWidgetRect(rect, false); |
1652 CFX_RectF rtInvalidate; | 1652 CFX_RectF rtInvalidate; |
1653 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 1653 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
1654 Repaint(&rtInvalidate); | 1654 Repaint(&rtInvalidate); |
1655 return true; | 1655 return true; |
1656 } | 1656 } |
OLD | NEW |