| 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 "../../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_EditCtrl.h" | 9 #include "../../include/pdfwindow/PWL_EditCtrl.h" |
| 10 #include "../../include/pdfwindow/PWL_ScrollBar.h" | 10 #include "../../include/pdfwindow/PWL_ScrollBar.h" |
| 11 #include "../../include/pdfwindow/PWL_Utils.h" | 11 #include "../../include/pdfwindow/PWL_Utils.h" |
| 12 #include "../../include/pdfwindow/PWL_Caret.h" | 12 #include "../../include/pdfwindow/PWL_Caret.h" |
| 13 #include "../../include/pdfwindow/PWL_FontMap.h" | 13 #include "../../include/pdfwindow/PWL_FontMap.h" |
| 14 | 14 |
| 15 #define IsFloatZero(f) ((f) < 0.0001 &&
(f) > -0.0001) | 15 #define IsFloatZero(f) ((f) < 0.0001 &&
(f) > -0.0001) |
| 16 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloat
Zero((fa) - (fb))) | 16 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloat
Zero((fa) - (fb))) |
| 17 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloat
Zero((fa) - (fb))) | 17 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloat
Zero((fa) - (fb))) |
| 18 #define IsFloatEqual(fa,fb) IsFloatZero((fa)
-(fb)) | 18 #define IsFloatEqual(fa,fb) IsFloatZero((fa)
-(fb)) |
| 19 | 19 |
| 20 /* ---------------------------- CPWL_EditCtrl ------------------------------ */ | 20 /* ---------------------------- CPWL_EditCtrl ------------------------------ */ |
| 21 | 21 |
| 22 CPWL_EditCtrl::CPWL_EditCtrl() : | 22 CPWL_EditCtrl::CPWL_EditCtrl() : |
| 23 m_pEdit(NULL), | 23 m_pEdit(NULL), |
| 24 m_pEditCaret(NULL), | 24 m_pEditCaret(NULL), |
| 25 » m_bMouseDown(FALSE), | 25 » m_bMouseDown(false), |
| 26 m_pEditNotify(NULL), | 26 m_pEditNotify(NULL), |
| 27 m_nCharSet(DEFAULT_CHARSET), | 27 m_nCharSet(DEFAULT_CHARSET), |
| 28 m_nCodePage(0) | 28 m_nCodePage(0) |
| 29 { | 29 { |
| 30 m_pEdit = IFX_Edit::NewEdit(); | 30 m_pEdit = IFX_Edit::NewEdit(); |
| 31 ASSERT(m_pEdit != NULL); | 31 ASSERT(m_pEdit != NULL); |
| 32 } | 32 } |
| 33 | 33 |
| 34 CPWL_EditCtrl::~CPWL_EditCtrl() | 34 CPWL_EditCtrl::~CPWL_EditCtrl() |
| 35 { | 35 { |
| 36 IFX_Edit::DelEdit(m_pEdit); | 36 IFX_Edit::DelEdit(m_pEdit); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM & cp) | 39 void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM & cp) |
| 40 { | 40 { |
| 41 cp.eCursorType = FXCT_VBEAM; | 41 cp.eCursorType = FXCT_VBEAM; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void CPWL_EditCtrl::OnCreated() | 44 void CPWL_EditCtrl::OnCreated() |
| 45 { | 45 { |
| 46 SetFontSize(GetCreationParam().fFontSize); | 46 SetFontSize(GetCreationParam().fFontSize); |
| 47 | 47 |
| 48 m_pEdit->SetFontMap(GetFontMap()); | 48 m_pEdit->SetFontMap(GetFontMap()); |
| 49 m_pEdit->SetNotify(this); | 49 m_pEdit->SetNotify(this); |
| 50 m_pEdit->Initialize(); | 50 m_pEdit->Initialize(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 FX_BOOL CPWL_EditCtrl::IsWndHorV() | 53 bool CPWL_EditCtrl::IsWndHorV() |
| 54 { | 54 { |
| 55 CPDF_Matrix mt = GetWindowMatrix(); | 55 CPDF_Matrix mt = GetWindowMatrix(); |
| 56 CPDF_Point point1(0,1); | 56 CPDF_Point point1(0,1); |
| 57 CPDF_Point point2(1,1); | 57 CPDF_Point point2(1,1); |
| 58 | 58 |
| 59 mt.Transform(point1.x, point1.y); | 59 mt.Transform(point1.x, point1.y); |
| 60 mt.Transform(point2.x, point2.y); | 60 mt.Transform(point2.x, point2.y); |
| 61 | 61 |
| 62 return point2.y == point1.y; | 62 return point2.y == point1.y; |
| 63 } | 63 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) | 160 void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) |
| 161 { | 161 { |
| 162 m_pEdit->SetFontSize(fFontSize); | 162 m_pEdit->SetFontSize(fFontSize); |
| 163 } | 163 } |
| 164 | 164 |
| 165 FX_FLOAT CPWL_EditCtrl::GetFontSize() const | 165 FX_FLOAT CPWL_EditCtrl::GetFontSize() const |
| 166 { | 166 { |
| 167 return m_pEdit->GetFontSize(); | 167 return m_pEdit->GetFontSize(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 FX_BOOL CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) | 170 bool CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) |
| 171 { | 171 { |
| 172 » if (m_bMouseDown) return TRUE; | 172 » if (m_bMouseDown) return true; |
| 173 | 173 |
| 174 » FX_BOOL bRet = CPWL_Wnd::OnKeyDown(nChar,nFlag); | 174 » bool bRet = CPWL_Wnd::OnKeyDown(nChar,nFlag); |
| 175 | 175 |
| 176 //FILTER | 176 //FILTER |
| 177 switch (nChar) | 177 switch (nChar) |
| 178 { | 178 { |
| 179 default: | 179 default: |
| 180 » » return FALSE; | 180 » » return false; |
| 181 case FWL_VKEY_Delete: | 181 case FWL_VKEY_Delete: |
| 182 case FWL_VKEY_Up: | 182 case FWL_VKEY_Up: |
| 183 case FWL_VKEY_Down: | 183 case FWL_VKEY_Down: |
| 184 case FWL_VKEY_Left: | 184 case FWL_VKEY_Left: |
| 185 case FWL_VKEY_Right: | 185 case FWL_VKEY_Right: |
| 186 case FWL_VKEY_Home: | 186 case FWL_VKEY_Home: |
| 187 case FWL_VKEY_End: | 187 case FWL_VKEY_End: |
| 188 case FWL_VKEY_Insert: | 188 case FWL_VKEY_Insert: |
| 189 case 'C': | 189 case 'C': |
| 190 case 'V': | 190 case 'V': |
| (...skipping 11 matching lines...) Expand all Loading... |
| 202 if (nChar == FWL_VKEY_Delete) | 202 if (nChar == FWL_VKEY_Delete) |
| 203 { | 203 { |
| 204 if (m_pEdit->IsSelected()) | 204 if (m_pEdit->IsSelected()) |
| 205 nChar = FWL_VKEY_Unknown; | 205 nChar = FWL_VKEY_Unknown; |
| 206 } | 206 } |
| 207 | 207 |
| 208 switch (nChar) | 208 switch (nChar) |
| 209 { | 209 { |
| 210 case FWL_VKEY_Delete: | 210 case FWL_VKEY_Delete: |
| 211 Delete(); | 211 Delete(); |
| 212 » » » return TRUE; | 212 » » » return true; |
| 213 case FWL_VKEY_Insert: | 213 case FWL_VKEY_Insert: |
| 214 if (IsSHIFTpressed(nFlag)) | 214 if (IsSHIFTpressed(nFlag)) |
| 215 PasteText(); | 215 PasteText(); |
| 216 » » » return TRUE; | 216 » » » return true; |
| 217 case FWL_VKEY_Up: | 217 case FWL_VKEY_Up: |
| 218 » » » m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag),FALSE); | 218 » » » m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag),false); |
| 219 » » » return TRUE; | 219 » » » return true; |
| 220 case FWL_VKEY_Down: | 220 case FWL_VKEY_Down: |
| 221 » » » m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag),FALSE); | 221 » » » m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag),false); |
| 222 » » » return TRUE; | 222 » » » return true; |
| 223 case FWL_VKEY_Left: | 223 case FWL_VKEY_Left: |
| 224 » » » m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag),FALSE); | 224 » » » m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag),false); |
| 225 » » » return TRUE; | 225 » » » return true; |
| 226 case FWL_VKEY_Right: | 226 case FWL_VKEY_Right: |
| 227 » » » m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag),FALSE); | 227 » » » m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag),false); |
| 228 » » » return TRUE; | 228 » » » return true; |
| 229 case FWL_VKEY_Home: | 229 case FWL_VKEY_Home: |
| 230 m_pEdit->OnVK_HOME(IsSHIFTpressed(nFlag),IsCTRLpressed(n
Flag)); | 230 m_pEdit->OnVK_HOME(IsSHIFTpressed(nFlag),IsCTRLpressed(n
Flag)); |
| 231 » » » return TRUE; | 231 » » » return true; |
| 232 case FWL_VKEY_End: | 232 case FWL_VKEY_End: |
| 233 m_pEdit->OnVK_END(IsSHIFTpressed(nFlag),IsCTRLpressed(nF
lag)); | 233 m_pEdit->OnVK_END(IsSHIFTpressed(nFlag),IsCTRLpressed(nF
lag)); |
| 234 » » » return TRUE; | 234 » » » return true; |
| 235 case FWL_VKEY_Unknown: | 235 case FWL_VKEY_Unknown: |
| 236 if (!IsSHIFTpressed(nFlag)) | 236 if (!IsSHIFTpressed(nFlag)) |
| 237 Clear(); | 237 Clear(); |
| 238 else | 238 else |
| 239 CutText(); | 239 CutText(); |
| 240 » » » return TRUE; | 240 » » » return true; |
| 241 default: | 241 default: |
| 242 break; | 242 break; |
| 243 } | 243 } |
| 244 | 244 |
| 245 return bRet; | 245 return bRet; |
| 246 } | 246 } |
| 247 | 247 |
| 248 FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) | 248 bool CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) |
| 249 { | 249 { |
| 250 » if (m_bMouseDown) return TRUE; | 250 » if (m_bMouseDown) return true; |
| 251 | 251 |
| 252 CPWL_Wnd::OnChar(nChar,nFlag); | 252 CPWL_Wnd::OnChar(nChar,nFlag); |
| 253 | 253 |
| 254 //FILTER | 254 //FILTER |
| 255 switch (nChar) | 255 switch (nChar) |
| 256 { | 256 { |
| 257 case 0x0A: | 257 case 0x0A: |
| 258 case 0x1B: | 258 case 0x1B: |
| 259 » » » return FALSE; | 259 » » » return false; |
| 260 default: | 260 default: |
| 261 break; | 261 break; |
| 262 } | 262 } |
| 263 | 263 |
| 264 » FX_BOOL bCtrl = IsCTRLpressed(nFlag); | 264 » bool bCtrl = IsCTRLpressed(nFlag); |
| 265 » FX_BOOL bAlt = IsALTpressed(nFlag); | 265 » bool bAlt = IsALTpressed(nFlag); |
| 266 » FX_BOOL bShift = IsSHIFTpressed(nFlag); | 266 » bool bShift = IsSHIFTpressed(nFlag); |
| 267 | 267 |
| 268 FX_WORD word = nChar; | 268 FX_WORD word = nChar; |
| 269 | 269 |
| 270 if (bCtrl && !bAlt) | 270 if (bCtrl && !bAlt) |
| 271 { | 271 { |
| 272 switch (nChar) | 272 switch (nChar) |
| 273 { | 273 { |
| 274 case 'C' - 'A' + 1: | 274 case 'C' - 'A' + 1: |
| 275 CopyText(); | 275 CopyText(); |
| 276 » » » » return TRUE; | 276 » » » » return true; |
| 277 case 'V' - 'A' + 1: | 277 case 'V' - 'A' + 1: |
| 278 PasteText(); | 278 PasteText(); |
| 279 » » » » return TRUE; | 279 » » » » return true; |
| 280 case 'X' - 'A' + 1: | 280 case 'X' - 'A' + 1: |
| 281 CutText(); | 281 CutText(); |
| 282 » » » » return TRUE; | 282 » » » » return true; |
| 283 case 'A' - 'A' + 1: | 283 case 'A' - 'A' + 1: |
| 284 SelectAll(); | 284 SelectAll(); |
| 285 » » » » return TRUE; | 285 » » » » return true; |
| 286 case 'Z' - 'A' + 1: | 286 case 'Z' - 'A' + 1: |
| 287 if (bShift) | 287 if (bShift) |
| 288 Redo(); | 288 Redo(); |
| 289 else | 289 else |
| 290 Undo(); | 290 Undo(); |
| 291 » » » » return TRUE; | 291 » » » » return true; |
| 292 default: | 292 default: |
| 293 if (nChar < 32) | 293 if (nChar < 32) |
| 294 » » » » » return FALSE; | 294 » » » » » return false; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 » if (IsReadOnly()) return TRUE; | 298 » if (IsReadOnly()) return true; |
| 299 | 299 |
| 300 if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) | 300 if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) |
| 301 word = FWL_VKEY_Unknown; | 301 word = FWL_VKEY_Unknown; |
| 302 | 302 |
| 303 Clear(); | 303 Clear(); |
| 304 | 304 |
| 305 switch (word) | 305 switch (word) |
| 306 { | 306 { |
| 307 case FWL_VKEY_Back: | 307 case FWL_VKEY_Back: |
| 308 Backspace(); | 308 Backspace(); |
| 309 break; | 309 break; |
| 310 case FWL_VKEY_Return: | 310 case FWL_VKEY_Return: |
| 311 InsertReturn(); | 311 InsertReturn(); |
| 312 break; | 312 break; |
| 313 case FWL_VKEY_Unknown: | 313 case FWL_VKEY_Unknown: |
| 314 break; | 314 break; |
| 315 default: | 315 default: |
| 316 if (IsINSERTpressed(nFlag)) | 316 if (IsINSERTpressed(nFlag)) |
| 317 Delete(); | 317 Delete(); |
| 318 InsertWord(word, GetCharSet()); | 318 InsertWord(word, GetCharSet()); |
| 319 break; | 319 break; |
| 320 } | 320 } |
| 321 | 321 |
| 322 » return TRUE; | 322 » return true; |
| 323 } | 323 } |
| 324 | 324 |
| 325 FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) | 325 bool CPWL_EditCtrl::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) |
| 326 { | 326 { |
| 327 CPWL_Wnd::OnLButtonDown(point,nFlag); | 327 CPWL_Wnd::OnLButtonDown(point,nFlag); |
| 328 | 328 |
| 329 if (ClientHitTest(point)) | 329 if (ClientHitTest(point)) |
| 330 { | 330 { |
| 331 if (m_bMouseDown) | 331 if (m_bMouseDown) |
| 332 InvalidateRect(); | 332 InvalidateRect(); |
| 333 | 333 |
| 334 » » m_bMouseDown = TRUE; | 334 » » m_bMouseDown = true; |
| 335 SetCapture(); | 335 SetCapture(); |
| 336 | 336 |
| 337 m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(n
Flag)); | 337 m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(n
Flag)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 » return TRUE; | 340 » return true; |
| 341 } | 341 } |
| 342 | 342 |
| 343 FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 343 bool CPWL_EditCtrl::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) |
| 344 { | 344 { |
| 345 CPWL_Wnd::OnLButtonUp(point,nFlag); | 345 CPWL_Wnd::OnLButtonUp(point,nFlag); |
| 346 | 346 |
| 347 if (m_bMouseDown) | 347 if (m_bMouseDown) |
| 348 { | 348 { |
| 349 //can receive keybord message | 349 //can receive keybord message |
| 350 if (ClientHitTest(point) && !IsFocused()) | 350 if (ClientHitTest(point) && !IsFocused()) |
| 351 SetFocus(); | 351 SetFocus(); |
| 352 | 352 |
| 353 ReleaseCapture(); | 353 ReleaseCapture(); |
| 354 » » m_bMouseDown = FALSE; | 354 » » m_bMouseDown = false; |
| 355 } | 355 } |
| 356 | 356 |
| 357 » return TRUE; | 357 » return true; |
| 358 } | 358 } |
| 359 | 359 |
| 360 FX_BOOL CPWL_EditCtrl::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) | 360 bool CPWL_EditCtrl::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) |
| 361 { | 361 { |
| 362 CPWL_Wnd::OnMouseMove(point,nFlag); | 362 CPWL_Wnd::OnMouseMove(point,nFlag); |
| 363 | 363 |
| 364 if (m_bMouseDown) | 364 if (m_bMouseDown) |
| 365 » » m_pEdit->OnMouseMove(point,FALSE,FALSE); | 365 » » m_pEdit->OnMouseMove(point,false,false); |
| 366 | 366 |
| 367 » return TRUE; | 367 » return true; |
| 368 } | 368 } |
| 369 | 369 |
| 370 CPDF_Rect CPWL_EditCtrl::GetContentRect() const | 370 CPDF_Rect CPWL_EditCtrl::GetContentRect() const |
| 371 { | 371 { |
| 372 return m_pEdit->GetContentRect(); | 372 return m_pEdit->GetContentRect(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) | 375 void CPWL_EditCtrl::SetEditCaret(bool bVisible) |
| 376 { | 376 { |
| 377 CPDF_Point ptHead(0,0),ptFoot(0,0); | 377 CPDF_Point ptHead(0,0),ptFoot(0,0); |
| 378 | 378 |
| 379 if (bVisible) | 379 if (bVisible) |
| 380 { | 380 { |
| 381 GetCaretInfo(ptHead,ptFoot); | 381 GetCaretInfo(ptHead,ptFoot); |
| 382 } | 382 } |
| 383 | 383 |
| 384 CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); | 384 CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); |
| 385 IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); | 385 IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 411 | 411 |
| 412 void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const | 412 void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const |
| 413 { | 413 { |
| 414 CPDF_Point ptHead(0,0), ptFoot(0,0); | 414 CPDF_Point ptHead(0,0), ptFoot(0,0); |
| 415 | 415 |
| 416 GetCaretInfo(ptHead,ptFoot); | 416 GetCaretInfo(ptHead,ptFoot); |
| 417 | 417 |
| 418 PWLtoWnd(ptHead, x, y); | 418 PWLtoWnd(ptHead, x, y); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const
CPDF_Point & ptFoot) | 421 void CPWL_EditCtrl::SetCaret(bool bVisible, const CPDF_Point & ptHead, const CPD
F_Point & ptFoot) |
| 422 { | 422 { |
| 423 if (m_pEditCaret) | 423 if (m_pEditCaret) |
| 424 { | 424 { |
| 425 if (!IsFocused() || m_pEdit->IsSelected()) | 425 if (!IsFocused() || m_pEdit->IsSelected()) |
| 426 » » » bVisible = FALSE; | 426 » » » bVisible = false; |
| 427 | 427 |
| 428 m_pEditCaret->SetCaret(bVisible, ptHead, ptFoot); | 428 m_pEditCaret->SetCaret(bVisible, ptHead, ptFoot); |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 FX_BOOL»CPWL_EditCtrl::IsModified() const | 432 bool» CPWL_EditCtrl::IsModified() const |
| 433 { | 433 { |
| 434 return m_pEdit->IsModified(); | 434 return m_pEdit->IsModified(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 CFX_WideString CPWL_EditCtrl::GetText() const | 437 CFX_WideString CPWL_EditCtrl::GetText() const |
| 438 { | 438 { |
| 439 return m_pEdit->GetText(); | 439 return m_pEdit->GetText(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 void CPWL_EditCtrl::SetSel(int32_t nStartChar,int32_t nEndChar) | 442 void CPWL_EditCtrl::SetSel(int32_t nStartChar,int32_t nEndChar) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 459 { | 459 { |
| 460 m_pEdit->SelectAll(); | 460 m_pEdit->SelectAll(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void CPWL_EditCtrl::Paint() | 463 void CPWL_EditCtrl::Paint() |
| 464 { | 464 { |
| 465 if (m_pEdit) | 465 if (m_pEdit) |
| 466 m_pEdit->Paint(); | 466 m_pEdit->Paint(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void CPWL_EditCtrl::EnableRefresh(FX_BOOL bRefresh) | 469 void CPWL_EditCtrl::EnableRefresh(bool bRefresh) |
| 470 { | 470 { |
| 471 if (m_pEdit) | 471 if (m_pEdit) |
| 472 m_pEdit->EnableRefresh(bRefresh); | 472 m_pEdit->EnableRefresh(bRefresh); |
| 473 } | 473 } |
| 474 | 474 |
| 475 int32_t CPWL_EditCtrl::GetCaret() const | 475 int32_t CPWL_EditCtrl::GetCaret() const |
| 476 { | 476 { |
| 477 if (m_pEdit) | 477 if (m_pEdit) |
| 478 return m_pEdit->GetCaret(); | 478 return m_pEdit->GetCaret(); |
| 479 | 479 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 571 } |
| 572 | 572 |
| 573 void CPWL_EditCtrl::PasteText() | 573 void CPWL_EditCtrl::PasteText() |
| 574 { | 574 { |
| 575 } | 575 } |
| 576 | 576 |
| 577 void CPWL_EditCtrl::CutText() | 577 void CPWL_EditCtrl::CutText() |
| 578 { | 578 { |
| 579 } | 579 } |
| 580 | 580 |
| 581 void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) | 581 void CPWL_EditCtrl::ShowVScrollBar(bool bShow) |
| 582 { | 582 { |
| 583 } | 583 } |
| 584 | 584 |
| 585 void CPWL_EditCtrl::InsertText(const FX_WCHAR* csText) | 585 void CPWL_EditCtrl::InsertText(const FX_WCHAR* csText) |
| 586 { | 586 { |
| 587 if (!IsReadOnly()) | 587 if (!IsReadOnly()) |
| 588 m_pEdit->InsertText(csText); | 588 m_pEdit->InsertText(csText); |
| 589 } | 589 } |
| 590 | 590 |
| 591 void CPWL_EditCtrl::InsertWord(FX_WORD word, int32_t nCharset) | 591 void CPWL_EditCtrl::InsertWord(FX_WORD word, int32_t nCharset) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 605 if (!IsReadOnly()) | 605 if (!IsReadOnly()) |
| 606 m_pEdit->Delete(); | 606 m_pEdit->Delete(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 void CPWL_EditCtrl::Backspace() | 609 void CPWL_EditCtrl::Backspace() |
| 610 { | 610 { |
| 611 if (!IsReadOnly()) | 611 if (!IsReadOnly()) |
| 612 m_pEdit->Backspace(); | 612 m_pEdit->Backspace(); |
| 613 } | 613 } |
| 614 | 614 |
| 615 FX_BOOL»CPWL_EditCtrl::CanUndo() const | 615 bool» CPWL_EditCtrl::CanUndo() const |
| 616 { | 616 { |
| 617 return !IsReadOnly() && m_pEdit->CanUndo(); | 617 return !IsReadOnly() && m_pEdit->CanUndo(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 FX_BOOL»CPWL_EditCtrl::CanRedo() const | 620 bool» CPWL_EditCtrl::CanRedo() const |
| 621 { | 621 { |
| 622 return !IsReadOnly() && m_pEdit->CanRedo(); | 622 return !IsReadOnly() && m_pEdit->CanRedo(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 void CPWL_EditCtrl::Redo() | 625 void CPWL_EditCtrl::Redo() |
| 626 { | 626 { |
| 627 if (CanRedo()) | 627 if (CanRedo()) |
| 628 m_pEdit->Redo(); | 628 m_pEdit->Redo(); |
| 629 } | 629 } |
| 630 | 630 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 644 Info.fContentMin = fContentMin; | 644 Info.fContentMin = fContentMin; |
| 645 Info.fContentMax = fContentMax; | 645 Info.fContentMax = fContentMax; |
| 646 Info.fSmallStep = fSmallStep; | 646 Info.fSmallStep = fSmallStep; |
| 647 Info.fBigStep = fBigStep; | 647 Info.fBigStep = fBigStep; |
| 648 | 648 |
| 649 OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); | 649 OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); |
| 650 | 650 |
| 651 if (IsFloatBigger(Info.fPlateWidth,Info.fContentMax-Info.fContentMin) | 651 if (IsFloatBigger(Info.fPlateWidth,Info.fContentMax-Info.fContentMin) |
| 652 || IsFloatEqual(Info.fPlateWidth,Info.fContentMax-Info.fContentM
in)) | 652 || IsFloatEqual(Info.fPlateWidth,Info.fContentMax-Info.fContentM
in)) |
| 653 { | 653 { |
| 654 » » ShowVScrollBar(FALSE); | 654 » » ShowVScrollBar(false); |
| 655 } | 655 } |
| 656 else | 656 else |
| 657 { | 657 { |
| 658 » » ShowVScrollBar(TRUE); | 658 » » ShowVScrollBar(true); |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 | 661 |
| 662 void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) | 662 void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) |
| 663 { | 663 { |
| 664 OnNotify(this, PNM_SETSCROLLPOS,SBT_VSCROLL, (intptr_t)&fy); | 664 OnNotify(this, PNM_SETSCROLLPOS,SBT_VSCROLL, (intptr_t)&fy); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, con
st CPDF_Point & ptFoot, const CPVT_WordPlace& place) | 667 void CPWL_EditCtrl::IOnSetCaret(bool bVisible, const CPDF_Point & ptHead, const
CPDF_Point & ptFoot, const CPVT_WordPlace& place) |
| 668 { | 668 { |
| 669 PWL_CARET_INFO cInfo; | 669 PWL_CARET_INFO cInfo; |
| 670 cInfo.bVisible = bVisible; | 670 cInfo.bVisible = bVisible; |
| 671 cInfo.ptHead = ptHead; | 671 cInfo.ptHead = ptHead; |
| 672 cInfo.ptFoot = ptFoot; | 672 cInfo.ptFoot = ptFoot; |
| 673 | 673 |
| 674 OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t)NULL); | 674 OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t)NULL); |
| 675 } | 675 } |
| 676 | 676 |
| 677 void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_Wo
rdProps & wordProps) | 677 void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_Wo
rdProps & wordProps) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStartChar); | 710 CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStartChar); |
| 711 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); | 711 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); |
| 712 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); | 712 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void CPWL_EditCtrl::SetReadyToInput() | 715 void CPWL_EditCtrl::SetReadyToInput() |
| 716 { | 716 { |
| 717 if (m_bMouseDown) | 717 if (m_bMouseDown) |
| 718 { | 718 { |
| 719 ReleaseCapture(); | 719 ReleaseCapture(); |
| 720 » » m_bMouseDown = FALSE; | 720 » » m_bMouseDown = false; |
| 721 } | 721 } |
| 722 } | 722 } |
| OLD | NEW |