Exemplo n.º 1
0
//--------------------------------------------------------------
void CBMRegEditView::UpdateRow(int nInvalidRow)
{ int nRowCount = GetRowCount();
 if (nRowCount != m_nPrevRowCount) { UpdateScrollSizes(); m_nPrevRowCount = nRowCount; }
 CClientDC dc(this);
 OnPrepareDC(&dc);

 int nFirstRow, nLastRow;
 CRect rectClient;
 GetClientRect(&rectClient);
 dc.DPtoLP(&rectClient);
 RectLPtoRowRange(rectClient, nFirstRow, nLastRow, FALSE);

 POINT pt;
 pt.x = 0;
 BOOL bNeedToScroll = TRUE;
 if (nInvalidRow < nFirstRow) pt.y = RowToYPos(nInvalidRow);
 else
   if (nInvalidRow > nLastRow) pt.y=max(0,RowToYPos(nInvalidRow+1) - rectClient.Height());
   else bNeedToScroll = FALSE;
 if (bNeedToScroll) { ScrollToDevicePosition(pt); OnPrepareDC(&dc); }
 CRect rectInvalid = RowToWndRect(&dc, nInvalidRow);
 rectInvalid.left=23; rectInvalid.right=37;
 InvalidateRect(&rectInvalid);
 int nSelectedRow = GetActReg();
 if (m_nPrevSelectedRow != nSelectedRow) {
   CRect rectOldSelection = RowToWndRect(&dc, m_nPrevSelectedRow);
   rectOldSelection.left=23; rectOldSelection.right=37;
   InvalidateRect(&rectOldSelection);
   m_nPrevSelectedRow = nSelectedRow;
 }
}
Exemplo n.º 2
0
//------------------------------------------------------------
// Overrides of CView and CBrView
void CBMView::OnUpdate(CView*, LPARAM lHint, CObject* pHint)
{ if (pHint!=NULL && theApp.m_nActiveFrame!=DBVIEW) return;
 if ( pHint != NULL && pHint->IsKindOf(RUNTIME_CLASS(CScriptDoc))) return;
 UpdateScrollSizes(); Invalidate();
 if (theApp.m_nActiveFrame==DBVIEW) {
   if (theApp.CurrentTask&NEW_SAMPLE) OnVScroll(SB_BOTTOM,0,GetScrollBarCtrl(SB_VERT));
 }
}
Exemplo n.º 3
0
void CJevView::OnInitialUpdate()
{
	TRACE( "Entering OnInitialUpdate()\n" );

	CJevDoc* pDoc = GetDocument();                  
	UpdateScrollSizes();
	InvalidateRect( NULL );

	TRACE( "Leaving OnInitialUpdate()\n" );
}
Exemplo n.º 4
0
//------------------------------------------------------------
// Overrides of CView and CBrView
void CBMRegEditView::OnUpdate(CView*, LPARAM lHint, CObject* pHint)
{ if (pHint!=NULL && theApp.m_nActiveFrame!=KBVIEW) return;
 if ( pHint != NULL && pHint->IsKindOf(RUNTIME_CLASS(CScriptDoc))) return;
 else if ( pHint != NULL && pHint->IsKindOf(RUNTIME_CLASS(CSBlock))) {
        int nReg = LOWORD(lHint)-1;
        if (theApp.m_nActiveFrame==KBVIEW) {
          UpdateRow(nReg);
        }
      }
 else { UpdateScrollSizes(); Invalidate(); }
}
Exemplo n.º 5
0
void CEx29aView::OnUpdate(CView*, LPARAM lHint, CObject* pHint)
{
    // called when the user executes a new query
    // can't set m_pSet in OnInitialUpdate because it's NULL then
    ScrollToPosition(CPoint(0, 0));
    Invalidate(TRUE);
    m_nSelectedRow = -1;
    CEx29aDoc* pDoc = GetDocument();
    if((m_pSet = pDoc->m_pRecordset) != NULL) {
        UpdateScrollSizes();
    }
}
Exemplo n.º 6
0
BOOL COXTabViewContainer::LoadState(LPCTSTR lpszProfileName)
{
	CWinApp* pApp=AfxGetApp();
	if(pApp==NULL)
		return FALSE;

	m_nLastTabBtnAreaWidth=pApp->GetProfileInt(lpszProfileName,
		_T("TabButtonsAreaWidth"),m_nLastTabBtnAreaWidth);

	CalcLayout();
	UpdateScrollSizes();
	RedrawContainer();

	return TRUE;
}
Exemplo n.º 7
0
void CJevView::OnSize(UINT nType, int cx, int cy)
{
	TRACE( "Entering OnSize()\n" );
	
	
	// TODO: Add your message handler code here 
	
	m_cxClient = cx;
	m_cyClient = cy;
	TRACE( "cxClient=%d, cyClient=%d\n", cx, cy );
	
	CClientDC dc( this );
	
    char szFaceName[30];
    dc.GetTextFace( sizeof szFaceName, szFaceName );
    TRACE("OnSize: FaceName='%s'\n", szFaceName );
                     

	TEXTMETRIC tm;
	dc.GetTextMetrics( &tm );
    m_cyChar = tm.tmHeight; 
    m_cxChar = tm.tmAveCharWidth; 
    TRACE("OnSize: tmHeight=%d, tmAveCharWidth=%d",
    	tm.tmHeight, tm.tmAveCharWidth);
    
    
    
	UpdateScrollSizes();
	CScrollView::OnSize(nType, cx, cy);
	
	CRect rectClient;
	GetClientRect( rectClient );
	TRACE( "OnSize: rectClient.left=%d, .right=%d, top=%d, bottom=%d\n",
			rectClient.left,rectClient.right, rectClient.top, rectClient.bottom );
	ClientToScreen( rectClient );
	TRACE( "OnSize: Screen rectClient.left=%d, .right=%d, top=%d, bottom=%d\n",
			rectClient.left,rectClient.right, rectClient.top, rectClient.bottom );
			
	TRACE( "Leaving OnSize()\n" );
	
}
Exemplo n.º 8
0
void COXTabViewContainer::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
	UNREFERENCED_PARAMETER(uFlags);
	UNREFERENCED_PARAMETER(lpszSection);

	CalcLayout();

	UpdateScrollSizes();

	CWnd* pWnd=GetActivePage();
	if(pWnd!=NULL)
	{
		ASSERT(::IsWindow(pWnd->m_hWnd));
		if(::IsWindow(pWnd->m_hWnd))
			pWnd->MoveWindow(m_rectPage);
	}

	RedrawContainer();

	CWnd::OnSettingChange(uFlags, lpszSection);
}
Exemplo n.º 9
0
void COXTabViewContainer::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	if(nType!=SIZE_MINIMIZED && cx>0 && cy>0)
	{
		CalcLayout();

		UpdateScrollSizes();

		CWnd* pWnd=GetActivePage();
		if(pWnd!=NULL)
		{
			ASSERT(::IsWindow(pWnd->m_hWnd));
			if(::IsWindow(pWnd->m_hWnd))
				pWnd->MoveWindow(m_rectPage);
		}

		RedrawContainer();
	}

}
Exemplo n.º 10
0
void CJevView::OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint )
{
	TRACE( "Entering OnUpdate\n" ); 
	int lsr, plsr, par, ar;
	CJevDoc* pDoc = GetDocument();        

	CClientDC dc( this );
	OnPrepareDC( &dc );                         
	if( pHint != 0 && pHint->IsKindOf(RUNTIME_CLASS(CUpdateHint)) ) {
		CUpdateHint* pCUpdateHint = (CUpdateHint*) pHint;
		switch( lHint )
		{
			TRACE("OnUpdate: lHint-'%d'\n", (int)lHint );
			case HINT_DELETE_ACTIVE_RECORD:
				UpdateScrollSizes();
				InvalidateRecord( &dc, pDoc->njeGetActiveRecord(), 
					pCUpdateHint->iHint1);
				break;
				
			case HINT_INSERT_ACTIVE_RECORD:
				//InvalidateRecord( &dc, m_posPrevActiveRecord );
				UpdateScrollSizes();
				//InvalidateRecord( &dc, pDoc->posGetActiveRecord() );
				m_njePrevLastSelectedRecord = pDoc -> njeGetLastSelectedRecord();
				
				Invalidate();
				break;

			case HINT_CHANGE_ACTIVE_RECORD:
				UpdateScrollSizes();				
				InvalidateRecord( &dc, pDoc->njeGetActiveRecord() );
				break;
				
			case HINT_NAVIGATION_KEY:
				lsr = pDoc -> njeGetLastSelectedRecord();
				par = m_njePrevActiveRecord;
				ar = pDoc -> njeGetActiveRecord();
				TRACE("lsr=%d, par=%d\n", lsr,par);
				if( lsr < par ) {
					INVALIDATERANGE( lsr, par-1 );
				} else if( lsr > par ) {
					INVALIDATERANGE( par+1, lsr);
				}	


				if( ar != par ) {
					// Previous
        			InvalidateRecord( &dc, par ); 
        
        			// Newly actived
        			InvalidateRecord( &dc, ar );
        
					m_njePrevActiveRecord = ar;
				}

        		break;
			
			case HINT_LAST_SELECTED_RECORD:
				plsr = m_njePrevLastSelectedRecord;
				lsr = pDoc -> njeGetLastSelectedRecord();
				ar = pDoc -> njeGetActiveRecord();
				
				if( plsr > ar ) {
					if( lsr > plsr ) { INVALIDATERANGE( plsr+1, lsr);
					} else if( lsr >= ar && lsr < plsr ) { INVALIDATERANGE( lsr+1, plsr );
					} else if( lsr < ar ) { INVALIDATERANGE( lsr+1, plsr );
					} else TRACE( "plsr>ar:  no Invalidate Records selected!\n");

				} else if( plsr < ar ) {
					if( lsr < plsr ) { INVALIDATERANGE( lsr, plsr-1 );
					} else if( lsr > plsr && lsr <= ar ) { INVALIDATERANGE( plsr, lsr-1 );
					} else if( lsr > ar ) { INVALIDATERANGE( plsr, lsr );
					} else TRACE( "plsr<ar:  no Invalidate Records selected!\n");
				} else if( plsr == ar) {
					if( lsr < ar ) { INVALIDATERANGE( lsr, ar-1 );
					} else if( lsr > ar ) { INVALIDATERANGE( ar+1, lsr );
					} else TRACE(" plsr == ar: no Invalidate Records Selectec!\n");
				}



				m_njePrevLastSelectedRecord = pDoc -> njeGetLastSelectedRecord();
				
				break;
	
			default:
				TRACE("OnUpdate:  Unexpected Hint-'%d'\n", (int)lHint );
				break;
		}
		//return;
	}
	
	
	// Get the first and last record index displayed inthe Client area
	//
	int nyFirstLogicalDisplayLine, nyLastLogicalDisplayLine;
	CRect rectClient;
	GetClientRect( &rectClient );
	dc.DPtoLP( &rectClient );
	
	nyFirstLogicalDisplayLine = rectClient.top / m_cyChar;
	nyLastLogicalDisplayLine  = (rectClient.bottom-1) / m_cyChar;
 
	TRACE( "FirstRec=%d, LastRec=%d\n", nyFirstLogicalDisplayLine,
					nyLastLogicalDisplayLine );					
    TRACE( "top=%d, bottom=%d\n", rectClient.top, rectClient.bottom);
    
    // Scroll, if necessary, so that the selected row is visible
    POINT pt;
    pt.x = 0;
    pt.y = 0;
    BOOL bNeedToScroll = TRUE; 
    
    int nyActiveRecordDispLine, njelActiveRecord, nSubAcct;
    int NJE = pDoc->njeGetActiveRecord();
    pDoc->MapNJEToDispLine( NJE, nyActiveRecordDispLine, 
    					 nSubAcct );
    TRACE( "nyActiveRecordDispLine=%d, njelActiveRecord=%d, m_njelPrevActiveRecord=%d\n", nyActiveRecordDispLine,
    		njelActiveRecord, m_njePrevActiveRecord );
    			
    if( njelActiveRecord < 0 ) {
    	bNeedToScroll = FALSE;
    } else if( nyActiveRecordDispLine < nyFirstLogicalDisplayLine ) {
    	pt.y = nyActiveRecordDispLine * m_cyChar;
    } else if( nyActiveRecordDispLine > nyLastLogicalDisplayLine ) {
    	pt.y = max( 0, (nyActiveRecordDispLine+1)*m_cyChar - rectClient.Height() );
    } else { 
    	bNeedToScroll = FALSE;
    }
    	                
    TRACE( "bNeedToScroll=%d, pt.y=%d\n", bNeedToScroll, pt.y );
    	                
    if( bNeedToScroll ) { 
    	TRACE( "OnUpdate: Scrolling\n");
    	ScrollToDevicePosition( pt );
    	OnPrepareDC( &dc );
    } 
    
	TRACE( "Leaving OnUpdate\n" );
}
Exemplo n.º 11
0
//------------------------------------------------------------
void CBMRegEditView::OnInitialUpdate()
{ m_nPrevRowCount=GetRowCount(); m_nPrevSelectedRow=GetActReg(); UpdateScrollSizes(); }