Example #1
0
void CBonfireDoc::OnGotoLine() 
{
	CGoToDlg	GoToDlg;

	if (GoToDlg.DoModal() == IDOK)
	{
		try
		{
			// get user input
			int line	= atoi(GoToDlg.m_strGoToValue);
			int max		= m_xTextBuffer.GetLineCount();
			
			// check min
			if (line <= 0)
				line = 1;

			// check max
			if (line >= max)
				line = max;
			
			CPoint pt1(0, line - 1);
		
			try
			{
				CBonfireView*	pBNewView	= NULL;
				CView*			pSourceView	= NULL;
			
				CString strCaption = ((CBonfireView)theApp.m_arAllViews[0]).m_strCaption;
				SwitchToView(strCaption);
				
				// check if a view of this type already exists
 				if ( !m_pViews->Lookup(strCaption, (void*&)pBNewView) )
					throw "No Such Viewer Found";
					
				pSourceView = pBNewView->m_pView;
				
				// go to the desired line
				((CSourceView*)pSourceView)->SetCursorPos(pt1);
				((CSourceView*)pSourceView)->EnsureVisible(pt1);
			}
			catch (...)
			{
				g_pMainFrame->AddOutputError("Error occurred while trying to seek to line.");
			}
		}
		catch (char* e)
		{
			CString strMessage;
			strMessage.Format("Error occurred while accessing the source view: %s", e);
			g_pMainFrame->AddOutputError(strMessage);
		}
		catch (...)
		{
			g_pMainFrame->AddOutputError("Invalid value inputted for \"Go To\".");
		}
	}
}
Example #2
0
/////////////////////////////////////////////////////////////////////////////
// switch to the first view under configuration settings - HACK
/////////////////////////////////////////////////////////////////////////////
void CBonfireDoc::SwitchToFirstView()
{
	POSITION pos			= GetFirstViewPosition();
	CChildFrame* pChild		= (CChildFrame*)GetNextView(pos)->GetParentFrame();
	if (pChild->m_wndTabBar.GetTabCount())
	{
		CString strFirstView	= pChild->m_wndTabBar.m_arrTabs[0];
		pChild->m_wndTabBar.SetSelTab(0);
		SwitchToView(strFirstView);
	}
}
Example #3
0
 const viewLabel_t SwitchToDefaultView() { return SwitchToView(GetDefaultViewLabel()); }
Example #4
0
void CMainFrame::OnViewHexView() 
{
	SwitchToView(HEX);	
}
Example #5
0
void CMainFrame::OnViewStringView() 
{
	SwitchToView(STRING);
}