Example #1
0
BOOL CFileView::CloseSkinFile(CString& strPath)
{
	CDocument* pDoc = FindSkinFile(strPath);
	if(pDoc == NULL)
		return FALSE;

	pDoc->OnCloseDocument();

	return TRUE;
}
void SECEditView::UpdateViews(CWnd* pSender, LPARAM lHint, CObject* pHint)
{
	// This is declared in SECEditCore.h because many OE functions
	// Update the view. The default implementation does nothing
	// and is called for SECEditCtrl derivatives. This is called
	// for SECEditView derivatives
	CDocument* pDoc = GetDocument();
	if (pDoc)
		pDoc->UpdateAllViews((CView*)pSender, lHint, pHint);
}
Example #3
0
void CInstrument::InstrumentChanged() const
{
	// Set modified flag
	CFrameWnd *pFrameWnd = dynamic_cast<CFrameWnd*>(AfxGetMainWnd());
	if (pFrameWnd != NULL) {
		CDocument *pDoc = pFrameWnd->GetActiveDocument();
		if (pDoc != NULL)
			pDoc->SetModifiedFlag();
	}
}
LPDISPATCH CMUSHclientDoc::Open(LPCTSTR FileName) 
{

//CDocument * pDoc = App.m_pWorldDocTemplate->OpenDocumentFile (FileName);
CDocument * pDoc = App.OpenDocumentFile (FileName);

  if (pDoc)
      return pDoc->GetIDispatch (TRUE);

	return NULL;
}   // end of CMUSHclientDoc::Open
Example #5
0
void CDocTemplate::OnIdle()
{
	POSITION pos = GetFirstDocPosition();
	while (pos != NULL)
	{
		CDocument* pDoc = GetNextDoc(pos);
		ASSERT_VALID(pDoc);
		ASSERT_KINDOF(CDocument, pDoc);
		pDoc->OnIdle();
	}
}
void CXTPShellListView::OnDblclk(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
	int iIndex = GetDoubleClickedItem();
	if (iIndex >= 0)
	{
		CDocument* pDoc = GetDocument();
		pDoc->UpdateAllViews(this, SHN_XTP_SELECTCHILD,
			(CObject*)GetListCtrl().GetItemData(iIndex));
	}
	*pResult = 0;
}
Example #7
0
HMENU COleIPFrameWnd::GetInPlaceMenu()
{
	// get active document associated with this frame window
	CDocument* pDoc = GetActiveDocument();
	ASSERT_VALID(pDoc);

	// get in-place menu from the doc template
	CDocTemplate* pTemplate = pDoc->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	return pTemplate->m_hMenuInPlaceServer;
}
Example #8
0
BOOL CDocTemplate::SaveAllModified()
{
	POSITION pos = GetFirstDocPosition();
	while (pos != NULL)
	{
		CDocument* pDoc = GetNextDoc(pos);
		if (!pDoc->SaveModified())
			return FALSE;
	}
	return TRUE;
}
Example #9
0
void test_parser() {
	std::string page("<h1><a>wrong link</a><a class=\"special\"\\>some link</a></h1>");
	CDocument doc;
	doc.parse(page.c_str());

	CSelection c = doc.find("h1 a.special");
	CNode node = c.nodeAt(0);
	printf("Node: %s\n", node.text().c_str());
	std::string content = page.substr(node.startPos(), node.endPos()-node.startPos());
	printf("Node: %s\n", content.c_str());
}
Example #10
0
// @pymethod int|PyCDocument|IsModified|Return a flag indicating if the document has been modified.
PyObject *
ui_doc_is_modified(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,IsModified);
	GUI_BGN_SAVE;
	int rc = pDoc->IsModified();
	GUI_END_SAVE;
	return Py_BuildValue("i", rc); // @pyseemfc CDocument|IsModified
}
Example #11
0
// @pymethod string|PyCDocument|GetTitle|Returns the title of the current document.
// This will often be the file name portion of the path name.
PyObject *
ui_doc_get_title(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetTitle);
	GUI_BGN_SAVE;
	CString path = pDoc->GetTitle(); // @pyseemfc CDocument|GetTitle
	GUI_END_SAVE;
	return PyWinObject_FromTCHAR(path);
}
Example #12
0
int OpenPocket(   const vector<CRossPocketItem>& UnitNos,
			  CString    Title) 
{

	CDocTemplate* tmpl = GetRossPocketTemplate();;

	CDocument* pDocument = tmpl->CreateNewDocument();

	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return false;
	}

    ASSERT_VALID(pDocument);

	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = tmpl->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = TRUE;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return FALSE;
	};

	ASSERT_VALID(pFrame);

	pDocument->SetPathName(CString("An entry subset by  ")+Title);
	

	// open an existing document
	tmpl->InitialUpdateFrame(pFrame, pDocument, TRUE);

	POSITION pos =  pDocument->GetFirstViewPosition();
	CPocketForm* V = (CPocketForm*)(pDocument->GetNextView(pos));
	V->m_PocketItems = UnitNos;
    V->m_WordList.InsertColumn(1,"Словарный вход", LVCFMT_LEFT, 200);
	V->m_WordList.InsertColumn(2,"Номер значения", LVCFMT_LEFT, 60);
	V->m_WordList.InsertColumn(2,"Название словаря", LVCFMT_LEFT, 60);
	V->m_WordList.SetItemCountEx(UnitNos.size());
	V->m_UnitsSize.Format ("Число словарных входов : %i",    V->m_WordList.GetItemCount());
    V->UpdateData(FALSE);
    V->m_WordList.UpdateData(FALSE);
    V->m_WordList.Invalidate();	
	V->m_Title = Title;

	// установка размеров
	V->GetParent()->SetWindowPos(NULL, 0,0, 535 , 500, SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOMOVE);
	return true;
};
Example #13
0
void OleDocRoot::SetTitle(LPCTSTR lpszTitle)
  {
  CString s(lpszTitle);
  CDocTemplate* pTempl = GetDocTemplate();
  if (pTempl)
    {
    flag Found = True;
    while (Found)
      {
      Found = False;
      POSITION Pos = pTempl->GetFirstDocPosition();
      while (Pos && !Found)
        {
        CDocument * pDoc = pTempl->GetNextDoc(Pos);
        if (pDoc!=this)
          {
          CString Title = pDoc->GetTitle();
          if (Title.GetLength()==s.GetLength() && _stricmp((const char*)s, (const char*)Title)==0)
            Found = True;
          }
        }
      if (Found)
        {
        CString Ext = "";
        int DotPos = s.ReverseFind('.');
        if (DotPos>=0)
          {
          Ext = s.Mid(DotPos, 256);
          s = s.Left(DotPos);
          }
        int _Pos = s.ReverseFind('_');
        if (_Pos>=0)
          {
          CString ss = s.Mid(_Pos+1, 256);
          s = s.Left(_Pos+1);
          if (ss.GetLength()>0)
            {
            char Buff[32];
            sprintf(Buff, "%d", atoi((const char*)ss) + 1);
            s += Buff;
            }
          else
            s += "1";
          }
        else
          s += "_1";
        s += Ext;
        }
      }
    }
  COleLinkingDoc::SetTitle((const char*)s);
  }
