コード例 #1
0
void wxListBox::OnInternalIdle()
{
    if ( m_updateScrollbarY || m_updateScrollbarX )
    {
        UpdateScrollbars();

        m_updateScrollbarX =
        m_updateScrollbarY = false;
    }

    if ( m_currentChanged )
    {
        DoEnsureVisible(m_current);

        m_currentChanged = false;
    }

    if ( m_updateCount )
    {
        UpdateItems();

        m_updateCount = 0;
    }
    wxListBoxBase::OnInternalIdle();
}
コード例 #2
0
	//------------------------------------------------------------------------------
	void	CGUIWgtScrollPanel::ForceHorzScrollbarShow(bool bSetting)
	{
		if (m_bForceHorzScrollShow != bSetting)
		{
			m_bForceHorzScrollShow = bSetting;

			UpdateScrollbars();
		}
	}
コード例 #3
0
ファイル: AlbumView.cpp プロジェクト: HaikuArchives/Album
void AlbumView::FrameResized(float width, float height)
{
	if (fColumns == 0)
		Arrange(true);
	UpdateScrollbars(width, height);
	
	// update the splash message
	if (CountItems() == 0)
		Invalidate();	
}
コード例 #4
0
ファイル: tb_editfield.cpp プロジェクト: BibleUs/turbobadger
void TBEditField::OnResized(int old_w, int old_h)
{
	// Make the scrollbars move
	TBWidget::OnResized(old_w, old_h);

	TBRect visible_rect = GetVisibleRect();
	m_style_edit.SetLayoutSize(visible_rect.w, visible_rect.h, false);

	UpdateScrollbars();
}
コード例 #5
0
void wxListBox::EnsureVisible(int n)
{
    if ( m_updateScrollbarY )
    {
        UpdateScrollbars();

        m_updateScrollbarX =
        m_updateScrollbarY = false;
    }

    DoEnsureVisible(n);
}
コード例 #6
0
ファイル: HexEdit.cpp プロジェクト: Garfield-Chen/openlibs
void CHexEdit::ScrollIntoView(int p)
{
	if(p < m_topindex || p > m_topindex + m_lpp*m_bpr)
	{
		m_topindex = (p/m_bpr) * m_bpr;
		m_topindex -= (m_lpp / 3) * m_bpr;
		if(m_topindex < 0)
			m_topindex = 0;

		UpdateScrollbars();
		RedrawWindow();
	}
}
コード例 #7
0
/*
================
rvGEWorkspace::ZoomIn

Zooms the workspace in by one zoom level
================
*/
rvGEWorkspace::EZoomLevel rvGEWorkspace::ZoomIn ( void )
{
	mZoom = mZoom + 1;
	if ( mZoom >= ZOOM_MAX )
	{
		mZoom = ZOOM_MAX - 1;
	}

	UpdateScrollbars ( );
	UpdateTitle ( );

	InvalidateRect ( mWnd, NULL, FALSE );

	return (EZoomLevel)mZoom;
}
コード例 #8
0
/*
================
rvGEWorkspace::ZoomOut

Zooms the workspace out by one level
================
*/
rvGEWorkspace::EZoomLevel rvGEWorkspace::ZoomOut ( void )
{
	mZoom--;
	if ( mZoom <= ZOOM_MIN )
	{
		mZoom = ZOOM_MIN + 1;
	}

	UpdateScrollbars ( );
	UpdateTitle ( );

	InvalidateRect ( mWnd, NULL, FALSE );

	return (EZoomLevel)mZoom;
}
コード例 #9
0
ファイル: appli.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
  FrameRedraw
  ----------------------------------------------------------------------*/
