/**
 * NOTE: Need a custom set of SetUnwriteableMargin functions, because
 * whenever we change mUnwriteableMargin, we must pass the change
 * down to our GTKPageSetup object.  (This is needed in order for us
 * to give the correct default values in nsPrintDialogGTK.)
 *
 * It's important that the following functions pass
 * mUnwriteableMargin values rather than aUnwriteableMargin values
 * to gtk_page_setup_set_[blank]_margin, because the two may not be
 * the same.  (Specifically, negative values of aUnwriteableMargin
 * are ignored by the nsPrintSettings::SetUnwriteableMargin functions.)
 */
NS_IMETHODIMP
nsPrintSettingsGTK::SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin)
{
    nsPrintSettings::SetUnwriteableMarginInTwips(aUnwriteableMargin);
    gtk_page_setup_set_top_margin(mPageSetup,
                                  NS_TWIPS_TO_INCHES(mUnwriteableMargin.top), GTK_UNIT_INCH);
    gtk_page_setup_set_left_margin(mPageSetup,
                                   NS_TWIPS_TO_INCHES(mUnwriteableMargin.left), GTK_UNIT_INCH);
    gtk_page_setup_set_bottom_margin(mPageSetup,
                                     NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom), GTK_UNIT_INCH);
    gtk_page_setup_set_right_margin(mPageSetup,
                                    NS_TWIPS_TO_INCHES(mUnwriteableMargin.right), GTK_UNIT_INCH);
    return NS_OK;
}
/* attribute double unwriteableMarginRight; */
NS_IMETHODIMP
nsPrintSettingsGTK::SetUnwriteableMarginRight(double aUnwriteableMarginRight)
{
    nsPrintSettings::SetUnwriteableMarginRight(aUnwriteableMarginRight);
    gtk_page_setup_set_right_margin(mPageSetup,
                                    NS_TWIPS_TO_INCHES(mUnwriteableMargin.right), GTK_UNIT_INCH);
    return NS_OK;
}
/* attribute double unwriteableMarginBottom; */
NS_IMETHODIMP
nsPrintSettingsGTK::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom)
{
    nsPrintSettings::SetUnwriteableMarginBottom(aUnwriteableMarginBottom);
    gtk_page_setup_set_bottom_margin(mPageSetup,
                                     NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom), GTK_UNIT_INCH);
    return NS_OK;
}
/* attribute double unwriteableMarginTop; */
NS_IMETHODIMP
nsPrintSettingsGTK::SetUnwriteableMarginTop(double aUnwriteableMarginTop)
{
    nsPrintSettings::SetUnwriteableMarginTop(aUnwriteableMarginTop);
    gtk_page_setup_set_top_margin(mPageSetup,
                                  NS_TWIPS_TO_INCHES(mUnwriteableMargin.top), GTK_UNIT_INCH);
    return NS_OK;
}
void
nsPrintOptions::WriteInchesIntFromTwipsPref(const char * aPrefId, PRInt32 aTwips)
{
  if (!mPrefBranch) {
    return;
  }

  mPrefBranch->SetIntPref(aPrefId, PRInt32(NS_TWIPS_TO_INCHES(aTwips)*100.0f + 0.5f));
}
void
nsPrintOptions::WriteInchesFromTwipsPref(const char * aPrefId, PRInt32 aTwips)
{
  if (!mPrefBranch) {
    return;
  }

  double inches = NS_TWIPS_TO_INCHES(aTwips);
  nsCAutoString inchesStr;
  inchesStr.AppendFloat(inches);

  mPrefBranch->SetCharPref(aPrefId, inchesStr.get());
}
示例#7
0
/* attribute double unwriteableMarginRight; */
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginRight(double *aUnwriteableMarginRight)
{
    NS_ENSURE_ARG_POINTER(aUnwriteableMarginRight);
    *aUnwriteableMarginRight = NS_TWIPS_TO_INCHES(mUnwriteableMargin.right);
    return NS_OK;
}
示例#8
0
/* attribute double unwriteableMarginBottom; */
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginBottom(double *aUnwriteableMarginBottom)
{
    NS_ENSURE_ARG_POINTER(aUnwriteableMarginBottom);
    *aUnwriteableMarginBottom = NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom);
    return NS_OK;
}
示例#9
0
/* attribute double edgeRight; */
NS_IMETHODIMP nsPrintSettings::GetEdgeRight(double *aEdgeRight)
{
    NS_ENSURE_ARG_POINTER(aEdgeRight);
    *aEdgeRight = NS_TWIPS_TO_INCHES(mEdge.right);
    return NS_OK;
}
示例#10
0
/* attribute double edgeBottom; */
NS_IMETHODIMP nsPrintSettings::GetEdgeBottom(double *aEdgeBottom)
{
    NS_ENSURE_ARG_POINTER(aEdgeBottom);
    *aEdgeBottom = NS_TWIPS_TO_INCHES(mEdge.bottom);
    return NS_OK;
}
示例#11
0
/* attribute double edgeTop; */
NS_IMETHODIMP nsPrintSettings::GetEdgeTop(double *aEdgeTop)
{
    NS_ENSURE_ARG_POINTER(aEdgeTop);
    *aEdgeTop = NS_TWIPS_TO_INCHES(mEdge.top);
    return NS_OK;
}
示例#12
0
/* attribute double marginLeft; */
NS_IMETHODIMP nsPrintSettings::GetMarginLeft(double *aMarginLeft)
{
    NS_ENSURE_ARG_POINTER(aMarginLeft);
    *aMarginLeft = NS_TWIPS_TO_INCHES(mMargin.left);
    return NS_OK;
}
示例#13
0
/* attribute double marginTop; */
NS_IMETHODIMP nsPrintSettings::GetMarginTop(double *aMarginTop)
{
    NS_ENSURE_ARG_POINTER(aMarginTop);
    *aMarginTop = NS_TWIPS_TO_INCHES(mMargin.top);
    return NS_OK;
}