Esempio n. 1
0
void CAipi_Error::errorMark(unsigned int nLine)
{
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
	CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
	CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
	ASSERT(pView);
	
	//Find file path
	CAIPIEditorDoc* pDoc = (CAIPIEditorDoc*)pView->GetDocument();
	ASSERT_VALID(pDoc);
	CString strPath = pDoc->GetPathName();
	//AfxMessageBox(strPath);


	CScintillaCtrl& rCtrl = pView->GetCtrl();
	
	// Reset Scintilla Markers 
	rCtrl.MarkerDeleteAll(0);

	// Initilaize error markers
	rCtrl.MarkerDefine(0, SC_MARK_ARROW);
	rCtrl.MarkerSetFore(0, RGB( 80, 0, 0 ));
	rCtrl.MarkerSetBack(0, RGB( 255, 0, 0 ));
	
	// Set error marker to proper line
	rCtrl.MarkerAdd((nLine - 1), 0);
	rCtrl.GotoLine(nLine - 1);
	

}
Esempio n. 2
0
void CMainFrame::OnSysColorChange()
{
	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		const MSG* pMsg = GetCurrentMessage();
		pView->GetCtrl().SendMessage(WM_SYSCOLORCHANGE, pMsg->wParam, pMsg->lParam);
	}

	CFrameWnd::OnSysColorChange();
}
Esempio n. 3
0
void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		const MSG* pMsg = GetCurrentMessage();
		pView->GetCtrl().SendMessage(WM_SETTINGCHANGE, pMsg->wParam, pMsg->lParam);
	}

	CFrameWnd::OnSettingChange(uFlags, lpszSection);
}
Esempio n. 4
0
BOOL CMainFrame::OnQueryNewPalette()
{
	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		const MSG* pMsg = GetCurrentMessage();
		pView->GetCtrl().SendMessage(WM_QUERYNEWPALETTE, pMsg->wParam, pMsg->lParam);
	}

	return CFrameWnd::OnQueryNewPalette();
}
Esempio n. 5
0
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd)
{
	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		const MSG* pMsg = GetCurrentMessage();
		pView->GetCtrl().SendMessage(WM_PALETTECHANGED, pMsg->wParam, pMsg->lParam);
	}

	CFrameWnd::OnPaletteChanged(pFocusWnd);
}
Esempio n. 6
0
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
	CFrameWnd::OnSize(nType, cx, cy);

	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		CScintillaCtrl& rCtrl = pView->GetCtrl();

		// Cancel any outstanding call tip
		if (rCtrl.CallTipActive())
			rCtrl.CallTipCancel();
	}
}
Esempio n. 7
0
void CMainFrame::OnMove(int x, int y)
{
	CFrameWnd::OnMove(x, y);

	CScintillaView* pView = GetScintillaView();
	if (pView != NULL)
	{
		CScintillaCtrl& rCtrl = pView->GetCtrl();

		// Cancel any outstanding call tip
		if (rCtrl.CallTipActive())
			rCtrl.CallTipCancel();
	}
}
Esempio n. 8
0
void COutputTabView::OnItemchangedList3(NMHDR* pNMHDR, LRESULT* pResult) 
{
	
	//AfxMessageBox(_T("hola"));
	
	//CAIPIEditView notification modified message
	g_bNotificationModified = false;
	

	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*) pNMHDR;
	int nSelected = pNMListView->iItem;
	
	CString strItemLine		= m_listCtrl3.GetItemText(nSelected, 1);
	CString strItemPos		= m_listCtrl3.GetItemText(nSelected, 2);
	CString strFilePath		= m_listCtrl3.GetItemText(nSelected, 3);
	CString strFileName		= m_listCtrl3.GetItemText(nSelected, 4);
	
	CString strPathName = strFilePath + strFileName;

	int iLine = _ttoi(strItemLine);
	long iPos = _ttoi(strItemPos);
	int len = m_strFindText.GetLength();

		
	if ( pNMListView->uNewState & LVIS_SELECTED)
	{
			
		if( strFileName != _T(" - ") )
		{
		
			CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();
			BOOL alreadyOpen = pApp->SetDocumentView(strPathName);
		

				//if document is not already open then open it
			if( alreadyOpen == FALSE )
			{
				CString strExt = strPathName.Right(3);

			
				if( strExt == _T("knw") || strExt == _T("txt") )
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("The file  (") + strFileName + _T(")  was opened."));		
				}
				else if ( strExt == _T("ssn") || strExt == _T("rtf") )
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("WARNING: Aipi session file found (.ipi). The file  (") + strFileName + _T(")  do not belong to Aipi knowlegde files. Check the path and the name of the file."));	
				}
				else if( strExt == _T("csv") || _T("idt") || _T("tre") )
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("WARNING: Aipi tree file (.adt). The file  (") + strFileName + _T(")  do not belong to Aipi knowledge files. Check the path and the name of the file."));
				}
				else
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("WARNING: The file  (") + strFileName + _T(")   do not belong to Aipi knowledge files. Check the path and the name of the file."));
				}
		
				pApp->m_pAIPIEditorDocTemplate->OpenDocumentFile(strPathName);
				if( pApp == NULL )
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("ERROR: The file  (") + strFileName + _T(")   could not be linked. Check if the file is not corrupted."));
					return;
				}
		
		
			}
			else
			{
				CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
				CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
				CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
				ASSERT(pView);
				CScintillaCtrl& rCtrl = pView->GetCtrl();
				// Reset Scintilla Markers 
				rCtrl.MarkerDeleteAll(0);

				// Initilaize error markers
				rCtrl.MarkerDefine(0, SC_MARK_SHORTARROW);
				rCtrl.MarkerSetFore(0, RGB( 0, 0, 255 ));
				rCtrl.MarkerSetBack(0, RGB( 0, 0, 255 ));
		
				// Set error marker to proper line
				rCtrl.GotoLine(iLine -1 );
				rCtrl.MarkerAdd((iLine - 1), 0);

				//Set the cursor position in the GUI
				rCtrl.SetFocus();
				rCtrl.SetSel(iPos - len, iPos);
				
				//int n = pApp->CountOpenDocuments();
				//int b = n;
			}

		}

		 
		
		
	}	

	
	*pResult;
	Beep(iPos, 100);

	g_bNotificationModified = true;
	
	
	
}
Esempio n. 9
0
void COutputTabView::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	//CAIPIEditView notification modified message
    g_bNotificationModified = false; 
	
	
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*) pNMHDR;
	int nSelected = pNMListView->iItem;
	
	
	CString strItemLine = m_listCtrl2.GetItemText(nSelected, 1);
	CString strItemPos = m_listCtrl2.GetItemText(nSelected, 2);
	CString strFilePath = m_listCtrl2.GetItemText(nSelected, 4); 

    int iLine = _ttoi(strItemLine);
	unsigned int iPos = _ttoi(strItemPos);
	
	
		
	if ( pNMListView->uNewState & LVIS_SELECTED)
	{
		
		if( strFilePath != _T(" - ") )
		{		
			CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();
			BOOL alreadyOpen = pApp->SetDocumentView(strFilePath);
			
			//if document is not already open then open it
			if( alreadyOpen == FALSE )
			{
				pApp->m_pAIPIEditorDocTemplate->OpenDocumentFile(strFilePath);
				if( pApp == NULL )
				{
					CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
					pMainFrame->m_wndOutputTabView.AddMsg1(_T("ERROR: The file  (") + strFilePath + _T(")   could not be linked. Check if the file is not corrupted."));
					return;
				}
			}
			else
			{

				
				//MessageBox(strItem);
				CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
				CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
				CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
				ASSERT(pView);
				CScintillaCtrl& rCtrl = pView->GetCtrl();
		
				// Reset Scintilla Markers 
				rCtrl.MarkerDeleteAll(0);

				// Initilaize error markers
				rCtrl.MarkerDefine(0, SC_MARK_SHORTARROW);
				rCtrl.MarkerSetFore(0, RGB( 0, 0, 255 ));
				rCtrl.MarkerSetBack(0, RGB( 0, 0, 255 ));
		
				// Set error marker to proper line
				rCtrl.GotoLine(iLine -1 );
				rCtrl.MarkerAdd((iLine - 1), 0);

				//Set the cursor position in the GUI
				rCtrl.SetFocus();
				rCtrl.SetSel(iPos, iPos + 1);
			}
		}
		
	}	
	
	*pResult;
	Beep(iPos, 100);

	g_bNotificationModified = true;
	
}
Esempio n. 10
0
void COutputTabView::FindExtDesc(CString strFindText, BOOL bCase, BOOL bWord, BOOL bRegularExpression)
{
	//USES_CONVERSION;
	const int FIND_LENGTH = 1040;
	LANGID dwLanguageID = GetSystemLanguagePrimaryID();
	
	BOOL bFound = FALSE;
	BOOL bWholeWord = FALSE;
	BOOL bMatchCase = FALSE;
	BOOL bRegExp = FALSE;

	LVITEM Item;
	int iBufferSize = 254;
	int iCount = 0;
	int iLine = 0;
	int iPos = 0;
	int iType = 1;
		
	TCHAR chBuff[16];

	
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
	CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
	CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
	ASSERT(pView);

	
	CScintillaCtrl& rCtrl = pView->GetCtrl();
	int iLastLine = rCtrl.GetLineCount();
	iPos = rCtrl.GetLineEndPosition(iLastLine -1);
	rCtrl.GotoPos(iPos);
	rCtrl.SetCurrentPos(iPos);

	
		if ( bCase == TRUE)
			bMatchCase = SCFIND_MATCHCASE;
		if ( bWord == TRUE)
			bWholeWord = SCFIND_WHOLEWORD;
		if ( bRegularExpression == TRUE)
			bRegExp = SCFIND_REGEXP;


	do 
	{
		
		bFound = pView->FindTextSimple(strFindText, FALSE ,bMatchCase ,bWholeWord ,bRegExp);
		
		if (bFound == FALSE )
			break;

		iPos = rCtrl.GetCurrentPos();
		iLine = rCtrl.LineFromPosition(iPos);
		//int iLen = rCtrl.LineLength(iLine);
	
		
		int nStartSel = rCtrl.PositionFromLine(iLine);
		int nEndSel = rCtrl.GetLineEndPosition(iLine);
		int iLength = nEndSel - nStartSel + 1;
		
		
			
			TextRange tr;
			tr.chrg.cpMin = nStartSel;
			tr.chrg.cpMax = nEndSel;
			char sText[FIND_LENGTH];
							
			tr.lpstrText = sText;
			
			if (iLength > FIND_LENGTH )
			{
				rCtrl.GetText(FIND_LENGTH, sText);
			}
			else
				rCtrl.GetTextRange(&tr);
			
			CString strPos = _itot(iPos, chBuff, 10);
			CString strLine = _itot(iLine + 1, chBuff, 10);
			CString strText = (CString)sText;
			strText.Remove('\t');
			
			
			LPTSTR lpszText = (LPTSTR)strText.GetBuffer(iBufferSize);
			LPTSTR lpszLine = strLine.GetBuffer(iBufferSize);
			LPTSTR lpszPos = strPos.GetBuffer(iBufferSize);
			LPTSTR lpszFilePath = _T(" - ");
			LPTSTR lpszFileName = _T(" - ");
			LPTSTR lpszFileSize = _T(" - ");
			LPTSTR lpszFileDate = _T(" - ");
			
			//Handle Internationational
			switch(dwLanguageID)
			{
				case LANG_SPANISH:
					Item = AddListItem3(0, 0, _T(""), iType );
					break;
				default:
					Item = AddListItem3(0, 0, _T(""), iType );
					break;
			}
			
			AddListSubItem3(Item, 0, 1,lpszLine);
			AddListSubItem3(Item, 0, 2,lpszPos);
			AddListSubItem3(Item, 0, 3,lpszFilePath);
			AddListSubItem3(Item, 0, 4,lpszFileName);
			AddListSubItem3(Item, 0, 5,lpszFileSize);
			AddListSubItem3(Item, 0, 6,lpszFileDate);
			AddListSubItem3(Item, 0, 7,lpszText);
			
			iCount++;
	
	} while( bFound == TRUE);

	
	
	CString strCount = _itot(iCount, chBuff, 10);
	LPTSTR lpszCount = _T("0");

	LVCOLUMN lvcol;

	switch(dwLanguageID)
	{
		case LANG_SPANISH:
			strCount = _T("Contenido     *** ") + strCount + _T("  palabra(s) encontrada(s) de la búsqueda. ***");
			lpszCount = strCount.GetBuffer(iBufferSize);
			
			lvcol.pszText = lpszCount;
			m_listCtrl3.SetColumn(7, &lvcol);
			break;
		default:
			strCount = _T("Content     *** ")+ strCount + _T("  ocurrence(s) have been found. ***");
			lpszCount = strCount.GetBuffer(iBufferSize);
			
			lvcol.pszText = lpszCount;
			m_listCtrl3.SetColumn(7, &lvcol);
			break;
	}


}
Esempio n. 11
0
void CAipi_Error::displayRunTimeFileError(int e, int type, CString path, CString desc)
{
	
	CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();
	BOOL alreadyOpen = pApp->UpdateDocumentView(path);
	//if document is not already open then open it
	if( alreadyOpen == FALSE )
	{
		pApp->m_pAIPIEditorDocTemplate->OpenDocumentFile(path);
	}
		
	CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
	TCHAR buff[64];

	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
	CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
	CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
	ASSERT(pView);
	CScintillaCtrl& rCtrl = pView->GetCtrl();

	
	LPTSTR lpsErrLine =_T("0");
	LPTSTR lpsErrPos = _T("0");
	LPTSTR lpsErrCode = _T("0");
	LPTSTR lpsErrDesc = _T("No description has found for this error");
	LPTSTR lpsErrFile = _T("");  
	
	//Handle Internationational
	LANGID dwLanguageID = GetSystemLanguagePrimaryID();

	switch( dwLanguageID)
	{
	case LANG_SPANISH:
		//errLine = _bstr_t(_T("Línea: "))  +  _itot( g_currentLine, buff, 10 );
		//errPos = _bstr_t(_T("Pos. "))  +  _itot(g_currentPos, buff, 10);
		break;
	default:
		//errLine = _bstr_t(_T("Line: "))  +  _itot( g_currentLine, buff, 10 );
		//errPos = _bstr_t(_T("Pos. "))  +  _itot(g_currentPos, buff, 10);
		break;
	}

	//errorMark(g_currentLine);


	
	switch(type)
	{
	case LEX_ERROR:
		++g_LexError;
		break;
	case SINTAX_ERROR:
		++g_SintaxError;
		break;
	case SEMANT_ERROR:
		++g_SemantError;
		break;
	case WARNING_ERROR:
		++g_WarningError;
		break;
	case QUESTION_ERROR:
		++g_QuestionError;
		break;
	case STOP_ERROR:
		++g_StopError;
		break;
	case INFO_ERROR:
		++g_InfoError;
		break;
		
	}
	
	

	findErrorMembers(e);
	
	lpsErrCode = _itot( e, buff, 10 );
		
	
	CString strErrPos = _itot(g_fcurrentPos, buff, 10);
	lpsErrPos = strErrPos.GetBuffer(0);  
	strErrPos.ReleaseBuffer();
	
	//CString strErrLine = _itot(g_currentLine, buff, 10);
	CString strErrLine = _itot(rCtrl.LineFromPosition(g_fcurrentPos) + 1, buff, 10);
	lpsErrLine = strErrLine.GetBuffer(0);  
	strErrLine.ReleaseBuffer();
	
	CString strErrDesc = m_ErrorMsg + desc;
	lpsErrDesc = strErrDesc.GetBuffer(0);  
	strErrDesc.ReleaseBuffer();

	CString strErrFile = g_currentFile;
	lpsErrFile = strErrFile.GetBuffer(0);  
	lpsErrFile = strErrFile.GetBuffer(0);
	
	
	if ( pMainFrame->m_wndOutputTabView.IsVisible())
    {
		
		pMainFrame->m_wndOutputTabView.m_TabViewContainer.SetActivePageIndex(1);
		LVITEM  Item = pMainFrame->m_wndOutputTabView.AddListItem2(0, 0, _T(""), type);
		pMainFrame->m_wndOutputTabView.AddListSubItem2(Item, 0, 1, lpsErrLine);
		pMainFrame->m_wndOutputTabView.AddListSubItem2(Item, 0, 2, lpsErrPos);
		pMainFrame->m_wndOutputTabView.AddListSubItem2(Item, 0, 3, lpsErrDesc);
		pMainFrame->m_wndOutputTabView.AddListSubItem2(Item, 0, 4, lpsErrFile);
		pMainFrame->m_wndOutputTabView.AddListSubItem2(Item, 0, 5, lpsErrCode);
	}

  
	
}