Ejemplo n.º 1
0
void CSmcView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();

    CSmcDoc* pDoc = (CSmcDoc*)GetDocument();


    while ( m_strList.GetCount () < pDoc->m_nScrollSize ) 
        m_strList.AddTail("");

    // Init colors 
    m_nCurrentBg = 0;
    m_nCurrentFg =7;
    

//===================================================================================================================

    ((CMainFrame*)AfxGetMainWnd())->m_editBar.GetDlgItem(IDC_EDIT)->SetFont(&pDoc->m_fntText);

    CRect rect;
    GetClientRect(&rect);

    // To init screen dimentions in characters !!!
/*    OnSize(0 , rect.Width(), rect.Height());
*/
    
    SetScrollSettings();

    if ( dwThreadID == 0 ) 
	    CreateThread(NULL, 0, &ClientThread, NULL, 0, &dwThreadID);

}
Ejemplo n.º 2
0
int CAnsiWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
    SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
    while ( m_strList.GetCount () < pDoc->m_nScrollSize ) 
        m_strList.AddTail("");

    // Init colors 
    m_nCurrentBg = 0;
    m_nCurrentFg =7;
    

//===================================================================================================================

    ((CMainFrame*)AfxGetMainWnd())->m_editBar.GetDlgItem(IDC_EDIT)->SetFont(&pDoc->m_fntText);

    CRect rect;
    GetClientRect(&rect);

    // To init screen dimentions in characters !!!
    
    SetScrollSettings();
    return 0;
}
Ejemplo n.º 3
0
int CAnsiWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
    SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
    while ( m_strList.GetCount () < nScrollSize ) 
        m_strList.AddTail("");

	m_TotalLinesReceived = 0;

    // Init colors 
    m_nCurrentBg = 0;
    m_nCurrentFg =7;
    

