зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1665904 - Rename paperName to paperId for better clarity (platform). r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D90790
This commit is contained in:
Родитель
a8c40b4ffe
Коммит
7fd751e756
|
@ -47,7 +47,7 @@ struct PrintData {
|
|||
bool shrinkToFit;
|
||||
bool showPrintProgress;
|
||||
|
||||
nsString paperName;
|
||||
nsString paperId;
|
||||
double paperWidth;
|
||||
double paperHeight;
|
||||
short paperSizeUnit;
|
||||
|
|
|
@ -85,7 +85,7 @@ nsresult nsPrintSettingsServiceX::SerializeToPrintDataParent(nsIPrintSettings* a
|
|||
|
||||
NSString* paperName = [dict objectForKey:NSPrintPaperName];
|
||||
if (paperName) {
|
||||
nsCocoaUtils::GetStringForNSString(paperName, data->paperName());
|
||||
nsCocoaUtils::GetStringForNSString(paperName, data->paperId());
|
||||
}
|
||||
|
||||
float scalingFactor = [[dict objectForKey:NSPrintScalingFactor] floatValue];
|
||||
|
|
|
@ -476,17 +476,18 @@ nsPrintSettingsGTK::SetScaling(double aScaling) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettingsGTK::GetPaperName(nsAString& aPaperName) {
|
||||
nsPrintSettingsGTK::GetPaperId(nsAString& aPaperId) {
|
||||
const gchar* name =
|
||||
gtk_paper_size_get_name(gtk_page_setup_get_paper_size(mPageSetup));
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(name), aPaperName);
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(name), aPaperId);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettingsGTK::SetPaperName(const nsAString& aPaperName) {
|
||||
NS_ConvertUTF16toUTF8 gtkPaperName(aPaperName);
|
||||
nsPrintSettingsGTK::SetPaperId(const nsAString& aPaperId) {
|
||||
NS_ConvertUTF16toUTF8 gtkPaperName(aPaperId);
|
||||
|
||||
// Convert these Gecko names to GTK names
|
||||
// XXX (jfkthame): is this still relevant?
|
||||
if (gtkPaperName.EqualsIgnoreCase("letter"))
|
||||
gtkPaperName.AssignLiteral(GTK_PAPER_NAME_LETTER);
|
||||
else if (gtkPaperName.EqualsIgnoreCase("legal"))
|
||||
|
|
|
@ -93,8 +93,8 @@ class nsPrintSettingsGTK : public nsPrintSettings {
|
|||
|
||||
// A name recognised by GTK is strongly advised here, as this is used to
|
||||
// create a GtkPaperSize.
|
||||
NS_IMETHOD GetPaperName(nsAString& aPaperName) override;
|
||||
NS_IMETHOD SetPaperName(const nsAString& aPaperName) override;
|
||||
NS_IMETHOD GetPaperId(nsAString& aPaperId) override;
|
||||
NS_IMETHOD SetPaperId(const nsAString& aPaperId) override;
|
||||
|
||||
NS_IMETHOD SetUnwriteableMarginInTwips(
|
||||
nsIntMargin& aUnwriteableMargin) override;
|
||||
|
|
|
@ -201,7 +201,7 @@ interface nsIPrintSettings : nsISupports
|
|||
attribute boolean showMarginGuides; /* whether to draw guidelines showing the margin settings */
|
||||
|
||||
/* Additional XP Related */
|
||||
attribute AString paperName; /* name of paper */
|
||||
attribute AString paperId; /* identifier of paper (not display name) */
|
||||
attribute double paperWidth; /* width of the paper in inches or mm */
|
||||
attribute double paperHeight; /* height of the paper in inches or mm */
|
||||
attribute short paperSizeUnit; /* paper is in inches or mm */
|
||||
|
|
|
@ -66,10 +66,10 @@ void nsPrintSettings::InitWithInitializer(
|
|||
SetPrinterName(aSettings.mPrinter);
|
||||
SetPrintInColor(aSettings.mPrintInColor);
|
||||
SetResolution(aSettings.mResolution);
|
||||
// The paper "name" used by nsPrintSettings is the non-localizable identifier
|
||||
// The paper ID used by nsPrintSettings is the non-localizable identifier
|
||||
// exposed as "id" by the paper, not the potentially localized human-friendly
|
||||
// "name", which could change, e.g. if the user changes their system locale.
|
||||
SetPaperName(aSettings.mPaperInfo.mId);
|
||||
SetPaperId(aSettings.mPaperInfo.mId);
|
||||
SetPaperWidth(aSettings.mPaperInfo.mSize.Width() * kInchesPerPoint);
|
||||
SetPaperHeight(aSettings.mPaperInfo.mSize.Height() * kInchesPerPoint);
|
||||
SetPaperSizeUnit(nsIPrintSettings::kPaperSizeInches);
|
||||
|
@ -605,12 +605,12 @@ NS_IMETHODIMP nsPrintSettings::SetShowMarginGuides(bool aShowMarginGuides) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettings::GetPaperName(nsAString& aPaperName) {
|
||||
aPaperName = mPaperName;
|
||||
NS_IMETHODIMP nsPrintSettings::GetPaperId(nsAString& aPaperId) {
|
||||
aPaperId = mPaperId;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintSettings::SetPaperName(const nsAString& aPaperName) {
|
||||
mPaperName = aPaperName;
|
||||
NS_IMETHODIMP nsPrintSettings::SetPaperId(const nsAString& aPaperId) {
|
||||
mPaperId = aPaperId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ nsPrintSettings& nsPrintSettings::operator=(const nsPrintSettings& rhs) {
|
|||
mShrinkToFit = rhs.mShrinkToFit;
|
||||
mShowPrintProgress = rhs.mShowPrintProgress;
|
||||
mShowMarginGuides = rhs.mShowMarginGuides;
|
||||
mPaperName = rhs.mPaperName;
|
||||
mPaperId = rhs.mPaperId;
|
||||
mPaperWidth = rhs.mPaperWidth;
|
||||
mPaperHeight = rhs.mPaperHeight;
|
||||
mPaperSizeUnit = rhs.mPaperSizeUnit;
|
||||
|
|
|
@ -101,7 +101,7 @@ class nsPrintSettings : public nsIPrintSettings {
|
|||
nsString mHeaderStrs[NUM_HEAD_FOOT];
|
||||
nsString mFooterStrs[NUM_HEAD_FOOT];
|
||||
|
||||
nsString mPaperName;
|
||||
nsString mPaperId;
|
||||
double mPaperWidth;
|
||||
double mPaperHeight;
|
||||
int16_t mPaperSizeUnit;
|
||||
|
|
|
@ -58,7 +58,7 @@ static const char kPrintFooterStrRight[] = "print_footerright";
|
|||
// Additional Prefs
|
||||
static const char kPrintReversed[] = "print_reversed";
|
||||
static const char kPrintInColor[] = "print_in_color";
|
||||
static const char kPrintPaperName[] = "print_paper_name";
|
||||
static const char kPrintPaperId[] = "print_paper_id";
|
||||
static const char kPrintPaperSizeUnit[] = "print_paper_size_unit";
|
||||
static const char kPrintPaperWidth[] = "print_paper_width";
|
||||
static const char kPrintPaperHeight[] = "print_paper_height";
|
||||
|
@ -131,7 +131,7 @@ nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings,
|
|||
aSettings->GetShrinkToFit(&data->shrinkToFit());
|
||||
aSettings->GetShowPrintProgress(&data->showPrintProgress());
|
||||
|
||||
aSettings->GetPaperName(data->paperName());
|
||||
aSettings->GetPaperId(data->paperId());
|
||||
aSettings->GetPaperWidth(&data->paperWidth());
|
||||
aSettings->GetPaperHeight(&data->paperHeight());
|
||||
aSettings->GetPaperSizeUnit(&data->paperSizeUnit());
|
||||
|
@ -229,7 +229,7 @@ nsPrintSettingsService::DeserializeToPrintSettings(const PrintData& data,
|
|||
settings->SetShrinkToFit(data.shrinkToFit());
|
||||
settings->SetShowPrintProgress(data.showPrintProgress());
|
||||
|
||||
settings->SetPaperName(data.paperName());
|
||||
settings->SetPaperId(data.paperId());
|
||||
|
||||
settings->SetPaperWidth(data.paperWidth());
|
||||
settings->SetPaperHeight(data.paperHeight());
|
||||
|
@ -406,7 +406,7 @@ nsresult nsPrintSettingsService::ReadPrefs(nsIPrintSettings* aPS,
|
|||
bool success = GETINTPREF(kPrintPaperSizeUnit, &sizeUnit) &&
|
||||
GETDBLPREF(kPrintPaperWidth, width) &&
|
||||
GETDBLPREF(kPrintPaperHeight, height) &&
|
||||
GETSTRPREF(kPrintPaperName, str);
|
||||
GETSTRPREF(kPrintPaperId, str);
|
||||
|
||||
// Bug 315687: Sanity check paper size to avoid paper size values in
|
||||
// mm when the size unit flag is inches. The value 100 is arbitrary
|
||||
|
@ -423,8 +423,8 @@ nsresult nsPrintSettingsService::ReadPrefs(nsIPrintSettings* aPS,
|
|||
DUMP_DBL(kReadStr, kPrintPaperWidth, width);
|
||||
aPS->SetPaperHeight(height);
|
||||
DUMP_DBL(kReadStr, kPrintPaperHeight, height);
|
||||
aPS->SetPaperName(str);
|
||||
DUMP_STR(kReadStr, kPrintPaperName, str.get());
|
||||
aPS->SetPaperId(str);
|
||||
DUMP_STR(kReadStr, kPrintPaperId, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ nsresult nsPrintSettingsService::WritePrefs(nsIPrintSettings* aPS,
|
|||
if (NS_SUCCEEDED(aPS->GetPaperSizeUnit(&sizeUnit)) &&
|
||||
NS_SUCCEEDED(aPS->GetPaperWidth(&width)) &&
|
||||
NS_SUCCEEDED(aPS->GetPaperHeight(&height)) &&
|
||||
NS_SUCCEEDED(aPS->GetPaperName(name))) {
|
||||
NS_SUCCEEDED(aPS->GetPaperId(name))) {
|
||||
DUMP_INT(kWriteStr, kPrintPaperSizeUnit, sizeUnit);
|
||||
Preferences::SetInt(GetPrefName(kPrintPaperSizeUnit, aPrinterName),
|
||||
int32_t(sizeUnit));
|
||||
|
@ -651,8 +651,8 @@ nsresult nsPrintSettingsService::WritePrefs(nsIPrintSettings* aPS,
|
|||
WritePrefDouble(GetPrefName(kPrintPaperWidth, aPrinterName), width);
|
||||
DUMP_DBL(kWriteStr, kPrintPaperHeight, height);
|
||||
WritePrefDouble(GetPrefName(kPrintPaperHeight, aPrinterName), height);
|
||||
DUMP_STR(kWriteStr, kPrintPaperName, name.get());
|
||||
Preferences::SetString(GetPrefName(kPrintPaperName, aPrinterName), name);
|
||||
DUMP_STR(kWriteStr, kPrintPaperId, name.get());
|
||||
Preferences::SetString(GetPrefName(kPrintPaperId, aPrinterName), name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ void nsPrintSettingsWin::InitWithInitializer(
|
|||
if (mDevMode->dmFields & DM_PAPERSIZE) {
|
||||
nsString paperIdString;
|
||||
paperIdString.AppendInt(mDevMode->dmPaperSize);
|
||||
SetPaperName(paperIdString);
|
||||
SetPaperId(paperIdString);
|
||||
if (mDevMode->dmPaperSize > 0 &&
|
||||
mDevMode->dmPaperSize < int32_t(ArrayLength(kPaperSizeUnits))) {
|
||||
SetPaperSizeUnit(kPaperSizeUnits[mDevMode->dmPaperSize]);
|
||||
|
@ -351,8 +351,8 @@ void nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode) {
|
|||
}
|
||||
|
||||
if (aDevMode->dmFields & DM_PAPERSIZE) {
|
||||
mPaperName.Truncate(0);
|
||||
mPaperName.AppendInt(aDevMode->dmPaperSize);
|
||||
mPaperId.Truncate(0);
|
||||
mPaperId.AppendInt(aDevMode->dmPaperSize);
|
||||
// If not a paper size we know about, the unit will be the last one saved.
|
||||
if (aDevMode->dmPaperSize > 0 &&
|
||||
aDevMode->dmPaperSize < int32_t(ArrayLength(kPaperSizeUnits))) {
|
||||
|
@ -403,8 +403,8 @@ void nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode) {
|
|||
void nsPrintSettingsWin::CopyToNative(DEVMODEW* aDevMode) {
|
||||
MOZ_ASSERT(aDevMode);
|
||||
|
||||
if (!mPaperName.IsEmpty()) {
|
||||
aDevMode->dmPaperSize = _wtoi((const wchar_t*)mPaperName.BeginReading());
|
||||
if (!mPaperId.IsEmpty()) {
|
||||
aDevMode->dmPaperSize = _wtoi((const wchar_t*)mPaperId.BeginReading());
|
||||
aDevMode->dmFields |= DM_PAPERSIZE;
|
||||
} else {
|
||||
aDevMode->dmPaperSize = 0;
|
||||
|
@ -543,7 +543,7 @@ Tester::Tester() {
|
|||
ps->SetFooterStrLeft(NS_ConvertUTF8toUTF16("Left").get());
|
||||
ps->SetFooterStrCenter(NS_ConvertUTF8toUTF16("Center").get());
|
||||
ps->SetFooterStrRight(NS_ConvertUTF8toUTF16("Right").get());
|
||||
ps->SetPaperName(NS_ConvertUTF8toUTF16("Paper Name").get());
|
||||
ps->SetPaperId(NS_ConvertUTF8toUTF16("Paper Id").get());
|
||||
ps->SetPaperWidth(100.0);
|
||||
ps->SetPaperHeight(50.0);
|
||||
ps->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
|
||||
|
|
Загрузка…
Ссылка в новой задаче