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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_EditCtrl.cpp

Issue 2341453002: CFX_FloatPoint default constructor and equals operators (Closed)
Patch Set: style Created 4 years, 3 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/pdfwindow/PWL_Edit.cpp ('k') | fpdfsdk/pdfwindow/PWL_Utils.h » ('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 "fpdfsdk/pdfwindow/PWL_EditCtrl.h" 7 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
8 8
9 #include "core/fpdfdoc/include/cpvt_section.h" 9 #include "core/fpdfdoc/include/cpvt_section.h"
10 #include "core/fpdfdoc/include/cpvt_word.h" 10 #include "core/fpdfdoc/include/cpvt_word.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 m_pEdit->OnMouseMove(point, FALSE, FALSE); 321 m_pEdit->OnMouseMove(point, FALSE, FALSE);
322 322
323 return TRUE; 323 return TRUE;
324 } 324 }
325 325
326 CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { 326 CFX_FloatRect CPWL_EditCtrl::GetContentRect() const {
327 return m_pEdit->GetContentRect(); 327 return m_pEdit->GetContentRect();
328 } 328 }
329 329
330 void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) { 330 void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) {
331 CFX_FloatPoint ptHead(0, 0), ptFoot(0, 0); 331 CFX_FloatPoint ptHead;
332 332 CFX_FloatPoint ptFoot;
333 if (bVisible) { 333 if (bVisible)
334 GetCaretInfo(ptHead, ptFoot); 334 GetCaretInfo(ptHead, ptFoot);
335 }
336 335
337 CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); 336 CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace();
338 IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); 337 IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp);
339 } 338 }
340 339
341 void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, 340 void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead,
342 CFX_FloatPoint& ptFoot) const { 341 CFX_FloatPoint& ptFoot) const {
343 CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); 342 CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
344 pIterator->SetAt(m_pEdit->GetCaret()); 343 pIterator->SetAt(m_pEdit->GetCaret());
345 CPVT_Word word; 344 CPVT_Word word;
346 CPVT_Line line; 345 CPVT_Line line;
347 if (pIterator->GetWord(word)) { 346 if (pIterator->GetWord(word)) {
348 ptHead.x = word.ptWord.x + word.fWidth; 347 ptHead.x = word.ptWord.x + word.fWidth;
349 ptHead.y = word.ptWord.y + word.fAscent; 348 ptHead.y = word.ptWord.y + word.fAscent;
350 ptFoot.x = word.ptWord.x + word.fWidth; 349 ptFoot.x = word.ptWord.x + word.fWidth;
351 ptFoot.y = word.ptWord.y + word.fDescent; 350 ptFoot.y = word.ptWord.y + word.fDescent;
352 } else if (pIterator->GetLine(line)) { 351 } else if (pIterator->GetLine(line)) {
353 ptHead.x = line.ptLine.x; 352 ptHead.x = line.ptLine.x;
354 ptHead.y = line.ptLine.y + line.fLineAscent; 353 ptHead.y = line.ptLine.y + line.fLineAscent;
355 ptFoot.x = line.ptLine.x; 354 ptFoot.x = line.ptLine.x;
356 ptFoot.y = line.ptLine.y + line.fLineDescent; 355 ptFoot.y = line.ptLine.y + line.fLineDescent;
357 } 356 }
358 } 357 }
359 358
360 void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { 359 void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const {
361 CFX_FloatPoint ptHead(0, 0), ptFoot(0, 0); 360 CFX_FloatPoint ptHead;
362 361 CFX_FloatPoint ptFoot;
363 GetCaretInfo(ptHead, ptFoot); 362 GetCaretInfo(ptHead, ptFoot);
364
365 PWLtoWnd(ptHead, x, y); 363 PWLtoWnd(ptHead, x, y);
366 } 364 }
367 365
368 void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible, 366 void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible,
369 const CFX_FloatPoint& ptHead, 367 const CFX_FloatPoint& ptHead,
370 const CFX_FloatPoint& ptFoot) { 368 const CFX_FloatPoint& ptFoot) {
371 if (m_pEditCaret) { 369 if (m_pEditCaret) {
372 if (!IsFocused() || m_pEdit->IsSelected()) 370 if (!IsFocused() || m_pEdit->IsSelected())
373 bVisible = FALSE; 371 bVisible = FALSE;
374 372
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); 585 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar);
588 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); 586 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd));
589 } 587 }
590 588
591 void CPWL_EditCtrl::SetReadyToInput() { 589 void CPWL_EditCtrl::SetReadyToInput() {
592 if (m_bMouseDown) { 590 if (m_bMouseDown) {
593 ReleaseCapture(); 591 ReleaseCapture();
594 m_bMouseDown = FALSE; 592 m_bMouseDown = FALSE;
595 } 593 }
596 } 594 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Edit.cpp ('k') | fpdfsdk/pdfwindow/PWL_Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698