当前位置: 首页>>代码示例>>C++>>正文


C++ DocView类代码示例

本文整理汇总了C++中DocView的典型用法代码示例。如果您正苦于以下问题:C++ DocView类的具体用法?C++ DocView怎么用?C++ DocView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DocView类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void OpException::Do(OpDescriptor* WhichOp)
{
	if (WhichOp->Token == String( OPTOKEN_EXCEPTION_PTR) )
		GlobalByte = *lpByte;
	else if (WhichOp->Token == String( OPTOKEN_EXCEPTION_INT ) )
		iZero[1] = 1 / iZero[0];
	else if (WhichOp->Token == String( OPTOKEN_EXCEPTION_DBL ) )
		dZero[1] = 1 / dZero[0];									
	else
	{
		DocView *pDocView = DocView::GetSelected();
		if (pDocView != NULL)
		{
			pDocView->ForceRedraw();										// posts the paint message
			CWindowID pWnd = DocView::GetCurrentRenderWindow();
			if (pWnd)
			{
				// Set trap for later
				RenderTrap = TRUE;										
				// Now do the paint
				TRACE( _T("Into update explosion\n"));
				pWnd->Update();										// do the paint
				TRACE( _T("Out of update explosion\n"));
			}
		}
	}
}
开发者ID:vata,项目名称:xarino,代码行数:27,代码来源:exceptio.cpp

示例2: ENSURE

