Пример #1
0
void CPrinterInfo::WriteSettings(void)
{
	WriteProfileInt(ENTRY_FastBitmaps, FastBitmaps(), GetDefaultFastBitmaps());
	WriteProfileInt(ENTRY_OutlineGammaValue, GetOutlineGamma(), DEFAULT_OUTLINE_GAMMA);
	WriteProfileInt(ENTRY_GammaValue, m_Record.m_nBitmapGamma, DEFAULT_BITMAP_GAMMA);
	WriteProfileInt(ENTRY_FastBitmapGammaValue, m_Record.m_nFastBitmapGamma, DEFAULT_FAST_BITMAP_GAMMA);
	WriteProfileInt(ENTRY_PostscriptType, GetPostScriptType(), m_nDefaultPostScriptType);
	WriteProfileInt(ENTRY_EnvelopePosition, GetEnvelopePosition(), GetDefaultEnvelopePosition());

	if (m_nOrientationType == PORTRAIT)
	{
		WriteProfileFixed(ENTRY_LeftMargin, GetLeftMargin(), m_PhysicalMargins.Left);
		WriteProfileFixed(ENTRY_TopMargin, GetTopMargin(), m_PhysicalMargins.Top);
		WriteProfileFixed(ENTRY_RightMargin, GetRightMargin(), m_PhysicalMargins.Right);
		WriteProfileFixed(ENTRY_BottomMargin, GetBottomMargin(), m_PhysicalMargins.Bottom);
		WriteProfileFixed(ENTRY_LeftOffset, GetLeftOffset(), MakeFixed(0));
		WriteProfileFixed(ENTRY_TopOffset, GetTopOffset(), MakeFixed(0));
	}
	else
	{
		WriteProfileFixed(ENTRY_LeftMarginLandscape, GetLeftMargin(), m_PhysicalMargins.Left);
		WriteProfileFixed(ENTRY_TopMarginLandscape, GetTopMargin(), m_PhysicalMargins.Top);
		WriteProfileFixed(ENTRY_RightMarginLandscape, GetRightMargin(), m_PhysicalMargins.Right);
		WriteProfileFixed(ENTRY_BottomMarginLandscape, GetBottomMargin(), m_PhysicalMargins.Bottom);
		WriteProfileFixed(ENTRY_LeftOffsetLandscape, GetLeftOffset(), MakeFixed(0));
		WriteProfileFixed(ENTRY_TopOffsetLandscape, GetTopOffset(), MakeFixed(0));
	}
	
	WriteProfileInt(ENTRY_UseReverseLandscape, ReverseLandscape(), GetDefaultReverseLandscape());
	WriteProfileInt(ENTRY_DoubleSidedType, GetDoubleSidedType(), 0);
	WriteProfileInt(ENTRY_PrintInstructions, GetPrintInstructions(), DEFAULT_PRINT_INSTRUCTIONS);
	WriteProfileInt(ENTRY_FlagPrintAsBitmap, GetPrintAsBitmap(), FALSE);
}
Пример #2
0
void CHTMLSectionCreator::CarriageReturn( bool bSetNextY )
//
//	Recalcualtes the left and right margins for the current Y position and
//	moves the X position to the new left margin.
{
	if( GetCurrentShapeID() )
	{
		AdjustShapeBaselinesAndHorizontalAlignment();
	}

	m_nLeftMargin = m_nDefaultLeftMargin;
	while( m_stkLeftMargin.GetSize() )
	{
		MarginStackItem msi = m_stkLeftMargin.Top();
		if( msi.nYExpiry >= m_nNextYPos )
		{
			m_nLeftMargin = msi.nMargin;
			break;
		}
		else
		{
			(void)m_stkLeftMargin.Pop();
		}
	}


	m_nRightMargin = m_nDefaultRightMargin;
	while( m_stkRightMargin.GetSize() )
	{
		MarginStackItem msi = m_stkRightMargin.Top();
		if( msi.nYExpiry >= m_nNextYPos )
		{
			m_nRightMargin = msi.nMargin;
			break;
		}
		else
		{
			(void)m_stkRightMargin.Pop();
		}
	}
	m_nXPos = GetLeftMargin();

	m_mapBaseline.RemoveAll();
	m_nLowestBaseline = 0;
	m_nFirstShapeOnLine = GetCurrentShapeID();

	//	If there is nothing in the margin stack, this is a good place for
	//	a page break.
	if( m_dc.IsPrinting() && GetLeftMargin() == m_nDefaultLeftMargin && GetRightMargin() == m_nDefaultRightMargin)
	{
		GetHTMLSection()->AddBreakSection(GetCurrentShapeID());
	}

	if( bSetNextY )
	{
		SetCurrentYPos( GetNextYPos() );
	}
}
CRect COXCoolComboBox::GetButtonRect() const 
{
    CRect rect(0,0,0,0);
	BOOL bSimpleCombo=((GetStyle()&0x000f)==CBS_SIMPLE);
	if(bSimpleCombo)
		return rect;

    GetClientRect(&rect);

    int nRightMargin=GetRightMargin();
	int nTopMargin=GetTopMargin();
	int nBottomMargin=GetBtmMargin();
	int nButtonWidth=GetButtonWidth();

    rect.left=rect.right-nRightMargin-::GetSystemMetrics(SM_CXVSCROLL);
    rect.top+=nTopMargin;
    rect.right=rect.left+nButtonWidth;
    rect.bottom-=nBottomMargin;

    if(rect.left<0)
        rect.left=0;

    return rect;
}
void COXCoolComboBox::OnPaint() 
{
	if(!IsInCoolState())
	{
		Default();
		return;
	}

	// set up all the pens we are likely to need
    HPEN penDefault=(HPEN)GetStockObject(BLACK_PEN);
    static CPen penHilite(PS_SOLID,1,GetSysColor(COLOR_3DHIGHLIGHT));
    static CPen penShadow(PS_SOLID,1,GetSysColor(COLOR_3DSHADOW));
    static CPen penFace3D(PS_SOLID,1,GetSysColor(COLOR_3DFACE));
    static CPen penDkShad3D(PS_SOLID,1,GetSysColor(COLOR_3DDKSHADOW));

    // store margins for future use
    int nLeftMargin=GetLeftMargin(); 
	int nRightMargin=GetRightMargin();
	int nTopMargin=GetTopMargin();
	int nBottomMargin=GetBtmMargin();
    CRect button_rect=GetButtonRect();

	const BOOL bSimpleCombo=((GetStyle()&0x000f)==CBS_SIMPLE);
    const BOOL bIsEnabled=IsWindowEnabled();
	const BOOL bIsHot=IsInHotState() & bIsEnabled;

    // paint background
    CPaintDC paintdc(this);
    CDC* dc=&paintdc;

    CRect rect, rectClient, rectInternal; // temp rect, client rect, internal rect respectively

    GetClientRect(rectClient);
	rectClient.right-=::GetSystemMetrics(SM_CXVSCROLL)-GetButtonWidth();

	if(bSimpleCombo)
	{
		ASSERT(::IsWindow(m_edit.GetSafeHwnd()));
		CRect rectEdit;
		m_edit.GetWindowRect(rectEdit);
		rectClient.bottom=rectClient.top+rectEdit.Height()+5;
	}

    // set up internal rectangle
    rectInternal=rectClient;
    rectInternal.left+=nLeftMargin;
    rectInternal.top+=nTopMargin;
    rectInternal.right-=nRightMargin;
    rectInternal.bottom-=nBottomMargin;

    rect=rectInternal;
	if(!button_rect.IsRectEmpty())
		rect.right=button_rect.left;
    if(!bIsEnabled)
        ::FillRect(dc->m_hDC,&rect,GetSysColorBrush(COLOR_3DFACE));
    else
        ::FillRect(dc->m_hDC,&rect,GetSysColorBrush(COLOR_WINDOW));

    // do default painting
    if(!::IsWindow(m_edit.GetSafeHwnd()))
    {
        DRAWITEMSTRUCT dis={ sizeof(&dis) };
        dis.CtlType=ODT_COMBOBOX;
        dis.CtlID=GetWindowLongPtr(m_hWnd, GWL_ID);
        dis.itemID=GetCurSel();
        dis.itemAction=ODA_DRAWENTIRE;
        dis.hwndItem=m_hWnd;
        dis.hDC=dc->m_hDC;
        dis.rcItem=CRect(nLeftMargin+1,nTopMargin+1, 
			button_rect.left-1,rectClient.bottom-nBottomMargin-1);
        dis.itemData=GetItemData(GetCurSel());
        dis.itemState=((::GetFocus()==GetSafeHwnd() && !IsDroppedDown()) ? 
			ODS_FOCUS : 0);

        DrawItem(&dis);
    }

    // now do our painting - first borderect...
    // but first exclude the 'real' client area from the DC
    dc->SelectClipRgn(NULL);   // from drawing background
    dc->ExcludeClipRect(&rectInternal);

    // draw border
	if(!bIsHot)
	{
		// now paint background 
	    if(bSimpleCombo)
			FillRect(dc->m_hDC, &rectClient, ::GetSysColorBrush(COLOR_WINDOW));
		else
			FillRect(dc->m_hDC, &rectClient, ::GetSysColorBrush(COLOR_3DFACE));

		// fill in small area to the left of edit window in appropriate colour, 
		// to make window look bigger
		rect=rectClient;
		rect.top+=nTopMargin;
		rect.left+=nLeftMargin-1;
		rect.right=rect.left+1;
		rect.bottom-=nBottomMargin;

		if(bIsEnabled)
			FillRect(dc->m_hDC, &rect, GetSysColorBrush(COLOR_WINDOW));
		else
			FillRect(dc->m_hDC, &rect, GetSysColorBrush(COLOR_3DFACE));
	}
	else
	{
		// HOT case - difficult to describe, but reasonably obvious
		rect=rectClient;
		rect.left++;
		rect.right--;
		rect.top++;
		rect.bottom-=1+EXTRA_BOTTOM_MARGIN;            

		// paint background 
		FillRect(dc->m_hDC, &rect, GetSysColorBrush(COLOR_3DFACE));

		// and border
		rect=rectClient;
		SelectObject(dc->m_hDC,penShadow);
		dc->MoveTo(0,0);
		dc->LineTo(rect.right,0);
		dc->MoveTo(0,0);
		dc->LineTo(0,rect.bottom-1-EXTRA_BOTTOM_MARGIN);

		SelectObject(dc->m_hDC,penHilite);
		dc->LineTo(rect.right-1,rect.bottom-1-EXTRA_BOTTOM_MARGIN);
		dc->LineTo(rect.right-1,rect.top);

		// and paint extra margin
		if(EXTRA_BOTTOM_MARGIN)
		{
			rect=rectClient;
			rect.top=rect.bottom-EXTRA_BOTTOM_MARGIN;        

			FillRect(dc->m_hDC, &rect, GetSysColorBrush(COLOR_3DFACE));
		}
	}

    // unselect the clip region
    SelectClipRgn(dc->m_hDC, NULL);

    // now draw highlight border, if disabled
    if(!bIsEnabled)
    {
        SelectObject(dc->m_hDC, GetStockObject(NULL_BRUSH));
        SelectObject(dc->m_hDC, penHilite);
        dc->Rectangle(rectInternal.left-1, rectInternal.top-1, 
			rectInternal.right+1, rectInternal.bottom+1);
    }

    // and now for the button
    BOOL pressed=IsDroppedDown();
    rect=button_rect;

    // do the background
    if(bIsHot)
    {
        rect.bottom--;
        rect.right++;
    }

    if(bIsHot || pressed || !bIsEnabled)
    {
        ::FillRect(dc->m_hDC, &rect, GetSysColorBrush(COLOR_3DFACE));
    }
    else
    {
		if(bIsEnabled)
		{
			// cold and unpressed
			SelectObject(dc->m_hDC, penHilite);
			SelectObject(dc->m_hDC, GetSysColorBrush(COLOR_3DFACE));
			::Rectangle(dc->m_hDC, rect.left, rect.top, rect.right, rect.bottom);
		}
    }

    rect=button_rect; // set again

    if(bIsHot || pressed)
    {
        if(pressed)
        {
            SelectObject(dc->m_hDC, penShadow);
            dc->MoveTo(rect.left , rect.top);
            dc->LineTo(rect.right, rect.top);
            dc->MoveTo(rect.left , rect.top);
            dc->LineTo(rect.left , rect.bottom);
        }
        else
        {
            SelectObject(dc->m_hDC, penHilite);
            dc->MoveTo(rect.right,  rect.top);
            dc->LineTo(rect.left+1, rect.top);
            dc->LineTo(rect.left+1, rect.bottom);
            SelectObject(dc->m_hDC, penFace3D);
            dc->MoveTo(rect.left, rect.top);
            dc->LineTo(rect.left, rect.bottom);
            SelectObject(dc->m_hDC, penShadow);
            dc->MoveTo(rect.left , rect.bottom - 1);
            dc->LineTo(rect.right-1, rect.bottom - 1);
            dc->LineTo(rect.right-1, rect.top);
        }

        SelectObject(dc->m_hDC, penDefault);
    }

    // now draw shadowy arrow
    SelectObject(dc->m_hDC, penDkShad3D);
    SelectObject(dc->m_hDC, ::GetSysColorBrush(COLOR_3DDKSHADOW));

    POINT p[3];

    p[0].x=rect.left +((rect.right - rect.left) / 3);
    p[1].x=rect.left +(2 *(rect.right - rect.left) / 3) + 1;
    p[2].x=(p[0].x + p[1].x) / 2;

    if(((p[1].x - p[0].x) % 2))
        p[1].x--;

    p[0].y=(rect.top + rect.bottom / 2) -(p[1].x - p[0].x) / 4 - 1;
    p[1].y=p[0].y;
    p[2].y=p[0].y +(p[1].x - p[0].x) / 2;

    if(pressed)    // offset by a pixel
    {
        p[0].x++;
        p[0].y++;
        p[1].x++;
        p[1].y++;
        p[2].x++;
        p[2].y++;
    }

    Polygon(dc->m_hDC, p, 3);

}
Пример #5
0
/*---------------------------------------------------------------------------*/
void HTMLBodyDisplay::Format(void)
{
	DisplayManager *manager = GetManager();

	if (manager)
	{
		PresetWebRect rect(&manager->mViewRect);
		DISPLAY_INT viewportWidth  = rect.Width();
		DISPLAY_INT viewportHeight = rect.Height();
		WEBC_DEBUG_LOG_TIME_HANDLE(TimeInside)

		WEBC_DEBUG_LOG_TIME_ENTER(TimeInside,"HTMLBodyDisplay::Format", " ")
		rect.MoveTo(0, 0);


		SetParentWidth(viewportWidth, viewportWidth);
		SetParentHeight(viewportHeight);

#if (WEBC_SUPPORT_FRAMES)
		HTMLBody* bodyElement = (HTMLBody*) mpHtmlElement;
		HTMLFrameSet* framesetElement = (bodyElement)? bodyElement->GetFrameSet() : 0;

		mpFrameSet = (HTMLFrameSetDisplay*) ((framesetElement)? framesetElement->GetDisplayElement() : 0);

		if (mpFrameSet)
		{
			// remove all old children
			while (mpFirstChild)
			{
				Remove(mpFirstChild);
			}

			// add the frameset
			mpFrameSet->SetParentWidth(viewportWidth, viewportWidth);
			mpFrameSet->SetParentHeight(viewportHeight);
			mpFrameSet->SetXYPosition(0,0);
			mpFrameSet->SetParentDisplay(this, 0);
			miContentHeight = viewportHeight;
			miMaxWidth = viewportWidth;
			miMinWidth = viewportWidth;

			mFlowFlags &= ~(FD_FLAG_POS_CHILD_STYLE_MODIFIED|
			                FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                FD_FLAG_LOCAL_STYLE_MODIFIED|
							FD_FLAG_PARENT_STYLE_MODIFIED);
		}
		else
#endif // WEBC_SUPPORT_FRAMES
		{
			DISPLAY_INT marginLeftValue   = GetLeftMargin();
			DISPLAY_INT marginRightValue  = GetRightMargin();
			DISPLAY_INT marginTopValue    = GetTopMargin();

			DISPLAY_INT paddingLeftValue  = mBorder.GetPaddingWidth(CSS_LEFT);
			DISPLAY_INT paddingRightValue = mBorder.GetPaddingWidth(CSS_RIGHT);
			DISPLAY_INT paddingTopValue   = mBorder.GetPaddingWidth(CSS_TOP);

			// check to see if we just need to update positioned child formatting
			if (mFlowFlags & (FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                  FD_FLAG_LOCAL_STYLE_MODIFIED|
			                  FD_FLAG_PARENT_STYLE_MODIFIED))
			{
				DISPLAY_INT iContentWidth;
				MarginContext margin (marginLeftValue + paddingLeftValue,
				                      viewportWidth - (marginRightValue + paddingRightValue) - 1, this);

				// Format the flow content
				miContentHeight = FormatFlowContent (&margin,
				                                     marginLeftValue + paddingLeftValue,
				                                     marginTopValue + paddingTopValue, &iContentWidth);

				// update miContentHeight to include anything in the margins
				DISPLAY_INT topPad = marginTopValue + paddingTopValue;
				DISPLAY_INT clearedHeight = margin.ClearAll(topPad + miContentHeight) - topPad;
				if (clearedHeight > miContentHeight)
				{
					miContentHeight = clearedHeight;
				}

				// set this element's height
				UpdateHeight(0, 0);
			}

			// Format positioned elements
			FormatContextFactory childContextFactory;

			if (mPositionedChildFormatContext)
			{
				WebRect oldRect;

				mPositionedChildFormatContext->getContainingBlock(&oldRect);

				if (!oldRect.Equals(&rect) ||
				    miContentHeight != mPositionedChildFormatContext->getAutoIndentTop())
				{
					mPositionedChildFormatContext->release();
					mPositionedChildFormatContext = 0;
				}
			}

			WEBC_BOOL reformatPositionedChildren = (mFlowFlags & FD_FLAG_POS_CHILD_STYLE_MODIFIED) != 0;

			if (!mPositionedChildFormatContext)
			{
				mPositionedChildFormatContext = childContextFactory.newPositioned (
						&rect,            // containingBlock,
						WEBC_FALSE,       // parentHeightIsAuto,
						TU_DIR_LTR,       // textDirection,
						0,                // parentBorderLeft,
						0,                // parentBorderTop,
						0,                // parentBorderRight,
						0,                // parentBorderBottom,
						marginLeftValue,  // autoIndentLeft,
						miContentHeight,  // autoIndentTop,
						marginRightValue  // autoIndentRight
					);

				reformatPositionedChildren = (mPositionedChildFormatContext != WEBC_NULL);
			}

			if (reformatPositionedChildren)
			{
				HTMLFlowDisplayFormatContext formatCtx;

				BeginFormatPositionedChildren(&formatCtx);

				FormatPositionedChildren (
						mPositionedChildFormatContext,
						mPositionedChildFormatContext,
						&childContextFactory
					);

				EndFormatPositionedChildren(&formatCtx);
			}

			mFlowFlags &= ~(FD_FLAG_POS_CHILD_STYLE_MODIFIED|
			                FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                FD_FLAG_LOCAL_STYLE_MODIFIED|
							FD_FLAG_PARENT_STYLE_MODIFIED);
		}

		WEBC_ASSERT(!NeedsFormat());

		// handles the case where HTMLDocument::ScrollToAnchor is called before the
		//  document's content has been formatted.
		if (mpHtmlElement)
		{
			HTMLDocument* document = mpHtmlElement->GetDocument();
			if (document)
			{
				document->ScrollToDefaultAnchor();
				document->SetQueuedFocus();
			}
		}
		WEBC_DEBUG_LOG_TIME_EXIT(TimeInside,"HTMLBodyDisplay::Format", " ")
	}
}