Example #14
0
CWnd* WPhonePlugin::GetActiveWnd(CMultiDocTemplate* doc)
{
	CWnd* pView = NULL;
	POSITION posdoc = doc->GetFirstDocPosition();
	while(posdoc != NULL)
	{
		CDocument* pdoc = doc->GetNextDoc(posdoc);
		POSITION posview = pdoc->GetFirstViewPosition();
		pView = (pdoc->GetNextView(posview));
	}

	return pView;
}
Example #15
0
CMDIChildWnd *CMDIChildIter::GetNextChild()
{
	CDocument	*pDoc = m_DocIter.GetNextDoc();
	if (pDoc != NULL) {
		POSITION	pos = pDoc->GetFirstViewPosition();
		if (pos != NULL) {
			CView	*pView = pDoc->GetNextView(pos);
			if (pView != NULL)
				return(DYNAMIC_DOWNCAST(CMDIChildWnd, pView->GetParentFrame()));
		}
	}
	return(NULL);
}
Example #16
0
void CFileView::OnFileNew()
{
	CMultiDocTemplate* pUIDocTemplate = theApp.GetUIDocTemplate();
	CDocument* pDoc = pUIDocTemplate->OpenDocumentFile(NULL);
	CString strFilePath = CGlobalVariable::m_strProjectPath + pDoc->GetTitle() + _T(".xml");
	pDoc->DoSave(strFilePath);
	HTREEITEM hSelectedItem = m_wndFileView.GetSelectedItem();
	DWORD dwInfo = m_wndFileView.GetItemData(hSelectedItem);
	HTREEITEM hParent = (dwInfo != INFO_FILE) ? hSelectedItem : m_wndFileView.GetParentItem(hSelectedItem);
	HTREEITEM hNewItem = m_wndFileView.InsertItem(pDoc->GetTitle(), 2, 2, hParent);
	m_wndFileView.SetItemData(hNewItem, INFO_FILE);
	m_wndFileView.Expand(hParent, TVE_EXPAND);
}
Example #17
0
// @pymethod <o PyCDocTemplate>|PyCDocument|GetDocTemplate|Returns the template for the document.
PyObject *
ui_doc_get_template(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetDocTemplate);
	GUI_BGN_SAVE;
	CDocTemplate *ret = pDoc->GetDocTemplate();
	GUI_END_SAVE;
	// @pyseemfc CDocument|GetDocTemplate
	return ui_assoc_object::make(PyCDocTemplate::type, ret)->GetGoodRet();
}
Example #18
0
CWordPadView* CEmbeddedItem::GetView() const
{
	CDocument* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	POSITION pos = pDoc->GetFirstViewPosition();
	if (pos == NULL)
		return NULL;

	CWordPadView* pView = (CWordPadView*)pDoc->GetNextView(pos);
	ASSERT_VALID(pView);
	ASSERT(pView->IsKindOf(RUNTIME_CLASS(CWordPadView)));
	return pView;
}
Example #19
0
void CMDITabsDialogBar::DrawItem(LPDRAWITEMSTRUCT pdis)
{
    CRect rc = pdis->rcItem;
    int nTabIndex = pdis->itemID;
    bool fSelected = (nTabIndex == GetCurSel());
    ODA_DRAWENTIRE;
	char label[64];
	TCITEM tci;
	tci.mask = TCIF_TEXT | TCIF_PARAM;
	tci.pszText = label;
	tci.cchTextMax = ARRAYSIZE(label);
	if (GetItem(nTabIndex, &tci))
    {
        CMDITabChildWnd *pActive = reinterpret_cast<CMDITabChildWnd*>(tci.lParam);

        CDC dc;
        dc.Attach(pdis->hDC);

        int iIndex = _GetBitmapIndex(pActive->GetTabType());
        CExtBitmap &bitmapToUse = fSelected ? _tabBitmap[iIndex] : _tabBitmapNS[iIndex];
        CRect rcSrc(CPoint(0, 0), bitmapToUse.GetSize());
        //CRect rcPadding(2, 2, 2, 2);
        CRect rcPadding(0, 0, 0, 0);
        bitmapToUse.AlphaBlendSkinParts(pdis->hDC, rc, rcSrc, rcPadding, /*__EXT_BMP_FLAG_PREMULTIPLIED_RGB_CHANNELS |*/ CExtBitmap::__EDM_STRETCH, true, true, 0xFF);

        // Use a different font decoration depending on if this is the most recent version of this item.
        bool fNotMostRecent = false;
        CDocument *pDocAny = pActive->GetActiveDocument();
        if (pDocAny && pDocAny->IsKindOf(RUNTIME_CLASS(CResourceDocument)))
        {
            CResourceDocument *pDoc = static_cast<CResourceDocument*>(pDocAny);
            fNotMostRecent = !theApp._resourceRecency.IsResourceMostRecent(pDoc);
        }
        if (fNotMostRecent)
        {
            // Draw a diagonal line across the thing.
            dc.MoveTo(rc.TopLeft());
            dc.LineTo(rc.BottomRight());
        }

        rc.OffsetRect(4, 1); // indent
        COLORREF crText = RGB(0, 0, 0); // g_PaintManager->PAINTPUSHBUTTONDATA::m_clrForceTextNormal; // green in release, black in debug!
        int nOldText = dc.SetTextColor(crText);
        int nOldBk = dc.SetBkMode(TRANSPARENT);
        dc.DrawText(tci.pszText, -1, &rc, DT_SINGLELINE);
        dc.SetBkMode(nOldBk);
        dc.SetTextColor(nOldText);

        dc.Detach();
    }
}
CString CXTPMDIWndTab::GetChildWndText(HWND hWnd) const
{
	// Check to see if the user has defined a label for the tab first.
	CString strTitle;
	if (m_mapTabLabels.Lookup(hWnd, strTitle))
	{
		return strTitle;
	}

	// Get a pointer to the frame window.
	CMDIChildWnd* pChildFrame = (CMDIChildWnd*)CWnd::FromHandle(hWnd);
	if (!::IsWindow(pChildFrame->GetSafeHwnd()))
	{
		return _T("");
	}

	// Get the window text for the frame and use it for the tab label.
	pChildFrame->GetWindowText(strTitle);

	// If the string is empty the document's title.
	if (strTitle.IsEmpty())
	{
		CWnd* pChildWnd = pChildFrame->GetWindow(GW_CHILD);
		while (pChildWnd)
		{
			if (pChildWnd->IsKindOf(RUNTIME_CLASS(CView)))
			{
				// Get a pointer to the view's document.
				CDocument* pDoc = ((CView*)pChildWnd)->GetDocument();
				if (pDoc == NULL)
				{
					return _T("");
				}

				// Set the return string value
				strTitle = pDoc->GetTitle();

				// Reset the frames title
				pChildFrame->SetWindowText(strTitle);

				// Return the document title.
				return strTitle;
			}
			pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
		}
	}

	// Return the MDI frame window's title.
	return strTitle;
}
Example #21
0
void CProcessApp::OnImageInverse()
{
	CDocument* pDoc = PIGetActiveDocument();
	if (pDoc == NULL)
		return;
	if (!pDoc->IsKindOf(RUNTIME_CLASS(CPIDocument)))
		return;

	CImage* pImage = ((CPIDocument*)pDoc)->GetImage();
	if (pImage == NULL)
		return;

	AfxBeginThread(InverseThread, pImage);
}
Example #22
0
void CStartView::OnInitialUpdate()
{
    CDocument* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    if (m_Image.GetCount() == 0)
    {
        m_Image.Load(IDR_START);
        m_Image.SetSingleImage();
        m_Image.SetTransparentColor(RGB(255, 0, 255));
    }

    pDoc->SetTitle(_T("Start Page"));
}
Example #23
0
void CGuiApp::newwin(CMultiDocTemplate *p)
{
  POSITION pdoc = p->GetFirstDocPosition();
  if (pdoc) {
    CDocument *doc = p->GetNextDoc(pdoc);
    POSITION pos =  doc->GetFirstViewPosition();
    if (pos) {
      raisekids(p);
      return ;
    }
  }
  p->OpenDocumentFile(NULL);
  raisekids(p);
}
Example #24
0
void CFrameWnd::OnUpdateFrameTitle( BOOL bAddToTitle )
/****************************************************/
{
    if( bAddToTitle ) {
        CDocument *pDoc = GetActiveDocument();
        if( pDoc != NULL ) {
            UpdateFrameTitleForDocument( pDoc->GetTitle() );
        } else {
            UpdateFrameTitleForDocument( NULL );
        }
    } else {
        UpdateFrameTitleForDocument( NULL );
    }
}
Example #25
0
void CLevelApp::OnImageLevel()
{
	CDocument* pDoc = PIGetActiveDocument();
	if (pDoc == NULL)
		return;
	if (!pDoc->IsKindOf(RUNTIME_CLASS(CPIDocument)))
		return;

	CLevelDlg dlg;
	dlg.DoModal();

//	CLevelDlg* pDlg = new CLevelDlg;
//	PIDockablePane(pDlg, _T("Test"));
}
Example #26
0
void CdcmviewerView::draw_dcm_header(CDC *pDC,dicom::DataSet &data,int x, int &y,int line_height)
{
	if(m_create_dcm_img_error)
	{
		CDocument *pDoc = GetDocument();
		if(pDoc)
		{
			CString msg;
			msg.Format( _T("unrecognized file :%s"),pDoc->GetPathName());
			pDC->TextOut(x,y,msg);
		}
		else
		{
			pDC->TextOut(x,y,_T("no file"));
		}
		y+= line_height;
	}
	CString text;
	CdcmviewerDoc* pDoc = (CdcmviewerDoc*)GetDocument();
	if(pDoc && pDoc->m_photometric_interpretation!="RGB")
	{
		text.Format( _T("ww:%f,wc:%f,"),get_ww(),get_wc());
		theApp.DebugOutput(text);
		pDC->TextOut(x,y,text);
		y += line_height;
	}

	if(m_number_of_frame>1)
	{
		text.Format("frame index:%04d,navigate to next frame by key PAGE DOWN/RIGHT ARROW/DOWN ARROW",m_frame_index);
		pDC->TextOut(x,y,text);
		y += line_height;
	}
	std::stringstream oss;
	for(dicom::DataSet::const_iterator it=data.begin();
		it!=data.end();
		it++)
	{
		dicom::Tag tag = it->first;
		if(GroupTag(tag)==0x28 || /*GroupTag(tag) == 0x08 ||*/ GroupTag(tag)==0x10)
		{
			oss.str("");
			IndentDumper::write_tag(oss,tag,0);
			oss<<it->second;
			pDC->TextOut(x,y,oss.str().c_str());
			y += line_height;
		}
	}
}
Example #27
0
CMineView* CMainFrame::GetMineView() {
	CView* view = NULL;
	CDocument* doc = GetActiveDocument();
	if (doc)
	{
		POSITION pos = doc->GetFirstViewPosition();
		while (pos != NULL)
		{
			view = (CMineView *)doc->GetNextView(pos);
			if (view->IsKindOf(RUNTIME_CLASS(CMineView))) break;
		}
		ASSERT(view->IsKindOf(RUNTIME_CLASS(CMineView)));
	}
	return (CMineView *)view;
}
Example #28
0
void CGuiApp:: raisekids(CMultiDocTemplate *doc_temp)
{
  POSITION pos_doc_temp = doc_temp->GetFirstDocPosition();
  while (pos_doc_temp) {
    CDocument *doc = doc_temp->GetNextDoc(pos_doc_temp);
    POSITION p =  doc->GetFirstViewPosition();
    while (p)
      {
	CView *view = doc->GetNextView (p);
	//      view->GetParentFrame()->SetParent(crap);
	CFrameWnd *f = (CFrameWnd *)(view->GetParentFrame());
	f->ActivateFrame(SW_SHOWNORMAL);
      } 
  }
}
void CXTPShellTreeView::SelectionChanged(HTREEITEM hItem, CString strFolderPath)
{
	if (hItem != NULL && !m_bTunneling)
	{
		CDocument* pDoc = GetDocument();
		if (pDoc != NULL)
		{
			pDoc->UpdateAllViews(this, SHN_XTP_TREESELCHANGE,
				(CObject*)GetTreeCtrl().GetItemData(hItem));
		}
	}

	CXTPShellTreeBase::SelectionChanged(hItem, strFolderPath);

}
Example #30
0
void CMDITabChildWnd::OnUpdateFrameTitle(BOOL bAddToTitle)
{
    // Don't call super - all it does it take the document title and put it there.
    CDocument* pDocument = GetActiveDocument();
    if (bAddToTitle && pDocument)
    {
        bool fModified = (pDocument->IsModified() == TRUE);
        if (_fFirstTime || (_fModifiedCache != fModified))
        {
            _fModifiedCache = (pDocument->IsModified() == TRUE);
            _UpdateFrameTitle(pDocument);
            _fFirstTime = true;
        }
    }
}