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

Side by Side Diff: fpdfsdk/cpdfsdk_widget.cpp

Issue 2338553002: Stop converting widestring -> c_str -> widestring in several places. (Closed)
Patch Set: 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 | « core/fpdfdoc/include/cpdf_variabletext.h ('k') | fpdfsdk/formfiller/cffl_combobox.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/cpdfsdk_widget.h" 7 #include "fpdfsdk/include/cpdfsdk_widget.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 else 1384 else
1385 pEdit->SetFontSize(fFontSize); 1385 pEdit->SetFontSize(fFontSize);
1386 1386
1387 pEdit->Initialize(); 1387 pEdit->Initialize();
1388 1388
1389 if (sValue) { 1389 if (sValue) {
1390 pEdit->SetText(*sValue); 1390 pEdit->SetText(*sValue);
1391 } else { 1391 } else {
1392 int32_t nCurSel = pField->GetSelectedIndex(0); 1392 int32_t nCurSel = pField->GetSelectedIndex(0);
1393 if (nCurSel < 0) 1393 if (nCurSel < 0)
1394 pEdit->SetText(pField->GetValue().c_str()); 1394 pEdit->SetText(pField->GetValue());
1395 else 1395 else
1396 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); 1396 pEdit->SetText(pField->GetOptionLabel(nCurSel));
1397 } 1397 }
1398 1398
1399 CFX_FloatRect rcContent = pEdit->GetContentRect(); 1399 CFX_FloatRect rcContent = pEdit->GetContentRect();
1400 1400
1401 CFX_ByteString sEdit = 1401 CFX_ByteString sEdit =
1402 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); 1402 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f));
1403 if (sEdit.GetLength() > 0) { 1403 if (sEdit.GetLength() > 0) {
1404 sBody << "/Tx BMC\n" 1404 sBody << "/Tx BMC\n"
1405 << "q\n"; 1405 << "q\n";
1406 if (rcContent.Width() > rcEdit.Width() || 1406 if (rcContent.Width() > rcEdit.Width() ||
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1455
1456 for (int32_t i = nTop; i < nCount; ++i) { 1456 for (int32_t i = nTop; i < nCount; ++i) {
1457 bool bSelected = false; 1457 bool bSelected = false;
1458 for (int32_t j = 0; j < nSelCount; ++j) { 1458 for (int32_t j = 0; j < nSelCount; ++j) {
1459 if (pField->GetSelectedIndex(j) == i) { 1459 if (pField->GetSelectedIndex(j) == i) {
1460 bSelected = true; 1460 bSelected = true;
1461 break; 1461 break;
1462 } 1462 }
1463 } 1463 }
1464 1464
1465 pEdit->SetText(pField->GetOptionLabel(i).c_str()); 1465 pEdit->SetText(pField->GetOptionLabel(i));
1466 1466
1467 CFX_FloatRect rcContent = pEdit->GetContentRect(); 1467 CFX_FloatRect rcContent = pEdit->GetContentRect();
1468 FX_FLOAT fItemHeight = rcContent.Height(); 1468 FX_FLOAT fItemHeight = rcContent.Height();
1469 1469
1470 if (bSelected) { 1470 if (bSelected) {
1471 CFX_FloatRect rcItem = 1471 CFX_FloatRect rcItem =
1472 CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy); 1472 CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy);
1473 sList << "q\n" 1473 sList << "q\n"
1474 << CPWL_Utils::GetColorAppStream( 1474 << CPWL_Utils::GetColorAppStream(
1475 CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 1475 CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 pEdit->SetLimitChar(nMaxLen); 1571 pEdit->SetLimitChar(nMaxLen);
1572 } 1572 }
1573 } 1573 }
1574 1574
1575 if (IsFloatZero(fFontSize)) 1575 if (IsFloatZero(fFontSize))
1576 pEdit->SetAutoFontSize(TRUE, TRUE); 1576 pEdit->SetAutoFontSize(TRUE, TRUE);
1577 else 1577 else
1578 pEdit->SetFontSize(fFontSize); 1578 pEdit->SetFontSize(fFontSize);
1579 1579
1580 pEdit->Initialize(); 1580 pEdit->Initialize();
1581 1581 pEdit->SetText(sValue ? *sValue : pField->GetValue());
1582 if (sValue)
1583 pEdit->SetText(*sValue);
1584 else
1585 pEdit->SetText(pField->GetValue().c_str());
1586 1582
1587 CFX_FloatRect rcContent = pEdit->GetContentRect(); 1583 CFX_FloatRect rcContent = pEdit->GetContentRect();
1588
1589 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream( 1584 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(
1590 pEdit.get(), CFX_FloatPoint(0.0f, 0.0f), nullptr, !bCharArray, subWord); 1585 pEdit.get(), CFX_FloatPoint(0.0f, 0.0f), nullptr, !bCharArray, subWord);
1591 1586
1592 if (sEdit.GetLength() > 0) { 1587 if (sEdit.GetLength() > 0) {
1593 sBody << "/Tx BMC\n" 1588 sBody << "/Tx BMC\n"
1594 << "q\n"; 1589 << "q\n";
1595 if (rcContent.Width() > rcClient.Width() || 1590 if (rcContent.Width() > rcClient.Width() ||
1596 rcContent.Height() > rcClient.Height()) { 1591 rcContent.Height() > rcClient.Height()) {
1597 sBody << rcClient.left << " " << rcClient.bottom << " " 1592 sBody << rcClient.left << " " << rcClient.bottom << " "
1598 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; 1593 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n";
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 return FALSE; 1940 return FALSE;
1946 1941
1947 if (!IsVisible()) 1942 if (!IsVisible())
1948 return FALSE; 1943 return FALSE;
1949 1944
1950 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) 1945 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
1951 return FALSE; 1946 return FALSE;
1952 1947
1953 return TRUE; 1948 return TRUE;
1954 } 1949 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/include/cpdf_variabletext.h ('k') | fpdfsdk/formfiller/cffl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698