void OpPush::DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag)
{
	DocView* pDocView = DocView::GetSelected();
	ENSURE( pDocView != NULL, "OpPush::DragPointerMove - DocView was NULL" );
	if (pDocView==NULL)
		return;

	// Declare a few WorkCoords we will need
	WorkCoord ScrollOffsets;
	WorkCoord Change;	
	WorkCoord MoveClick = pDocView->GetClickWorkCoord();
	
	// How Much has it changed
	Change.x = AnchorPoint.x - MoveClick.x;
	Change.y = AnchorPoint.y - MoveClick.y;
	
	// Find the Scroll Offsets and change them
	ScrollOffsets = pDocView->GetScrollOffsets(); 
	ScrollOffsets.x += Change.x;
	ScrollOffsets.y += Change.y;
	
	// Make sure the ScrollOffsets are valid and then set them
	if ( ScrollOffsets.x < 0 ) ScrollOffsets.x = 0;
	if ( ScrollOffsets.y > 0 ) ScrollOffsets.y = 0;
	pDocView->SetScrollOffsets( ScrollOffsets, TRUE );
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:26,代码来源:pushtool.cpp

示例3: GetState

OpState OpShowGuides::GetState(String_256* pUIDescription, OpDescriptor*)
{
	OpState OpSt;

	DocView *pDocView = DocView::GetSelected();
	if (pDocView != NULL)
		OpSt.Ticked = pDocView->GetShowGuidesState();

	Spread* pSpread = Document::GetSelectedSpread();
	if (pSpread != NULL)
	{
		// if we have a guide layer, then make the menu item available, if not, grey it 
		//	and give a reason.
		if (pSpread->FindFirstGuideLayer() != NULL)
		{
			OpSt.Greyed = FALSE;
		}
		else
		{
			OpSt.Greyed = TRUE;
			*pUIDescription = String_256 (_R(IDS_NO_GUIDES));
		}

	}	// if (pSpread != NULL)

	return OpSt;
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:27,代码来源:snapops.cpp

示例4: SetPreviewBitmap

BOOL ThumbnailFilterPNG::DoExport(Operation* pOp, CCLexFile* pFile, PathName* pPath, 
								Document* TheDocument, BOOL ShowOptions)
{
	// set ourselves up - this flags the BaseBitmapFilter to do resizing, which needs to be
	// done there because of Accusoft.
	SetPreviewBitmap(TRUE);

	// create a new view for the document
	DocView *pView = new DocView(TheDocument);

	if (pView && pView->Init())
	{
		// set the view as current, but remember the last current one
		View *pOldView = View::GetCurrent();
		pView->SetCurrent();

		// Export the thumbnail to the file by doing what our base class does
		BOOL ok = PNGFilter::DoExport(pOp, pFile, pPath, TheDocument, TRUE);

		// restore the last view
		if (pOldView != NULL)
			pOldView->SetCurrent();
		else
			View::SetNoCurrent();

		// delete our view
		delete pView;

		return ok;
	}
	else
		return FALSE; // view creation failed
}
开发者ID:vata,项目名称:xarino,代码行数:33,代码来源:prvwflt.cpp

示例5: onWindowResize

void PreviewEditorWindow::onWindowResize()
{
  Window::onWindowResize();

  DocView* view = UIContext::instance()->activeView();
  if (view)
    updateUsingEditor(view->editor());
}
开发者ID:aseprite,项目名称:aseprite,代码行数:8,代码来源:preview_editor.cpp

示例6: Will_Cowling

/********************************************************************************************

>	BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)

	Author:		Will_Cowling (Xara Group Ltd) <[email protected]> (from Simon)
	Created:	12/6/96
	Inputs:		-
	Outputs:	Spread:  The spread to place the clipboard objects on
				Position:The centre of the view (Spread coords)
	Purpose:	Finds the centre insertion position for clipboard objects

********************************************************************************************/
BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
{
	// ---------------------------------------------------------------------------------
	// Find out which spread is in the centre of the view 
	// this is the spread that the pasted objects will be placed on

	// Obtain the current DocView
	DocView* CurDocView = DocView::GetCurrent();

	ENSURE(CurDocView != NULL, "The current DocView is NULL"); 
	if (CurDocView == NULL)
		return FALSE; // No DocView

	// Get the view rect
	WorkRect WrkViewRect = CurDocView->GetViewRect();

	if (WrkViewRect.IsEmpty() || (!WrkViewRect.IsValid()) )
		return FALSE; // Defensive
	
	// Determine the centre of the view
	WorkCoord WrkCentreOfView; 
	WrkCentreOfView.x = WrkViewRect.lox	+ (WrkViewRect.Width()/2); 
	WrkCentreOfView.y = WrkViewRect.loy	+ (WrkViewRect.Height()/2);
	
	// FindEnclosing spread requires an OilCoord
	OilCoord OilCentreOfView = WrkCentreOfView.ToOil(CurDocView->GetScrollOffsets()); 

	// Find out which spread to insert the pasteboard objects onto
	(*Spread) = CurDocView->FindEnclosingSpread(OilCentreOfView);
	if ((*Spread) == NULL)
		return FALSE; // There is no spread

	// Phew
	// ---------------------------------------------------------------------------------
	// Now lets find the spread coordinate of the centre of the view
	DocRect DocViewRect = CurDocView->GetDocViewRect(*Spread);
	
	if ( DocViewRect.IsEmpty() || (!DocViewRect.IsValid()) )
	{
		ERROR3("DocViewRect is invalid");
		return FALSE; // Defensive
	}

	// Find the centre of the DocViewRect
   	DocCoord DocCentreOfView; 
	DocCentreOfView.x = DocViewRect.lox	+ (DocViewRect.Width()/2); 
	DocCentreOfView.y = DocViewRect.loy	+ (DocViewRect.Height()/2);

	// --------------------------------------------------------------------------------
	// Now convert from DocCoords to spread coords

	DocRect PhysSpreadRect = (*Spread)->GetPasteboardRect();
	
	(*Position).x = DocCentreOfView.x - PhysSpreadRect.lo.x; 
	(*Position).y = DocCentreOfView.y - PhysSpreadRect.lo.y;
	
	return TRUE;  
}
开发者ID:vata,项目名称:xarino,代码行数:70,代码来源:makebmp.cpp

示例7: TRACEUSER

BOOL ScaleTab::InitSection()
{
TRACEUSER( "Neville", _T("ScaleTab::InitSection\n"));
	ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::InitSection called with no dialog pointer");

//	BOOL ReadOk = FALSE; 	// Flag to say whether the preference value was read ok 

	// Make sure the information field displaying the name of the current document
	// is correct.
	String_256	DocumentName(_R(IDT_OPTS_SCALING_INFO)); 
	DocumentName +=	*GetDocumentName();
	pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);

	// Section = Scale settings

	DocView* pSelectedView = DocView::GetSelected();
	// This may now be a valid state so must not error
	//ERROR3IF(pSelectedView == NULL,"ScaleTab::InitSection Where's the current view eh?");
	if (pSelectedView != NULL)
	{
		Spread* pSpread = pSelectedView->GetFirstSelectedSpread();

		// If no selected spread then use the visible spread
		if (pSpread == NULL)
			pSpread = pSelectedView->GetVisibleSpread();

		// If no selected spread then use the first spread
		// Of course, this should not be here but above routines seem to return
		// null a bit too often for my liking
		if (pSpread == NULL)
		{
TRACEUSER( "Neville", _T("ScaleTab::InitSection BODGE! using 1st spread\n"));
			Document* pSelectedDoc = Document::GetSelected();
			if (pSelectedDoc !=NULL )
				pSpread = pSelectedDoc->FindFirstSpread();
		}

		// Go and get a pointer to the scaling values
		if (pSpread != NULL)
		{
			pDimScale = pSpread->GetPtrDimScale();
			if (pDimScale != NULL)
			{
				// And now show the initial state of the controls given this
				// scaling 
				ShowScaleDetails();
			}
		}
	}
	else
	{
		// If no current view then ensure section is greyed
		GreySection();
	}

	return TRUE;
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:57,代码来源:optsscal.cpp

示例8: Do

void OpSnapToGuides::Do(OpDescriptor*)
{
	DocView *pDocView = DocView::GetSelected();

	if (pDocView != NULL)
		pDocView->SetSnapToGuidesState(!pDocView->GetSnapToGuidesState());

	End();
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:9,代码来源:snapops.cpp

示例9: MakeImage

KernelBitmap* SGNameDrag::MakeImage(UINT32 nDepth)
{
	// If there's no current View, or no Spread, then fail.
	DocView* pView = DocView::GetCurrent();
	if (pView == 0) return 0;
	Spread* pSpread = pView->FindEnclosingSpread(OilCoord(0, 0));
	if (pSpread == 0) return 0;

	// Create a device context for the display.
	CDC sdc;
	sdc.CreateDC("DISPLAY", 0, 0, 0); 

	// Calculate the size of the rendering and set up the rendering matrix etc.
	Matrix matConvert;
	FIXED16 fxScale = 1;
	INT32 nSel = NameGallery::Instance()->GetSelectedItemCount();
	DocRect drClip(0, 0, SG_DefaultNameText, nSel * SG_DefaultSmallIcon);

	// Work out the destination bitmap's characteristics.
	double dpi = (double) GetDeviceCaps(sdc.m_hDC, LOGPIXELSX);
	if (nDepth == 0)
			nDepth = GetDeviceCaps(sdc.m_hDC, BITSPIXEL) * GetDeviceCaps(sdc.m_hDC, PLANES);

	// Create a render region with the given properties of the display etc.
	GRenderBitmap* pRenderer = new GRenderBitmap(drClip, matConvert, fxScale, nDepth, dpi);
	ERRORIF(pRenderer == 0, _R(IDE_NOMORE_MEMORY), 0);
	pRenderer->AttachDevice(pView, &sdc, pSpread);
	pRenderer->StartRender();
	pRenderer->SaveContext();

	// Blank the background.
	pRenderer->SetLineWidth(0);
	pRenderer->SetLineColour(COLOUR_WHITE);
	pRenderer->SetFillColour(COLOUR_WHITE);
	pRenderer->DrawRect(&drClip);

	// Render the item's name.
	DocColour dcText(COLOUR_BLACK), dcBack(COLOUR_WHITE);
	pRenderer->SetFixedSystemTextColours(&dcText, &dcBack);

	String_256 strName;
	m_pSourceItem->GetNameText(&strName);
	pRenderer->DrawFixedSystemText(&strName, drClip);

	// Create a kernel bitmap from the OIL bitmap and return it.
	pRenderer->RestoreContext();
	pRenderer->StopRender();
	OILBitmap* pOilMaskBmp = pRenderer->ExtractBitmap();
	delete pRenderer;

	KernelBitmap* pkb = new KernelBitmap(pOilMaskBmp, TRUE);
	ERRORIF(pkb == 0, _R(IDE_NOMORE_MEMORY), 0);
	return pkb;
}
开发者ID:vata,项目名称:xarino,代码行数:54,代码来源:ngdrag.cpp

示例10: delta

gfx::Point MoveThing::getDelta(Context* context) const
{
  gfx::Point delta(0, 0);

  DocView* view = static_cast<UIContext*>(context)->activeView();
  if (!view)
    return delta;

  DocumentPreferences& docPref = Preferences::instance().document(view->document());
  Editor* editor = view->editor();
  gfx::Rect vp = view->viewWidget()->viewportBounds();
  gfx::Rect gridBounds = docPref.grid.bounds();
  int pixels = 0;

  switch (units) {
    case Pixel:
      pixels = 1;
      break;
    case TileWidth:
      pixels = gridBounds.w;
      break;
    case TileHeight:
      pixels = gridBounds.h;
      break;
    case ZoomedPixel:
      pixels = editor->zoom().apply(1);
      break;
    case ZoomedTileWidth:
      pixels = editor->zoom().apply(gridBounds.w);
      break;
    case ZoomedTileHeight:
      pixels = editor->zoom().apply(gridBounds.h);
      break;
    case ViewportWidth:
      pixels = vp.h;
      break;
    case ViewportHeight:
      pixels = vp.w;
      break;
  }

  switch (direction) {
    case Left:  delta.x = -quantity * pixels; break;
    case Right: delta.x = +quantity * pixels; break;
    case Up:    delta.y = -quantity * pixels; break;
    case Down:  delta.y = +quantity * pixels; break;
  }

  return delta;
}
开发者ID:aseprite,项目名称:aseprite,代码行数:50,代码来源:move_thing.cpp

示例11: GetSolidDragMask

KernelBitmap* GalleryLineDragInfo::GetSolidDragMask()
{
	// Note we abuse this call (like our base class abuses this call) to create the bitmap
	// itself. We don't use DragMask itself anymore (i.e. it stays NULL)
	if (!DragMask && !TheBitmap)
	{
		DocView *View = DocView::GetCurrent();
		if (View == NULL)
		{
			return NULL;
		}
		
		Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0));
		if (pSpread == NULL)
		{
			return NULL;
		}

		// Find the size of the rendered item.
		DocRect ClipRegion(0,0, 750*100, 750*50);
//		ClipRegion.lo.x = ClipRegion.lo.y = 0;
//		SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y);
		Matrix ConvertMatrix;
		FIXED16 ViewScale = 1;

		wxScreenDC DisplayDC;
		double dpi = (double) OSRenderRegion::GetFixedDCPPI(DisplayDC).GetWidth();

		GRenderBitmap* pMaskRegion 	= new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale, 
														32, dpi);

		pMaskRegion->SetDoCompression(TRUE); // misnamed call to indicate we want transparency
		pMaskRegion->AttachDevice(View, &DisplayDC, pSpread);

		// Make a Mask Bitmap
		pMaskRegion->StartRender();
	  	SourceItem->Render(pMaskRegion, ClipRegion, c_eLineAttrDragTextPos);
		pMaskRegion->StopRender();

		OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap();
		TheBitmap = new KernelBitmap(pOilMaskBmp, TRUE);	

		delete pMaskRegion;
	}

	return BitmapDragInformation::GetSolidDragMask();
}
开发者ID:vata,项目名称:xarino,代码行数:47,代码来源:sgldrag.cpp

