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


C++ GetDocument函数代码示例

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


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

示例1: WXUNUSED

/// Edit a custom property
void ctConfigToolView::OnEditCustomProperty(wxCommandEvent& WXUNUSED(event))
{
    ctConfigToolDoc* doc = (ctConfigToolDoc*) GetDocument();
    ctConfigItem* sel = GetSelection();
    ctPropertyEditor* editor = wxGetApp().GetMainFrame()->GetPropertyEditor();
    if (doc && sel && editor)
    {
        int row;
        ctProperty* property = editor->FindSelectedProperty(row) ;
        if (property && property->IsCustom())
        {
            wxString oldName = property->GetName();
            wxString oldDescription = property->GetDescription();
            wxString oldType = property->GetVariant().GetType();
            wxString oldEditorType = property->GetEditorType();
            wxArrayString oldChoices = property->GetChoices();

            ctCustomPropertyDialog dialog(wxGetApp().GetMainFrame(),
                wxID_ANY, _("Edit custom property"));
            dialog.SetPropertyName(oldName);
            dialog.SetPropertyType(oldType);
            dialog.SetPropertyDescription(oldDescription);
            if (dialog.ShowModal() == wxID_OK)
            {
                wxString name = dialog.GetPropertyName();
                wxString type = dialog.GetPropertyType();
                wxString editorType = dialog.GetEditorType();
                wxArrayString choices = dialog.GetChoices();
                wxString descr = dialog.GetPropertyDescription();

                if (name != oldName && sel->GetProperties().FindProperty(name))
                {
                    wxMessageBox(_("Sorry, this name already exists."), _T("Add custom property"),
                        wxOK|wxICON_INFORMATION);
                    return;
                }
                if (type != oldType)
                {
                    if (type == wxT("bool"))
                        property->GetVariant() = wxVariant(false, name);
                    else if (type == wxT("double"))
                        property->GetVariant() = wxVariant((double) 0.0, name);
                    else if (type == wxT("long"))
                        property->GetVariant() = wxVariant((long) 0, name);
                    else
                        property->GetVariant() = wxVariant(wxEmptyString, name);
                }
                if (name != oldName)
                    property->GetVariant().SetName(name);

                if (choices != oldChoices)
                    property->SetChoices(choices);

                if (editorType != oldEditorType)
                    property->SetEditorType(editorType);

                if (name != oldName)
                    property->GetVariant().SetName(name);

                property->SetCustom(true);

                if (descr != oldDescription)
                    property->SetDescription(descr);

                editor->ShowItem(sel);
                OnChangeFilename();
            }
        }
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:71,代码来源:configtoolview.cpp

示例2: SkipWhiteSpace

TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
{
	TiXmlNode* returnNode = 0;

	p = SkipWhiteSpace( p, encoding );
	if( !p || !*p || *p != '<' )
	{
		return 0;
	}

	TiXmlDocument* doc = GetDocument();
	p = SkipWhiteSpace( p, encoding );

	if ( !p || !*p )
	{
		return 0;
	}

	// What is this thing? 
	// - Elements start with a letter or underscore, but xml is reserved.
	// - Comments: <!--
	// - Decleration: <?xml
	// - Everthing else is unknown to tinyxml.
	//

	const char* xmlHeader = { "<?xml" };
	const char* commentHeader = { "<!--" };
	const char* dtdHeader = { "<!" };

	if ( StringEqual( p, xmlHeader, true, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Declaration\n" );
		#endif
		returnNode = new TiXmlDeclaration();
	}
	else if ( StringEqual( p, commentHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Comment\n" );
		#endif
		returnNode = new TiXmlComment();
	}
	else if ( StringEqual( p, dtdHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Unknown(1)\n" );
		#endif
		returnNode = new TiXmlUnknown();
	}
	else if (    IsAlpha( *(p+1), encoding )
			  || *(p+1) == '_' )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Element\n" );
		#endif
		returnNode = new TiXmlElement( "" );
	}
	else
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Unknown(2)\n" );
		#endif
		returnNode = new TiXmlUnknown();
	}

	if ( returnNode )
	{
		// Set the parent, so it can report errors
		returnNode->parent = this;
	}
	else
	{
		if ( doc )
			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
	}
	return returnNode;
}
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:78,代码来源:tinyxmlparser.cpp

示例3: ErrorBeep

/*! 指定拡張子のファイルに対応するファイルを開く補助関数

	@date 2003.06.28 Moca ヘッダ・ソースファイルオープン機能のコードを統合
	@date 2008.04.09 ryoji 処理対象(file_ext)と開く対象(open_ext)の扱いが逆になっていたのを修正
*/
BOOL CEditView::OPEN_ExtFromtoExt(
	BOOL			bCheckOnly,		//!< [in] true: チェックのみ行ってファイルは開かない
	BOOL			bBeepWhenMiss,	//!< [in] true: ファイルを開けなかった場合に警告音を出す
	const TCHAR*	file_ext[],		//!< [in] 処理対象とする拡張子
	const TCHAR*	open_ext[],		//!< [in] 開く対象とする拡張子
	int				file_extno,		//!< [in] 処理対象拡張子リストの要素数
	int				open_extno,		//!< [in] 開く対象拡張子リストの要素数
	const TCHAR*	errmes			//!< [in] ファイルを開けなかった場合に表示するエラーメッセージ
)
{
//From Here Feb. 7, 2001 JEPRO 追加
	int		i;
//To Here Feb. 7, 2001

	/* 編集中ファイルの拡張子を調べる */
	for( i = 0; i < file_extno; i++ ){
		if( CheckEXT( GetDocument()->m_cDocFile.GetFilePath(), file_ext[i] ) ){
			goto open_c;
		}
	}
	if( bBeepWhenMiss ){
		ErrorBeep();
	}
	return FALSE;

open_c:;

	TCHAR	szPath[_MAX_PATH];
	TCHAR	szDrive[_MAX_DRIVE];
	TCHAR	szDir[_MAX_DIR];
	TCHAR	szFname[_MAX_FNAME];
	TCHAR	szExt[_MAX_EXT];
	HWND	hwndOwner;

	_tsplitpath( GetDocument()->m_cDocFile.GetFilePath(), szDrive, szDir, szFname, szExt );

	for( i = 0; i < open_extno; i++ ){
		_tmakepath( szPath, szDrive, szDir, szFname, open_ext[i] );
		if( !fexist(szPath) ){
			if( i < open_extno - 1 )
				continue;
			if( bBeepWhenMiss ){
				ErrorBeep();
			}
			return FALSE;
		}
		break;
	}
	if( bCheckOnly ){
		return TRUE;
	}

	/* 指定ファイルが開かれているか調べる */
	/* 開かれている場合は開いているウィンドウのハンドルも返す */
	/* ファイルを開いているか */
	if( CShareData::getInstance()->IsPathOpened( szPath, &hwndOwner ) ){
	}else{
		/* 文字コードはこのファイルに合わせる */
		SLoadInfo sLoadInfo;
		sLoadInfo.cFilePath = szPath;
		sLoadInfo.eCharCode = GetDocument()->GetDocumentEncoding();
		sLoadInfo.bViewMode = false;
		CControlTray::OpenNewEditor(
			G_AppInstance(),
			this->GetHwnd(),
			sLoadInfo,
			NULL,
			true
		);
		/* ファイルを開いているか */
		if( CShareData::getInstance()->IsPathOpened( szPath, &hwndOwner ) ){
		}else{
			// 2011.01.12 ryoji エラーは表示しないでおく
			// ファイルサイズが大きすぎて読むかどうか問い合わせているような場合でもエラー表示になるのは変
			// OpenNewEditor()または起動された側のメッセージ表示で十分と思われる

			//ErrorMessage( this->GetHwnd(), _T("%ts\n\n%ts\n\n"), errmes, szPath );
			return FALSE;
		}
	}
	/* アクティブにする */
	ActivateFrameWindow( hwndOwner );

// 2004/06/21 novice タグジャンプ機能追加
// 2004/07/09 genta/Moca タグジャンプバックの登録が取り除かれていたが、
//            こちらでも従来どおり登録する
	TagJump	tagJump;
	/*
	  カーソル位置変換
	  レイアウト位置(行頭からの表示桁位置、折り返しあり行位置)
	  →
	  物理位置(行頭からのバイト数、折り返し無し行位置)
	*/
	GetDocument()->m_cLayoutMgr.LayoutToLogic(
		GetCaret().GetCaretLayoutPos(),
//.........这里部分代码省略.........
开发者ID:lunaplus,项目名称:sakura-editor-fork,代码行数:101,代码来源:CEditView_Command.cpp

示例4: SkipWhiteSpace

const char* TTiXmlElement::Parse( const char* p, TTiXmlParsingData* data, TTiXmlEncoding encoding )
{
	p = SkipWhiteSpace( p, encoding );
	TTiXmlDocument* document = GetDocument();

	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
		return 0;
	}

	if ( data )
	{
		data->Stamp( p, encoding );
		location = data->Cursor();
	}

	if ( *p != '<' )
	{
		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
		return 0;
	}

	p = SkipWhiteSpace( p+1, encoding );

	// Read the name.
	const char* pErr = p;

    p = ReadName( p, &value, encoding );
	if ( !p || !*p )
	{
		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
		return 0;
	}

    TIXML_STRING endTag ("</");
	endTag += value;

	// Check for and read attributes. Also look for an empty
	// tag or an end tag.
	while ( p && *p )
	{
		pErr = p;
		p = SkipWhiteSpace( p, encoding );
		if ( !p || !*p )
		{
			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
			return 0;
		}
		if ( *p == '/' )
		{
			++p;
			// Empty tag.
			if ( *p  != '>' )
			{
				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );		
				return 0;
			}
			return (p+1);
		}
		else if ( *p == '>' )
		{
			// Done with attributes (if there were any.)
			// Read the value -- which can include other
			// elements -- read the end tag, and return.
			++p;
			p = ReadValue( p, data, encoding );		// Note this is an Element method, and will set the error if one happens.
			if ( !p || !*p ) {
				// We were looking for the end tag, but found nothing.
				// Fix for [ 1663758 ] Failure to report error on bad XML
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}

			// We should find the end tag now
			// note that:
			// </foo > and
			// </foo> 
			// are both valid end tags.
			if ( StringEqual( p, endTag.c_str(), false, encoding ) )
			{
				p += endTag.length();
				p = SkipWhiteSpace( p, encoding );
				if ( p && *p && *p == '>' ) {
					++p;
					return p;
				}
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}
			else
			{
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}
		}
		else
		{
			// Try to read an attribute:
			TTiXmlAttribute* attrib = new TTiXmlAttribute();
//.........这里部分代码省略.........
开发者ID:edison9888,项目名称:LingPinWang,代码行数:101,代码来源:tinyxmlparser.cpp

示例5: SetWindowText

void CResFormView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	//Invalidate (FALSE) ;
	SetWindowText (_T("BLIPPY") );
	CString tempstring ;

	CNewestDoc *cnd = (CNewestDoc *) GetDocument () ;
	CDC *cdc = m_statRimProf.GetDC () ;
	if (cnd->rimprof_npts) MakeProfile () ;
	UpdateData (FALSE) ;

	if (lHint == 17) CleanUp () ;

	if (cnd->Centerflag) {
		m_strLocationString.Format ("Crater : \t%s\r\nX : %5d    \t\tY : %5d\r\nLon : %8.4f   \tLat : %7.4f\r\n",
			cnd->cratername, cnd->center.x, cnd->center.y, cnd->center_lon, 
			cnd->center_lat) ;
		tempstring.Format ("Pixel Dimension (m) : \t%9.1f\r\nPixel Area  (m2) : \t%9.0f\r\n", 
			cnd->pixdim_avg, cnd->pixsize) ;
		m_strLocationString += tempstring ;
	}

	if (cnd->SFitflag) {
		m_strSurftext.Format ("UNAFFECTED SURFACE FITTING\r\nNumber of Tiepoints : \t\t%5d\r\n",
			cnd->nTiepts) ;
		tempstring.Format ("Tiepts Resids Std Deviation : \t%9.1f\r\nTiepts R2 :  \t\t\t%5.2f \r\n",
			cnd->tiepts_stdev, cnd->tiepts_r2)   ;
		m_strSurftext += tempstring ;
	}

	if (cnd->Rimflag ) {
		m_strCratRim.Format ("CRATER STATISTICS\r\nApprox. Diam (km) : \t\t%9.1f\r\nMax Depth : \t\t\t%9.1f\r\nAvg Depth :\t\t\t%9.1f\r\nMed Depth : \t\t\t%9.1f\r\n",
			cnd->ctr_diam / 1.E3, -cnd->ctr_max_depth_all, -cnd->ctr_ave_depth_all, -cnd->ctr_median_depth) ;
		
		tempstring.Format ("Total Area (km2): \t\t%9.1f\r\nVol (only pxls below) (km3):\t%9.1f\r\n", 
			cnd->ctr_area * cnd->pixsize / 1.E6, cnd->ctr_vol * cnd->pixsize / 1.E9) ;
		m_strCratRim += tempstring ;


		tempstring.Format ("\r\nRIM PROFILE STATISTICS\r\nMax Height (m):  \t\t%9.1f\r\n",
			cnd->rimprof_max) ;

		m_strCratRim += tempstring ;
		tempstring.Format ("Avg Height : \t\t\t%9.1f\r\nMed Height : \t\t\t%9.1f\r\nAvg Height to Crater Max Depth :  %9.1f\r\nAvg Height to Crater Avg Depth :  %9.1f\r\n", 
			cnd->rimprof_avg, cnd->rimprof_med, cnd->rimprof_avg - cnd->ctr_max_depth_all, cnd->rimprof_avg - cnd->ctr_ave_depth_all) ;
		m_strCratRim += tempstring ;
	}

	if (cnd->RimInnerflag) {
		tempstring.Format ("\r\nRIM VOLUME STATISTICS\r\nArea (km2):   \t\t\t%9.1f\r\nVolume (km3):  \t\t\t%9.1f\r\n",
			cnd->rim_npix * cnd->pixsize / 1.E6, cnd->rim_vol * cnd->pixsize / 1.E9) ;
		m_strCratRim += tempstring ;
		
	}


	if (cnd->Innerflag) {
		m_strInner.Format ("INNER LOBE STATISTICS\r\nMax Thickness : \t%9.1f\r\n",
			cnd->inner_max) ;
		tempstring.Format ("Avg Thickness  : \t%9.1f\r\nMed Thickness : \t%9.1f\r\n",
			cnd->inner_avg, cnd->inner_median) ;
		m_strInner += tempstring ;
		tempstring.Format ("Area (km2) :\t\t%9.1f\r\nVolume (km3) :\t\t%9.1f\r\n", cnd->inner_npix_all * cnd->pixsize / 1.E6,
			cnd->inner_vol * cnd->pixsize / 1.E9) ;
		m_strInner += tempstring ;
	}
	if (cnd->Outerflag ) {
		m_strOuter.Format ("OUTER LOBE STATISTICS\r\nMax Thickness : \t%9.1f\r\n",
			cnd->outer_max) ;
		tempstring.Format ("Avg Thickness  : \t%9.1f\r\nMed Thickness  : \t%9.1f\r\n",
			cnd->outer_avg, cnd->outer_median) ;
		m_strOuter += tempstring ;
		tempstring.Format ("Area (km2) :\t\t%9.1f\r\nVolume (km3) :\t\t%9.1f\r\n", cnd->outer_npix_all * cnd->pixsize / 1.E6,
			cnd->outer_vol * cnd->pixsize / 1.E9) ;
		m_strOuter += tempstring ;
	}



	Invalidate (FALSE) ;
}
开发者ID:hgarbeil,项目名称:Impact,代码行数:82,代码来源:ResFormView1.cpp

示例6: Pix2Time

void
MFCArrangeView::EditorContextMenu(CPoint &point, UINT nFlags)
{
	Time	at_time;
//	short	at_note = Pix2Note(point.y);
	Pix2Time(point.x, at_time);

	CPoint		popPt = point;
	ClientToScreen(&popPt);

	CMenu		*ctxtMenu = new CMenu;
	ctxtMenu->CreatePopupMenu();
	short	i=0;
	char	buf[128];
	short	hitType;
	void	*hitIt=NULL;
	CPoint	itPt = point;
	itPt += GetScrollPosition();

	MFCInstanceView		*instv=NULL;
	Instance			*inst=NULL;
	MFCEditorItemView	*iv=NULL;
	long				nEnvelope=0;
	bool				add_dflt_items = true;
	bool				added_items = false;
	vector<Envelope *> envelopes;
	if ((instv= InstanceViewAtPoint(itPt))!=NULL) {
		add_dflt_items = true;
		added_items = true;
		inst = instv->instance;
		if (inst) {
			CMenu		*envMenu = new CMenu;
			envMenu->CreatePopupMenu();

			envelopes = quaLink->ListEnvelopesFor(inst->sym);
			nEnvelope = envelopes.size();
			string buf =  "Envelopes for '" + inst->sym->name + "'";
			ctxtMenu->AppendMenu(MF_POPUP, (UINT) envMenu->m_hMenu, buf.c_str());
//			for each variable
//				envMenu->AppendMenu(MF_STRING, ID_EDIT_SHOW_ENVELOPE, variable name);
//					tick state
		}
	} else if ((iv  = ItemViewAtPoint(itPt, nFlags|MK_CONTROL, hitType, hitIt)) != NULL) {
		if (iv->type == MFCEditorItemView::LIST) {
		} else if (iv->type == MFCEditorItemView::DISCRETE) {
		} else if (iv->type == MFCEditorItemView::CLIP) {
			add_dflt_items = true;
			added_items = true;
			MFCClipItemView	*civ = (MFCClipItemView*)iv;
			Clip	*c = civ->item;
			bool	ismark = false;
			if (c && c->duration.ticks <= 0) {
				ismark = true;
			}
			ctxtMenu->AppendMenu(MF_STRING, ID_EDITORCONTEXT_DEL_CLIP, ismark? "Delete Marker":"Delete Region");
		} else if (iv->type == MFCEditorItemView::ENV) {
		} else {
		}
	}

	if (add_dflt_items) { // run with the default menu
		if (added_items) {
			ctxtMenu->AppendMenu(MF_SEPARATOR);
		}
		ctxtMenu->AppendMenu(MF_STRING, ID_EDIT_ADD_CLIP, "Add Region");
		ctxtMenu->AppendMenu(MF_STRING, ID_EDIT_ADD_MARKER, "Add Marker");
	}

	short ret = ctxtMenu->TrackPopupMenuEx(
						TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RETURNCMD,
						popPt.x, popPt.y, this, NULL);
	delete ctxtMenu;
	if (ret == 0) {	// cancel
		return;
	}

	CQuaMFCDoc	*qdoc = (CQuaMFCDoc *)GetDocument();
	if (qdoc == NULL) {
		fprintf(stderr, "menu item track finds null doc");
		return;
	} else if (qdoc->qua == NULL) {
		fprintf(stderr, "menu item track finds null sequencer");
	}
	if (ret == ID_EDIT_ADD_CLIP || ret == ID_EDIT_ADD_MARKER) {
		StabEnt	*qSym = qdoc->qua->sym;
		if (qSym) {
			Time	dur_time;
			string nm;
			if (ret == ID_EDIT_ADD_CLIP) {
				dur_time.Set(1,0,0,at_time.metric);
				nm = glob.makeUniqueName(qSym, "region", 1);
			} else {
				dur_time.ticks = 0;
				nm = glob.makeUniqueName(qSym, "marker", 1);
			}
			Clip	*c = qdoc->qua->addClip(nm, at_time, dur_time, true);
//			MFCEditorItemView	*added_item = AddClipItemView(c);
		}
	} else if (ret == ID_EDITORCONTEXT_DEL_CLIP || ret == ID_EDITORCONTEXT_DEL_MARKER) {
		StabEnt	*qSym = qdoc->qua->sym;
//.........这里部分代码省略.........
开发者ID:dakyri,项目名称:qua,代码行数:101,代码来源:MFCArrangeView.cpp

示例7: ASSERT_VALID_IDR

BOOL CView::DoPrintPreview(UINT nIDResource, CView* pPrintView,
	CRuntimeClass* pPreviewViewClass, CPrintPreviewState* pState)
{
	ASSERT_VALID_IDR(nIDResource);
	ASSERT_VALID(pPrintView);
	ASSERT(pPreviewViewClass != NULL);
	ASSERT(pPreviewViewClass->IsDerivedFrom(RUNTIME_CLASS(CPreviewView)));
	ASSERT(pState != NULL);

	CFrameWnd* pParent = (CFrameWnd*)AfxGetThread()->m_pMainWnd;
	ASSERT_VALID(pParent);
	ASSERT_KINDOF(CFrameWnd, pParent);

	CCreateContext context;
	context.m_pCurrentFrame = pParent;
	context.m_pCurrentDoc = GetDocument();
	context.m_pLastView = this;

	// Create the preview view object
	CPreviewView* pView = (CPreviewView*)pPreviewViewClass->CreateObject();
	if (pView == NULL)
	{
		TRACE0("Error: Failed to create preview view.\n");
		return FALSE;
	}
	ASSERT_KINDOF(CPreviewView, pView);
	pView->m_pPreviewState = pState;        // save pointer

	pParent->OnSetPreviewMode(TRUE, pState);    // Take over Frame Window

#ifdef _MAC
	if (nIDResource == AFX_IDD_PREVIEW_TOOLBAR)
	{
		HINSTANCE hInst = AfxFindResourceHandle(
			MAKEINTRESOURCE(AFX_IDD_PREVIEW_TOOLBAR), RT_DIALOG);
		HRSRC hResource = FindResource(hInst,
			MAKEINTRESOURCE(AFX_IDD_PREVIEW_TOOLBAR), RT_DIALOG);

		HGLOBAL hdt = NULL;
		if (hResource != NULL)
			hdt = LoadResource(hInst, hResource);

		DLGTEMPLATE* pdt = NULL;
		if (hdt != NULL)
			pdt = (DLGTEMPLATE*)LockResource(hdt);

		if (pdt != NULL)
		{
			CRect rectParent;
			pParent->GetClientRect(&rectParent);

			int cxToolbar = MulDiv(LOWORD(GetDialogBaseUnits()), pdt->cx, 4);

			if (cxToolbar > rectParent.Width())
				nIDResource = AFX_IDD_PREVIEW_SHORTTOOLBAR;

			UnlockResource(hdt);
			FreeResource(hdt);
		}
	}
#endif

	// Create the toolbar from the dialog resource
	pView->m_pToolBar = new CDialogBar;
	if (!pView->m_pToolBar->Create(pParent, MAKEINTRESOURCE(nIDResource),
		CBRS_TOP, AFX_IDW_PREVIEW_BAR))
	{
		TRACE0("Error: Preview could not create toolbar dialog.\n");
		pParent->OnSetPreviewMode(FALSE, pState);   // restore Frame Window
		delete pView->m_pToolBar;       // not autodestruct yet
		pView->m_pToolBar = NULL;
		pView->m_pPreviewState = NULL;  // do not delete state structure
		delete pView;
		return FALSE;
	}
	pView->m_pToolBar->m_bAutoDelete = TRUE;    // automatic cleanup

	// Create the preview view as a child of the App Main Window.  This
	// is a sibling of this view if this is an SDI app.  This is NOT a sibling
	// if this is an MDI app.

	if (!pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0,0,0,0), pParent, AFX_IDW_PANE_FIRST, &context))
	{
		TRACE0("Error: couldn't create preview view for frame.\n");
		pParent->OnSetPreviewMode(FALSE, pState);   // restore Frame Window
		pView->m_pPreviewState = NULL;  // do not delete state structure
		delete pView;
		return FALSE;
	}

	// Preview window shown now

	pState->pViewActiveOld = pParent->GetActiveView();
	CView* pActiveView = pParent->GetActiveFrame()->GetActiveView();
	if (pActiveView != NULL)
		pActiveView->OnActivateView(FALSE, pActiveView, pActiveView);

	if (!pView->SetPrintView(pPrintView))
	{
//.........这里部分代码省略.........
开发者ID:rickerliang,项目名称:OpenNT,代码行数:101,代码来源:viewprev.cpp

示例8: WXUNUSED

/// Command Events
///< This code demonstrates how to parse a loaded Power Tab document
///< You could also load a document directly using Load
void PowerTabView::OnTestParseFile(wxCommandEvent& event)
{
    // Menu Test -> Parse File
    //------Last Checked------//
    // - Jan 25, 2005
    WXUNUSED(event);
    
    // Get the active document
    PowerTabDocument* document = (PowerTabDocument*)GetDocument();
    wxCHECK2(document != NULL, return);
    
    wxLongLong startTime = ::wxGetLocalTimeMillis();
    
    // Get the header
    PowerTabFileHeader& header = document->GetHeaderRef();
    
    // File version that the file was saved as; the document automatically
    // converts to the latest version during deserialization
    wxWord version = header.GetVersion();

    // In Power Tab Editor v1.7, most of the header data is accessable via the Song Property Sheet:
    // Menu View -> File Information
    // Menu View -> Performance Notes
    // Menu View -> Lyrics
    
    // File is a song
    if (header.IsSong())
    {              
        wxByte contentType = header.GetSongContentType();
        wxString title = header.GetSongTitle();
        wxString artist = header.GetSongArtist();
        
        wxByte releaseType = header.GetSongReleaseType();

        // Audio release     
        if (releaseType == PowerTabFileHeader::RELEASETYPE_PUBLIC_AUDIO)
        {
            wxByte releaseType = header.GetSongAudioReleaseType();
            wxString releaseTitle = header.GetSongAudioReleaseTitle();
            wxWord year = header.GetSongAudioReleaseYear();
            bool live = header.IsSongAudioReleaseLive();
        }
        // Video release
        else if (releaseType == PowerTabFileHeader::RELEASETYPE_PUBLIC_VIDEO)
        {
            wxString releaseTitle = header.GetSongVideoReleaseTitle();
            bool live = header.IsSongVideoReleaseLive();
        }
        // Bootleg
        else if (releaseType == PowerTabFileHeader::RELEASETYPE_BOOTLEG)
        {
            wxString releaseTitle = header.GetSongBootlegTitle();
            wxDateTime bootlegDate = header.GetSongBootlegDate();
        }
        // Not released
        else if (releaseType == PowerTabFileHeader::RELEASETYPE_NOTRELEASED)
        {
            // no extra data for this data
        }
                        
        // If author is known, get the composer and lyricist; otherwise, song is traditional
        if (header.GetSongAuthorType() == PowerTabFileHeader::AUTHORTYPE_AUTHORKNOWN)
        {
            wxString composer = header.GetSongComposer();
            wxString lyricist = header.GetSongLyricist();
        }
        
        wxString arranger = header.GetSongArranger();
        
        wxString guitarScoreTranscriber = header.GetSongGuitarScoreTranscriber();
        wxString bassScoreTranscriber = header.GetSongBassScoreTranscriber();
        
        wxString copyright = header.GetSongCopyright();
                   
        wxString lyrics = header.GetSongLyrics();
        
        wxString guitarScoreNotes = header.GetSongGuitarScoreNotes();
        wxString bassScoreNotes = header.GetSongBassScoreNotes();
    }
    // File is a lesson
    else if (header.IsLesson())
    {
        wxString title = header.GetLessonTitle();
        wxString subtitle = header.GetLessonSubtitle();
        wxWord musicStyle = header.GetLessonMusicStyle();
        wxByte level = header.GetLessonLevel();
        wxString author = header.GetLessonAuthor();
        wxString notes = header.GetLessonNotes();
        wxString copyright = header.GetLessonCopyright();
    }
    
    wxUint8 scoreIndex = 0;
    // There are two scores in each document:
    // 1) Guitar score
    // 2) Bass score
    for (; scoreIndex < 2; scoreIndex++)
    {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:ptparser-svn,代码行数:101,代码来源:powertabview.cpp

示例9: OnUpdate

void ReportSagittal::OnUpdate(CView* aSenderPtr,LPARAM aHint,CObject* aHintPtr)
{
    C_Hom_Doc *lDocPtr = (C_Hom_Doc*)GetDocument();
    //Analysis &lResults = lDocPtr->getResultsRef();

    // Fill in measurement units text
//    Force temp(0.0F,0);
    mCompressionLabel = CString("") + "Total Compression (" + lDocPtr->ForceUnits() + "):";
    mShearLabel = CString("") + "Total Shear (" + lDocPtr->ForceUnits() + "):";

    // Get sagittal low back analysis results
    //LowBackSagittalData sagittal;
    //lResults.getLowBackSagittal(&sagittal);
	const LowBackSagittalData_s& sagittal = lDocPtr->GetSkeleton()->getLowBackSagittalData();

    // Write results to the form controls, converting to the desired system of units in the process
	const int NUM_DATUM = 12;
    CString* reported[] = {&mTotalCompression,&mTotalCompressionSD,&mErectorSpinae,&mErectorSpinaeSD,&mRectusAbdominus,
                           &mRectusAbdominusSD,&mAbdominal,&mCompressionHandLoads,&mCompressionBodyWeight,&mTotalShear,
                           &mSagittal,&mFrontal};
	double data[] = {sagittal.cmpTotal, sagittal.cmpTotalSD, sagittal.cmpSpinae, sagittal.cmpSpinaeSD, sagittal.cmpAbdominus,
					sagittal.cmpAbdominusSD, sagittal.cmpAbdominal, sagittal.cmpHandLoads, sagittal.cmpUpperBody, sagittal.shrTotal,
					sagittal.shrSagittal, sagittal.shrFrontal};
    for(int i = 0; i < NUM_DATUM; ++i)
    {
		(*(reported[i])).Format("%.0f", data[i]);
        //temp.Value(*((double*)&sagittal + i), MetricCns); // + 2 to pass by total compression / stddev
		//temp.Value(data[i], MetricCns);
        //*(reported[i]) = temp.ValueText();
    }
    mStrain.Format("%.0f",sagittal.ligamentStrain);

    // Add +/- to the standard deviations
    mTotalCompressionSD = "+/- " + mTotalCompressionSD;
    mErectorSpinaeSD = "+/- " + mErectorSpinaeSD;
    mRectusAbdominusSD = "+/- " + mRectusAbdominusSD;

	mHeader = lDocPtr->ReportHeader();
    mFooter = lDocPtr->ReportFooter();
       
    UpdateData( FALSE );

	UpdateUnits();

	Skeleton &lSkeleton = *lDocPtr->GetSkeleton();

	mHandForceTxtLVal.Format("%.1f", lSkeleton.getExtForce(JT_LHAND).length());
	mHandForceTxtRVal.Format("%.1f", lSkeleton.getExtForce(JT_RHAND).length());

	Vector3 offsetCoordinate = lDocPtr->getOffset();

	Vector3 LHand = lSkeleton.getJoint(JT_LHAND);

    mLeftHori.Format("%.1f", (LHand[1] -  offsetCoordinate[1]));
	mLeftLat.Format("%.1f", (LHand[0] - offsetCoordinate[0]));
	mLeftVert.Format("%.1f", (LHand[2] - offsetCoordinate[2]));


	Vector3 RHand = lSkeleton.getJoint(JT_RHAND);

	mRightHori.Format("%.1f", (RHand[1]  - offsetCoordinate[1]));
	mRightLat.Format("%.1f", (RHand[0] - offsetCoordinate[0]));
	mRightVert.Format("%.1f", (RHand[2] - offsetCoordinate[2]));
}
开发者ID:fabulousfeng,项目名称:3DSSPP,代码行数:64,代码来源:ReportSagittal.cpp

示例10: SetScrollSizes

void CMatchView1::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CvSize dstsize;
	IplImage* tempimg;
	CString outmsg;
	pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;//得到主窗口指针
	CMatchDoc* pDoc=GetDocument();
	if(pDoc->isenlarge)
	{
		if(pDoc->scale1-2.8<1e-6)
		{
			pDoc->scale1+=0.2;
			//使Scrollbar符合图像大小
			if(pDoc->IMG1OPEN)
				SetScrollSizes(MM_TEXT,CSize(pDoc->m_imgsize2.width*pDoc->scale1,pDoc->m_imgsize2.height*pDoc->scale1));
			
			//保证每次创建的显示图像内存大小与待打开图像大小一致
			m_frame2.Create(pDoc->m_imgsize2.width*pDoc->scale1,pDoc->m_imgsize2.height*pDoc->scale1,24);
			
			//填充显示图像内存区域
			if(pDoc->IMG1OPEN)
			{
				ShownImage2=m_frame2.GetImage();
				//	cvSetImageROI(ShownImage1,cvRect(0,0,pDoc->m_imgsize1.width*pDoc->scale,pDoc->m_imgsize1.height*pDoc->scale));
				dstsize.width=pDoc->m_imgsize2.width*pDoc->scale1;
				dstsize.height=pDoc->m_imgsize2.height*pDoc->scale1;
				tempimg=cvCreateImage(dstsize,pDoc->srcImg2->depth,pDoc->srcImg2->nChannels);
				cvResize(pDoc->showImg2,tempimg,0);
				cvCopy(tempimg,ShownImage2);
				outmsg.Format(">>图像2大小增大至%d*%d",tempimg->width,tempimg->height);	
			}
			else
				outmsg=">>没有打开图像2,不能增大";
		}
		else
			outmsg=">>图像2不能继续增大";
		pFrame->m_listbox.SetTextColor(pDoc->crTextColor1);
		pFrame->m_listbox.InsertItem(0,outmsg);
	}
	else if(pDoc->isreduce)
	{
		if(pDoc->scale1-0.2>1e-6)
		{
			pDoc->scale1-=0.2;
			//使Scrollbar符合图像大小
			if(pDoc->IMG1OPEN)
				SetScrollSizes(MM_TEXT,CSize(pDoc->m_imgsize2.width*pDoc->scale1,pDoc->m_imgsize2.height*pDoc->scale1));
			
			//保证每次创建的显示图像内存大小与待打开图像大小一致
			m_frame2.Create(pDoc->m_imgsize2.width*pDoc->scale1,pDoc->m_imgsize2.height*pDoc->scale1,24);
			
			//填充显示图像内存区域
			if(pDoc->IMG1OPEN)
			{
				ShownImage2=m_frame2.GetImage();
				//	cvSetImageROI(ShownImage1,cvRect(0,0,pDoc->m_imgsize1.width*pDoc->scale,pDoc->m_imgsize1.height*pDoc->scale));
				dstsize.width=pDoc->m_imgsize2.width*pDoc->scale1;
				dstsize.height=pDoc->m_imgsize2.height*pDoc->scale1;
				tempimg=cvCreateImage(dstsize,pDoc->srcImg2->depth,pDoc->srcImg2->nChannels);
				cvResize(pDoc->showImg2,tempimg,0);
				cvCopy(tempimg,ShownImage2);
				outmsg.Format(">>图像2大小减小至%d*%d",tempimg->width,tempimg->height);	
			}
			else
				outmsg=">>没有打开图像2,不能减小";
		}
		else
			outmsg=">>图像2不能继续减小";
		pFrame->m_listbox.SetTextColor(pDoc->crTextColor1);
		pFrame->m_listbox.InsertItem(0,outmsg);
	}
	if(pDoc->isdeletefeas1)
	{
		int nIn; //定义一个鼠标的点击值;
		nIn=GetDocument()->m_rectTracker1.HitTest(point); //看看点到了哪了
		if(nIn<0)  //不在四边形区域内;
		{
		}
		else 
			//在四边形区域内:
		{
			// Track()是CRectTracker中最富魅力的函数。它时时的改变调用者的m_rect;
			GetDocument()->m_rectTracker1.Track(this,point,TRUE);
			CClientDC dc(this);
			pDoc->m_rect2=pDoc->m_rectTracker1.m_rect;
			OnPrepareDC(&dc);
			dc.DPtoLP(&pDoc->m_rect2);
			//GetDocument()->m_rectTracker.Draw(&dc);
			bDraw=TRUE;
		}
	}
	Invalidate(true);
	CScrollView::OnLButtonDown(nFlags, point);
}
开发者ID:ahmadsl,项目名称:imagematch,代码行数:95,代码来源:MatchView1.cpp

示例11: GetDocument

void CAutoExeView::OnDraw(CDC* pDC)
{
	CAutoExeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}
开发者ID:dekai-wang,项目名称:TestCode,代码行数:6,代码来源:AutoExeView.cpp

示例12: GetDocument

/// Add a custom property: update event
void ctConfigToolView::OnUpdateAddCustomProperty(wxUpdateUIEvent& event)
{
    ctConfigToolDoc* doc = (ctConfigToolDoc*) GetDocument();
    event.Enable( doc && GetSelection() && GetSelection()->GetParent() );
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:6,代码来源:configtoolview.cpp

示例13: STRING_T

/**
	@brief	call back function
	@author	HumKyung
	@date	2011.01.05
	@param
	@return
*/
void CBusToBusView::OnBnClickedSave()
{
	CELoadDocData& docData = CELoadDocData::GetInstance();
	const STRING_T sProjectMDBFilePath = docData.GetProjectMDBFilePath();
	/// MDB CONNECT
	CADODB adoDB;
	const STRING_T sDBPath = STRING_T(PROVIDER) + _T("Data Source=") + sProjectMDBFilePath  + DB_PASSWORD;
	if(TRUE == adoDB.DBConnect(sDBPath))
	{
		list<CELoadItem*> TrItemList;
		docData.GetELoadItemListOf(TrItemList , CTransformerItem::TypeString());

		const int iRowCount = m_wndGridCtrl.GetRowCount();
		for(int i = 1;i < iRowCount;++i)
		{
			CString sFromBus = m_wndGridCtrl.GetItemText(i , 1);
			CString sToBus   = m_wndGridCtrl.GetItemText(i , 2);
			if(sFromBus.IsEmpty() || sToBus.IsEmpty()) continue;

			CBusItem* pFromBus = (CBusItem*)(docData.FindItemByName(CBusItem::TypeString() , sFromBus.operator LPCSTR()));
			CBusItem* pToBus = (CBusItem*)(docData.FindItemByName(CBusItem::TypeString() , sToBus.operator LPCSTR()));

			CTransformerItem* pTrItem = (CTransformerItem*)(m_wndGridCtrl.GetItemData(i , 0));
			if(pTrItem)
			{
				pTrItem->prop()->SetValue(_T("From") , _T("Bus Id") , sFromBus.operator LPCSTR());
				pTrItem->prop()->SetValue(_T("To") , _T("Bus Id") , sToBus.operator LPCSTR());

				/// remove transformer item from list
				list<CELoadItem*>::iterator where = find(TrItemList.begin() , TrItemList.end() , pTrItem);
				if(where != TrItemList.end()) TrItemList.erase(where);
			}
			else
			{
				/// create a tranformer and insert a transformer record.
				pTrItem = static_cast<CTransformerItem*>(docData.CreateELoadItemOf(CTransformerItem::TypeString()));
				if(pTrItem)
				{
					const string sName(string(_T("DEL ")) + sFromBus.operator LPCSTR() + string(_T("_")) + sToBus.operator LPCSTR());
					pTrItem->SetName(sName);
					pTrItem->prop()->SetValue(_T("From") , _T("Bus Id") , sFromBus.operator LPCSTR());
					pTrItem->prop()->SetValue(_T("To") , _T("Bus Id") , sToBus.operator LPCSTR());

					CELoadItem* pFrom = docData.FindItemByName(CBusItem::TypeString() , sFromBus.operator LPCSTR());
					if(pFrom)
					{
						string sValue = pFrom->prop()->GetValue(_T("General") , _T("Bus Voltage"));
						pTrItem->prop()->SetValue(_T("From") , _T("Bus Volt") , sValue);
						sValue = pFrom->prop()->GetValue(_T("General") , _T("Load Voltage"));
						pTrItem->prop()->SetValue(_T("From") , _T("Load Volt") , sValue);
					}
					CELoadItem* pTo = docData.FindItemByName(CBusItem::TypeString() , sToBus.operator LPCSTR());
					if(pTo)
					{
						string sValue = pFrom->prop()->GetValue(_T("General") , _T("Bus Voltage"));
						pTrItem->prop()->SetValue(_T("To") , _T("Bus Volt") , sValue);
						sValue = pFrom->prop()->GetValue(_T("General") , _T("Load Voltage"));
						pTrItem->prop()->SetValue(_T("To") , _T("Load Volt") , sValue);
					}

					const double dCapacity = pTrItem->CalculateCapacity();
					stringstream oss;
					oss << dCapacity;
					pTrItem->prop()->SetValue(_T("Capacity") , _T("Calculated Capacity") , oss.str());
					pTrItem->prop()->SetValue(_T("Capacity") , _T("Selected Capacity") , _T("0"));

					m_wndGridCtrl.SetItemData(i , 0 , LPARAM(pTrItem));
				}
			}
			if(pTrItem) pTrItem->SaveData(adoDB , CTransformerItem::TableName());
		}

		/// delete database record which's item is deleted
		for(list<CELoadItem*>::iterator itr = TrItemList.begin();itr != TrItemList.end();++itr)
		{
			CTransformerItem* pTrItem = (CTransformerItem*)(*itr);
			if(0 != pTrItem->GetName().find(_T("DEL "))) continue;

			/// delete transformer record from table
			const string sSql = _T("DELETE * FROM ") + CTransformerItem::TableName() + _T(" WHERE C_ID='") + string(pTrItem->id()) + _T("'");
			adoDB.ExecuteQuery(sSql.c_str());

			pTrItem->SetDeleteFlag(true);
		}

		adoDB.DBDisConnect();
		GetDocument()->SetModifiedFlag(FALSE);	/// 2014.04.04 added by humkyung
	}

	CELOADApp* pApp = (CELOADApp*)AfxGetApp();
	if(pApp) pApp->OpenNewDocumentIfNeed(CBusItem::TypeString());

	AfxMessageBox(_T("Save is done."));
//.........这里部分代码省略.........
开发者ID:radtek,项目名称:e-load,代码行数:101,代码来源:BusToBusView.cpp

示例14: GetDocument

void CTextView::OnDraw(CDC*)
{
	CTextDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
}
开发者ID:StephenVivash,项目名称:Yijing,代码行数:5,代码来源:TextView.cpp

示例15: GetDocument

void CGoIO_consoleView::OnDraw(CDC* pDC)
{
	CGoIO_consoleDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}
开发者ID:VijayKrishn,项目名称:sensor-projects,代码行数:6,代码来源:GoIO_consoleView.cpp


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