예제 #1
0
BOOL CuDlgDBEventPane01::OnInitDialog() 
{
    CDialog::OnInitDialog();
    VERIFY (m_cListDBEvent.SubclassDlgItem (IDC_MFC_LIST1, this));

    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    pDoc->SetRegisteredDBEventList (&m_cListDBEvent);
    try
    {
        //
        // If the Document is load, then we update the control.
        UpdateControl();
    }
    catch (CMemoryException* e)
    {
        VDBA_OutOfMemoryMessage();
        e->Delete();
    }
    catch (...)
    {
        throw;
    }
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #2
0
void CMainFrame::SwitchToView(eView nView)
{
	CView* pOldActiveView = GetActiveView();
	CView* pNewActiveView = (CView*) GetDlgItem(nView);
	if (pNewActiveView == NULL) {
		switch (nView) {
		case STRING:
			pNewActiveView = (CView*) new CStringView;
			break;
		case HEX:
			pNewActiveView = (CView*) new CHexView;
			break;
		}
		CCreateContext context;
		context.m_pCurrentDoc = pOldActiveView->GetDocument();
		pNewActiveView->Create(NULL, NULL, WS_BORDER,
			CFrameWnd::rectDefault, this, nView, &context);
		pNewActiveView->OnInitialUpdate();
	}
	SetActiveView(pNewActiveView);
	pNewActiveView->ShowWindow(SW_SHOW);
	pOldActiveView->ShowWindow(SW_HIDE);
	pOldActiveView->SetDlgCtrlID(
		pOldActiveView->GetRuntimeClass() == 
		RUNTIME_CLASS(CStringView) ? STRING : HEX);
	pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
}
예제 #3
0
//****************************************************************************
COleClientItem*	CBCGPFrameWnd::GetInPlaceActiveItem ()
{
    CFrameWnd* pActiveFrame = GetActiveFrame ();
    if (pActiveFrame == NULL)
    {
        return NULL;
    }

    ASSERT_VALID (pActiveFrame);

    CView* pView = pActiveFrame->GetActiveView ();
    if (pView == NULL || pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView)))
    {
        return NULL;
    }

    ASSERT_VALID (pView);

    COleDocument* pDoc = DYNAMIC_DOWNCAST (COleDocument, pView->GetDocument ());
    if (pDoc == NULL)
    {
        return NULL;
    }

    ASSERT_VALID (pDoc);
    return pDoc->GetInPlaceActiveItem (pView);
}
예제 #4
0
BOOL CuDlgDBEventPane02::OnMaxLineChange (int nMax)
{
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);

    int nCount = m_cListRaisedDBEvent.GetItemCount();
    if (nCount > nMax)
    {
        int i, diff = nCount - nMax;
        if (pDoc->m_bClearFirst)
        {
            for (i=0; i<diff; i++)
                m_cListRaisedDBEvent.DeleteItem (0); 
        }
        else
        {
            //CString strMsg = "New value is smaller than actual number of lines,\n"
            //                 "and 'Clear First When Max Reached is not checked'.\n"
            //                 "Previous value is kept";
            BfxMessageBox (VDBA_MfcResourceString(IDS_E_NEW_VALUE), MB_OK|MB_ICONEXCLAMATION);
            return FALSE;
        }
    }
    return TRUE;
}
예제 #5
0
void CuDlgDBEventPane01::UpdateControl()
{
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CWnd*   pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame* pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);
    //
    // Remark:
    // InitializeDBEvent() is called on the CBN_SELCHANGE of Database ComboBox.
    CString strNone;
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
        return;
    
    // Load ...
    // Initialize the new Database.
    if (DBETraceInit (pDoc->m_hNode, (LPUCHAR)(LPCTSTR)pDoc->m_strDBName , pFrame->m_hWnd, &(pDoc->m_nHandle)) == RES_SUCCESS)
    {
        pDoc->m_bDBInit = TRUE;
        m_strCurrentDB  = pDoc->m_strDBName;
    }
    else
    {
        pDoc->m_bDBInit = FALSE;
        pDoc->m_nHandle = -1;
        BfxMessageBox (VDBA_MfcResourceString(IDS_E_INITIALIZE_DB_EVENT));//"Error while initializing the Database for DB Event Registration"
    }
    if (pDoc->m_bDBInit)
    {
        int index;
        CTypedPtrList<CObList, CuDataRegisteredDBevent*>& listDBEvent = pDoc->m_listRegisteredDBEvent;

        POSITION pos = listDBEvent.GetHeadPosition();
        while  (pos != NULL)
        {
            CuDataRegisteredDBevent* dbe = listDBEvent.GetNext (pos);

            index = m_cListDBEvent.AddString (dbe->m_strDBEvent);
            if (index != LB_ERR)
            {
                LPTSTR lpszOwner = new TCHAR [dbe->m_strOwner.GetLength() +1];
                lstrcpy (lpszOwner, (LPTSTR)(LPCTSTR)dbe->m_strOwner);
                m_cListDBEvent.SetItemData (index, (DWORD)lpszOwner);
                if (dbe->m_bRegistered)
                {
                    if (DBETraceRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)dbe->m_strDBEvent, (LPUCHAR)(LPCTSTR)dbe->m_strOwner) != RES_SUCCESS)
			            BfxMessageBox (VDBA_MfcResourceString(IDS_E_REGISTERING_DB_EVENT));//"Error while Registering DB Event"
                    else
                        m_cListDBEvent.SetCheck (index, 1);
                }
            }
        }
    }
}
예제 #6
0
void CuDlgDBEventPane01::OnRefresh()
{
    TRACE0 ("CuDlgDBEventPane01::OnRefresh() ...\n");
    int     nCount, i, index =CB_ERR;
    CString strItem;
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    //
    // Refresh data of this Window
    // Refresh the DB Events of One Database.
    CString strNone;
    strNone.LoadString (IDS_DATABASE_NONE);
    if (pDoc->m_strDBName == strNone || pDoc->m_strDBName == "")
        return;
    CCheckListBox list;
    list.Create (WS_CHILD|LBS_HASSTRINGS|LBS_OWNERDRAWFIXED, CRect (0,0, 10, 10), this, (UINT)-1);
    ASSERT (IsWindow (list.m_hWnd));
    InitializeDBEvent (m_strCurrentDB, &list);
    
    nCount = m_cListDBEvent.GetCount();
    for (i = 0; i < nCount; i++)
    {
        if (m_cListDBEvent.GetCheck(i) == 1)
        {
            m_cListDBEvent.GetText (i, strItem);
            index = list.FindStringExact (-1, strItem);
            if (index == LB_ERR)
            {
                CString msg;
                AfxFormatString1 (msg, IDS_DBECHECKED_HASBEEN_REMOVED, (LPCTSTR)strItem);
                BfxMessageBox (msg);
            }
            else
            {
                list.SetCheck (index, 1);
            }
        }
    }
    CleanListBox (&m_cListDBEvent);
    m_cListDBEvent.ResetContent ();
    nCount = list.GetCount();
    for (i = 0; i < nCount; i++)
    {
        list.GetText (i, strItem);
        index = m_cListDBEvent.AddString (strItem);
        if (index != LB_ERR)
        {
            LPTSTR lpszOwner = (LPTSTR)list.GetItemData (i);
            m_cListDBEvent.SetItemData (i, (DWORD)lpszOwner);
            if (list.GetCheck (i) == 1)
                m_cListDBEvent.SetCheck (index, 1);
        }
    }
}
예제 #7
0
CConvertToSPEXDoc* CDrawGraph::GetMyDocument() const 
{
	CView *pParent = (CView *)GetParent();
	VERIFY(pParent);
	CDocument *m_pDocument = pParent->GetDocument();

	VERIFY(m_pDocument);
	ASSERT_KINDOF(CConvertToSPEXDoc,m_pDocument);
	return (CConvertToSPEXDoc*)m_pDocument;
}
예제 #8
0
/////////////////////////////////////////////////////////////////////////////
// CuDlgDBEventPane02 message handlers
void CuDlgDBEventPane02::ResetDBEvent()
{
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
//    pDoc->m_nCounter1 = 1;
//    pDoc->m_nCounter2 = 0;
    m_cListRaisedDBEvent.DeleteAllItems();
}
예제 #9
0
BOOL CuDlgDBEventPane02::OnInitDialog() 
{
    CDialog::OnInitDialog();
    VERIFY (m_cListRaisedDBEvent.SubclassDlgItem (IDC_MFC_LIST1, this));
    //
    // Initalize the Column Header of CListCtrl (CuListCtrl)
    //
    LV_COLUMN lvcolumn;
    UINT      strHeaderID[LAYOUT_NUMBER] = 
    {
        IDS_RAISEDDBE_NUM,
        IDS_RAISEDDBE_TIME, 
        IDS_RAISEDDBE_NAME, 
        IDS_RAISEDDBE_OWNER, 
        IDS_RAISEDDBE_TEXT
    };
    int i, hWidth   [LAYOUT_NUMBER] = {40, 100, 80, 100, 400};
    //
    // Set the number of columns: LAYOUT_NUMBER
    //
    memset (&lvcolumn, 0, sizeof (LV_COLUMN));
    lvcolumn.mask = LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH;
    for (i=0; i<LAYOUT_NUMBER; i++)
    {
        CString strHeader;
        strHeader.LoadString (strHeaderID[i]);
        lvcolumn.fmt = LVCFMT_LEFT;
        lvcolumn.pszText = (LPTSTR)(LPCTSTR)strHeader;
        lvcolumn.iSubItem = i;
        lvcolumn.cx = hWidth[i];
        m_cListRaisedDBEvent.InsertColumn (i, &lvcolumn); 
    }
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    pDoc->SetRaisedDBEventList (&m_cListRaisedDBEvent);
    try
    {
        //
        // If the Document is load, then we update the control.
        UpdateControl();
    }
    catch (CMemoryException* e)
    {
        VDBA_OutOfMemoryMessage ();
        e->Delete();
    }
    catch (...)
    {
        throw;
    }
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #10
0
BOOL CDocument::CanCloseFrame( CFrameWnd *pFrame )
/************************************************/
{
    POSITION position = m_viewList.GetHeadPosition();
    while( position != NULL ) {
        CView *pView = (CView *)m_viewList.GetNext( position );
        if( pView->GetDocument() == this && pView->GetParentFrame() != pFrame ) {
            return( TRUE );
        }
    }
    return( SaveModified() );
}
예제 #11
0
CDocument *CFrameWnd::GetActiveDocument()
/***************************************/
{
    CFrameWnd *pFrame = GetActiveFrame();
    if( pFrame != NULL ) {
        CView *pView = pFrame->GetActiveView();
        if( pView != NULL ) {
            return( pView->GetDocument() );
        }
    }
    return( NULL );
}
예제 #12
0
LONG CuDlgDBEventPane02::OnDbeventTraceIncoming (WPARAM wParam, LPARAM lParam)
{
    LPRAISEDDBE lpStruct = (LPRAISEDDBE)lParam;
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CSplitterWnd* pSplitter = (CSplitterWnd*)pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame*  pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT  (pFrame);
    if (!pFrame->GetPaneRegisteredDBEvent()->Find ((LPCTSTR)lpStruct->DBEventName, (LPCTSTR)lpStruct->DBEventOwner))
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText,
            "*");
    }
    else
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText);
    }
    if (pDoc->m_bPopupOnRaise)
    {
        CString strMsg;
        strMsg.GetBuffer (520);
        TCHAR tchszAll [80];

        StringWithOwner ((LPUCHAR)lpStruct->DBEventName, (LPUCHAR)lpStruct->DBEventOwner, (LPUCHAR)tchszAll);
        //"%s: Database Event %s '%s' was raised on node %s."
            strMsg.Format (IDS_I_DB_EVENT_RAISED,
            (LPCTSTR)lpStruct->StrTimeStamp,
            (LPCTSTR)tchszAll,
            (LPCTSTR)lpStruct->DBEventText,
            (LPCTSTR)GetVirtNodeName (pDoc->m_hNode));
        BfxMessageBox (strMsg);
    }
    return RES_SUCCESS;
}
예제 #13
0
CView* CStaticDoc::GetActiveView( )
{
	CMainFrame * pMainFrame = AfxGetMainFrame();
	if( pMainFrame )
	{
		CChildFrame * pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
		if( pChildFrame )
		{
			CView * pView = pChildFrame->GetActiveView();
			if( pView && this == pView->GetDocument() )
				return pView;
		}
	}
	return NULL;
}
예제 #14
0
BOOL CDFFDGlobal::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Show the template name in the dialog title
	CView *pv = dynamic_cast<CView *>(m_pParentWnd);
	ASSERT(pv != NULL);
	if (pv != NULL)
	{
		CHexEditDoc *pdoc = dynamic_cast<CHexEditDoc *>(pv->GetDocument());
		ASSERT(pdoc != NULL);
		if (pdoc != NULL)
			SetWindowText("Global Settings for \"" + pdoc->GetXMLFileDesc() +".XML\"");
	}

	ASSERT(pelt_ != NULL && pelt_->GetName() == "binary_file_format");

	CString ss;

	ss = pelt_->GetAttr("default_byte_order");
	default_big_endian_ = (ss == "big");

	ss = pelt_->GetAttr("default_read_only");
	default_read_only_ = (ss == "true");

	ss = pelt_->GetAttr("default_char_set");
	if (ss == "ansi")
		default_char_set_ = 1;
	else if (ss == "oem")
		default_char_set_ = 2;
	else if (ss == "ebcdic")
		default_char_set_ = 3;
	else
	{
		ASSERT(ss == "ascii");
		default_char_set_ = 0;
	}

	ss = pelt_->GetAttr("web_site");
	if (ss.IsEmpty())
		web_site_ = "http://";
	else
		web_site_ = ss;

	UpdateData(FALSE);

	return TRUE;
}
예제 #15
0
파일: Childfrm.cpp 프로젝트: aidush/openmpt
void CChildFrame::ActivateFrame(int nCmdShow)
//-------------------------------------------
{
    if ((glMdiOpenCount == 1) && (CMainFrame::gbMdiMaximize) && (nCmdShow == -1))
    {
            nCmdShow = SW_SHOWMAXIMIZED;
    }
    CMDIChildWnd::ActivateFrame(nCmdShow);


    //rewbs.fix3185: When song first loads, initialise patternViewState
    //               to point to start of song.
    CView *pView = GetActiveView();
    CModDoc *pModDoc = NULL;
    if (pView) pModDoc = (CModDoc *)pView->GetDocument();
    if ((m_hWndCtrl) && (pModDoc))
    {
            if (m_bInitialActivation && m_ViewPatterns.nPattern==0)
            {
                    m_ViewPatterns.nPattern=pModDoc->GetSoundFile()->Order[0];
                    m_ViewPatterns.nOrder=0; //just in case (should already be 0)
                    m_ViewPatterns.nRow=0;   //just in case
                    m_bInitialActivation=false;
            }
        if (!pattern_test) {
            DEBUG_FUNC("creating my homie");
            DEBUG_FUNC("pModDoc = %p", pModDoc);
            auto pSndFile = pModDoc->GetSoundFile();
            if (pSndFile) {
                pattern_test = new modplug::gui::qt5::document_window(
                    pSndFile,
                    CMainFrame::GetMainFrame()->global_config,
                    nullptr
                );
                /*
                pattern_test->resize(400, 400);
                pattern_test->show();
                */
                CMainFrame::GetMainFrame()
                    ->ui_root
                    ->mainwindow.add_document_window(pattern_test);
            }
        }
    }
    //end rewbs.fix3185
}
예제 #16
0
파일: Childfrm.cpp 프로젝트: aidush/openmpt
LRESULT CChildFrame::OnInstrumentSelected(WPARAM wParam, LPARAM lParam)
//---------------------------------------------------------------------
{
    CView *pView = GetActiveView();
    CModDoc *pModDoc = NULL;
    if (pView) pModDoc = (CModDoc *)pView->GetDocument();
    if ((m_hWndCtrl) && (pModDoc))
    {
            module_renderer *pSndFile = pModDoc->GetSoundFile();
            UINT nIns = lParam;

            if ((!wParam) && (pSndFile->m_nInstruments > 0))
            {
                    nIns = pModDoc->FindSampleParent(nIns);
            }
            ::SendMessage(m_hWndCtrl, WM_MOD_CTRLMSG, CTRLMSG_PAT_SETINSTRUMENT, nIns);
    }
    return 0;
}
예제 #17
0
void CMainFrame::SwitchView(ViewType nType)
{
	CView* pOldView = GetActiveView();
	CView* pNewView = (CView*)GetDlgItem(nType);

	if(pNewView == NULL)
	{
		switch(nType)
		{
		case FORMVIEW:
			pNewView = (CView*)new CMultiLookView;
			break;
		case FONTVIEW:
			pNewView = (CView*)new CFontView;
			break;
		case PAINTVIEW:
			pNewView = (CView*)new CPaintView;
			break;
		}

		CCreateContext context;
		context.m_pCurrentDoc = pOldView->GetDocument();
		pNewView->Create(NULL, NULL, WS_BORDER, 
			CFrameWnd::rectDefault, this, nType, &context);
		pNewView->OnInitialUpdate();
	}

	SetActiveView(pNewView);
	pNewView->ShowWindow(SW_SHOW);
	pOldView->ShowWindow(SW_HIDE);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CMultiLookView))
		pOldView->SetDlgCtrlID(FORMVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CFontView))
		pOldView->SetDlgCtrlID(FONTVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CPaintView))
		pOldView->SetDlgCtrlID(PAINTVIEW);

	pNewView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
	
}
예제 #18
0
BOOL CSplitterFrame::SetNewView(int row, int col, CRuntimeClass* pViewClass) {
  ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)));
  
  CView* pView = STATIC_DOWNCAST(CView, m_wndSplitter.GetPane(row, col));
  CFrameWnd* pFrame = pView->GetParentFrame();
  ASSERT(pFrame);
  
  // set up create context to preserve doc/frame etc.
  CCreateContext cc;
  memset(&cc, 0, sizeof(cc));
  cc.m_pNewViewClass = pViewClass;
  cc.m_pCurrentDoc = pView->GetDocument();
  cc.m_pNewDocTemplate = cc.m_pCurrentDoc ?
    cc.m_pCurrentDoc->GetDocTemplate() : NULL;
  cc.m_pCurrentFrame = pFrame;
  
  m_wndSplitter.DeleteView(row, col);                // delete old view

  /* */
  /* recréer control tabs */
  this_app->NewTabs();
  /* */

  VERIFY(m_wndSplitter.CreateView(row, col,          // create new one
    pViewClass,
    CSize(0,0),                      // will fix in RecalcLayout
    &cc));
  
  m_wndSplitter.RecalcLayout();                      // recompute layout 
  
  // initialize the view
  CWnd* pWnd = m_wndSplitter.GetPane(row, col);
  if (pWnd)
    pWnd->SendMessage(WM_INITIALUPDATE);

  GetActiveDocument()->SetModifiedFlag(FALSE);      // Document vide
  GetActiveDocument()->SetTitle("New Project");
  //SetDefaultTitle(GetActiveDocument());
  return 1;
}
예제 #19
0
void CMainFrame::OnViewPrediction()
{
	// TODO: Add your command handler code here
	CDocument* pDoc;
	CView* pView;
	CCreateContext context;
	CRect rect;
	pView=(CView*)m_splitter.GetPane(0,0);
	pView->GetWindowRect(rect);
	if(!pView)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc=pView->GetDocument();
	CString title=pDoc->GetTitle();
	if(!pDoc)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc->m_bAutoDelete=false;
	m_splitter.GetPane(0,0)->DestroyWindow();
	pDoc->m_bAutoDelete=true;
	context.m_pNewViewClass=RUNTIME_CLASS(CPredView);
	context.m_pCurrentDoc=pDoc;
	context.m_pLastView=NULL;
	context.m_pNewDocTemplate=NULL;
	context.m_pCurrentFrame=NULL;
	m_splitter.CreateView(0,0,RUNTIME_CLASS(CPredView),CSize(rect.Width(),rect.Height()),&context);
	((CView*)m_splitter.GetPane(0,0))->OnInitialUpdate();// it is important to call initial update before create a view expecially a CScrollView
	m_splitter.RecalcLayout();
	m_splitter.GetPane(0,0)->SendMessage(WM_PAINT);
	SetActiveView((CScrollView*)m_splitter.GetPane(0,0));
	pDoc->SetTitle(title);
	((CFCCDoc*)pDoc)->MessageCenter(IDS_MESSAGE_MAKEPREDICTION);
	

}
예제 #20
0
// Returns the name of the currently opened file, including extension (if saved).
CString CTemplateFormater::GetFile(void)
{
	// Use the generic view class to make this class as portable as possible
	CView* pView = NULL;

	CMDIFrameWnd* pFrame = reinterpret_cast<CMDIFrameWnd*>(AfxGetApp()->m_pMainWnd);
	
	// Get the active MDI child window.
	CMDIChildWnd* pChild = 
		reinterpret_cast<CMDIChildWnd*>(pFrame->GetActiveFrame());		
	// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
	
	// Get the active view attached to the active MDI child window.
	pView = reinterpret_cast<CView*>(pChild->GetActiveView());		

	ASSERT(pView != NULL);
	// If at this point the view could not be obtained, the leave
	if (pView != NULL)
	{
		CDocument* pDoc = pView->GetDocument();
		ASSERT(pDoc != NULL);
		if (pDoc != NULL)
		{
			CString strPathName = pDoc->GetPathName(); 

			if (!strPathName.IsEmpty())
			{
				CCFileSpec fs(strPathName);	//NOTE: This part is not portable!
				return fs.GetFileName();
			}
			else
			{
				return pDoc->GetTitle();
			}
		}
	}

	return _T("");
};
예제 #21
0
void CuDlgDBEventPane02::UpdateControl()
{
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CWnd*   pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame* pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);

    CString strNone;
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
        return;
    
    // Load ...
    int nCount;
    CTypedPtrList<CObList, CuDataRaisedDBevent*>& listRaisedDBEvent = pDoc->m_listRaisedDBEvent;
    nCount = listRaisedDBEvent.GetCount();
    POSITION pos = listRaisedDBEvent.GetHeadPosition();
    while  (pos != NULL)
    {
        CuDataRaisedDBevent* dbe = listRaisedDBEvent.GetNext (pos);
        IncomingDBEvent (pDoc, dbe->m_strNum, dbe->m_strTime, dbe->m_strDBEvent, dbe->m_strDBEOwner, dbe->m_strDBEText);
    }
    if ((pDoc->m_nMaxLine+1) == nCount)
    {
        CTime   t = CTime::GetCurrentTime();
        CString st= t.Format ("%c");
        nCount = m_cListRaisedDBEvent.GetItemCount ();
        int index  = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)"", 0);
        m_cListRaisedDBEvent.SetItemText (index, 1, (LPTSTR)(LPCTSTR)st);
        m_cListRaisedDBEvent.SetItemText (index, 2, VDBA_MfcResourceString(IDS_INTERRUPTED));//"<Interrupted>"
    }     
    SetHeader (pDoc->m_strRaisedSince);
}
예제 #22
0
void CuDlgDBEventPane01::ForceRefresh()
{
    TRACE0 ("CuDlgDBEventPane01::ForceRefresh() ...\n");
    CString strNone;
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    LPUCHAR      parentstrings [MAXPLEVEL];
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
        return;
    parentstrings[0] = (LPUCHAR)(LPCTSTR)pDoc->m_strDBName;
    //
    // Refresh the cach
    DOMDisableDisplay (pDoc->m_hNode, NULL);
    UpdateDOMData (
        pDoc->m_hNode, 
        OT_DBEVENT, 
        1,
        parentstrings,
        FALSE,
        FALSE);
    DOMUpdateDisplayData (
        pDoc->m_hNode, 
        OT_DBEVENT, 
        1,
        parentstrings,
        FALSE,
        ACT_ADD_OBJECT,
        0L,
        0);
    //
    // Refresh data of this Window
    OnRefresh ();
}
예제 #23
0
void CDlgObjectManager::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
	CDialog::OnActivate(nState, pWndOther, bMinimized);

	CMDIChildWnd* pChildWnd;
	CMod3DDoc*	pDoc;
	CView*		pView;

	CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*) GetParent();
	pChildWnd = (CMDIChildWnd *) pMainWnd->MDIGetActive();
	if( pChildWnd == NULL )		return;

	pView = (CView *) pChildWnd->GetActiveView();
	ASSERT( pView != NULL );
	pDoc = (CMod3DDoc*) pView->GetDocument();

	if( pDoc == NULL )
		return;

	if( pDoc != m_pDoc ) {
		m_pDoc = pDoc;
		OnInitDialog();
	}
}
예제 #24
0
void CuDlgDBEventPane01::UnregisterDBEvents()
{
    CDbeventDoc* pDoc;
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    pDoc  = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    if (!pDoc)
        return;
    //
    // Unregister the DB Events:
    int     nCount, i;
    CString strItem;
    nCount = m_cListDBEvent.GetCount();
    for (i=0; i<nCount; i++)
    {
        m_cListDBEvent.GetText (i, strItem);
        LPTSTR lpszOwner = (LPTSTR)m_cListDBEvent.GetItemData (i);
        if (m_cListDBEvent.GetCheck (i) == 1)
		{
            DBETraceUnRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)strItem, (LPUCHAR)lpszOwner);
			m_cListDBEvent.SetCheck (i, 0);
		}
    }
    CString strNone;
    if (pDoc && m_strCurrentDB != "" && m_strCurrentDB != strNone)
    {
        // 
        // Reset the Database ...
        if (pDoc->m_bDBInit && pDoc->m_nHandle != -1)
        {
            DBETraceTerminate (pDoc->m_nHandle);
        }
    }

}
예제 #25
0
BOOL CSizingTabCtrlBar::AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CCreateContext *pContext)
{	

#ifdef _DEBUG
	ASSERT_VALID(this);
	ASSERT(pViewClass != NULL);
	ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
	ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
#endif

	CCreateContext context;
	if (pContext == NULL)
	{
		// if no context specified, generate one from the currently selected
		//  client if possible
		CView* pOldView = NULL;
		if (pOldView != NULL && pOldView->IsKindOf(RUNTIME_CLASS(CView)))
		{
			// set info about last pane
			ASSERT(context.m_pCurrentFrame == NULL);
			context.m_pLastView = pOldView;
			context.m_pCurrentDoc = pOldView->GetDocument();
			if (context.m_pCurrentDoc != NULL)
				context.m_pNewDocTemplate =
				context.m_pCurrentDoc->GetDocTemplate();
		}
		pContext = &context;
	}
	
	CWnd* pWnd;
	TRY
	{
		pWnd = (CWnd*)pViewClass->CreateObject();
		if (pWnd == NULL)
			AfxThrowMemoryException();
	}
	CATCH_ALL(e)
	{
		TRACE0("Out of memory creating a view.\n");
		// Note: DELETE_EXCEPTION(e) not required
		return FALSE;
	}
	END_CATCH_ALL
		
    ASSERT_KINDOF(CWnd, pWnd);
	ASSERT(pWnd->m_hWnd == NULL);       // not yet created
	
	DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
	CRect rect;
	// Create with the right size and position
	if (!pWnd->Create(NULL, NULL, dwStyle, rect, this, 0, pContext))
	{
		TRACE0("Warning: couldn't create client pane for view.\n");
		// pWnd will be cleaned up by PostNcDestroy
		return FALSE;
	}
	m_pActiveView = (CView*) pWnd;

	TCB_ITEM *pMember=new TCB_ITEM;
	pMember->pWnd=pWnd;
	_tcscpy(pMember->szLabel, lpszLabel);
	m_views.AddTail(pMember);

	int nViews = m_views.GetCount();
	if (nViews!=1)
	{
		pWnd->EnableWindow(FALSE);
		pWnd->ShowWindow(SW_HIDE);
	}
	else
	{
		((CFrameWnd *)GetParent())->SetActiveView((CView *)m_pActiveView);
	}

	TC_ITEM tci;
	tci.mask = TCIF_TEXT | TCIF_IMAGE;
	tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
	tci.iImage = nViews-1;
	m_tabctrl.InsertItem(nViews, &tci);

	return TRUE;
}
예제 #26
0
void CuDlgDBEventPane01::InitializeDBEvent (CString& str, CCheckListBox* pList)
{
    CWinApp* app = NULL;
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);

    int      cur, ires;
    TCHAR    buf [MAXOBJECTNAME];
    TCHAR    buffilter [MAXOBJECTNAME];
    LPUCHAR  parentstrings [MAXPLEVEL];
    memset (buf, 0, sizeof (buf));
    memset (buffilter, 0, sizeof (buffilter));
    if (!pList)
    {
        CleanListBox (&m_cListDBEvent);
        m_cListDBEvent.ResetContent();
    }
    CString strNone;
    strNone.LoadString (IDS_DATABASE_NONE);
    if (str == strNone)
    {
        m_strCurrentDB = "";
        return;
    }
    parentstrings [0] = (LPUCHAR)(LPCTSTR)str;
    parentstrings [1] = NULL;
    app = AfxGetApp();
    app->DoWaitCursor (1);
    ires = DOMGetFirstObject (
        pDoc->m_hNode, 
        OT_DBEVENT, 
        1, 
        parentstrings, 
        pDoc->m_bSysDBEvent, 
        NULL, 
        (LPUCHAR)buf, 
        (LPUCHAR)buffilter, 
        NULL);
    while (ires == RES_SUCCESS)
    {
        if (pList)
            cur = pList->AddString ((LPCTSTR)buf);
        else
            cur = m_cListDBEvent.AddString ((LPCTSTR)buf);
        if (cur != LB_ERR)
        {
            LPTSTR lpszOwner;
            lpszOwner = new TCHAR [lstrlen (buffilter)+1];
            lstrcpy (lpszOwner, (LPTSTR)buffilter);
            if (pList)
                pList->SetItemData (cur, (DWORD)lpszOwner);
            else
                m_cListDBEvent.SetItemData (cur, (DWORD)lpszOwner);
        }
        ires  = DOMGetNextObject ((LPUCHAR)buf, (LPUCHAR)buffilter, NULL);
    }
    app->DoWaitCursor (-1);
    m_strCurrentDB = str;
}
예제 #27
0
void CuDlgDBEventPane01::OnCheckChange()
{
    CDbeventFrame*  pFrame;
    CView*          pView;
    CDbeventDoc*    pDoc;
    int     nCheck, index   = LB_ERR;
    CString strItem;
    CString strTime;
    LPTSTR  lpszOwner;

    CTime time = CTime::GetCurrentTime();
    strTime = time.Format ("%c");
    index = m_cListDBEvent.GetCaretIndex();
    if (index == LB_ERR)
        return;
    pView = (CView*)GetParent();
    ASSERT (pView);
    pDoc  = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    CWnd* pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);
    if (!pDoc->m_bDBInit)
    {
        BfxMessageBox (VDBA_MfcResourceString(IDS_E_DB_EVENT_REGISTER));//"DBEvent Initialization Failure: Unable to register."
        nCheck = m_cListDBEvent.GetCheck (index);
        if (nCheck == 1)
            m_cListDBEvent.SetCheck (index, 0); // Stay unckecked
        return;
    }
    CuDlgDBEventPane02* pRaisePanel = pFrame->GetPaneRaisedDBEvent();
    ASSERT (pRaisePanel);
    m_cListDBEvent.GetText (index, strItem);
    lpszOwner = (LPTSTR)m_cListDBEvent.GetItemData (index);
    nCheck = m_cListDBEvent.GetCheck (index);
    if (nCheck == 1)
    {
        if (DBETraceRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)strItem, (LPUCHAR)lpszOwner) != RES_SUCCESS)
        {
            BfxMessageBox (VDBA_MfcResourceString(IDS_E_REGISTERING_DB_EVENT));//"Error while Registering DB Event"
            m_cListDBEvent.SetCheck (index, 0); // Stay unckecked
            return;
        }
        CString st1;
        st1.Format (IDS_DBEVENT_CHECK, (LPCTSTR)strItem);//"<Check %s>"
        pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
    }
    else
    if (nCheck == 0)
    {
        CString st1;
        int ans = DBETraceUnRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)strItem, (LPUCHAR)lpszOwner);
        if (ans != RES_SUCCESS && ans != RES_MOREDBEVENT)
        {
            BfxMessageBox (VDBA_MfcResourceString(IDS_E_UNREGISTERING_DB_EVENT));//"Error while unregistering DB Event"
            m_cListDBEvent.SetCheck (index, 1); // Stay ckecked
            st1.Format (IDS_E_UNCHECK, (LPCTSTR)strItem);//"<ERROR in Uncheck %s>"
            pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
            return;
        }
        st1.Format (IDS_I_UNCHECK, (LPCTSTR)strItem);//"<Uncheck %s>"
        pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
    }
}
예제 #28
0
//-----------------------------------------------------------------------------
// Purpose: Replaces the current active view with a given view type.
// Input  : *pViewClass - 
// Output : CView
//-----------------------------------------------------------------------------
CView *CChildFrame::ReplaceView(CRuntimeClass *pViewClass)
{
	//
	// Verify that there is an active view to replace.
	//
	CView *pCurrentView = GetActiveView();
	if (!pCurrentView)
	{
		return(NULL);
	}
	
	//
	// If we're already displaying this kind of view, no need to go
	// further.
	//
	if ((pCurrentView->IsKindOf(pViewClass)) == TRUE)
	{
		return(pCurrentView);
	}
 
	//
	// Get pointer to CDocument object so that it can be used in the
	// creation process of the new view. Set flag so that the document
	// will not be deleted when view is destroyed.
	//
	CMapDoc *pDoc = (CMapDoc *)pCurrentView->GetDocument();
    BOOL bAutoDelete = pDoc->m_bAutoDelete;
    pDoc->m_bAutoDelete=FALSE;

	int iRow = 0, iCol = 0;
	CRect rect;

	// Delete existing view
	if (bUsingSplitter)
	{
		pCurrentView->GetClientRect(rect);
		m_wndSplitter->GetActivePane(&iRow, &iCol);
		m_wndSplitter->DeleteView(iRow, iCol);
	}
	else
	{
		pCurrentView->DestroyWindow();
	}

    // Restore the autodelete flag.
    pDoc->m_bAutoDelete = bAutoDelete;
 
	// Create new view and redraw.
	CCreateContext context;

	context.m_pNewViewClass = pViewClass;
	context.m_pCurrentDoc = pDoc;
	context.m_pNewDocTemplate = NULL;
	context.m_pLastView = NULL;
	context.m_pCurrentFrame=this;
 
	CView *pNewView = NULL;

	if (bUsingSplitter)
	{
		if (m_wndSplitter->CreateView(iRow, iCol, pViewClass, rect.Size(), &context))
		{
			pNewView = (CView *)m_wndSplitter->GetPane(iRow, iCol);
		}
	}
	else
	{
		pNewView = (CView *)pViewClass->CreateObject();
		if (pNewView)
		{
			CRect r;
			GetClientRect(r);

			if (!pNewView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, r, this, AFX_IDW_PANE_FIRST, &context))
			{
				pNewView = NULL;
			}
		}
 	}

	if (!pNewView) 
	{
		TRACE0("Warning: couldn't create view for frame\n");
		return(NULL);
	}
 
	pNewView->SendMessage(WM_INITIALUPDATE, 0, 0);

	if (bUsingSplitter)
	{
		m_wndSplitter->RecalcLayout();
	}
 
	return(pNewView);
}
예제 #29
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bSplitter - 
//-----------------------------------------------------------------------------
void CChildFrame::SetSplitterMode(BOOL bSplitter)
{
	if(bSplitter == bUsingSplitter)
		return;	// already at this mode

	if(!bSplitter)
	{
		// delete the splitterwnd.. first, get the view that it is currently
		//  using.
		CView * pActiveView = GetActiveView();
		CDocument* pDoc = pActiveView->GetDocument();

	    BOOL bAutoDelete=pDoc->m_bAutoDelete;
		pDoc->m_bAutoDelete=FALSE;

		pActiveView->SetRedraw(FALSE);
		m_wndSplitter->SetRedraw(FALSE);
		pActiveView->SetParent(this);

		m_wndSplitter->DestroyWindow();
		delete m_wndSplitter;
		m_wndSplitter = NULL;

		pDoc->m_bAutoDelete = bAutoDelete;

		// redraw active view
		CRect r;
		GetClientRect(r);
		pActiveView->SetRedraw(TRUE);
		pActiveView->MoveWindow(0, 0, r.right, r.bottom, TRUE);
	}
	else
	{
		CView * pActiveView = GetActiveView();
		Assert(pActiveView);
		CMapDoc* pDoc = (CMapDoc*) pActiveView->GetDocument();

	    BOOL bAutoDelete=pDoc->m_bAutoDelete;
		pDoc->m_bAutoDelete=FALSE;
		pActiveView->DestroyWindow();
		pDoc->m_bAutoDelete = bAutoDelete;

		// creating new four views.
		m_wndSplitter = new CMySplitterWnd;
		if(!m_wndSplitter->CreateStatic(this, 2, 2))
		{
			TRACE0("Failed to create split bar ");
			return;    // failed to create
		}

		CRect r;
		GetClientRect(r);
		CSize sizeView(r.Width()/2 - 3, r.Height()/2 - 3);

		CCreateContext context;
		context.m_pNewViewClass = NULL;
		context.m_pCurrentDoc = pDoc;
		context.m_pNewDocTemplate = NULL;
		context.m_pLastView = NULL;
		context.m_pCurrentFrame = this;

		context.m_pNewViewClass = RUNTIME_CLASS(CMapView2D);
		m_wndSplitter->CreateView(0, 1, RUNTIME_CLASS(CMapView2D),
			sizeView, &context);
		m_wndSplitter->CreateView(1, 0, RUNTIME_CLASS(CMapView2D),
			sizeView, &context);
		m_wndSplitter->CreateView(1, 1, RUNTIME_CLASS(CMapView2D),
			sizeView, &context);

		context.m_pNewViewClass = RUNTIME_CLASS(CMapView3D);

		m_wndSplitter->CreateView(0, 0, context.m_pNewViewClass,
			sizeView, &context);
	}

	bUsingSplitter = bSplitter;
}
예제 #30
0
파일: XDialog.cpp 프로젝트: uesoft/AutoIPED
BOOL CXDialog::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	ASSERT(pMsg != NULL);
	ASSERT_VALID(this);
	ASSERT(m_hWnd != NULL);

	// allow tooltip messages to be filtered
	if (m_bAccelToParentFrm && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST )
	{
		// use document specific accelerator table over m_hAccelTable
		
		CView* pView =(CView*)GetParent();
		CDocument *pDoc=NULL;
		if(pView && pView->IsKindOf(RUNTIME_CLASS(CView)))
		{
			pDoc=pView->GetDocument();
		}
		if(pDoc==NULL)
			goto PreMsgOut;
		if(pMsg->wParam==VK_TAB)
			goto PreMsgOut;
		if(pMsg->wParam==VK_SPACE)
			goto PreMsgOut;
		if(pMsg->wParam==VK_RETURN)
			goto PreMsgOut;
		if(pMsg->wParam==VK_BACK)
			goto PreMsgOut;

		if(VK_LEFT <= pMsg->wParam && pMsg->wParam <= VK_DOWN)
			goto PreMsgOut;
		if(VK_END <= pMsg->wParam && pMsg->wParam <= VK_HOME)
			goto PreMsgOut;
		if(VK_INSERT <= pMsg->wParam && pMsg->wParam <= VK_DELETE)
			goto PreMsgOut;
		if(VK_NUMPAD0 <= pMsg->wParam && pMsg->wParam <= VK_DIVIDE)
			goto PreMsgOut;

		if(pMsg->wParam==VK_F1)
			goto PreMsgOut;

		char ch=(char)pMsg->wParam;

		if('a'<=ch && ch<='z')
			ch+='A'-'a';

		if(ch=='C')
			goto PreMsgOut;
		if(ch=='V')
			goto PreMsgOut;
		if(ch=='X')
			goto PreMsgOut;
		if(ch=='Z')
			goto PreMsgOut;
		if(ch=='Y')
			goto PreMsgOut;

		HACCEL hAccel = pDoc->GetDefaultAccelerator();
		return (hAccel != NULL &&
		   ::TranslateAccelerator(pView->m_hWnd, hAccel, pMsg));
		goto PreMsgOut;
	}
PreMsgOut:
	return CDialog::PreTranslateMessage(pMsg);
}