示例12: SetCurrentStates

void ScreenCamView::OnSize( wxSizeEvent &event )
{
	// This is called early, so if pDocView is null do nothing
	if( NULL == pDocView )
		return;

	SetCurrentStates();

	Document* pCurDoc = Document::GetCurrent();
	DocView* pCurView = DocView::GetCurrent();
	
	// these lines are here to stop very strange things happening on exit under Win32s
	// when this fn gets called when it really shouldn't. I would like to really know
	// just what on earth os going on under Win32s but it iss something strange in message
	// handling as far as I can tell.

	wxSize	size( event.GetSize() );

	// Check for irrelevant or potty messages.
	if (size.x <= 0 || size.y <= 0)
	{
//		TRACEUSER( "JustinF", _T("Strange size msg in ScreenView::OnSize(0x%X, %d, %d)\n"), 
//					nType, cx, cy);
		return;
	}

	// Handle OLE 2.0 in-place activation stuff.
#if (_OLE_VER >= 0x200)
	if(GetDocument())
	{
		COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
		if (pActiveItem) pActiveItem->SetItemRects();
	}	
#endif

	if (Status->ScrollersVisible)
	{
PORTNOTETRACE( "other", "ScreenCamView::OnSize - Removed scroller usage" );
#if !defined(EXCLUDE_FROM_XARALX)
		// Resize and reposition the proportional scrollers.
		wxRect hrect, vrect;
		HScrollBar->CalcPosFromParentClient(&hrect);

		UINT32 RulerWidth = OILRuler::GetWidth();
		//if rulers are switched on the scroll bars are made
		// smaller to accomodate them
		if (Status->RulersVisible)
			hrect.left += RulerWidth;
		if (RULER_BORDERS)
			hrect.left-=2;

		HScrollBar->MoveWindow(&hrect, TRUE);
		VScrollBar->CalcPosFromParentClient(&vrect);

		if (Status->RulersVisible)
			vrect.top += RulerWidth;
		if (RULER_BORDERS)
			vrect.top-=2;

		VScrollBar->MoveWindow(&vrect, TRUE);

 		// Reposition the corner window at the bottom-right.
		Corner->MoveWindow(vrect.left, hrect.top, vrect.Width(), hrect.Height());
	 
		// Resize/reposition the rendering window.
		CurrentSize.left = CurrentSize.top = 0;
		CurrentSize.right = cx - vrect.Width() + 1;
		CurrentSize.bottom = cy - hrect.Height() + 1;
#endif
	}
	else
	{	
		CurrentSize.x = CurrentSize.y = 0;
		CurrentSize.width  = size.x;
		CurrentSize.height = size.y;
	}

	if (Status->RulersVisible)
	{
PORTNOTETRACE( "other", "ScreenCamView::OnSize - Removed scroller / ruler usage" );
#if !defined(EXCLUDE_FROM_XARALX)
	 	wxRect hRect, vRect, oRect;

	 	HRuler->CalcPosFromParentClient(&hRect);
		HRuler->MoveWindow(&hRect, TRUE);
		HRuler->PositionLegend();
		
		CurrentSize.top = 0 + hRect.Height() ;
			
	 	VRuler->CalcPosFromParentClient(&vRect);
		VRuler->MoveWindow(&vRect, TRUE);
		CurrentSize.left = 0 + vRect.Width(); 

	 	OGadget->CalcPosFromParentClient(&oRect);
		OGadget->MoveWindow(&oRect, TRUE);
		if (RULER_BORDERS)
		{
			CurrentSize.top --;
			CurrentSize.left--; 
		}
//.........这里部分代码省略.........
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,代码来源:scrcamvw.cpp

示例13: DropPoint

BOOL ScreenCamView::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
	if (!m_DropFormatOK || pDataObject == NULL)
		return FALSE;

//	Document* pSelDoc = Document::GetSelected();

	Document* pClipDoc = InternalClipboard::Instance();
	if (pClipDoc != NULL)
	{
		Document::SetSelectedViewAndSpread(pClipDoc);
		pClipDoc->ResetInsertionPosition();
		pClipDoc->SetCurrent();

		// If there is *still* a format on the external clip board we like, then it's ok to drop
		CLIPFORMAT ClipFormat = ExternalClipboard::GetBestPasteFormat(pDataObject);
		ExternalClipboard* pExtClipBoard = ExternalClipboard::GetExternalClipboard();

		if (ClipFormat != 0 && pExtClipBoard !=NULL && pExtClipBoard->PrepareForOlePaste(pDataObject))
		{
			Document::SetSelectedViewAndSpread(GetDocument()->GetKernelDoc(),GetDocViewPtr());
			DocView *pDocView = DocView::GetCurrent();

			if (pDocView != NULL)
			{
				// Make the drop point a WinCoord so we can turn it into an oil coord
				WinCoord DropPoint(point.x,point.y);

				// Turn it into Oil coordinates...
				OilCoord OilPos = DropPoint.ToOil(pDocView);

				// Find the spread that contains the coord
				Spread* pSpread = pDocView->FindEnclosingSpread(OilPos);
				if (pSpread != NULL)
				{
					// First of all convert the OilCoord into device coords
					DocCoord Centre = OilPos.ToDoc(pSpread, pDocView);
				
					// Translate the coord to spread coords
					pSpread->DocCoordToSpreadCoord(&Centre);

					// 'Centre' now contains the centre point for the paste, in spread coords

					TRY
					{
						// Wrap all this in a TRY/CATCH block so that if OLE throws a wobbly, we can
						// ensure that the clipboard remains intacted on exit.

						// Copy the selection to the drag'n'drop clipboard.
						OpDescriptor* pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_PASTE);
						ERROR3IF(!pOp, "No paste operation in ScreenCamView::OnDrop");

						if (pOp != NULL)
						{
							Document::SetSelectedViewAndSpread(pClipDoc);
							pClipDoc->SetCurrent();
							pClipDoc->ResetInsertionPosition();
							InsertionNode* pInsertNode = pClipDoc->GetInsertionPosition();
							if (pInsertNode != NULL)
							{
								pInsertNode->UnlinkNodeFromTree();
								delete pInsertNode;
								pInsertNode = NULL;
							}

							Document::SetSelectedViewAndSpread(GetDocument()->GetKernelDoc(),GetDocViewPtr());
							
							// create a param object that contains the centre point in the spread at which
							// we would like the objects to be pasted
							OpParamPasteAtPosition Param(pSpread,Centre);

							// Call the paste op via its DoWithParams() funtion
							pOp->Invoke(&Param);
						}
					}
					CATCH_ALL(e)
					{
						if (m_ClipBoardSwapped = FALSE)
						{
//							TRACEUSER( "Markn", _T("Swapping back to clipboard doc (Catch in ScreenCamView::OnDrop())\n"));
							InternalClipboard::Swap();
							ExternalClipboard::UpdateSystemClipboard(TRUE);
						}
						THROW_LAST();
					}
					END_CATCH_ALL
				}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:87,代码来源:scrcamvw.cpp


注:本文中的DocView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。