Changes to actually print checkbox's and radiobuttons under Windows.

No longer need special offset's during printing. nsFormControlFrame now detects
when to gfx render the widgets.
This commit is contained in:
kmcclusk%netscape.com 1998-12-10 17:29:13 +00:00
Родитель 4408592081
Коммит 2c74221f9c
4 изменённых файлов: 34 добавлений и 21 удалений

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

@ -230,11 +230,23 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
//XXX:PRINTING Temporary to force GFX rendered widgets to appear on the display. This
//Will be used to debug GFX rendered widgets for printing. This should be removed when
//Printing is completely working.
PRBool renderToScreen = PR_FALSE;
if (PR_TRUE == renderToScreen) {
PRBool renderToScreen = PR_FALSE;
nsIDeviceContext* dx = nsnull;
dx = aPresContext.GetDeviceContext();
PRBool supportsWidgets = PR_FALSE;
if (nsnull != dx) {
PRBool native = PR_FALSE;
dx->SupportsNativeWidgets(supportsWidgets);
NS_RELEASE(dx);
}
if ((PR_TRUE == renderToScreen) || (PR_FALSE == supportsWidgets)) {
return(ReflowWithNoWidget(aPresContext, aDesiredSize, aReflowState, aStatus));
}
GetDesiredSize(&aPresContext, aReflowState, aDesiredSize, mWidgetSize);
if (!mDidInit) {

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

@ -37,6 +37,7 @@
#ifdef XP_PC
#define NS_PC_DESIRED_CHECKBOX_SIZE 20
#define NS_PC_ABSOLUTE_CHECKBOX_SIZE 12
#endif
@ -413,14 +414,11 @@ nsCheckboxControlFrame::PaintCheckBox(nsIPresContext& aPresContext,
float p2t;
aPresContext.GetScaledPixelsToTwips(p2t);
//XXX:??? Offset for rendering, Not sure why we need this??? When rendering the
//checkbox to the screen this is not needed. But it is needed when Printing. Looks
// Like it offsets from the middle of the control during Printing, but not when rendered
// to the screen?
const int printOffsetX = (NS_PC_DESIRED_CHECKBOX_SIZE / 2);
const int printOffsetY = (NS_PC_DESIRED_CHECKBOX_SIZE / 2);
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
NSIntPixelsToTwips(printOffsetY, p2t));
//Offset fixed size checkbox in to the middle of the area reserved for the checkbox
const int printOffsetX = (NS_PC_DESIRED_CHECKBOX_SIZE - NS_PC_ABSOLUTE_CHECKBOX_SIZE);
const int printOffsetY = (NS_PC_DESIRED_CHECKBOX_SIZE - NS_PC_ABSOLUTE_CHECKBOX_SIZE);
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
NSIntPixelsToTwips(printOffsetY, p2t));
// Draw's background + border
PaintFixedSizeCheckMarkBorder(aRenderingContext, p2t);

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

@ -230,11 +230,23 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
//XXX:PRINTING Temporary to force GFX rendered widgets to appear on the display. This
//Will be used to debug GFX rendered widgets for printing. This should be removed when
//Printing is completely working.
PRBool renderToScreen = PR_FALSE;
if (PR_TRUE == renderToScreen) {
PRBool renderToScreen = PR_FALSE;
nsIDeviceContext* dx = nsnull;
dx = aPresContext.GetDeviceContext();
PRBool supportsWidgets = PR_FALSE;
if (nsnull != dx) {
PRBool native = PR_FALSE;
dx->SupportsNativeWidgets(supportsWidgets);
NS_RELEASE(dx);
}
if ((PR_TRUE == renderToScreen) || (PR_FALSE == supportsWidgets)) {
return(ReflowWithNoWidget(aPresContext, aDesiredSize, aReflowState, aStatus));
}
GetDesiredSize(&aPresContext, aReflowState, aDesiredSize, mWidgetSize);
if (!mDidInit) {

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

@ -323,15 +323,6 @@ nsRadioControlFrame::PaintRadioButton(nsIPresContext& aPresContext,
float p2t;
aPresContext.GetScaledPixelsToTwips(p2t);
//XXX:??? Offset for rendering, Not sure why we need this??? When rendering the
//radiobox to the screen this is not needed. But it is needed when Printing. Looks
// Like it offsets from the middle of the control during Printing, but not when rendered
// to the screen?
const int printOffsetX = (NS_DESIRED_RADIOBOX_SIZE / 2);
const int printOffsetY = (NS_DESIRED_RADIOBOX_SIZE / 2);
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
NSIntPixelsToTwips(printOffsetY, p2t));
nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);