margins pref no longer works
patch by jblanco@us.ibm.com (Jessica Blanco) r=mkaply sr=dbaron
This commit is contained in:
cbiesinger%web.de 2006-02-07 01:14:47 +00:00
Родитель c7c393dbf0
Коммит 24eade8c01
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -383,13 +383,13 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUi
nscoord halfInch = NS_INCHES_TO_TWIPS(0.5); nscoord halfInch = NS_INCHES_TO_TWIPS(0.5);
nsMargin margin; nsMargin margin;
margin.SizeTo(halfInch, halfInch, halfInch, halfInch); margin.SizeTo(halfInch, halfInch, halfInch, halfInch);
ReadInchesToTwipsPref(GetPrefName(kMarginTop, aPrefName), margin.top); ReadInchesToTwipsPref(GetPrefName(kMarginTop, aPrefName), margin.top, kMarginTop);
DUMP_INT(kReadStr, kMarginTop, margin.top); DUMP_INT(kReadStr, kMarginTop, margin.top);
ReadInchesToTwipsPref(GetPrefName(kMarginLeft, aPrefName), margin.left); ReadInchesToTwipsPref(GetPrefName(kMarginLeft, aPrefName), margin.left, kMarginLeft);
DUMP_INT(kReadStr, kMarginLeft, margin.left); DUMP_INT(kReadStr, kMarginLeft, margin.left);
ReadInchesToTwipsPref(GetPrefName(kMarginBottom, aPrefName), margin.bottom); ReadInchesToTwipsPref(GetPrefName(kMarginBottom, aPrefName), margin.bottom, kMarginBottom);
DUMP_INT(kReadStr, kMarginBottom, margin.bottom); DUMP_INT(kReadStr, kMarginBottom, margin.bottom);
ReadInchesToTwipsPref(GetPrefName(kMarginRight, aPrefName), margin.right); ReadInchesToTwipsPref(GetPrefName(kMarginRight, aPrefName), margin.right, kMarginRight);
DUMP_INT(kReadStr, kMarginRight, margin.right); DUMP_INT(kReadStr, kMarginRight, margin.right);
aPS->SetMarginInTwips(margin); aPS->SetMarginInTwips(margin);
} }
@ -1141,7 +1141,8 @@ nsresult nsPrintOptions::WritePrefDouble(const char * aPrefId,
//--------------------------------------------------- //---------------------------------------------------
void nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, void nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId,
nscoord& aTwips) nscoord& aTwips,
const char * aMarginPref)
{ {
if (!mPrefBranch) { if (!mPrefBranch) {
return; return;
@ -1149,6 +1150,8 @@ void nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId,
char * str = nsnull; char * str = nsnull;
nsresult rv = mPrefBranch->GetCharPref(aPrefId, &str); nsresult rv = mPrefBranch->GetCharPref(aPrefId, &str);
if (NS_FAILED(rv) || !str)
rv = mPrefBranch->GetCharPref(aMarginPref, &str);
if (NS_SUCCEEDED(rv) && str) { if (NS_SUCCEEDED(rv) && str) {
nsAutoString justStr; nsAutoString justStr;
justStr.AssignWithConversion(str); justStr.AssignWithConversion(str);

Просмотреть файл

@ -49,7 +49,7 @@ protected:
void WriteBitFieldPref(const char * aPrefId, PRInt32 anOption); void WriteBitFieldPref(const char * aPrefId, PRInt32 anOption);
void ReadJustification(const char * aPrefId, PRInt16& aJust, PRInt16 aInitValue); void ReadJustification(const char * aPrefId, PRInt16& aJust, PRInt16 aInitValue);
void WriteJustification(const char * aPrefId, PRInt16 aJust); void WriteJustification(const char * aPrefId, PRInt16 aJust);
void ReadInchesToTwipsPref(const char * aPrefId, nscoord& aTwips); void ReadInchesToTwipsPref(const char * aPrefId, nscoord& aTwips, const char * aMarginPref);
void WriteInchesFromTwipsPref(const char * aPrefId, nscoord aTwips); void WriteInchesFromTwipsPref(const char * aPrefId, nscoord aTwips);
nsresult ReadPrefString(const char * aPrefId, nsString& aString); nsresult ReadPrefString(const char * aPrefId, nsString& aString);