void FrameRedraw (int frame, unsigned int width, unsigned int height)
{
  int                 dx, dy, view;
  NotifyWindow        notifyDoc;
  Document            doc;

  if (FrameTable[frame].FrDoc == 0)
    return;
  if (width > 0 && height > 0 && 
      documentDisplayMode[FrameTable[frame].FrDoc - 1] != NoComputedDisplay)
    /* ne pas traiter si le document est en mode NoComputedDisplay */
    {
      notifyDoc.event = TteViewResize;
      FrameToView (frame, &doc, &view);
      notifyDoc.document = doc;
      notifyDoc.view = view;
      dx = width - FrameTable[frame].FrWidth;
      dy = height - FrameTable[frame].FrHeight;
      notifyDoc.verticalValue = dy;
      notifyDoc.horizontalValue = dx;
      if (!CallEventType ((NotifyEvent *) & notifyDoc, TRUE))
        {
          /* close current insertion */
          FrameTable[frame].FrWidth = (int) width;
          FrameTable[frame].FrHeight = (int) height;
          /* Il faut reevaluer le contenu de la fenetre */
          RebuildConcreteImage (frame, FALSE);
          /* recompute the scroll bars */
          UpdateScrollbars (frame);
          notifyDoc.event = TteViewResize;
          notifyDoc.document = doc;
          notifyDoc.view = view;
          notifyDoc.verticalValue = dy;
          notifyDoc.horizontalValue = dx;
          CallEventType ((NotifyEvent *) & notifyDoc, FALSE);
        }
    }
}
コード例 #10
0
ファイル: scroll.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
  ShowBox displays the box pBox at the requested position in the window.
  The parameter position is:
  0 for the top of the window
  1 for the middle of the window
  2 for the bottom of the window
  When the position = 0, percent gives the percent from the top of the
  window.
  scrollUpdate is TRUE when scrollbars must be recomputed
  ----------------------------------------------------------------------*/
