Support new gfx FontMetrics api

This commit is contained in:
spider%netscape.com 1998-09-10 02:09:20 +00:00
Родитель 6c31539133
Коммит 834353a098
5 изменённых файлов: 4 добавлений и 86 удалений

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

@ -119,11 +119,7 @@ nsresult nsCalCommandCanvas :: Init()
fm->GetWidth(text,width);
float f;
GetWidget()->GetDeviceContext()->GetTwipsToDevUnits(f);
rect.width = width * f;
rect.width = width ;
mStaticTextField->SetReadOnly(PR_TRUE);
@ -206,13 +202,10 @@ nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
nsXPFCCanvas::SetBounds(aBounds);
nsRect rect = aBounds;
nscoord width = 0;
float f = 0.0;
if (mStaticTextField) {
mStaticTextField->GetDeviceContext()->GetTwipsToDevUnits(f);
nsString text("COMMAND: ");
nsFont font("Times", NS_FONT_STYLE_NORMAL,
@ -227,7 +220,7 @@ nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
fm->GetWidth(text,width);
rect.width = width * f;
rect.width = width ;
mStaticTextField->Invalidate(PR_FALSE);
@ -240,8 +233,8 @@ nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
rect = aBounds;
rect.x += (width*f);
rect.width -= (width*f);
rect.x += (width);
rect.width -= (width);
mTextField->Invalidate(PR_FALSE);

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

@ -289,19 +289,6 @@ nsEventStatus nsCalDayViewCanvas :: PaintForeground(nsIRenderingContext& aRender
aRenderingContext.GetFontMetrics()->GetHeight(fm_height);
nsIDeviceContext * dc ;
float f = 0.0;
dc = aRenderingContext.GetDeviceContext();
dc->GetTwipsToDevUnits(f);
fm_height *= f;
NS_RELEASE(dc);
if (rect.height > fm_height)
{
// rndctx->SetColor(GetForegroundColor());

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

@ -96,19 +96,6 @@ nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsIRenderingContext& aR
aRenderingContext.GetFontMetrics()->GetHeight(height);
aRenderingContext.GetFontMetrics()->GetWidth(*string,width);
nsIDeviceContext * dc ;
float f = 0.0;
dc = aRenderingContext.GetDeviceContext();
dc->GetTwipsToDevUnits(f);
NS_RELEASE(dc);
height *= f;
width *= f;
/*
* XXX: If we are too big, remove the Day of the week. Need a better algorithm
* to use string who fits to begin with
@ -119,7 +106,6 @@ nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsIRenderingContext& aR
pattern = "MMM dd\n";
GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string);
aRenderingContext.GetFontMetrics()->GetWidth(*string,width);
width *= f;
}
/*

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

@ -91,19 +91,6 @@ nsEventStatus nsCalTimebarUserHeading :: PaintForeground(nsIRenderingContext& aR
aRenderingContext.GetFontMetrics()->GetHeight(height);
aRenderingContext.GetFontMetrics()->GetWidth(mUserName,width);
nsIDeviceContext * dc ;
float f = 0.0;
dc = aRenderingContext.GetDeviceContext();
dc->GetTwipsToDevUnits(f);
NS_RELEASE(dc);
height *= f;
width *= f;
/*
* center the text in our rect and draw it
*/

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

@ -319,16 +319,6 @@ void nsCalMonthContextController::PaintMiniCalElement(
mRenderingContext->GetFontMetrics()->GetLeading(leading);
nsIDeviceContext * dc ;
float f = 0.0;
dc = mRenderingContext->GetDeviceContext();
dc->GetTwipsToDevUnits(f);
NS_RELEASE(dc);
iY = iYTop + leading;
mRenderingContext->DrawString(s, nsCRT::strlen(s), iX, iY, 100);
@ -1688,17 +1678,6 @@ void nsCalMonthContextController::GetTextExtent(char *p, int iChars, int& iWidth
fm->GetWidth(p,(nscoord)iWidth);
fm->GetHeight((nscoord)iHeight);
nsIDeviceContext * dc ;
float f = 0.0;
dc = mRenderingContext->GetDeviceContext();
dc->GetTwipsToDevUnits(f);
NS_RELEASE(dc);
iWidth *= f;
}
@ -1755,18 +1734,6 @@ void nsCalMonthContextController::GetFontInfo(
fm->GetWidth("0",m_iDigitWidth);
fm->GetHeight(m_iDigitHeight);
nsIDeviceContext * dc ;
float f = 0.0;
dc = mRenderingContext->GetDeviceContext();
dc->GetTwipsToDevUnits(f);
NS_RELEASE(dc);
m_iDigitWidth *= f;
/*
* The next few lines need to be replaced with some code that gets the
* strings for every day of the week and computes the max width...
@ -1777,8 +1744,6 @@ void nsCalMonthContextController::GetFontInfo(
fm->GetWidth(sBuf,m_iMaxDOWColHdrWidth);
m_iMaxDOWColHdrWidth *= f;
}
/*