Пример #1
0
void CCompositeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	CChildFrame* pFrame = DYNAMIC_DOWNCAST( CChildFrame, GetParentFrame() );
	if( !pFrame || !pFrame->IsWindowVisible() )
		return;

	if( !GetDVController() )
		return;

	// update the comparison doc detail sand frame
	CString csTitleBarText;
	CString csComparisonDoc = GetDVController()->GetComparisonDocController().GetComparisonDocumentTitle();
	if (pFrame && !csComparisonDoc.IsEmpty())
	{
		// do not keep setting the title text to the same stuff as it forces the tabctrl to relayout and repaint
		CString existingText;
		pFrame->GetWindowText(existingText);
		if (existingText != csComparisonDoc)
		{
			pFrame->GetDocument()->SetTitle(csComparisonDoc);

			if (csComparisonDoc.GetLength()>40)
			{
				csComparisonDoc = csComparisonDoc.Left(32);
				csComparisonDoc.TrimRight(L" ");
				csComparisonDoc += L"...";
			}
  			pFrame->SetWindowText(csComparisonDoc);
		}
	}
	else
	{
		// do not keep setting the title text to the same stuff as it forces the tabctrl to relayout and repaint
		CString existingText;
		pFrame->GetWindowText(existingText);
		if (existingText!= GetApplicationTitle())
			pFrame->SetWindowText(GetApplicationTitle());
	}
	
	try
	{
		if (GetDocObject())
			GetDocObject()->Repaint();
	}
	catch (...)
	{
		_ASSERTE(!_T("Catch ... How did we get here?"));
	}
	
	UpdateWindow();
}
Пример #2
0
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
	if (nCode == CN_UPDATE_COMMAND_UI)
	{
		if (nID >= WM_CLASSMENU && nID < (WM_CLASSMENU + WM_MAXITEMS))
		{ 
			((CCmdUI*)pExtra)->Enable(TRUE); 
			return TRUE;
		}
		else if (nID >= WM_PROCESSMENU && nID < (WM_PROCESSMENU + WM_MAXITEMS))
		{ 
			((CCmdUI*)pExtra)->Enable(TRUE); 
			return TRUE;
		}
		else if (nID >= WM_DELETECLASSMENU && nID < (WM_DELETECLASSMENU + WM_MAXITEMS))
		{ 
			((CCmdUI*)pExtra)->Enable(TRUE); 
			return TRUE;
		}
	}
	if (nCode == CN_COMMAND)
	{
		if (nID >= WM_CLASSMENU && nID < (WM_CLASSMENU + WM_MAXITEMS))
		{
			UINT idx = nID - WM_CLASSMENU;

			CChildFrame* pChild = (CChildFrame*)this->CreateNewChild(RUNTIME_CLASS(CChildFrame), IDR_ReClass2015TYPE, theApp.m_hMDIMenu, theApp.m_hMDIAccel);
			CNodeClass* pClass = theApp.Classes[idx];
			pClass->pChildWindow = pChild;

			pChild->SetTitle(pClass->Name);
			pChild->SetWindowText(pClass->Name);
			UpdateFrameTitleForDocument(pClass->Name);
			pChild->m_wndView.m_pClass = pClass;
			return TRUE;
		}
		if (nID >= WM_PROCESSMENU && nID < (WM_PROCESSMENU + WM_MAXITEMS) )
		{
			UINT idx = nID - WM_PROCESSMENU;
			g_ProcessID = ProcMenuItems[idx].ProcessId;
			g_hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, g_ProcessID);
			UpdateMemoryMap();
			return TRUE;
		}
		if (nID >= WM_DELETECLASSMENU && nID < (WM_DELETECLASSMENU + WM_MAXITEMS) )
		{
			UINT idx = nID - WM_DELETECLASSMENU;
			if (theApp.Classes[idx]->pChildWindow)
				theApp.Classes[idx]->pChildWindow->SendMessage(WM_CLOSE, 0, 0);
			theApp.DeleteClass(theApp.Classes[idx]);
			return TRUE;
		}
	}

	return CMDIFrameWndEx::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