void ShowBox (int frame, PtrBox pBox, int position, int percent,
              ThotBool scrollUpdate)
{
  PtrAbstractBox      pBlock;
  PtrBox              pBox1;
  PtrLine             pLine;
  ViewFrame          *pFrame;
  int                 ymin, ymax;
  int                 width, height;
  int                 y, dy, h;

  if (pBox == NULL)
    return;
  pBox1 = pBox;
  pBlock = NULL;
  pLine = NULL;
  if (pBox->BxType == BoGhost ||
      pBox->BxType == BoStructGhost ||
      pBox->BxType == BoFloatGhost)
    {
      while (pBox &&
             (pBox->BxType == BoGhost ||
              pBox->BxType == BoStructGhost ||
              pBox->BxType == BoFloatGhost))
        pBox = pBox->BxAbstractBox->AbFirstEnclosed->AbBox;
      if (!pBox)
        {
          pBox = pBox1;
          while (pBox->BxType == BoGhost ||
                 pBox->BxType == BoStructGhost ||
                 pBox->BxType == BoFloatGhost)
            pBox = pBox->BxAbstractBox->AbEnclosing->AbBox;
        }
      /* manage the line instead of the box itself */
      pLine = SearchLine (pBox, frame);
      if (pLine)
        {
          pBlock = pBox->BxAbstractBox;
          while (pBlock && pBlock->AbBox->BxType != BoBlock &&
                 pBlock->AbBox->BxType != BoFloatBlock &&
                 pBlock->AbBox->BxType != BoCellBlock)
            pBlock = pBlock->AbEnclosing;
        }
    }

  if (pBox->BxType == BoSplit)
    pBox = pBox->BxNexChild;

  pFrame = &ViewFrameTable[frame - 1];
  if (pBlock && pBlock->AbBox)
    {
      y = pBlock->AbBox->BxYOrg + pLine->LiYOrg;
      h = pLine->LiHeight;
    }
  else
    {
      y = pBox->BxYOrg;
      h = pBox->BxHeight;
    }
  /* largeur et hauteur de la fenetre */
  GetSizesFrame (frame, &width, &height);
  ymin = pFrame->FrYOrg;
  ymax = ymin + height;

  /* On debloque eventuellement l'affichage */
  pFrame->FrReady = TRUE;

  if (position == 0)
    /* Affiche le haut de la boite a pourcent du haut de la fenetre */
    dy = y - ymin - ((height * percent) / 100);
  else if (position == 1)
    /* Centre le milieu de la boite sur le milieu de la fenetre */
    dy = y + (h / 2) - ymin - (height / 2);
  else
    /* Affiche en bas de la fenetre */
    dy = y + h - ymax;

  /* Il faut realiser l'affichage par scroll ou par appel explicite */
  if (dy != 0)
    VerticalScroll (frame, dy, 1);
  else if (GL_prepare (frame))
    {
      RedrawFrameBottom (frame, dy, NULL);
#ifdef _GL
      /* to be sure the scrolled page has been displayed */
      GL_Swap (frame);
#endif /* _GL */
      /* Mise a jour des ascenseurs */
      if (scrollUpdate)
        UpdateScrollbars (frame);
    }
}
コード例 #11
0
/*
================
rvGEWorkspace::HandleMessage

Handles window messages to the workspace
================
*/
void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam )
{
	switch ( msg )
	{
		case WM_CLOSE:
		{

			if ( IsModified ( ) )
			{
				if ( IDYES == gApp.MessageBox ( va("Save changes to the document \"%s\" before closing?", GetFilename() ), MB_YESNO|MB_ICONQUESTION ) )
				{
					SendMessage ( mApplication->GetMDIFrame(), WM_COMMAND, MAKELONG(ID_GUIED_FILE_SAVE,0), 0 );
				}
			}


			GetApplication ( )->GetNavigator().SetWorkspace(NULL);
			GetApplication ( )->GetTransformer().SetWorkspace(NULL);
			GetApplication ( )->GetProperties().SetWorkspace(NULL);
			break;
		}

		case WM_CAPTURECHANGED:
			if ( (HWND)lParam != mWnd )
			{
				mDragScroll = false;
				mDragType	= rvGESelectionMgr::HT_NONE;
			}
			break;

		case WM_SETCURSOR:
		{
			POINT point;
			idVec2 cursor;
			GetCursorPos ( &point );
			cursor.Set ( point.x, point.y );
			WindowToWorkspace ( cursor );
			if ( mDragType == rvGESelectionMgr::HT_NONE )
			{
				UpdateCursor ( cursor.x, cursor.y );
			}
			else
			{
				UpdateCursor ( mDragType );
			}
			break;
		}

		case WM_MOUSEWHEEL:
			if ( (short)HIWORD(wParam) > 0 )
			{
				ZoomIn ( );
			}
			else if ( (short)HIWORD(wParam) < 0 )
			{
				ZoomOut ( );
			}
			break;

		case WM_MOUSEMOVE:
			HandleMouseMove ( wParam, lParam );
			break;

		case WM_MBUTTONDOWN:
			HandleMButtonDown ( wParam, lParam );
			break;

		case WM_MBUTTONUP:
			HandleMButtonUp ( wParam, lParam );
			break;

		case WM_LBUTTONDOWN:
			HandleLButtonDown ( wParam, lParam );
			break;

		case WM_LBUTTONUP:
			HandleLButtonUp ( wParam, lParam );
			break;

		case WM_LBUTTONDBLCLK:
			HandleLButtonDblClk ( wParam, lParam );
			break;

		case WM_INITMENUPOPUP:
			SendMessage ( mApplication->GetMDIFrame(), msg, wParam, lParam );
			break;

		case WM_COMMAND:
			HandleCommand ( wParam, lParam );
			break;

		case WM_RBUTTONDOWN:
			HandleRButtonDown ( wParam, lParam );
			break;

		case WM_SIZE:
			UpdateScrollbars();
			break;

		case WM_VSCROLL:
			HandleScroll ( SB_VERT, wParam, lParam );
			break;

		case WM_HSCROLL:
			HandleScroll ( SB_HORZ, wParam, lParam );
			break;

		case WM_KEYDOWN:
			HandleKeyDown ( wParam, lParam );
			break;
	}
}
コード例 #12
0
ファイル: map_window.cpp プロジェクト: Rydda/rme
void MapWindow::OnSize(wxSizeEvent& event) 
{
	UpdateScrollbars(event.GetSize().GetWidth(), event.GetSize().GetHeight());
	event.Skip();
}
コード例 #13
0
	//------------------------------------------------------------------------------
	uint32		CGUIWgtScrollPanel::OnOpen( CGUIEventNotification* pEvent )
	{
		UpdateScrollbars();
		return CGUIWidget::OnOpen( pEvent);
	}