//===================================================================================================================

    CRect rect;
    GetClientRect(&rect);

    // To init screen dimentions in characters !!!
    
    SetScrollSettings();
    return 0;
}
Ejemplo n.º 4
0
void CAnsiWnd::OnSize(UINT nType, int cx, int cy) 
{
    CWnd::OnSize(nType, cx, cy);
    m_nLastPageSize = m_nPageSize;
    m_nPageSize = cy/pDoc->m_nYsize;
    m_nYDiff = cy - m_nPageSize*pDoc->m_nYsize;
    SetScrollSettings(FALSE);
//vls-begin// multiple output
//    pDoc->m_nOutWindowCharsSize = max (cx/pDoc->m_nCharX, 1);
    pDoc->m_nOutputWindowCharsSize[m_wndCode] = max (cx/pDoc->m_nCharX, 1);
//vls-end//
}
Ejemplo n.º 5
0
void CSmcView::OnSize(UINT nType, int cx, int cy) 
{
	CSmcDoc* pDoc = GetDocument();
    CView::OnSize(nType, cx, cy);
    m_nLastPageSize = m_nPageSize;
    m_nPageSize = cy/pDoc->m_nYsize;
    m_nYDiff = cy - m_nPageSize*pDoc->m_nYsize;
    SetScrollSettings(FALSE);
    pDoc->m_nWindowCharsSize = max (cx/pDoc->m_nCharX, 1);
/*    InvalidateRect(NULL, FALSE);
    UpdateWindow();
*/}
Ejemplo n.º 6
0
void CAnsiWnd::OnSize(UINT nType, int cx, int cy) 
{
    CWnd::OnSize(nType, cx, cy);
    
	m_nLastPageSize = m_nPageSize;
    m_nPageSize = min(cy/pDoc->m_nYsize, nScrollSize);
	
    m_nYDiff = cy - m_nPageSize*pDoc->m_nYsize;

	m_nLineWidth = cx/pDoc->m_nCharX;
	if(cx % pDoc->m_nCharX)
		m_nLineWidth++;

    SetScrollSettings(FALSE);
    pDoc->m_nOutputWindowCharsSize[m_wndCode] = m_nLineWidth;
}
Ejemplo n.º 7
0
void CAnsiWnd::OnUpdate(LPARAM lHint) 
{
    switch ( lHint ) {
    case TEXT_ARRIVED:
        // redraw etc 
        {
            CRect rect, rectSmall;

	        GetClientRect(&rect);

//vls-begin// multiple output
//	        ASSERT(pDoc->m_nOutputUpdateCount == pDoc->m_strOutoputTempList.GetCount()-1 );
//
//	        m_strList.SetAt(m_strList.GetTailPosition(), pDoc->m_strOutoputTempList.GetHead());
//	        // pDoc->m_strOutoputTempList.RemoveHead();
//
//            POSITION pos = pDoc->m_strOutoputTempList.GetHeadPosition();
//            pDoc->m_strOutoputTempList.GetNext(pos);
//
//	        while(pos) {
//		        CString str = pDoc->m_strOutoputTempList.GetNext(pos);
//		        m_strList.AddTail(str);
//		        m_strList.RemoveHead();
//	        }
//            rectSmall.left = 0;
//	        rectSmall.right = rect.right;
//	        rectSmall.bottom = rect.bottom; 
//	        rectSmall.top = rect.bottom -pDoc->m_nYsize*(pDoc->m_nOutputUpdateCount+1);
//            if ( pDoc->m_nOutputUpdateCount ) 
//	            ScrollWindowEx(0, -pDoc->m_nYsize*pDoc->m_nOutputUpdateCount, NULL, &rect, NULL, /*&rectSmall*/ NULL , SW_INVALIDATE | SW_ERASE);
            if (pDoc->m_strOutputTempList[m_wndCode].GetCount() > 0 && pDoc->m_nOutputUpdateCount[m_wndCode] == pDoc->m_strOutputTempList[m_wndCode].GetCount()-1) {
                m_strList.SetAt(m_strList.GetTailPosition(), pDoc->m_strOutputTempList[m_wndCode].GetHead());
                // pDoc->m_strOutoputTempList.RemoveHead();
                
				if ( pDoc->m_bClearOutputContents[m_wndCode] ) {
					for ( POSITION it = m_strList.GetHeadPosition(); it != NULL; m_strList.GetNext(it))
							m_strList.SetAt(it, "");
				}

                POSITION pos = pDoc->m_strOutputTempList[m_wndCode].GetHeadPosition();
                pDoc->m_strOutputTempList[m_wndCode].GetNext(pos);
                
                while(pos) {
                    CString str = pDoc->m_strOutputTempList[m_wndCode].GetNext(pos);
                    m_strList.AddTail(str);
                    m_strList.RemoveHead();
                }
                rectSmall.left = 0;
                rectSmall.right = rect.right;
                rectSmall.bottom = rect.bottom; 
                rectSmall.top = rect.bottom -pDoc->m_nYsize*(pDoc->m_nOutputUpdateCount[m_wndCode]+1);
                if ( pDoc->m_nOutputUpdateCount[m_wndCode] ) 
                    ScrollWindowEx(0, -pDoc->m_nYsize*pDoc->m_nOutputUpdateCount[m_wndCode], NULL, &rect, NULL, /*&rectSmall*/ NULL , SW_INVALIDATE | SW_ERASE);

				if ( pDoc->m_bClearOutputContents[m_wndCode] )
					InvalidateRect(NULL, FALSE);
				else
					InvalidateRect(&rectSmall, FALSE);
				UpdateWindow();
            }
//vls-end//
            /*else */
        }        

        break;
    case SCROLL_SIZE_CHANGED:
        if ( pDoc->m_nScrollSize < m_strList.GetCount() ) { // remove some string from head of list
            while ( pDoc->m_nScrollSize < m_strList.GetCount() ) 
                m_strList.RemoveHead();
        }
        if ( pDoc->m_nScrollSize > m_strList.GetCount() ) {
            while ( pDoc->m_nScrollSize > m_strList.GetCount() ) 
                m_strList.AddHead("");
        }
        SetScrollSettings();
        InvalidateRect(NULL, FALSE);
        UpdateWindow();
        break;
    default:
        break;
    }
	
}
Ejemplo n.º 8
0
void CSmcView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
    CSmcDoc* pDoc = GetDocument();
    switch ( lHint ) {
    case TEXT_ARRIVED:
        // redraw etc 
        {
            CSmcDoc* pDoc = GetDocument();
            CRect rect, rectSmall;

	        GetClientRect(&rect);

	        ASSERT(pDoc->m_nUpdateCount == pDoc->m_strTempList.GetCount()-1 );

			if ( pDoc->m_bClearContents ) {
				for ( POSITION it = m_strList.GetHeadPosition(); it != NULL; m_strList.GetNext(it))
						m_strList.SetAt(it, "");
			}

	        m_strList.SetAt(m_strList.GetTailPosition(), pDoc->m_strTempList.GetHead());
	        // pDoc->m_strTempList.RemoveHead();

            POSITION pos = pDoc->m_strTempList.GetHeadPosition();
            pDoc->m_strTempList.GetNext(pos);

	        while(pos) {
		        CString str = pDoc->m_strTempList.GetNext(pos);
		        m_strList.AddTail(str);
		        m_strList.RemoveHead();
	        }
            // check for splitted and head view 
            if ( pMainWnd->m_wndSplitter.GetRowCount () > 1 && pMainWnd->m_wndSplitter.GetPane(0,0) == this ) {
                int OldPos = GetScrollPos(SB_VERT);
                SetScrollPos(SB_VERT, OldPos-pDoc->m_nUpdateCount, TRUE);
            } else {
                rectSmall.left = 0;
	            rectSmall.right = rect.right;
	            rectSmall.bottom = rect.bottom; 
	            rectSmall.top = rect.bottom -pDoc->m_nYsize*(pDoc->m_nUpdateCount+1);
                if ( pDoc->m_nUpdateCount ) 
	                ScrollWindowEx(0, -pDoc->m_nYsize*pDoc->m_nUpdateCount, NULL, &rect, NULL, /*&rectSmall*/ NULL , SW_INVALIDATE | SW_ERASE);
                /*else */
                if ( pDoc->m_bClearContents ) 
					InvalidateRect(NULL, FALSE);
				else
					InvalidateRect(&rectSmall, FALSE);
	            UpdateWindow();
            }
        }        

        break;
    case SCROLL_SIZE_CHANGED:
        if ( pDoc->m_nScrollSize < m_strList.GetCount() ) { // remove some string from head of list
            while ( pDoc->m_nScrollSize < m_strList.GetCount() ) 
                m_strList.RemoveHead();
        }
        if ( pDoc->m_nScrollSize > m_strList.GetCount() ) {
            while ( pDoc->m_nScrollSize > m_strList.GetCount() ) 
                m_strList.AddHead("");
        }
        SetScrollSettings();
        InvalidateRect(NULL, FALSE);
        UpdateWindow();
        break;
    default:
        break;
    }
	
}
Ejemplo n.º 9
0
void CAnsiWnd::OnUpdate(LPARAM lHint) 
{
    switch ( lHint ) {
    case TEXT_ARRIVED:
        // redraw etc 
        {
            CRect rect, rectSmall;

	        GetClientRect(&rect);

            if (pDoc->m_strOutputTempList[m_wndCode].GetCount() > 0) {
                m_strList.SetAt(m_strList.GetTailPosition(), pDoc->m_strOutputTempList[m_wndCode].GetHead());
                
				if ( pDoc->m_bClearOutputContents[m_wndCode] ) {
					for ( POSITION it = m_strList.GetTailPosition(); it != NULL && m_TotalLinesReceived >= 0; m_strList.GetPrev(it)) {
						m_strList.SetAt(it, "");
						m_TotalLinesReceived--;
					}
					m_TotalLinesReceived = 0;
				}

                POSITION pos = pDoc->m_strOutputTempList[m_wndCode].GetHeadPosition();
                CString last_line = pDoc->m_strOutputTempList[m_wndCode].GetNext(pos);

				int dcnt_last_line = 0;
				int cnt_last_line = 1;
				if (pDoc->m_bLineWrap && m_LineCountsList.size() > 0) {
					int old_len = m_LineCountsList[0];
					cnt_last_line = NumOfLines(LengthWithoutANSI((const wchar_t*)last_line), m_nLineWidth);
					dcnt_last_line = cnt_last_line - old_len;
				}
                
				int new_lines = 0;
                while(pos) {
                    CString str = pDoc->m_strOutputTempList[m_wndCode].GetNext(pos);

                    m_strList.AddTail(str);
                    m_strList.RemoveHead();
					m_TotalLinesReceived++;

					new_lines += pDoc->m_bLineWrap ? 
						NumOfLines(LengthWithoutANSI((const wchar_t*)str), m_nLineWidth) : 1;
                }
                rectSmall.left = 0;
                rectSmall.right = rect.right;
                rectSmall.bottom = rect.bottom; 
				rectSmall.top = rect.bottom -pDoc->m_nYsize*(new_lines+cnt_last_line);
                if ( pDoc->m_nOutputUpdateCount[m_wndCode] ) 
					ScrollWindowEx(0, -pDoc->m_nYsize*(new_lines + dcnt_last_line), NULL, &rect, NULL, /*&rectSmall*/ NULL , SW_INVALIDATE | SW_ERASE);

				if ( pDoc->m_bClearOutputContents[m_wndCode] )
					InvalidateRect(NULL, FALSE);
				else
					InvalidateRect(&rectSmall, FALSE);
				UpdateWindow();
            }
        }        

        break;
    case SCROLL_SIZE_CHANGED:
        if ( nScrollSize < m_strList.GetCount() ) { // remove some string from head of list
            while ( nScrollSize < m_strList.GetCount() ) 
                m_strList.RemoveHead();
        }
        if ( nScrollSize > m_strList.GetCount() ) {
            while ( nScrollSize > m_strList.GetCount() ) 
                m_strList.AddHead("");
        }
        SetScrollSettings();
        InvalidateRect(NULL, FALSE);
        UpdateWindow();
        break;
    default:
        break;
    }
	
}