Пример #3
0
void CMainFrame::OnFileNew() 
{
	BOOL bMaximized = FALSE;
	// creates a new child window, maximized if active child is maximized
	CChildFrame* pActiveChild = (CChildFrame*) MDIGetActive(&bMaximized);
	CChildFrame* pChild = new CChildFrame();
	pChild->LoadFrame(IDR_EX22CTYPE,
		WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW |
		(bMaximized ? WS_MAXIMIZE : 0), this);

	CString strTitle;
	strTitle.Format("Child Window %d", m_nChild++);
	pChild->SetWindowText(strTitle);
}
Пример #4
0
void CLayout::SetName(CString name_) 
{
	if (name_ == "")
		return;

	// check it's not in use by other layouts
	CLayout* layout;
	POSITION position = application->layouts.GetHeadPosition();

	for (int i = 0; i < application->layouts.GetCount(); i++)
	{ 
		layout = application->layouts.GetNext(position);
		
		if (layout->GetName() == name_)
			return;
	}

	m_Name = name_;
	m_WndName = name_;

	HWND ClientWindow;
	ClientWindow = ::GetWindow(g_MainFrame->m_hWndMDIClient, GW_CHILD);

	// Now find any layouts within this application
	while (ClientWindow != NULL)
	{
		CChildFrame* pWnd = (CChildFrame*)CWnd::FromHandle(ClientWindow);
		if(pWnd->layout == this)
		{
			// Rename
			CString Title;
			Title.Format("%s : %s", pWnd->application->file_information.name, m_Name);
			pWnd->SetWindowText(Title);
		}

		ClientWindow = :: GetWindow(ClientWindow, GW_HWNDNEXT);
	}

	// update project bar
	g_MainFrame->project_bar.tree.SetItemText(tree, name_);

	// Update windows displaying this potentially
	g_MainFrame->tabs.RedrawWindow();

}
Пример #5
0
void CChildView::OnPaint()
{
	CRect pos(0, 0, 0, 0);
	HotSpots.clear();

	CPaintDC pdc(this); // device context for painting
	CMemDC m(pdc, this);
	CDC& dc = m.GetDC();

	CRect client;
	GetClientRect(&client);

	dc.FillSolidRect(&client, crBackground);
	if (!m_pClass)
		return;

	dc.SelectObject(&Font);

	HotSpots.clear();

	DWORD classSize = m_pClass->GetMemorySize();
	Memory.SetSize(classSize);
	ReadMemory((LPVOID)m_pClass->offset, Memory.pMemory, classSize);

	ViewInfo View;
	View.Address = m_pClass->offset;
	View.pData = Memory.pMemory;
	View.Classes = &theApp.Classes;
	View.client = &client;
	View.dc = &dc;
	View.Level = 0;
	View.HotSpots = &HotSpots;
	View.bMultiSelected = (Selected.size() > 1) ? true : false;

	int ypos = m_Scroll.GetScrollPos() * FontHeight;
	if (m_Scroll.IsWindowVisible()) View.client->right -= SB_WIDTH;

	int DrawMax = m_pClass->Draw(View, 0, -ypos) + ypos;

	if (m_pClass->RequestPosition != -1)
	{
		if ((m_pClass->RequestPosition >= 0) && ((unsigned int)m_pClass->RequestPosition < theApp.Classes.size()))
		{
			int idx = -1;
			for (UINT i = 0; i < theApp.Classes.size(); i++)
			{
				CNodeClass* pClass = View.Classes->at(i);
				if (m_pClass == theApp.Classes[i])
					idx = i;
			}
			theApp.Classes.erase(theApp.Classes.begin() + idx);
			theApp.Classes.insert(theApp.Classes.begin() + m_pClass->RequestPosition, m_pClass);
		}
		m_pClass->RequestPosition = -1;
	}
	if (client.Height() < DrawMax)
	{
		SCROLLINFO si;
		si.cbSize = sizeof(SCROLLINFO);
		si.fMask = SIF_PAGE | SIF_RANGE;
		si.nMin = 0;
		si.nMax = DrawMax / FontHeight;
		si.nPage = client.Height() / FontHeight;
		m_Scroll.SetScrollInfo(&si);
		m_Scroll.ShowScrollBar(1);
	}
	else
	{
		m_Scroll.SetScrollPos(0);
		m_Scroll.ShowScrollBar(0);
	}


	// this makes tabs
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CChildFrame* pChild = (CChildFrame*)pFrame->GetActiveFrame();
	if (pChild->m_wndView.m_hWnd == this->m_hWnd)
	{
		pChild->SetWindowText(m_pClass->Name.GetString());
		pChild->SetTitle(m_pClass->Name.GetString());
		pFrame->UpdateFrameTitleForDocument(m_pClass->Name.GetString());

		//char txt[256];
		//sprintf (txt,"Total HotSpots: %i",HotSpots.size());

		//dc.SetTextColor(0xFF0000);
		//dc.SetBkColor(0x000000);
		//dc.SetBkMode(OPAQUE);
		//dc.DrawText(txt,-1,&CRect(0,0,0,0), DT_LEFT | DT_NOCLIP | DT_NOPREFIX);
	}

	//for (UINT i=0; i < HotSpots.size();i++)
	//{
	//	dc.DrawFocusRect(HotSpots[i].Rect);
	//}
}