コード例 #14
0
ファイル: AlbumView.cpp プロジェクト: HaikuArchives/Album
/**
	The view is on.
	All BView functions can be called now.
*/
void AlbumView::AttachedToWindow()
{
	SetTarget(this, Looper());
	// Initial scrollbar positions
	UpdateScrollbars(Frame().Width(), Frame().Height());	
}
コード例 #15
0
ファイル: AlbumView.cpp プロジェクト: HaikuArchives/Album
void AlbumView::SetPageBounds(BRect bounds)
{
	fPage = bounds;
	UpdateScrollbars(Frame().Width(), Frame().Height());
}
コード例 #16
0
ファイル: HexEdit.cpp プロジェクト: Garfield-Chen/openlibs
void CHexEdit::OnPaint() 
{
	CPaintDC pdc(this); // device context for painting

	CRect rc;
	GetClientRect(rc);
	
	CDC	dc;
	dc.CreateCompatibleDC(CDC::FromHandle(pdc.m_ps.hdc));
	CBitmap bm;

	bm.CreateCompatibleBitmap(CDC::FromHandle(pdc.m_ps.hdc), rc.Width(), rc.Height());
	dc.SelectObject(bm);

	CBrush b;
	b.CreateSolidBrush(RGB(0xff,0xff,0xff));
	dc.FillRect(rc, &b);

	ASSERT(m_currentAddress >= 0);
	ASSERT(m_topindex >= 0);

	dc.SelectObject(m_Font);
	int		height		= 0;
	int		x,y;
	char	buf[256];
    WCHAR   wbuf[256];
	int	 n=0;
	x = rc.TopLeft().x;
	y = rc.TopLeft().y;

	dc.SetBoundsRect(&rc, DCB_DISABLE);

	if(m_pData)
	{
		//
		// get char dimensions
		//
		if(m_bUpdate)
		{
			dc.GetCharWidth('0', '0', &m_nullWidth);
			CSize sz = dc.GetTextExtent(L"0", 1);
			m_lineHeight = sz.cy;
			
			m_offHex	= m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
			m_offAscii	= m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
			m_offAscii += m_bShowHex	 ? (m_bpr * 3 * m_nullWidth) : 0;

			m_lpp = rc.Height() / m_lineHeight;
			m_bHalfPage = FALSE;
			if(m_lpp * m_bpr > m_length)
			{
				m_lpp = (m_length + (m_bpr/2)) / m_bpr ;
				if(m_length % m_bpr != 0)
				{
					m_bHalfPage = TRUE;
					m_lpp++;
				}
			}
			m_bUpdate = FALSE;
			UpdateScrollbars();
		}

		//TRACE("%i %i\n", m_topindex, m_selStart);
		
		height = rc.Height() / m_lineHeight;
		height *= m_lineHeight;

		if(m_bShowAddress)
		{
			char fmt[8] = {'%','0','8','l','X'};
			fmt[2] = m_bAddressIsWide ? '8' : '4';
			int w = m_bAddressIsWide ? 8 : 4;
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = m_offAddress;
			for(int	 i = m_topindex + m_AddOff; (i < m_length+ m_AddOff) && (rcd.TopLeft().y < height); i+= m_bpr)
			{
				sprintf(buf, fmt, i);
				CMySystem::CharToWCHAR(wbuf,buf);
				dc.DrawText(wbuf, w, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
				rcd.TopLeft().y += m_lineHeight;
			}
		}
		if(m_bShowHex)
		{
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = x = m_offHex;

			if(m_selStart != 0xffffffff && (m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW))
			{
				int	 i;
				int	 n = 0;
				int	 selStart = m_selStart, selEnd = m_selEnd;
				if(selStart > selEnd)
					selStart ^= selEnd ^= selStart ^= selEnd;

				for(i = m_topindex ; (i < selStart) && (y < height); i++)
				{
					char* p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
				dc.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
				for(; (i < selEnd) && (i < m_length) && (y < height); i++)
				{
					char* p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
				dc.SetBkColor(GetSysColor(COLOR_WINDOW));
				for(; (i < m_length) && (y < height); i++)
				{
					char* p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
			}
			else
			{
				for(int	 i = m_topindex ; (i < m_length) && (rcd.TopLeft().y < height);)
				{
					char* p = &buf[0];
					for(	 n = 0; (n < m_bpr) && (i < m_length); n++)
					{
						TOHEX(m_pData[i ], p);
						*p++ = ' ';
						i++;
					}
					while(n < m_bpr)
					{
						*p++ = ' ';	*p++ = ' ';	*p++ = ' ';
						n++;
					}
			        CMySystem::CharToWCHAR(wbuf,buf);
					dc.DrawText(wbuf, m_bpr*3, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
					rcd.TopLeft().y += m_lineHeight;
				}
			}
		}
		if(m_bShowAscii)
		{
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = x = m_offAscii;
			if(m_selStart != 0xffffffff && m_currentMode == EDIT_ASCII)
			{
				int	 i;
				int	 n = 0;
				int	 selStart = m_selStart, selEnd = m_selEnd;
				if(selStart > selEnd)
					selStart ^= selEnd ^= selStart ^= selEnd;

				for(i = m_topindex ; (i < selStart) && (y < height); i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
				    CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
				dc.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
				for(; (i < selEnd) && (y < height); i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
				dc.SetBkColor(GetSysColor(COLOR_WINDOW));
				for(; (i < m_length) && y < height; i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.TextOut(x, y, wbuf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
			}
			else
			{
				for(int	 i = m_topindex ; (i < m_length) && (rcd.TopLeft().y < height);)
				{
					char* p = &buf[0];
					for(	 n = 0; (n < m_bpr) && (i < m_length); n++)
					{
						*p++ = isprint(m_pData[i]) ? m_pData[i] : '.';
						i++;
					}
					CMySystem::CharToWCHAR(wbuf,buf);
					dc.DrawText(wbuf, n, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
					rcd.TopLeft().y += m_lineHeight;
				}
			}
		}
	}
	pdc.BitBlt(0, 0, rc.Width(), rc.Height(), &dc, 0, 0, SRCCOPY);
}
コード例 #17
0
	//------------------------------------------------------------------------------
	uint32		CGUIWgtScrollPanel::OnScaleChange( CGUIEventNotification* pEvent )
	{
		UpdateScrollbars();
		return CGUIWidget::OnScaleChange(pEvent);
	}
コード例 #18
0
// 重载OnPaint,处理每一行
void CHexEdit::OnPaint() 
{
	CPaintDC pdc(this); // device context for painting
	
	CRect rc;
	GetClientRect(rc);
	
	CDC	dc;
	dc.CreateCompatibleDC(CDC::FromHandle(pdc.m_ps.hdc));
	CBitmap bm;
	
	bm.CreateCompatibleBitmap(CDC::FromHandle(pdc.m_ps.hdc), rc.Width(), rc.Height());
	dc.SelectObject(bm);
	
	CBrush b;
	b.CreateSolidBrush(RGB(0xff,0xff,0xff));
	dc.FillRect(rc, &b);
	
	ASSERT(m_currentAddress >= 0);
	ASSERT(m_topindex >= 0);
	
	dc.SelectObject(m_Font);
	int		height		= 0;
	int		x,y;
	char	buf[256];
	
	x = rc.TopLeft().x;
	y = rc.TopLeft().y;
	
	dc.SetBoundsRect(&rc, DCB_DISABLE);
	
	if(m_pData)
	{
		//
		// get char dimensions
		//
		if(m_bUpdate)
		{
			dc.GetCharWidth('0', '0', &m_nullWidth);
			CSize sz = dc.GetTextExtent("0", 1);
			m_lineHeight = sz.cy;
			
            // 每一种类型的间隔
			m_offHex	= m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
			m_offAscii	= m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 10 : m_nullWidth * 5) : 0;
			m_offAscii += m_bShowHex	 ? (m_bpr * 3 * m_nullWidth) : 0;
			
			m_lpp = rc.Height() / m_lineHeight;
			m_bHalfPage = FALSE;
			if(m_lpp * m_bpr > m_length)
			{
				m_lpp = (m_length + (m_bpr/2)) / m_bpr ;
				if(m_length % m_bpr != 0)
				{
					m_bHalfPage = TRUE;
					m_lpp++;
				}
			}
			m_bUpdate = FALSE;
			UpdateScrollbars();
		}
		
		TRACE("%i %i\n", m_topindex, m_selStart);
		
		height = rc.Height() / m_lineHeight;
		height *= m_lineHeight;
		
		if(m_bShowAddress)
		{
			char fmt[8] = {'%','0','8','l','X'};
			fmt[2] = m_bAddressIsWide ? '8' : '4';
			int w = m_bAddressIsWide ? 8 : 4;
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = m_offAddress;
            // 使用用户自定义偏移--在分析定位文件内容时有作用
            // todo:存在bug,滚动时,偏移量不会变化。-->临时不使用
            int tmp = m_myoffset;
			for(int	 i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height); i+= m_bpr)
			{
                if (m_myoffset)
                {
                    sprintf(buf, fmt, tmp);
                    tmp += m_bpr;
                }
                else
                {
                    sprintf(buf, fmt, i);
                }
				dc.DrawText(buf, w, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
				rcd.TopLeft().y += m_lineHeight;
			}
		}
		if(m_bShowHex)
		{
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = x = m_offHex;
			
			if(m_selStart != 0xffffffff)
			{
				int	 i;
				int	 n = 0;
				int	 selStart = m_selStart, selEnd = m_selEnd;
				if(selStart > selEnd)
					selStart ^= selEnd ^= selStart ^= selEnd;
				
				char* p;
				for(i = m_topindex; (i < selStart) && (y < height); i++)
				{
					p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					dc.TextOut(x, y, buf, 3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
				dc.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
				for(; i <= selEnd && 
					i < m_length && y < height ; i++)
				{
					p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					dc.TextOut(x, y, buf, (i==selEnd || (i+1)%m_bpr==0 || i==m_length-1) ? 2:3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
				dc.SetBkColor(GetSysColor(COLOR_WINDOW));
				for(; (i < m_length) && (y < height); i++)
				{
					char* p = &buf[0];
					TOHEX(m_pData[i], p);
					*p++ = ' ';
					dc.TextOut(x, y, buf, 3);
					x += m_nullWidth * 3;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offHex;
						y += m_lineHeight;
					}
				}
			}
			else
			{
				for(int	 i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
				{
                    int n = 0;
					char* p = &buf[0];
					for(n = 0; (n < m_bpr) && (i < m_length); n++)
					{
						TOHEX(m_pData[i], p);
						*p++ = ' ';
						i++;
					}
					while(n < m_bpr)
					{
						*p++ = ' ';	*p++ = ' ';	*p++ = ' ';
						n++;
					}
					
					dc.DrawText(buf, m_bpr*3, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
					rcd.TopLeft().y += m_lineHeight;
				}
			}
		}
		if(m_bShowAscii)
		{
			y = 0;
			CRect rcd = rc;
			rcd.TopLeft().x = x = m_offAscii;
			if(m_selStart != 0xffffffff)
			{
				int	 i;
				int	 n = 0;
				int	 selStart = m_selStart, selEnd = m_selEnd;
				if(selStart > selEnd)
					selStart ^= selEnd ^= selStart ^= selEnd;
				
				for(i = m_topindex; (i < selStart) && (y < height); i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
					dc.TextOut(x, y, buf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
				dc.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
				for(; (i <=selEnd) && i<m_length && (y < height); i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
					dc.TextOut(x, y, buf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
				dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
				dc.SetBkColor(GetSysColor(COLOR_WINDOW));
				for(; (i < m_length) && y < height; i++)
				{
					buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
					dc.TextOut(x, y, buf, 1);
					x += m_nullWidth;
					n++;
					if(n == m_bpr)
					{
						n = 0;
						x = m_offAscii;
						y += m_lineHeight;
					}
				}
			}
			else
			{
				for(int	 i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
				{
                    int n = 0;
					char* p = &buf[0];
					for(n = 0; (n < m_bpr) && (i < m_length); n++)
					{
						*p++ = isprint(m_pData[i]) ? m_pData[i] : '.';
						i++;
					}
					dc.DrawText(buf, n, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
					rcd.TopLeft().y += m_lineHeight;
				}
			}
		}
	}
	pdc.BitBlt(0, 0, rc.Width(), rc.Height(), &dc, 0, 0, SRCCOPY);

	//char ss[40];
	//sprintf(ss,"m_length:%d  m_currentAddress:%d",m_length,m_currentAddress);
	//GetParent()->SetWindowText(ss); // no need to do this

}
コード例 #19
0
ファイル: scroll.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
  VerticalScroll scrolls forward (delta > 0) or backward (delta < 0).
  Moves by raster-op a part of the window and displays the new part:                  
  - forwardr by RedrawFrameBottom,                       
  - backward by RedrawFrameTop.                     
  The parameter selection is 1 if threre is a selection, 0 if not.
  ----------------------------------------------------------------------*/
void VerticalScroll (int frame, int delta, int selection)
{
  int                 y, height;
  int                 max, width;
  int                 lframe, hframe;
  PtrBox              srcbox;
  ViewFrame          *pFrame;
  PtrAbstractBox      pAb;
  ThotBool            add;
  
  if (delta != 0 && GL_prepare (frame))
    {
      pFrame = &ViewFrameTable[frame - 1];
      if (pFrame->FrReady && pFrame->FrAbstractBox)
        {
          pAb = pFrame->FrAbstractBox;
          /* On termine l'insertion courante */
          CloseTextInsertion ();
          srcbox = pAb->AbBox;
          /* Limites du scroll */
          if (srcbox)
            {
              /* A priori pas de paves ajoutes */
              add = FALSE;
              /* Au plus, la limite du document + le debordement vertical*/
              GetSizesFrame (frame, &lframe, &hframe);
              max = srcbox->BxYOrg + srcbox->BxHeight - pFrame->FrYOrg - hframe;
              if (!pAb->AbTruncatedTail && delta > max)
                {
                  JumpIntoView (frame, 100);
                  return;
                }
              if (pAb->AbTruncatedTail)
                max = delta;
              if (pAb->AbTruncatedHead)
                y = delta;
              else
                {
                  y = -pFrame->FrYOrg;
                  /* Il faut respecter la marge initiale si elle est
                     positive */
                  if (srcbox->BxYOrg < 0)
                    y += srcbox->BxYOrg;
                }
              
              /* Le Scroll est possible --> Calcule l'amplitude du Scroll*/
              if ((delta > 0 && max > 0) || (delta < 0 && y < 0))
                {
                  if (delta > 0)
                    {
                      /* SCROLL forward */
                      if (delta > max)
                        delta = max;
                      y = delta;
                      height = hframe - y;
                      if (lframe > srcbox->BxWidth)
                        /* pay attention to positioning boxes */
                        width = srcbox->BxWidth;
                      else
                        width = lframe + 1;
                      Scroll (frame, width, height, 0, y, 0, 0);
		      height = pFrame->FrYOrg + hframe;
		      DefClip (frame, pFrame->FrXOrg, height,
			       pFrame->FrXOrg + lframe, 
			       height + delta);
                      add = RedrawFrameBottom (frame, delta, NULL);
                    }
                  else
                    {
                      /* SCROLL backward */
                      if (delta < y)
                        delta = y;
                      height = hframe + delta;
                      if (lframe > srcbox->BxWidth)
                        /* pay attention to positioning boxes */
                        width = srcbox->BxWidth;
                      else
                        width = lframe + 1;
                      y = -delta;
                      Scroll (frame, width, height, 0, 0, 0, y);
                      height = pFrame->FrYOrg;
                      DefClip (frame, pFrame->FrXOrg, height + delta,
                               pFrame->FrXOrg + lframe, height);
                      add = RedrawFrameTop (frame, -delta);
                    }
                  /* recompute scrolls */
                  CheckScrollingWidthHeight (frame);
                  UpdateScrollbars (frame);
                }
              
              if (selection != 0)
                if (add)
                  {
                    ClearViewSelMarks (frame);
                    /* On supprime l'ancienne selection */
                    ShowSelection (pFrame->FrAbstractBox, FALSE);
                    /* On reprend la nouvelle */
                    /* On reallume la selection deja visualisee */
                  }
#ifdef _GL
	      /* to be sure the scrolled page has been displayed */
	      GL_Swap( frame );
#endif /* _GL */
            }
        }
    }
}
コード例 #20
0
ファイル: scroll.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
  HorizontalScroll effectue un scroll en avant (delta > 0) ou en arriere   
  (delta < 0).                                            
  Deplacement par rasterop d'une partie de la fenetre et  
  reaffichage du reste de la fenetre par RedrawFrameBottom.    
  Le parametre selection indique s'il faut gerer la       
  selection (valeur 1) ou non (valeur 0).                 
  ----------------------------------------------------------------------*/
void HorizontalScroll (int frame, int delta, int selection)
{
  int                 x, height;
  int                 min, max, width;
  int                 lframe, hframe;
  PtrBox              srcbox;
  ViewFrame          *pFrame;
  
  if (delta != 0 && GL_prepare (frame))
    {
      pFrame = &ViewFrameTable[frame - 1];
      if (pFrame->FrReady && pFrame->FrAbstractBox != NULL)
        {
          CloseTextInsertion ();
          /* finish the current insertion */
          srcbox = pFrame->FrAbstractBox->AbBox;
          GetSizesFrame (frame, &lframe, &hframe);
          /* FrameTable[frame].FrScrollOrg is negative or null */
          min = FrameTable[frame].FrScrollOrg - pFrame->FrXOrg;
          /* Right limit is the current scroll width + extra */
          max = min + FrameTable[frame].FrScrollWidth - lframe;
          /* Left limit is the current scroll width - extra */
          /* keep the right margin if the document is smaller than the window*/
          if (srcbox->BxXOrg  < 0)
            min += srcbox->BxXOrg;

          if ((delta > 0 && max > 0) || (delta < 0 && min < 0))
            {
              /* Scroll is possible -> compute the delta */
              height = hframe + 1;
              if (delta > 0)
                {
                  /* Scroll right */
                  if (delta > max)
                    delta = max;
                  x = delta;
                  width = lframe - x + 1;
                  Scroll (frame, width, height, x, 0, 0, 0);
                  width = pFrame->FrXOrg + lframe;
                  DefClip (frame, width, pFrame->FrYOrg, width + x,
                           pFrame->FrYOrg + hframe);
                }
              else
                {
                  /* Scroll left */
                  if (delta < min)
                    delta = min;
                  x = -delta;
                  width = lframe - x + 1;
                  Scroll (frame, width, height, 0, 0, x, 0);
                  width = pFrame->FrXOrg;
                  DefClip (frame, width - x, pFrame->FrYOrg, width,
                           pFrame->FrYOrg + hframe);
                }
              
              /* display the rest of the window */
              pFrame->FrXOrg += delta;
              RedrawFrameBottom (frame, 0, NULL);
              /* recompute the scroll bars */
              UpdateScrollbars (frame);
            }
#ifdef _GL
#ifdef DEBUG_MAC
printf ("HorizontalScroll:GL_Swap frame=%d\n",frame);
#endif /* DEBUG_MAC */
          /* to be sure the scrolled page has been displayed */
          GL_Swap( frame );
#endif /* _GL */
        }
    }
}
コード例 #21
0
	//------------------------------------------------------------------------------
	uint32		CGUIWgtScrollPanel::OnSizeChanged( CGUIEventSize* pEvent )
	{
		UpdateScrollbars();
		return CGUIWidget::OnSizeChanged(pEvent);
	}